]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
[PATCH] x86_64: Fix canonical checking for segment registers in ptrace
authorAndi Kleen <ak@suse.de>
Tue, 17 May 2005 04:53:30 +0000 (04:53 +0000)
committer <chrisw@vas.sous-sol.org> <>
Fri, 27 May 2005 04:20:11 +0000 (21:20 -0700)
Allowed user programs to set a non canonical segment base, which would cause
oopses in the kernel later.

Credit-to: Alexander Nyberg <alexn@dsv.su.se>
 For identifying and reporting this bug.

Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Chris Wright <chrisw@osdl.org>
arch/x86_64/kernel/ptrace.c

index b2b7e347a6715f7f487928336608a411564e7e5f..cddc37a5415ac2fecfd246bb80e3a22d462eac22 100644 (file)
@@ -129,13 +129,13 @@ static int putreg(struct task_struct *child,
                        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):