[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFxDsE8sb5wQQNJdxvt8m6n6aVpOo1yVpk1BEzXDv8XzaQ@mail.gmail.com>
Date: Mon, 16 Jul 2018 10:17:26 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: "Eric W. Biederman" <ebiederm@...ssion.com>
Cc: Oleg Nesterov <oleg@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Wen Yang <wen.yang99@....com.cn>, majiang <ma.jiang@....com.cn>
Subject: Re: [RFC][PATCH 07/11] signal: Deliver group signals via PIDTYPE_TGID
not PIDTYPE_PID
On Mon, Jul 16, 2018 at 7:50 AM Eric W. Biederman <ebiederm@...ssion.com> wrote:
>
> In practice since glibc does not make thread id's available I don't
> expect anyone relies on this behavior. Since no one relies on it we
> can change it without creating a regression.
Maybe.
However, possibly not.
The thing is, glibc wasn't the original or only use of our threads. In
fact, there are people out there that use clone() directly, without
using it for posix threading. And Oleg was right to notice this,
because the traditional model was literally to just use "kill()" on
the pid returned from clone().
So the semantics of Linux kill() really is to kill the thread, not the
group leader. glibc's implementation of pthreads is not the only model
out there.
Now, it is possible that at none of the legacy uses use CLONE_THREAD
and thus aren't affected (because tgid will always be pid). So maybe
nobody notices.
But we really have three different 'kill' system calls:
- the original 'kill' system call (#37 on x86-32).
This looks up the thread ID, but signals the *group*.
- tkill (#238)
This looks up the thread, and signals the specific thread.
- tgkill (#270)
This looks up the tgid, and signals the group.
Modern glibc will not even use the original 'kill()' at all, I think.
But it's the legacy behavior.
So I do think Oleg is right. We should be careful. You'll not notice
breakage on a modern distro, but you might easily break old code.
Linus
Powered by blists - more mailing lists