aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64/kernel/process.c
diff options
context:
space:
mode:
authorSuresh Siddha <suresh.b.siddha@intel.com>2005-06-21 20:14:32 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-21 21:46:12 -0400
commit84929801e14d968caeb84795bfbb88f04283fbd9 (patch)
tree248fa9fd6cfb411a6df3b7f7fb42aa4f9ceca2bf /arch/x86_64/kernel/process.c
parent589777eab7360894b7ca1c4ba9d252e03b51225b (diff)
[PATCH] x86_64: TASK_SIZE fixes for compatibility mode processes
Appended patch will setup compatibility mode TASK_SIZE properly. This will fix atleast three known bugs that can be encountered while running compatibility mode apps. a) A malicious 32bit app can have an elf section at 0xffffe000. During exec of this app, we will have a memory leak as insert_vm_struct() is not checking for return value in syscall32_setup_pages() and thus not freeing the vma allocated for the vsyscall page. And instead of exec failing (as it has addresses > TASK_SIZE), we were allowing it to succeed previously. b) With a 32bit app, hugetlb_get_unmapped_area/arch_get_unmapped_area may return addresses beyond 32bits, ultimately causing corruption because of wrap-around and resulting in SEGFAULT, instead of returning ENOMEM. c) 32bit app doing this below mmap will now fail. mmap((void *)(0xFFFFE000UL), 0x10000UL, PROT_READ|PROT_WRITE, MAP_FIXED|MAP_PRIVATE|MAP_ANON, 0, 0); Signed-off-by: Zou Nan hai <nanhai.zou@intel.com> Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com> Cc: Andi Kleen <ak@muc.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/x86_64/kernel/process.c')
-rw-r--r--arch/x86_64/kernel/process.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c
index 761b6d35e338..dce8bab4306c 100644
--- a/arch/x86_64/kernel/process.c
+++ b/arch/x86_64/kernel/process.c
@@ -656,7 +656,7 @@ long do_arch_prctl(struct task_struct *task, int code, unsigned long addr)
656 656
657 switch (code) { 657 switch (code) {
658 case ARCH_SET_GS: 658 case ARCH_SET_GS:
659 if (addr >= TASK_SIZE) 659 if (addr >= TASK_SIZE_OF(task))
660 return -EPERM; 660 return -EPERM;
661 cpu = get_cpu(); 661 cpu = get_cpu();
662 /* handle small bases via the GDT because that's faster to 662 /* handle small bases via the GDT because that's faster to
@@ -682,7 +682,7 @@ long do_arch_prctl(struct task_struct *task, int code, unsigned long addr)
682 case ARCH_SET_FS: 682 case ARCH_SET_FS:
683 /* Not strictly needed for fs, but do it for symmetry 683 /* Not strictly needed for fs, but do it for symmetry
684 with gs */ 684 with gs */
685 if (addr >= TASK_SIZE) 685 if (addr >= TASK_SIZE_OF(task))
686 return -EPERM; 686 return -EPERM;
687 cpu = get_cpu(); 687 cpu = get_cpu();
688 /* handle small bases via the GDT because that's faster to 688 /* handle small bases via the GDT because that's faster to