From: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
To: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: linux-mm <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>,
Rik van Riel <riel@redhat.com>, Hugh Dickins <hugh@veritas.com>,
Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [PATCH/RFC] - support inheritance of mlocks across fork/exec
Date: Sat, 29 Nov 2008 17:38:39 -0500 [thread overview]
Message-ID: <1227998319.7489.30.camel@lts-notebook> (raw)
In-Reply-To: <20081126172913.3CB8.KOSAKI.MOTOHIRO@jp.fujitsu.com>
On Wed, 2008-11-26 at 17:37 +0900, KOSAKI Motohiro wrote:
> only one nit.
>
> > @@ -599,7 +602,8 @@ asmlinkage long sys_mlockall(int flags)
> > unsigned long lock_limit;
> > int ret = -EINVAL;
> >
> > - if (!flags || (flags & ~(MCL_CURRENT | MCL_FUTURE)))
> > + if (!flags || (flags & ~(MCL_CURRENT | MCL_FUTURE |
> > + MCL_INHERIT | MCL_RECURSIVE)))
> > goto out;
>
> from patch description, I think mlockall(MCL_INHERIT) and
> mlockall(MCL_RECURSIVE) are incorrect. right?
>
> if so, I think following likes error check is needed.
>
> if (!(flags & (MCL_CURRENT | MCL_FUTURE)))
> goto out;
>
> if ((flags & (MCL_INHERIT | MECL_RECURSIVE)) == MCL_RECURSIVE)
> goto out;
>
Hello, Kosaki-san:
Thanks for looking at this. I think you mean that:
1) don't allow MCL_INHERIT | MCL_RECURSIVE without either MCL_CURRENT or
MCL_FUTURE, and
2) MCL_RECURSIVE without MCL_INHERIT does not make sense, either.
Is this correct?
I guess I agree with you. As is stands, my patch would allow
MCL_INHERIT[|MCL_RECURSIVE] to sneak through with neither MCL_CURRENT
nor MCL_FUTURE set. Looks like this would result in mlock_fixup() being
called with a newflags that does not containing VM_LOCKED. This would
be treated as munlockall(). Not good. Your first check would catch
this.
The second condition would be a no-op, I think. We only look at look
for MCL_RECURSIVE in mm->mcl_inherit when mcl_inherit is non-zero; and
we only set mcl_inherit when MCL_INHERIT is specified. But, if the
caller specified MCL_RECURSIVE, they probably intended something to
happen, and since it won't, best to return an error.
I'll fix this up and send it out to the wider distribution that Andrew
requested.
Thanks, again.
Lee
--
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>
next prev parent reply other threads:[~2008-11-29 22:38 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-24 21:21 Lee Schermerhorn
2008-11-25 4:05 ` KOSAKI Motohiro
2008-11-25 16:21 ` Rik van Riel
2008-11-25 23:26 ` Andrew Morton
2008-12-03 19:04 ` [PATCH] - support inheritance of mlocks across fork/exec V2 Lee Schermerhorn
2008-12-04 1:57 ` KOSAKI Motohiro
2008-12-07 6:07 ` Andrew Morton
2008-12-08 15:01 ` Lee Schermerhorn
2008-12-08 21:05 ` Lee Schermerhorn
2008-12-08 21:33 ` Matt Mackall
2008-12-09 19:40 ` Lee Schermerhorn
2008-12-09 20:41 ` Matt Mackall
2009-06-05 4:39 ` Jon Masters
2009-06-05 4:49 ` KOSAKI Motohiro
2009-06-05 5:12 ` Jon Masters
2008-11-26 8:37 ` [PATCH/RFC] - support inheritance of mlocks across fork/exec KOSAKI Motohiro
2008-11-29 22:38 ` Lee Schermerhorn [this message]
2008-11-30 5:21 ` KOSAKI Motohiro
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=1227998319.7489.30.camel@lts-notebook \
--to=lee.schermerhorn@hp.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=hugh@veritas.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-mm@kvack.org \
--cc=riel@redhat.com \
/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