public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Vegard Nossum <vegard.nossum@oracle.com>
Cc: linux-kernel@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Jamie Iles <jamie.iles@oracle.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Andy Lutomirski <luto@kernel.org>
Subject: Re: [PATCH] kthread: fix use-after-free if kthread fork fails
Date: Sat, 6 May 2017 21:51:36 +0200	[thread overview]
Message-ID: <20170506195136.GB21726@redhat.com> (raw)
In-Reply-To: <939ac33e-ebe1-2b1e-425f-aced558ad5e3@oracle.com>

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.

      reply	other threads:[~2017-05-06 19:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-05 16:20 [PATCH] kthread: fix use-after-free if kthread fork fails Vegard Nossum
2017-05-05 16:44 ` Oleg Nesterov
2017-05-05 17:17   ` Vegard Nossum
2017-05-06 19:51     ` Oleg Nesterov [this message]

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=20170506195136.GB21726@redhat.com \
    --to=oleg@redhat.com \
    --cc=fweisbec@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jamie.iles@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=vegard.nossum@oracle.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