From 3a36ef7ace64c507f6b087071429dbfed7d2a96d Mon Sep 17 00:00:00 2001 From: Andi Kleen Date: Tue, 28 Jun 2005 15:18:17 +0200 Subject: [PATCH] [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 --- arch/x86_64/kernel/ptrace.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86_64/kernel/ptrace.c b/arch/x86_64/kernel/ptrace.c index 812961f0..edaf18bc 100644 --- a/arch/x86_64/kernel/ptrace.c +++ b/arch/x86_64/kernel/ptrace.c @@ -114,13 +114,13 @@ static int putreg(struct task_struct *child, 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): -- 2.11.0