[PATCH 2/2] stdlib: Make abort AS-safe (BZ 26275)
Florian Weimer
fweimer@redhat.com
Wed Aug 2 12:38:39 GMT 2023
* Adhemerval Zanella via Libc-alpha:
> diff --git a/nptl/pthread_kill.c b/nptl/pthread_kill.c
> index 44e45a4e23..e3364fb5d1 100644
> --- a/nptl/pthread_kill.c
> +++ b/nptl/pthread_kill.c
> @@ -69,6 +69,17 @@ __pthread_kill_implementation (pthread_t threadid, int signo, int no_tid)
> return ret;
> }
>
> +/* Send the signal SIGNO to the caller. Used by abort and called where the
> + signals are being already blocked and there is no need to synchronize with
> + exit_lock. */
> +int
> +__pthread_raise_internal (int signo)
> +{
> + struct pthread *pd = THREAD_SELF;
> + int ret = INTERNAL_SYSCALL_CALL (tgkill, __getpid (), pd->tid, signo);
> + return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;
> +}
This needs to use gettid (the system call) so that it works after vfork,
which may have an incorrect pd->tid.
There should be a comment to this effect in pthread_kill implementation
already.
Thanks,
Florian
More information about the Libc-alpha
mailing list