Messages in this thread Patch in this message | | | Date | Tue, 16 Nov 2004 15:19:37 -0800 | From | Chris Wright <> | Subject | [PATCH 1/2] setup_arg_pages can insert overlapping vma |
| |
Florian Heinz built an a.out binary that could map bss from 0x0 to 0xc0000000, and setup_arg_pages() would BUG() in insert_vma_struct because the arg pages overlapped. This just checks before inserting, and bails out if it would overlap.
Signed-off-by: Chris Wright <chrisw@osdl.org>
===== fs/exec.c 1.143 vs edited ===== --- 1.143/fs/exec.c 2004-10-28 00:40:03 -07:00 +++ edited/fs/exec.c 2004-11-11 19:24:54 -08:00 @@ -413,6 +413,7 @@ down_write(&mm->mmap_sem); { + struct vm_area_struct *vma; mpnt->vm_mm = mm; #ifdef CONFIG_STACK_GROWSUP mpnt->vm_start = stack_base; @@ -433,6 +434,12 @@ mpnt->vm_flags = VM_STACK_FLAGS; mpnt->vm_flags |= mm->def_flags; mpnt->vm_page_prot = protection_map[mpnt->vm_flags & 0x7]; + vma = find_vma(mm, mpnt->vm_start); + if (vma) { + up_write(&mm->mmap_sem); + kmem_cache_free(vm_area_cachep, mpnt); + return -ENOMEM; + } insert_vm_struct(mm, mpnt); mm->stack_vm = mm->total_vm = vma_pages(mpnt); } - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |