From d29057d0866a663d4a5a867147a4a6366c12a647 Mon Sep 17 00:00:00 2001 From: Luca Dariz Date: Tue, 28 Jun 2022 11:49:25 +0200 Subject: fix message fields alignment for 64 bit On x86_64 alignment of structures is different, as the pointer size is different. For simplicity we keep the same 4-byte alignment as used on 32-bit. This simplifies the support for 32-bit rpc on 64-bit kernels, and also it seems not worth as an optimization, as we would need to add more code in the ipc_kmsg* routines. * routine.c: align both short and long descriptors * utils.c: use a fixed alignment for data fields in structures representing messages. Signed-off-by: Luca Dariz Message-Id: <20220628094927.442907-2-luca@orpolo.org> --- routine.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'routine.c') diff --git a/routine.c b/routine.c index 0edc6b9..6972e14 100644 --- a/routine.c +++ b/routine.c @@ -321,9 +321,9 @@ rtFindSize(const argument_t *args, u_int mask) { ipc_type_t *it = arg->argType; + /* might need proper alignment on demanding 64bit archies */ + size = (size + word_size-1) & ~(word_size-1); if (arg->argLongForm) { - /* might need proper alignment on 64bit archies */ - size = (size + word_size-1) & ~(word_size-1); size += sizeof_mach_msg_type_long_t; } else { size += sizeof_mach_msg_type_t; -- cgit v1.2.3