From: Oleg Nesterov <oleg@redhat.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: naveen yadav <yad.naveen@gmail.com>,
Vaibhav Shinde <v.bhav.shinde@gmail.com>,
Ajeet Yadav <ajeet.yadav.77@gmail.com>, Tejun Heo <tj@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] secure unlock_task_sighand() call
Date: Sat, 21 Dec 2013 19:27:04 +0100 [thread overview]
Message-ID: <20131221182703.GA11516@redhat.com> (raw)
In-Reply-To: <CA+55aFyVrrvDzUt0OU4d9YZM8C-N+ycSKEa3+-5nowUoZ=rb8w@mail.gmail.com>
On 12/21, Linus Torvalds wrote:
>
> We have coredump serialization in exit_mm() that I think *should* make
> this all ok - if we still see p->mm matching our mm,
Yes. And the comment says:
lock_task_sighand(p)
must be used. Since p->mm != NULL and we hold ->mmap_sem
it can't fail.
IOW, this task can't pass exit_mm() and thus lock_task_sighand() can't
fail.
> > do {
> > if (p->mm) {
> > if (unlikely(p->mm == mm)) {
> > - lock_task_sighand(p, &flags);
> > - nr += zap_process(p, exit_code);
> > - unlock_task_sighand(p, &flags);
> > + if (lock_task_sighand(p, &flags) {
> > + nr += zap_process(p, exit_code);
> > + unlock_task_sighand(p, &flags);
> > + }
I too do not think this is needed. But perhaps BUG_ON() make sense.
Note: just in case, this has another problem: while_each_thread() is racy.
We already have the initial fixes in -mm, this code (as other users)
should be converted to use for_each_thread(), I'll send the patch(es).
Oleg.
next prev parent reply other threads:[~2013-12-21 18:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-21 9:55 [PATCH] secure unlock_task_sighand() call naveen yadav
2013-12-21 17:41 ` Linus Torvalds
2013-12-21 18:27 ` Oleg Nesterov [this message]
2013-12-22 14:34 ` Oleg Nesterov
2013-12-23 12:29 ` naveen yadav
2013-12-23 14:26 ` Oleg Nesterov
2013-12-23 18:17 ` Linus Torvalds
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=20131221182703.GA11516@redhat.com \
--to=oleg@redhat.com \
--cc=ajeet.yadav.77@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=v.bhav.shinde@gmail.com \
--cc=yad.naveen@gmail.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