All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mel Gorman <mel@csn.ul.ie>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Linux-MM <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Minchan Kim <minchan.kim@gmail.com>,
	Christoph Lameter <cl@linux.com>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Rik van Riel <riel@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH] mm,migration: Avoid race between shift_arg_pages() and rmap_walk() during migration by not migrating temporary stacks
Date: Wed, 12 May 2010 21:51:50 +0100	[thread overview]
Message-ID: <20100512205150.GL24989@csn.ul.ie> (raw)
In-Reply-To: <20100512125427.d1b170ba.akpm@linux-foundation.org>

On Wed, May 12, 2010 at 12:54:27PM -0700, Andrew Morton wrote:
> On Wed, 12 May 2010 09:23:44 +0900 (JST)
> KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> wrote:
> 
> > > diff --git a/fs/exec.c b/fs/exec.c
> > > index 725d7ef..13f8e7f 100644
> > > --- a/fs/exec.c
> > > +++ b/fs/exec.c
> > > @@ -242,9 +242,10 @@ static int __bprm_mm_init(struct linux_binprm *bprm)
> > >  	 * use STACK_TOP because that can depend on attributes which aren't
> > >  	 * configured yet.
> > >  	 */
> > > +	BUG_ON(VM_STACK_FLAGS & VM_STACK_INCOMPLETE_SETUP);
> > 
> > Can we use BUILD_BUG_ON()? 
> 
> That's vastly preferable - I made that change.
> 

I will be surprised if it works. On x86, that is

#define VM_STACK_FLAGS  (VM_GROWSDOWN | VM_STACK_DEFAULT_FLAGS | VM_ACCOUNT)
#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS
#define VM_DATA_DEFAULT_FLAGS \
        (((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
         VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)

so VM_STACK_FLAGS is depending on the value of current->personality
which we don't know at build time.

-- 
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab

WARNING: multiple messages have this Message-ID (diff)
From: Mel Gorman <mel@csn.ul.ie>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Linux-MM <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Minchan Kim <minchan.kim@gmail.com>,
	Christoph Lameter <cl@linux.com>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Rik van Riel <riel@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH] mm,migration: Avoid race between shift_arg_pages() and rmap_walk() during migration by not migrating temporary stacks
Date: Wed, 12 May 2010 21:51:50 +0100	[thread overview]
Message-ID: <20100512205150.GL24989@csn.ul.ie> (raw)
In-Reply-To: <20100512125427.d1b170ba.akpm@linux-foundation.org>

On Wed, May 12, 2010 at 12:54:27PM -0700, Andrew Morton wrote:
> On Wed, 12 May 2010 09:23:44 +0900 (JST)
> KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> wrote:
> 
> > > diff --git a/fs/exec.c b/fs/exec.c
> > > index 725d7ef..13f8e7f 100644
> > > --- a/fs/exec.c
> > > +++ b/fs/exec.c
> > > @@ -242,9 +242,10 @@ static int __bprm_mm_init(struct linux_binprm *bprm)
> > >  	 * use STACK_TOP because that can depend on attributes which aren't
> > >  	 * configured yet.
> > >  	 */
> > > +	BUG_ON(VM_STACK_FLAGS & VM_STACK_INCOMPLETE_SETUP);
> > 
> > Can we use BUILD_BUG_ON()? 
> 
> That's vastly preferable - I made that change.
> 

I will be surprised if it works. On x86, that is

#define VM_STACK_FLAGS  (VM_GROWSDOWN | VM_STACK_DEFAULT_FLAGS | VM_ACCOUNT)
#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS
#define VM_DATA_DEFAULT_FLAGS \
        (((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
         VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)

so VM_STACK_FLAGS is depending on the value of current->personality
which we don't know at build time.

-- 
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2010-05-12 20:52 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-11  8:57 [PATCH] mm,migration: Avoid race between shift_arg_pages() and rmap_walk() during migration by not migrating temporary stacks Mel Gorman
2010-05-11  8:57 ` Mel Gorman
2010-05-11 12:10 ` Rik van Riel
2010-05-11 12:10   ` Rik van Riel
2010-05-11 17:11 ` Linus Torvalds
2010-05-11 17:11   ` Linus Torvalds
2010-05-11 17:21   ` Rik van Riel
2010-05-11 17:21     ` Rik van Riel
2010-05-12  0:23 ` KOSAKI Motohiro
2010-05-12  0:23   ` KOSAKI Motohiro
2010-05-12 19:54   ` Andrew Morton
2010-05-12 19:54     ` Andrew Morton
2010-05-12 20:51     ` Mel Gorman [this message]
2010-05-12 20:51       ` Mel Gorman
2010-05-12 20:58       ` Andrew Morton
2010-05-12 20:58         ` Andrew Morton
2010-05-12 23:06       ` KOSAKI Motohiro
2010-05-12 23:06         ` KOSAKI Motohiro
2010-05-12 21:33     ` Christoph Lameter
2010-05-12 21:33       ` Christoph Lameter
2010-05-13  0:19       ` KAMEZAWA Hiroyuki
2010-05-13  0:19         ` KAMEZAWA Hiroyuki
2010-05-13 17:22         ` Christoph Lameter
2010-05-13 17:22           ` Christoph Lameter
2010-05-13 23:51           ` KAMEZAWA Hiroyuki
2010-05-13 23:51             ` KAMEZAWA Hiroyuki

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=20100512205150.GL24989@csn.ul.ie \
    --to=mel@csn.ul.ie \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan.kim@gmail.com \
    --cc=peterz@infradead.org \
    --cc=riel@redhat.com \
    --cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.