[PATCH v10 1/5] nptl: Add __raise_direct
Adhemerval Zanella Netto
adhemerval.zanella@linaro.org
Thu Jul 9 12:46:09 GMT 2026
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.
More information about the Libc-alpha
mailing list