[PATCH] Fix canonical checking for segment registers in ptrace
Linux Kernel Mailing List <[email protected]> Thu, 30 Jun 2005 22:45:20 -0700
| Newsgroups | gmane.linux.kernel.commits.2-4 |
|---|---|
| Message-ID | <[email protected]> |
tree f6097f56ad699f67e1c0dca233a095ce32715bc8 parent 2e7fe37125e00cf9090416345e36af80d7761e9a author Andi Kleen <[email protected]> Tue, 28 Jun 2005 15:18:17 +0200 committer Marcelo Tosatti <[email protected]> Wed, 29 Jun 2005 16:50:00 -0300 [PATCH] Fix canonical checking for segment registers in ptrace Fix canonical checking for segment registers in ptrace This avoids a local DOS where a process could oops the kernel by passing bogus values to ptrace. Some versions of UML did this. Found by Alexander Nyberg Signed-off-by: Andi Kleen <[email protected]> arch/x86_64/kernel/ptrace.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86_64/kernel/ptrace.c b/arch/x86_64/kernel/ptrace.c --- a/arch/x86_64/kernel/ptrace.c +++ b/arch/x86_64/kernel/ptrace.c @@ -114,13 +114,13 @@ static int putreg(struct task_struct *ch child->thread.es = value & 0xffff; return 0; case offsetof(struct user_regs_struct,fs_base): - if (!((value >> 48) == 0 || (value >> 48) == 0xffff)) - return -EIO; + if (value >= TASK_SIZE) + return -EIO; child->thread.fs = value; return 0; case offsetof(struct user_regs_struct,gs_base): - if (!((value >> 48) == 0 || (value >> 48) == 0xffff)) - return -EIO; + if (value >= TASK_SIZE) + return -EIO; child->thread.gs = value; return 0; case offsetof(struct user_regs_struct, eflags):