From 42c4ebcbd4cbd7b27667eb8081ee4dc46f9ece17 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 13 Mar 2014 20:33:22 +0100 Subject: sd-bus: don't look for a 64bit value when we only have 32bit value on reply cookie hash table access This broke hashtable lookups for the message cookies on s390x, which is a 64bit BE machine where accessing 32bit values as 64bit and vice versa will explode. Also, while we are at it, be a bit more careful when dealing with the 64bit cookies we expose and the 32bit serial numbers dbus uses in its payload. Problem identified by Fridrich Strba. --- src/libsystemd/sd-bus/bus-message.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/libsystemd/sd-bus/bus-message.h') diff --git a/src/libsystemd/sd-bus/bus-message.h b/src/libsystemd/sd-bus/bus-message.h index 5fbe3e6030..df792945b0 100644 --- a/src/libsystemd/sd-bus/bus-message.h +++ b/src/libsystemd/sd-bus/bus-message.h @@ -84,7 +84,7 @@ struct sd_bus_message { sd_bus *bus; - uint32_t reply_cookie; + uint64_t reply_cookie; const char *path; const char *interface; @@ -162,7 +162,8 @@ static inline uint64_t BUS_MESSAGE_BSWAP64(sd_bus_message *m, uint64_t u) { return BUS_MESSAGE_NEED_BSWAP(m) ? bswap_64(u) : u; } -static inline uint32_t BUS_MESSAGE_COOKIE(sd_bus_message *m) { +static inline uint64_t BUS_MESSAGE_COOKIE(sd_bus_message *m) { + /* Note that we return the serial converted to a 64bit value here */ return BUS_MESSAGE_BSWAP32(m, m->header->serial); } -- cgit v1.2.3-54-g00ecf