bus1 / dbus-broker

Linux D-Bus Message Broker
https://github.com/bus1/dbus-broker/wiki
Apache License 2.0
661 stars 78 forks source link

launcher/config: use AT_RANDOM for libexpat hash seeds #320

Closed dvdhrm closed 1 year ago

dvdhrm commented 1 year ago

A small series with 2 minor fixes to the libexpat handling, and finally a workaround to forward AT_RANDOM to libexpat, rather than making libexpat fetch its own entropy from the kernel.

Cc: @agners #319

agners commented 1 year ago

@dvdhrm the patch still lead to salt initialization in the parser. The reason is that XML_ParserReset clears the salt. We need to add a XML_SetHashSalt after XML_ParserReset as well.

In a quick test I've hacked in a static salt there, and that indeed fixes the problem on my target board completely (as in, no more hang/read from /dev/urandom).

dvdhrm commented 1 year ago

Oh, indeed, XML_ParserReset() calls initParser() and resets all the fields. I changed the patch to store the salt in the parser context and set it after resetting the parser.