diff options
author | Siddha, Suresh B <suresh.b.siddha@intel.com> | 2005-07-15 22:17:44 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-16 01:56:11 -0400 |
commit | 9fb1759a3102c26cd8f64254a7c3e532782c2bb8 (patch) | |
tree | b14426c49283b114594454c19168b84fd6cee4d8 /arch | |
parent | d6e1860312cd8c33ad1f17d1af22fb6aa1f2cf83 (diff) |
[PATCH] x86_64: TASK_SIZE fixes for compatibility mode processes
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.
Check the return value and free the vma incase of failure.
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86_64/ia32/syscall32.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/arch/x86_64/ia32/syscall32.c b/arch/x86_64/ia32/syscall32.c index 01d8db1a1c09..816a3b89f13d 100644 --- a/arch/x86_64/ia32/syscall32.c +++ b/arch/x86_64/ia32/syscall32.c | |||
@@ -57,6 +57,7 @@ int syscall32_setup_pages(struct linux_binprm *bprm, int exstack) | |||
57 | int npages = (VSYSCALL32_END - VSYSCALL32_BASE) >> PAGE_SHIFT; | 57 | int npages = (VSYSCALL32_END - VSYSCALL32_BASE) >> PAGE_SHIFT; |
58 | struct vm_area_struct *vma; | 58 | struct vm_area_struct *vma; |
59 | struct mm_struct *mm = current->mm; | 59 | struct mm_struct *mm = current->mm; |
60 | int ret; | ||
60 | 61 | ||
61 | vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL); | 62 | vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL); |
62 | if (!vma) | 63 | if (!vma) |
@@ -78,7 +79,11 @@ int syscall32_setup_pages(struct linux_binprm *bprm, int exstack) | |||
78 | vma->vm_mm = mm; | 79 | vma->vm_mm = mm; |
79 | 80 | ||
80 | down_write(&mm->mmap_sem); | 81 | down_write(&mm->mmap_sem); |
81 | insert_vm_struct(mm, vma); | 82 | if ((ret = insert_vm_struct(mm, vma))) { |
83 | up_write(&mm->mmap_sem); | ||
84 | kmem_cache_free(vm_area_cachep, vma); | ||
85 | return ret; | ||
86 | } | ||
82 | mm->total_vm += npages; | 87 | mm->total_vm += npages; |
83 | up_write(&mm->mmap_sem); | 88 | up_write(&mm->mmap_sem); |
84 | return 0; | 89 | return 0; |