config-loader-expat: Tell Expat not to defend against hash collisions
authorSimon McVittie <smcv@debian.org>
Fri, 21 Jul 2017 09:46:39 +0000 (10:46 +0100)
committerSimon McVittie <smcv@debian.org>
Fri, 28 Jul 2017 10:15:51 +0000 (11:15 +0100)
commit1252dc1d1f465b8ab6b36ff7252e395e66a040cf
tree30448cbbc47f0397a8eabb838e6a9b2b7727d315
parentb825751505ca17fa4a9cdc65b5d0a6ec3a04f2d1
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.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101858
Signed-off-by: Simon McVittie <smcv@debian.org>
Tested-by: Christopher Hewitt <hewitt@ieee.org>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
bus/config-loader-expat.c
configure.ac