Messages in this thread | | | Date | Sat, 21 Dec 2013 19:27:04 +0100 | From | Oleg Nesterov <> | Subject | Re: [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.
| |