diff options
author | Andy Lutomirski <luto@kernel.org> | 2019-07-15 07:21:44 -0700 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2019-07-15 17:12:31 +0200 |
commit | c7ca0b614513afba57824cae68447f9c32b1ee61 (patch) | |
tree | 59f54e34f9a3b9aee5abad16813894adf20a19b5 /arch | |
parent | fec88ab0af9706b2201e5daf377c5031c62d11f7 (diff) | |
download | linux-c7ca0b614513afba57824cae68447f9c32b1ee61.tar.bz2 |
Revert "x86/ptrace: Prevent ptrace from clearing the FS/GS selector" and fix the test
This reverts commit 48f5e52e916b55fb73754833efbacc7f8081a159.
The ptrace ABI change was a prerequisite to the proposed design for
FSGSBASE. Since FSGSBASE support has been reverted, and since I'm not
convinced that the ABI was ever adequately tested, revert the ABI change as
well.
This also modifies the test case so that it tests the preexisting behavior.
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/fca39c478ea7fb15bc76fe8a36bd180810a067f6.1563200250.git.luto@kernel.org
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/ptrace.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c index 71691a8310e7..0fdbe89d0754 100644 --- a/arch/x86/kernel/ptrace.c +++ b/arch/x86/kernel/ptrace.c @@ -369,12 +369,22 @@ static int putreg(struct task_struct *child, case offsetof(struct user_regs_struct,fs_base): if (value >= TASK_SIZE_MAX) return -EIO; - x86_fsbase_write_task(child, value); + /* + * When changing the FS base, use do_arch_prctl_64() + * to set the index to zero and to set the base + * as requested. + */ + if (child->thread.fsbase != value) + return do_arch_prctl_64(child, ARCH_SET_FS, value); return 0; case offsetof(struct user_regs_struct,gs_base): + /* + * Exactly the same here as the %fs handling above. + */ if (value >= TASK_SIZE_MAX) return -EIO; - x86_gsbase_write_task(child, value); + if (child->thread.gsbase != value) + return do_arch_prctl_64(child, ARCH_SET_GS, value); return 0; #endif } |