Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1636977

Re: [PATCH] kthread: fix use-after-free if kthread fork fails

From Oleg Nesterov <oleg@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH] kthread: fix use-after-free if kthread fork fails
Date 2017-05-06 22:00 +0200
Message-ID <tEe1Y-3PE-7@gated-at.bofh.it> (permalink)
References <tDOhc-46o-3@gated-at.bofh.it> <tDOAx-4hv-3@gated-at.bofh.it> <tDP3A-4H2-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 05/05, Vegard Nossum wrote:
>
> On 05/05/17 18:44, Oleg Nesterov wrote:
> >
> >Can't we just move both
> >
> >	p->set_child_tid = (clone_flags & CLONE_CHILD_SETTID) ? child_tidptr : NULL;
> >	/*
> >	 * Clear TID on mm_release()?
> >	 */
> >	p->clear_child_tid = (clone_flags & CLONE_CHILD_CLEARTID) ? child_tidptr : NULL;
> >
> >lines here?
>
> clone_flags is not available in dup_task_struct(), but we could move
> those lines higher in copy_process().

Yes, yes, this is what I meant.

> The newly attached patch has been tested and seems to work, if you
> prefer it.

Yes, please, this loos a bit better simply because we do not need to set it twice.

And I agree this needs cleanups. Even if we forget about this particular problem
and the usage of set_child_tid, we should add copy_misc() which should absorb a
lot of chaotic initializations from copy_process() imo.

Oleg.

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] kthread: fix use-after-free if kthread fork fails Vegard Nossum <vegard.nossum@oracle.com> - 2017-05-05 18:30 +0200
  Re: [PATCH] kthread: fix use-after-free if kthread fork fails Oleg Nesterov <oleg@redhat.com> - 2017-05-05 18:50 +0200
    Re: [PATCH] kthread: fix use-after-free if kthread fork fails Vegard Nossum <vegard.nossum@oracle.com> - 2017-05-05 19:20 +0200
      Re: [PATCH] kthread: fix use-after-free if kthread fork fails Oleg Nesterov <oleg@redhat.com> - 2017-05-06 22:00 +0200

csiph-web