Skip to content

Commit 9423494

Browse files
benzeajmberg-intel
authored andcommitted
um: fix SECCOMP 32bit xstate register restore
There was a typo that caused the extended FP state to be copied into the wrong location on 32 bit. On 32 bit we only store the xstate internally as that already contains everything. However, for compatibility, the mcontext on 32 bit first contains the legacy FP state and then the xstate. The code copied the xstate on top of the legacy FP state instead of using the correct offset. This offset was already calculated in the xstate_* variables, so simply switch to those to fix the problem. With this SECCOMP mode works on 32 bit, so lift the restriction. Fixes: b1e1bd2 ("um: Add helper functions to get/set state for SECCOMP") Signed-off-by: Benjamin Berg <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Johannes Berg <[email protected]>
1 parent e92e255 commit 9423494

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

arch/um/os-Linux/start_up.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -296,10 +296,6 @@ static bool __init init_seccomp(void)
296296
int n;
297297
unsigned long sp;
298298

299-
/* doesn't work on 32-bit right now */
300-
if (!IS_ENABLED(CONFIG_64BIT))
301-
return false;
302-
303299
/*
304300
* We check that we can install a seccomp filter and then exit(0)
305301
* from a trapped syscall.

arch/x86/um/os-Linux/mcontext.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ int set_stub_state(struct uml_pt_regs *regs, struct stub_data *data,
231231
xstate_size = fp_size;
232232
#endif
233233

234-
memcpy(fpstate_stub, &regs->fp, fp_size);
234+
memcpy(xstate_stub, &regs->fp, xstate_size);
235235

236236
#ifdef __i386__
237237
/*

0 commit comments

Comments
 (0)