Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion criu/arch/x86/crtools.c
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ int restore_fpu(struct rt_sigframe *sigframe, CoreEntry *core)
void *from = xsave->member; \
size_t size = pb_repeated_size(xsave, member); \
size_t xsize = (size_t)compel_fpu_feature_size(feature); \
size_t xstate_size_next = off + xsize; \
if (xsize != size) { \
if (size) { \
pr_err("%s reported %zu bytes (expecting %zu)\n",\
Expand All @@ -448,7 +449,8 @@ int restore_fpu(struct rt_sigframe *sigframe, CoreEntry *core)
} \
} \
xstate_bv |= (1UL << feature); \
xstate_size += xsize; \
BUG_ON(xstate_size > xstate_size_next); \
xstate_size = xstate_size_next; \
memcpy(to, from, size); \
} \
} while (0)
Expand Down Expand Up @@ -485,6 +487,11 @@ int restore_fpu(struct rt_sigframe *sigframe, CoreEntry *core)
UserX86XsaveEntry *xsave = core->thread_info->fpregs->xsave;
uint8_t *extended_state_area = (void *)x;

/*
* Note the order does matter here and bound
* to the increasing offsets of XFEATURE_x
* inside memory layout (xstate_size calculation).
*/
assign_xsave(XFEATURE_YMM, xsave, ymmh_space, extended_state_area);
assign_xsave(XFEATURE_BNDREGS, xsave, bndreg_state, extended_state_area);
assign_xsave(XFEATURE_BNDCSR, xsave, bndcsr_state, extended_state_area);
Expand Down