linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fengguang Wu <wfg@mail.ustc.edu.cn>
To: Dan Aloni <da-x@monatomic.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	linux-kernel@vger.kernel.org,
	parisc-linux@lists.parisc-linux.org, linux-mm@kvack.org,
	linux-arch@vger.kernel.org, Ollie Wild <aaw@google.com>,
	Andrew Morton <akpm@osdl.org>, Ingo Molnar <mingo@elte.hu>,
	Andi Kleen <ak@suse.de>
Subject: Re: [patch 3/3] mm: variable length argument support
Date: Wed, 22 Aug 2007 17:02:51 +0800	[thread overview]
Message-ID: <387773371.00311@ustc.edu.cn> (raw)
Message-ID: <20070822090251.GA7038@mail.ustc.edu.cn> (raw)
In-Reply-To: <20070822084852.GA12314@localdomain>

On Wed, Aug 22, 2007 at 11:48:52AM +0300, Dan Aloni wrote:
> On Wed, Jun 13, 2007 at 12:03:37PM +0200, Peter Zijlstra wrote:
> > From: Ollie Wild <aaw@google.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@monatomic.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
> 

FYI: This bug has been fixed by Alan Cox: http://lkml.org/lkml/2007/8/13/782.

But thanks anyway~


  parent reply	other threads:[~2007-08-22  9:16 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-13 10:03 [patch 0/3] no MAX_ARG_PAGES -v2 Peter Zijlstra
2007-06-13 10:03 ` [patch 1/3] arch: personality independent stack top Peter Zijlstra
2007-06-13 10:03 ` [patch 2/3] audit: rework execve audit Peter Zijlstra
2007-06-26 22:55   ` Andrew Morton
2007-07-03 15:00     ` Peter Zijlstra
2007-06-13 10:03 ` [patch 3/3] mm: variable length argument support Peter Zijlstra
2007-08-07 19:03   ` Olaf Hering
2007-08-07 19:20     ` Andrew Morton
2007-08-07 19:26       ` Peter Zijlstra
2007-08-07 20:10       ` Olaf Hering
2007-08-22  8:48   ` Dan Aloni
2007-08-22  8:54     ` Peter Zijlstra
2007-08-22  9:05       ` Andrew Morton
     [not found]     ` <20070822090251.GA7038@mail.ustc.edu.cn>
2007-08-22  9:02       ` Fengguang Wu [this message]
2007-06-13 23:36 ` [patch 0/3] no MAX_ARG_PAGES -v2 Luck, Tony
2007-06-14  6:23   ` Ollie Wild
2007-06-14  8:38     ` Peter Zijlstra
2007-06-14 18:22       ` Luck, Tony
2007-06-14 18:32         ` Peter Zijlstra
2007-06-14 20:58       ` Ollie Wild
2007-06-14 21:18         ` Peter Zijlstra
2007-06-15  9:24         ` Peter Zijlstra
2007-06-15 18:07           ` Ollie Wild
2007-06-15 18:49             ` Luck, Tony
2007-06-17 18:32 ` Pavel Machek
2007-06-17 19:07   ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=387773371.00311@ustc.edu.cn \
    --to=wfg@mail.ustc.edu.cn \
    --cc=a.p.zijlstra@chello.nl \
    --cc=aaw@google.com \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=da-x@monatomic.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@elte.hu \
    --cc=parisc-linux@lists.parisc-linux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).