From 9abba2d935f360d7c220c654b5b7ef00b49ddbea Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 24 Feb 2016 10:50:22 +0000 Subject: [PATCH 1/7] NEWS so far --- NEWS | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index ccdcc7fc..e6eeb6be 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,20 @@ D-Bus 1.10.8 (UNRELEASED) == -... +Fixes: + +• Enable "large file support" on systems where it exists: dbus-daemon + is not expected to open large files, but it might need to stat files + that happen to have large inode numbers (fd.o #93545, Hongxu Jia) + +• Correctly report test failures in C tests from run-test.sh + (fd.o #93379; amit tewari, Simon McVittie) + +• When tests are enabled, run all the marshal-validate tests, not just + the even-numbered ones (fd.o #93908, Nick Lewycky) + +• Correct the expected error from one marshal-validate test, which was + previously not run due to the above bug (fd.o #93908, Simon McVittie) D-Bus 1.10.6 (2015-12-01) == From ca9ea25e1122b33eaf15c63e4c34ebc157c39f6f Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 15 Feb 2016 13:45:49 +0000 Subject: [PATCH 2/7] dbus-internals: add _DBUS_ALIGNOF This is useful when making static assertions about our types' properties. Signed-off-by: Simon McVittie Reviewed-by: Thiago Macieira Bug: https://bugs.freedesktop.org/show_bug.cgi?id=94136 --- dbus/dbus-internals.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dbus/dbus-internals.h b/dbus/dbus-internals.h index 3eb8749f..df8e9643 100644 --- a/dbus/dbus-internals.h +++ b/dbus/dbus-internals.h @@ -195,6 +195,9 @@ extern const char *_dbus_return_if_fail_warning_format; #define _DBUS_STRUCT_OFFSET(struct_type, member) \ ((intptr_t) ((unsigned char*) &((struct_type*) 0)->member)) +#define _DBUS_ALIGNOF(type) \ + (_DBUS_STRUCT_OFFSET (struct { char _1; type _2; }, _2)) + #ifdef DBUS_DISABLE_CHECKS /* this is an assert and not an error, but in the typical --disable-checks case (you're trying * to really minimize code size), disabling these assertions makes sense. From 338cfa15992b73d2cd43a50c84bf5ebc4eeda04f Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 15 Feb 2016 14:58:59 +0000 Subject: [PATCH 3/7] DBusMessage: assert the properties we need DBusMessageIter to have We already asserted that DBusMessageIter must be at least as large as DBusMessageRealIter (so that casting DBusMessageIter * to DBusMessageRealIter * does not result in overflowing the stack variable). Also assert that it must have alignment requirements at least as strict as those of DBusMessageRealIter * (so that casting does not increase the required alignment). Signed-off-by: Simon McVittie Reviewed-by: Thiago Macieira Bug: https://bugs.freedesktop.org/show_bug.cgi?id=94136 --- dbus/dbus-message.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c index 699e022b..50e87cae 100644 --- a/dbus/dbus-message.c +++ b/dbus/dbus-message.c @@ -2025,7 +2025,10 @@ _dbus_message_iter_init_common (DBusMessage *message, DBusMessageRealIter *real, int iter_type) { + /* If these static assertions fail on your platform, report it as a bug. */ _DBUS_STATIC_ASSERT (sizeof (DBusMessageRealIter) <= sizeof (DBusMessageIter)); + _DBUS_STATIC_ASSERT (_DBUS_ALIGNOF (DBusMessageRealIter) <= + _DBUS_ALIGNOF (DBusMessageIter)); /* Since the iterator will read or write who-knows-what from the * message, we need to get in the right byte order From 38a5c3028ed27c4ceeffc32ddb17d1a8fe4fd0dd Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 15 Feb 2016 15:00:22 +0000 Subject: [PATCH 4/7] DBusMessageIter: eliminate padding on 64-bit platforms Previously, 64-bit (LP64 or LLP64) platforms would have had 32 bits of padding between pad2 and pad3. We want to guarantee that an ISO C compiler will copy the entire struct when assigning between structs, but padding is not guaranteed to be copied, so we want to ensure that the struct is "packed". Statically assert that the old ABI is compatible with the new ABI. Reviewed-by: Thiago Macieira [smcv: change >= to == as Thiago requested] Signed-off-by: Simon McVittie Bug: https://bugs.freedesktop.org/show_bug.cgi?id=94136 --- dbus/dbus-message.c | 29 +++++++++++++++++++++++++++++ dbus/dbus-message.h | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c index 50e87cae..abdc11f3 100644 --- a/dbus/dbus-message.c +++ b/dbus/dbus-message.c @@ -136,6 +136,29 @@ struct DBusMessageRealIter } u; /**< the type writer or reader that does all the work */ }; +/** + * Layout of a DBusMessageIter on the stack in dbus 1.10.0. This is no + * longer used, but for ABI compatibility we need to assert that the + * new layout is the same size. + */ +typedef struct +{ + void *dummy1; + void *dummy2; + dbus_uint32_t dummy3; + int dummy4; + int dummy5; + int dummy6; + int dummy7; + int dummy8; + int dummy9; + int dummy10; + int dummy11; + int pad1; + int pad2; + void *pad3; +} DBusMessageIter_1_10_0; + static void get_const_signature (DBusHeader *header, const DBusString **type_str_p, @@ -2029,6 +2052,12 @@ _dbus_message_iter_init_common (DBusMessage *message, _DBUS_STATIC_ASSERT (sizeof (DBusMessageRealIter) <= sizeof (DBusMessageIter)); _DBUS_STATIC_ASSERT (_DBUS_ALIGNOF (DBusMessageRealIter) <= _DBUS_ALIGNOF (DBusMessageIter)); + /* A failure of these two assertions would indicate that we've broken + * ABI on this platform since 1.10.0. */ + _DBUS_STATIC_ASSERT (sizeof (DBusMessageIter_1_10_0) == + sizeof (DBusMessageIter)); + _DBUS_STATIC_ASSERT (_DBUS_ALIGNOF (DBusMessageIter_1_10_0) == + _DBUS_ALIGNOF (DBusMessageIter)); /* Since the iterator will read or write who-knows-what from the * message, we need to get in the right byte order diff --git a/dbus/dbus-message.h b/dbus/dbus-message.h index 3e33eb7b..ac3e4087 100644 --- a/dbus/dbus-message.h +++ b/dbus/dbus-message.h @@ -62,7 +62,7 @@ struct DBusMessageIter int dummy10; /**< Don't use this */ int dummy11; /**< Don't use this */ int pad1; /**< Don't use this */ - int pad2; /**< Don't use this */ + void *pad2; /**< Don't use this */ void *pad3; /**< Don't use this */ }; From 64d6dbd190f5d58768fbf290747b06e464d44b00 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 15 Feb 2016 13:52:52 +0000 Subject: [PATCH 5/7] Statically assert that the DBusMessageIter struct has no padding Signed-off-by: Simon McVittie Reviewed-by: Thiago Macieira Bug: https://bugs.freedesktop.org/show_bug.cgi?id=94136 --- dbus/dbus-message.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c index abdc11f3..e22fe51b 100644 --- a/dbus/dbus-message.c +++ b/dbus/dbus-message.c @@ -2058,6 +2058,11 @@ _dbus_message_iter_init_common (DBusMessage *message, sizeof (DBusMessageIter)); _DBUS_STATIC_ASSERT (_DBUS_ALIGNOF (DBusMessageIter_1_10_0) == _DBUS_ALIGNOF (DBusMessageIter)); + /* If this static assertion fails, it means the DBusMessageIter struct + * is not "packed", which might result in "iter = other_iter" not copying + * every byte. */ + _DBUS_STATIC_ASSERT (sizeof (DBusMessageIter) == + 4 * sizeof (void *) + sizeof (dbus_uint32_t) + 9 * sizeof (int)); /* Since the iterator will read or write who-knows-what from the * message, we need to get in the right byte order From bfd9c8a3b3b707bf12bfffebfcfc2cdd639d4ea6 Mon Sep 17 00:00:00 2001 From: Dmitri Iouchtchenko Date: Sun, 21 Feb 2016 23:50:49 -0500 Subject: [PATCH 6/7] dbus-test-tool echo: fix sleep documentation Bug: https://bugs.freedesktop.org/show_bug.cgi?id=94244 Reviewed-by: Simon McVittie --- doc/dbus-test-tool.1.xml.in | 4 ++-- tools/dbus-echo.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/dbus-test-tool.1.xml.in b/doc/dbus-test-tool.1.xml.in index 091dee14..5b7c43ed 100644 --- a/doc/dbus-test-tool.1.xml.in +++ b/doc/dbus-test-tool.1.xml.in @@ -45,7 +45,7 @@ --system --name=NAME - --sleep=MS + --sleep-ms=MS @@ -161,7 +161,7 @@ - MS + MS Block for MS milliseconds before replying to a method call. diff --git a/tools/dbus-echo.c b/tools/dbus-echo.c index 0e7de1bd..738b1cb3 100644 --- a/tools/dbus-echo.c +++ b/tools/dbus-echo.c @@ -52,7 +52,7 @@ usage_echo (int exit_with) "\n" " --name=NAME claim this well-known name first\n" "\n" - " --sleep=N sleep N milliseconds before sending each reply\n" + " --sleep-ms=N sleep N milliseconds before sending each reply\n" "\n" " --session use the session bus (default)\n" " --system use the system bus\n" From 42ccc7dc39cf2e5563da971b65866f492ff4ddae Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 2 Mar 2016 18:24:11 +0000 Subject: [PATCH 7/7] update NEWS --- NEWS | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/NEWS b/NEWS index e6eeb6be..a230ac3e 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,14 @@ Fixes: is not expected to open large files, but it might need to stat files that happen to have large inode numbers (fd.o #93545, Hongxu Jia) +• Eliminate padding inside DBusMessageIter on 64-bit platforms, + which might result in a pedantic C compiler not copying the entire contents + of a DBusMessageIter; statically assert that this is not an ABI change + in practice (fd.o #94136, Simon McVittie) + +• Document dbus-test-tool echo --sleep-ms=N instead of incorrect --sleep=N + (fd.o #94244, Dmitri Iouchtchenko) + • Correctly report test failures in C tests from run-test.sh (fd.o #93379; amit tewari, Simon McVittie)