[Pkg-utopia-maintainers] Bug#932381: libdbus-1-3: lidbus _dbus_marshal_write_basic uses implementation defined behaviour (unaligned read)

Simon McVittie smcv at debian.org
Sat Jul 20 18:55:50 BST 2019


On Fri, 19 Jul 2019 at 10:25:56 +0200, Witold Baryluk wrote:
> I do see real world misaligned reads on alpha, and I did trace it to mentioned
> function . Thus the bug.

Are you able to reproduce this by running the dbus test suite?

If not, are you able to reproduce it with an application? Which one / how?

Is there a way to configure alpha kernels to kill processes with a signal
on misaligned reads, so that you can get a core dump and a backtrace? (I
don't know much about alpha, but I know 32-bit ARM used to have that
available as a sysctl.)

Is this still reproducible in dbus 1.13.x from experimental? (That's
the development branch, but it should rebuild OK on buster if you're
running that.)

Do the four commits from the top of
https://gitlab.freedesktop.org/smcv/dbus/commits/wip/memcpy fix this?
(They apply to git master and would probably apply OK on top of 1.13.12,
but probably not all of them apply to 1.12.x; I rebased them recently
and they pass the unit test suite, but I haven't had a chance to try
them against real workloads.)

> If there is some other code in dbus that ensures pointers are aligned, then
> something is not quite working, because CPU complains on alpha to me.

Pointers into the payload of a message should always be naturally-aligned
(each n-byte quantity aligned to an n-byte boundary). The header and body
are each stored at the beginning of a DBusString, which is memory from
malloc() (so ISO C says it should be suitably aligned for any built-in
type), and DBusString also skips the first 0-7 bytes if necessary to
get it aligned to an 8-byte boundary. The offset between the beginning
of the header/body and each value in the header/body is also naturally
aligned due to the design of the wire-format serialization.

If this is failing somehow, then I'd like to see exactly how, because
that will also need fixing.

If application code is supplying an unaligned pointer as input to a
function like dbus_message_append_args(), then libdbus can't fix that;
callers are meant to provide correctly-aligned inputs.

Thanks,
    smcv



More information about the Pkg-utopia-maintainers mailing list