Received: from eggs.gnu.org ([2001:4830:134:3::10]:38694) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZjPl6-0007CV-Ob for qemu-devel@nongnu.org; Tue, 06 Oct 2015 06:46:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZjPl1-0001X4-Rg for qemu-devel@nongnu.org; Tue, 06 Oct 2015 06:46:12 -0400 Received: from jessie.kos.to ([212.47.231.226]:40183 helo=pilvi.kos.to) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZjPl1-0001WH-LA for qemu-devel@nongnu.org; Tue, 06 Oct 2015 06:46:07 -0400 From: Riku Voipio Date: Tue, 06 Oct 2015 13:46:05 +0300 MIME-Version: 1.0 Message-ID: <315bdccf-0dea-4c2f-beb1-2778277db169@iki.fi> In-Reply-To: <1443885246-11520-1-git-send-email-laurent@vivier.eu> References: <1443885246-11520-1-git-send-email-laurent@vivier.eu> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] =?iso-8859-1?q?=5BPATCH=5D_linux-user=3A_correctly_a?= =?iso-8859-1?q?lign_target=5Fepoll=5Fevent?= List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: laurent@vivier.eu On lauantaina 3. lokakuuta 2015 18.14.06 EEST, Laurent Vivier wrote: > According to comments in /usr/include/linux/eventpoll.h, > poll_event is packed only on x86_64. > > And to be sure fields are correctly aligned in epoll_data, > use abi_XXX types for all of them. > > Moreover, fd type is wrong: fd is int, not ulong. > > This has been tested with a ppc guest on an x86_64 host: > without this patch, systemd crashes (core). Applied to linux-user, thanks > CC: Alexander Graf > CC: Peter Maydell > Signed-off-by: Laurent Vivier > --- > I cc' Alexander because it has added the padding and the packed attribute, > Peter because it is the author of the original structure. > > linux-user/syscall_defs.h | 19 +++++++++++-------- > 1 file changed, 11 insertions(+), 8 deletions(-) > > diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h > index 7ca33a6..f4e4122 100644 > --- a/linux-user/syscall_defs.h > +++ b/linux-user/syscall_defs.h > @@ -2503,20 +2503,23 @@ struct target_mq_attr { > #define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG |=20 > FUTEX_CLOCK_REALTIME) > =20 > #ifdef CONFIG_EPOLL > +#if defined(TARGET_X86_64) > +#define TARGET_EPOLL_PACKED QEMU_PACKED > +#else > +#define TARGET_EPOLL_PACKED > +#endif > + > typedef union target_epoll_data { > abi_ulong ptr; > - abi_ulong fd; > - uint32_t u32; > - uint64_t u64; > + abi_int fd; > + abi_uint u32; > + abi_ullong u64; > } target_epoll_data_t; > =20 > struct target_epoll_event { > - uint32_t events; > -#if defined(TARGET_ARM) || defined(TARGET_MIPS) || defined(TARGET_MIPS64) > - uint32_t __pad; > -#endif > + abi_uint events; > target_epoll_data_t data; > -} QEMU_PACKED; > +} TARGET_EPOLL_PACKED; > #endif > struct target_rlimit64 { > uint64_t rlim_cur;