Summary: | recent libexpat versions can make dbus-daemon hang waiting for entropy | ||
---|---|---|---|
Product: | dbus | Reporter: | Simon McVittie <smcv> |
Component: | core | Assignee: | Simon McVittie <smcv> |
Status: | RESOLVED FIXED | QA Contact: | D-Bus Maintainers <dbus> |
Severity: | normal | ||
Priority: | medium | CC: | hewitt |
Version: | git master | Keywords: | patch |
Hardware: | Other | ||
OS: | All | ||
URL: | https://github.com/smcv/dbus/commit/101858-expat-entropy | ||
Whiteboard: | review+ | ||
i915 platform: | i915 features: | ||
Attachments: |
[1.10] config-loader-expat: Tell Expat not to defend against hash collisions
[master] config-loader-expat: Tell Expat not to defend against hash collisions |
Description
Simon McVittie
2017-07-20 20:18:16 UTC
https://github.com/libexpat/libexpat/issues/91 is the Expat side of this. Created attachment 132813 [details] [review] [1.10] config-loader-expat: Tell Expat not to defend against hash collisions By default, Expat uses cryptographic-quality random numbers as a salt for its hash algorithm, and since 2.2.1 it gets them from the getrandom syscall on Linux. That syscall refuses to return any entropy until the kernel's CSPRNG (random pool) has been initialized. Unfortunately, this can take as long as 40 seconds on embedded devices with few entropy sources, which is too long: if the system dbus-daemon blocks for that length of time, important D-Bus clients like systemd and systemd-logind time out and fail to connect to it. We're parsing small configuration files here, and we trust them completely, so we don't need to defend against hash collisions: nobody is going to be crafting them to cause pathological performance. --- This is for 1.10. A slightly different version is needed for master because we changed the build around a bit. This also doesn't solve anything for CMake builds, but I'm not sure we care. The Autotools build system is recommended for anything other than: (a) MSVC on Windows (b) building on Linux to check that the CMake build system isn't completely broken Created attachment 132814 [details] [review] [master] config-loader-expat: Tell Expat not to defend against hash collisions --- Same thing but for master, where XML_CFLAGS and XML_LIBS have become EXPAT_* because we stopped pretending to support any other XML parser. Testing on the failing hardware, with the unpatched Expat >= 2.2.1, would be appreciated. I reverted any local modifications to expat and dbus, verified that the boot behavior was broken, then applied the patch for dbus 1.10 and built a new dbus package. Indeed the system now boots as expected once again. Thanks, added your Tested-by in my local version of those commits. Hopefully a reviewer can take a look at these soon. (Also at <https://github.com/smcv/dbus/commit/101858-expat-entropy> and <https://github.com/smcv/dbus/commit/101858-expat-entropy-1.10> for CI testing) Comment on attachment 132813 [details] [review] [1.10] config-loader-expat: Tell Expat not to defend against hash collisions Review of attachment 132813 [details] [review]: ----------------------------------------------------------------- r+ Comment on attachment 132814 [details] [review] [master] config-loader-expat: Tell Expat not to defend against hash collisions Review of attachment 132814 [details] [review]: ----------------------------------------------------------------- r+ Thanks, fixed in git for 1.10.24 and 1.11.18. |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.