On Mon, Jul 16, 2018 at 7:50 AM Eric W. Biederman <ebied...@xmission.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