public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Kirill Tkhai <ktkhai@virtuozzo.com>,
	gregkh@linuxfoundation.org, jslaby@suse.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/3] tty: Use RCU read lock to iterate tasks and threads in __do_SAK()
Date: Wed, 17 Jan 2018 18:39:55 +0100	[thread overview]
Message-ID: <20180117173955.GB7964@redhat.com> (raw)
In-Reply-To: <87lggwh1ef.fsf@xmission.com>

On 01/17, Eric W. Biederman wrote:
>
> __do_SAK() needs to be 100% accurate.

But it can't. A process/thread can open tty right after the check.

> I do not see the rcu_read_lock
> guaranteeing that new processes created while the process list is being
> iterated that happen to have a reference to the tty will be seen.

We can't miss the new child if its parent has this tty opened at fork() time,
__do_SAK() sends SIGKILL and ->siglock serializes __do_SAK() with copy_process()
which checks signal_pending() under the same ->siglock. So either fork() should
fail or for_each_process() should see the new child.

Right?

Otherwise we do not care. The child can open tty later but this doesn't differ
from the "race" above.

Oleg.

  reply	other threads:[~2018-01-17 17:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-17 12:39 [PATCH v2 0/3] tty: Make __do_SAK() less greedy in regard to tasklist_lock Kirill Tkhai
2018-01-17 12:39 ` [PATCH v2 1/3] Revert "do_SAK: Don't recursively take the tasklist_lock" Kirill Tkhai
2018-01-17 17:18   ` Eric W. Biederman
2018-01-17 17:34     ` Oleg Nesterov
2018-01-17 17:49       ` Eric W. Biederman
2018-01-17 18:04         ` Oleg Nesterov
2018-01-17 18:37           ` Eric W. Biederman
2018-01-17 20:43             ` Oleg Nesterov
2018-01-18 10:07         ` Kirill Tkhai
2018-01-18  9:59     ` Kirill Tkhai
2018-01-17 12:39 ` [PATCH v2 2/3] tty: Avoid threads files iterations in __do_SAK() Kirill Tkhai
2018-01-17 12:39 ` [PATCH v2 3/3] tty: Use RCU read lock to iterate tasks and threads " Kirill Tkhai
2018-01-17 16:54   ` Eric W. Biederman
2018-01-17 17:39     ` Oleg Nesterov [this message]
2018-01-18 10:11     ` Kirill Tkhai

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=20180117173955.GB7964@redhat.com \
    --to=oleg@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=ktkhai@virtuozzo.com \
    --cc=linux-kernel@vger.kernel.org \
    /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