Re: [PATCH v10 1/5] nptl: Add __raise_direct

Adhemerval Zanella Netto <[email protected]>
Newsgroups gmane.comp.lib.glibc.alpha
Organization Linaro
Message-ID <[email protected]>

On 09/07/26 07:01, Florian Weimer wrote:
> * Adhemerval Zanella:
> 
>> diff --git a/sysdeps/unix/sysv/linux/raise_direct.c b/sysdeps/unix/sysv/linux/raise_direct.c
>> new file mode 100644
>> index 00000000000..d38bd10817a
>> --- /dev/null
>> +++ b/sysdeps/unix/sysv/linux/raise_direct.c
>> @@ -0,0 +1,29 @@
>> +/* Internal function to send a signal to itself.  Linux version.
>> +   Copyright (C) 2026 Free Software Foundation, Inc.
>> +   This file is part of the GNU C Library.
>> +
>> +   The GNU C Library is free software; you can redistribute it and/or
>> +   modify it under the terms of the GNU Lesser General Public
>> +   License as published by the Free Software Foundation; either
>> +   version 2.1 of the License, or (at your option) any later version.
>> +
>> +   The GNU C Library is distributed in the hope that it will be useful,
>> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
>> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
>> +   Lesser General Public License for more details.
>> +
>> +   You should have received a copy of the GNU Lesser General Public
>> +   License along with the GNU C Library; if not, see
>> +   <https://www.gnu.org/licenses/>.  */
>> +
>> +#include <sysdep.h>
>> +#include <pthread.h>
>> +#include <unistd.h>
>> +
>> +int
>> +__raise_direct (int signo)
>> +{
>> +  pid_t tid = INTERNAL_SYSCALL_CALL (gettid);
>> +  int ret = INTERNAL_SYSCALL_CALL (tkill, tid, signo);
>> +  return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;
>> +}
> 
> The comment about not using the cached TID from the TCB was lost.
> I suggest to add this comment to the implementation here.
> 

Indeed, I made some confusion when rebasing this patchset and I might have
missed this work

> Is the change from tgkill to tkill safe from a seccomp filters
> perspective?  The manual page says: “Avoid using this system call.”
> At the very least, you should mention this change in the commit message.
I think I can replace with tgkill here, it will require an extra getpid but
it should be ok.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.