lkml.org 
[lkml]   [2013]   [Dec]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] secure unlock_task_sighand() call
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.



\
 
 \ /
  Last update: 2013-12-21 19:41    [W:0.070 / U:1.300 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site