[CRIU] [PATCH v2 2/6] compel: arch, x86 -- Dont require xsave_struct to be aligned
Cyrill Gorcunov
gorcunov at gmail.com
Mon Feb 13 08:37:45 PST 2017
We don't iteract with fpu hardware directly so no need
for alignment. Moreover it will help to handle ia32 mode
where this structure won't be aligned and this is required
by a kernel to process the sigreturn frame.
v2:
Still in fetching this data via ptrace(PTRACE_GETREGSET, NT_X86_XSTATE)
this data should be allocated with 8 byte alignment as kernel
requires.
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
compel/arch/x86/src/lib/include/uapi/asm/fpu.h | 6 ++++--
compel/arch/x86/src/lib/infect.c | 2 +-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/compel/arch/x86/src/lib/include/uapi/asm/fpu.h b/compel/arch/x86/src/lib/include/uapi/asm/fpu.h
index 7525f153a7e1..d3245f256924 100644
--- a/compel/arch/x86/src/lib/include/uapi/asm/fpu.h
+++ b/compel/arch/x86/src/lib/include/uapi/asm/fpu.h
@@ -74,13 +74,15 @@ struct ymmh_struct {
} __packed;
/*
- * cpu requires it to be 64 byte aligned
+ * cpu requires it to be 64 byte aligned but
+ * since we don't work with hw directly, drop
+ * it and we embed it into ia32 mode.
*/
struct xsave_struct {
struct i387_fxsave_struct i387;
struct xsave_hdr_struct xsave_hdr;
struct ymmh_struct ymmh;
-} __aligned(FP_MIN_ALIGN_BYTES) __packed;
+} __packed;
/*
* This one is used in restorer.
diff --git a/compel/arch/x86/src/lib/infect.c b/compel/arch/x86/src/lib/infect.c
index 418c43414d32..a75ad5eb5fc9 100644
--- a/compel/arch/x86/src/lib/infect.c
+++ b/compel/arch/x86/src/lib/infect.c
@@ -134,7 +134,7 @@ int sigreturn_prep_fpu_frame_plain(struct rt_sigframe *sigframe,
int get_task_regs(pid_t pid, user_regs_struct_t regs, save_regs_t save, void *arg)
{
- user_fpregs_struct_t xsave = { }, *xs = NULL;
+ user_fpregs_struct_t xsave __aligned(FP_MIN_ALIGN_BYTES) = { }, *xs = NULL;
struct iovec iov;
int ret = -1;
--
2.7.4
More information about the CRIU
mailing list