diff options
author | Benjamin Berg <benjamin@sipsolutions.net> | 2025-02-24 21:18:19 +0300 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2025-03-18 13:10:41 +0300 |
commit | cef721e0d53d2b64f2ba177c63a0dfdd7c0daf17 (patch) | |
tree | df9daa74137da16270e8de0c157ca1f58003c6fb | |
parent | 24ffa71b0f15fe4827d3672d5918f97564b2fba1 (diff) | |
download | linux-cef721e0d53d2b64f2ba177c63a0dfdd7c0daf17.tar.xz |
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>
-rw-r--r-- | arch/x86/um/os-Linux/mcontext.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/arch/x86/um/os-Linux/mcontext.c b/arch/x86/um/os-Linux/mcontext.c index d2f3a595b4ef..37decaa74761 100644 --- a/arch/x86/um/os-Linux/mcontext.c +++ b/arch/x86/um/os-Linux/mcontext.c @@ -28,8 +28,7 @@ void get_regs_from_mc(struct uml_pt_regs *regs, mcontext_t *mc) COPY(RIP); COPY2(EFLAGS, EFL); COPY2(CS, CSGSFS); - regs->gp[CS / sizeof(unsigned long)] &= 0xffff; - regs->gp[CS / sizeof(unsigned long)] |= 3; + regs->gp[SS / sizeof(unsigned long)] = mc->gregs[REG_CSGSFS] >> 48; #endif } |