Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 8933
b: refs/heads/master
c: 2fd4ef8
h: refs/heads/master
i:
  8931: 8ed4b7e
v: v3
  • Loading branch information
Hugh Dickins authored and Linus Torvalds committed Sep 14, 2005
1 parent 6accf8a commit 2a3ffd2
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 35 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fb085cf1d4294824571815d487daccc0609543f0
refs/heads/master: 2fd4ef85e0db9ed75c98e13953257a967ea55e03
6 changes: 0 additions & 6 deletions trunk/arch/ia64/ia32/binfmt_elf32.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,6 @@ ia32_setup_arg_pages (struct linux_binprm *bprm, int executable_stack)
if (!mpnt)
return -ENOMEM;

if (security_vm_enough_memory((IA32_STACK_TOP - (PAGE_MASK & (unsigned long) bprm->p))
>> PAGE_SHIFT)) {
kmem_cache_free(vm_area_cachep, mpnt);
return -ENOMEM;
}

memset(mpnt, 0, sizeof(*mpnt));

down_write(&current->mm->mmap_sem);
Expand Down
9 changes: 2 additions & 7 deletions trunk/arch/mips/kernel/sysirix.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,18 +581,13 @@ asmlinkage int irix_brk(unsigned long brk)
}

/*
* Check if we have enough memory..
* Ok, looks good - let it rip.
*/
if (security_vm_enough_memory((newbrk-oldbrk) >> PAGE_SHIFT)) {
if (do_brk(oldbrk, newbrk-oldbrk) != oldbrk) {
ret = -ENOMEM;
goto out;
}

/*
* Ok, looks good - let it rip.
*/
mm->brk = brk;
do_brk(oldbrk, newbrk-oldbrk);
ret = 0;

out:
Expand Down
15 changes: 9 additions & 6 deletions trunk/arch/ppc64/kernel/vdso.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int executable_stack)
vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
if (vma == NULL)
return -ENOMEM;
if (security_vm_enough_memory(vdso_pages)) {
kmem_cache_free(vm_area_cachep, vma);
return -ENOMEM;
}

memset(vma, 0, sizeof(*vma));

/*
Expand All @@ -237,8 +234,10 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int executable_stack)
*/
vdso_base = get_unmapped_area(NULL, vdso_base,
vdso_pages << PAGE_SHIFT, 0, 0);
if (vdso_base & ~PAGE_MASK)
if (vdso_base & ~PAGE_MASK) {
kmem_cache_free(vm_area_cachep, vma);
return (int)vdso_base;
}

current->thread.vdso_base = vdso_base;

Expand Down Expand Up @@ -266,7 +265,11 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int executable_stack)
vma->vm_ops = &vdso_vmops;

down_write(&mm->mmap_sem);
insert_vm_struct(mm, vma);
if (insert_vm_struct(mm, vma)) {
up_write(&mm->mmap_sem);
kmem_cache_free(vm_area_cachep, vma);
return -ENOMEM;
}
mm->total_vm += (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
up_write(&mm->mmap_sem);

Expand Down
5 changes: 0 additions & 5 deletions trunk/arch/x86_64/ia32/ia32_binfmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,11 +353,6 @@ int setup_arg_pages(struct linux_binprm *bprm, unsigned long stack_top, int exec
mpnt = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
if (!mpnt)
return -ENOMEM;

if (security_vm_enough_memory((IA32_STACK_TOP - (PAGE_MASK & (unsigned long) bprm->p))>>PAGE_SHIFT)) {
kmem_cache_free(vm_area_cachep, mpnt);
return -ENOMEM;
}

memset(mpnt, 0, sizeof(*mpnt));

Expand Down
6 changes: 1 addition & 5 deletions trunk/arch/x86_64/ia32/syscall32.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,13 @@ int syscall32_setup_pages(struct linux_binprm *bprm, int exstack)
vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
if (!vma)
return -ENOMEM;
if (security_vm_enough_memory(npages)) {
kmem_cache_free(vm_area_cachep, vma);
return -ENOMEM;
}

memset(vma, 0, sizeof(struct vm_area_struct));
/* Could randomize here */
vma->vm_start = VSYSCALL32_BASE;
vma->vm_end = VSYSCALL32_END;
/* MAYWRITE to allow gdb to COW and set breakpoints */
vma->vm_flags = VM_READ|VM_EXEC|VM_MAYREAD|VM_MAYEXEC|VM_MAYEXEC|VM_MAYWRITE;
vma->vm_flags = VM_READ|VM_EXEC|VM_MAYREAD|VM_MAYEXEC|VM_MAYWRITE;
vma->vm_flags |= mm->def_flags;
vma->vm_page_prot = protection_map[vma->vm_flags & 7];
vma->vm_ops = &syscall32_vm_ops;
Expand Down
5 changes: 0 additions & 5 deletions trunk/fs/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,11 +421,6 @@ int setup_arg_pages(struct linux_binprm *bprm,
if (!mpnt)
return -ENOMEM;

if (security_vm_enough_memory(arg_size >> PAGE_SHIFT)) {
kmem_cache_free(vm_area_cachep, mpnt);
return -ENOMEM;
}

memset(mpnt, 0, sizeof(*mpnt));

down_write(&mm->mmap_sem);
Expand Down
3 changes: 3 additions & 0 deletions trunk/mm/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1993,6 +1993,9 @@ int insert_vm_struct(struct mm_struct * mm, struct vm_area_struct * vma)
__vma = find_vma_prepare(mm,vma->vm_start,&prev,&rb_link,&rb_parent);
if (__vma && __vma->vm_start < vma->vm_end)
return -ENOMEM;
if ((vma->vm_flags & VM_ACCOUNT) &&
security_vm_enough_memory(vma_pages(vma)))
return -ENOMEM;
vma_link(mm, vma, prev, rb_link, rb_parent);
return 0;
}
Expand Down

0 comments on commit 2a3ffd2

Please sign in to comment.