[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20170506195136.GB21726@redhat.com>
Date: Sat, 6 May 2017 21:51:36 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Vegard Nossum <vegard.nossum@...cle.com>
Cc: linux-kernel@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Frederic Weisbecker <fweisbec@...il.com>,
Jamie Iles <jamie.iles@...cle.com>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Andy Lutomirski <luto@...nel.org>
Subject: Re: [PATCH] kthread: fix use-after-free if kthread fork fails
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.
Powered by blists - more mailing lists