From: "Serge E. Hallyn" <serue@us.ibm.com>
To: Sonny Rao <sonny@burdell.org>
Cc: "Serge E. Hallyn" <serue@us.ibm.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
anton@samba.org
Subject: Re: Possible bug in do_execve()
Date: Wed, 21 Jun 2006 14:09:10 -0500 [thread overview]
Message-ID: <20060621190910.GC16576@sergelap.austin.ibm.com> (raw)
In-Reply-To: <20060621185508.GA9234@kevlar.burdell.org>
Quoting Sonny Rao (sonny@burdell.org):
> On Wed, Jun 21, 2006 at 01:41:29PM -0500, Serge E. Hallyn wrote:
> <snip>
> > > Is the behavior in do_execve() correct?
> >
> > Well, I assume the intent is for out_mm: to clean up from mm_alloc(),
> > not from 'init_new_context'. So I think that code is correct.
> > This bug appears to be powerpc-specific, so would the following patch
> > be reasonable?
> >
> > Note it is entirely untested, just to show where i think this should
> > be solved. But I could try compile+boot test tonight.
> >
> > thanks,
> > -serge
> >
> > From: Serge E. Hallyn <hallyn@sergelap.(none)>
> > Date: Wed, 21 Jun 2006 13:37:27 -0500
> > Subject: [PATCH] powerpc: check for proper mm->context before destroying
> >
> > arch/powerpc/mm/mmu_context_64.c:destroy_context() can be called
> > from __mmput() in do_execve() if init_new_context() failed. This
> > can result in idr_remove() being called for an invalid context.
> >
> > So, don't call idr_remove if there is no context.
> >
> > Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
> >
> > ---
> >
> > arch/powerpc/mm/mmu_context_64.c | 3 +++
> > 1 files changed, 3 insertions(+), 0 deletions(-)
> >
> > ee74da9d3c122b92541dd6b7670731bd4a033f04
> > diff --git a/arch/powerpc/mm/mmu_context_64.c b/arch/powerpc/mm/mmu_context_64.c
> > index 714a84d..552d590 100644
> > --- a/arch/powerpc/mm/mmu_context_64.c
> > +++ b/arch/powerpc/mm/mmu_context_64.c
> > @@ -55,6 +55,9 @@ again:
> >
> > void destroy_context(struct mm_struct *mm)
> > {
> > + if (mm->context.id == NO_CONTEXT)
> > + return;
> > +
> > spin_lock(&mmu_context_lock);
> > idr_remove(&mmu_context_idr, mm->context.id);
> > spin_unlock(&mmu_context_lock);
>
> Yeah, I proposed a similar patch to Anton, and it would quiet the
> warning on powerpc, but that's not the point. It happens that powerpc
> doesn't use 0 as a context id, but that may not be true on another
> architecture. That's really what I'm concerned about.
FWIW, ppc and cris do the NO_CONTEXT check, while others don't
even have a arch-specific 'mm->context.id'.
-serge
--
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:[~2006-06-21 19:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-20 2:25 Sonny Rao
2006-06-21 18:41 ` Serge E. Hallyn
2006-06-21 18:55 ` Sonny Rao
2006-06-21 19:09 ` Serge E. Hallyn [this message]
2006-06-21 19:27 ` Sonny Rao
2006-06-21 19:42 ` Serge E. Hallyn
2006-06-21 20:12 ` Sonny Rao
2006-06-22 11:59 ` Serge E. Hallyn
2006-06-22 20:03 ` Sonny Rao
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=20060621190910.GC16576@sergelap.austin.ibm.com \
--to=serue@us.ibm.com \
--cc=anton@samba.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=sonny@burdell.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