lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070822084852.GA12314@localdomain>
Date:	Wed, 22 Aug 2007 11:48:52 +0300
From:	Dan Aloni <da-x@...atomic.org>
To:	Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc:	linux-kernel@...r.kernel.org, parisc-linux@...ts.parisc-linux.org,
	linux-mm@...ck.org, linux-arch@...r.kernel.org,
	Ollie Wild <aaw@...gle.com>, Andrew Morton <akpm@...l.org>,
	Ingo Molnar <mingo@...e.hu>, Andi Kleen <ak@...e.de>
Subject: Re: [patch 3/3] mm: variable length argument support

On Wed, Jun 13, 2007 at 12:03:37PM +0200, Peter Zijlstra wrote:
> From: Ollie Wild <aaw@...gle.com>
> 
> Remove the arg+env limit of MAX_ARG_PAGES by copying the strings directly
> from the old mm into the new mm.
> 
[...]
> +static int __bprm_mm_init(struct linux_binprm *bprm)
> +{
[...]
> +	vma->vm_flags = VM_STACK_FLAGS;
> +	vma->vm_page_prot = protection_map[vma->vm_flags & 0x7];
> +	err = insert_vm_struct(mm, vma);
> +	if (err) {
> +		up_write(&mm->mmap_sem);
> +		goto err;
> +	}
> +

That change causes a crash in khelper when overcommit_memory = 2 
under 2.6.23-rc3.

When a khelper execs, at __bprm_mm_init() current->mm is still NULL.
insert_vm_struct() calls security_vm_enough_memory(), which calls 
__vm_enough_memory(), and that's where current->mm->total_vm gets 
dereferenced.


Signed-off-by: Dan Aloni <da-x@...atomic.org>

diff --git a/mm/mmap.c b/mm/mmap.c
index 906ed40..6e021df 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -163,10 +163,12 @@ int __vm_enough_memory(long pages, int cap_sys_admin)
 	if (!cap_sys_admin)
 		allowed -= allowed / 32;
 	allowed += total_swap_pages;
-
-	/* Don't let a single process grow too big:
-	   leave 3% of the size of this process for other processes */
-	allowed -= current->mm->total_vm / 32;
+
+	if (current->mm) {
+		/* Don't let a single process grow too big:
+		   leave 3% of the size of this process for other processes */
+		allowed -= current->mm->total_vm / 32;
+	}
 
 	/*
 	 * cast `allowed' as a signed long because vm_committed_space


-- 
Dan Aloni
XIV LTD, http://www.xivstorage.com
da-x (at) monatomic.org, dan (at) xiv.co.il
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ