[CRIU] [PATCHv2 29/30] signal/x86-32: use packed for compat rt_sigaction

Dmitry Safonov dsafonov at virtuozzo.com
Fri Jun 24 08:08:34 PDT 2016


Otherwise compiler nicely align it for us on 24 bytes.

Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
 criu/arch/x86/include/asm/types.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/criu/arch/x86/include/asm/types.h b/criu/arch/x86/include/asm/types.h
index bb9d3a0c6119..a24d7b815506 100644
--- a/criu/arch/x86/include/asm/types.h
+++ b/criu/arch/x86/include/asm/types.h
@@ -48,7 +48,12 @@ typedef struct {
 	k_rtsigset_t	rt_sa_mask;
 } rt_sigaction_t;
 
-typedef struct {
+/*
+ * Note: there is unaligned access on x86_64 and it's fine.
+ * However, when porting this code -- keep in mind about possible issues
+ * with unaligned rt_sa_mask.
+ */
+typedef struct __attribute__((packed)) {
 	u32	rt_sa_handler;
 	u32	rt_sa_flags;
 	u32	rt_sa_restorer;
-- 
2.9.0



More information about the CRIU mailing list