Skip to content

Commit cef721e

Browse files
benzeajmberg-intel
authored andcommitted
um: Store full CSGSFS and SS register from mcontext
Doing this allows using registers as retrieved from an mcontext to be pushed to a process using PTRACE_SETREGS. It is not entirely clear to me why CSGSFS was masked. Doing so creates issues when using the mcontext as process state in seccomp and simply copying the register appears to work perfectly fine for ptrace. Signed-off-by: Benjamin Berg <benjamin@sipsolutions.net> Link: https://patch.msgid.link/20250224181827.647129-2-benjamin@sipsolutions.net Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 24ffa71 commit cef721e

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ void get_regs_from_mc(struct uml_pt_regs *regs, mcontext_t *mc)
2828
COPY(RIP);
2929
COPY2(EFLAGS, EFL);
3030
COPY2(CS, CSGSFS);
31-
regs->gp[CS / sizeof(unsigned long)] &= 0xffff;
32-
regs->gp[CS / sizeof(unsigned long)] |= 3;
31+
regs->gp[SS / sizeof(unsigned long)] = mc->gregs[REG_CSGSFS] >> 48;
3332
#endif
3433
}
3534

0 commit comments

Comments
 (0)