diff options
author | Waldemar Brodkorb <wbx@openadk.org> | 2017-01-22 10:24:51 +0100 |
---|---|---|
committer | Waldemar Brodkorb <wbx@openadk.org> | 2017-01-28 10:31:19 +0100 |
commit | bddde5860ffb8a78587854cc8e3e914bd69269ca (patch) | |
tree | d37c90a9ca983fb8be614844343ba2941927f88a /libpthread/nptl/init.c | |
parent | 30adfbeb8843c28869cc6ee33d7c556721cb241a (diff) |
remove PID caching
Follow GNU C Library from c579f48edba88380635ab98cb612030e3ed8691e
and remove the PID caching. These simplifies the architecture specific
assembly code.
The run of the test suite found no regressions, it even solves
some of the test failures for x86/x86_64/sparc.
Reviewed-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Vineet Gupta <Vineet.Gupta1@synopsys.com>
Acked-by: Matthew Fortune <Matthew.Fortune@imgtec.com>
Acked-by: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
Diffstat (limited to 'libpthread/nptl/init.c')
-rw-r--r-- | libpthread/nptl/init.c | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/libpthread/nptl/init.c b/libpthread/nptl/init.c index 0e1c60cda..09220c220 100644 --- a/libpthread/nptl/init.c +++ b/libpthread/nptl/init.c @@ -64,24 +64,13 @@ static const char nptl_version[] __attribute_used__ = VERSION; static void sigcancel_handler (int sig, siginfo_t *si, void *ctx) { -#ifdef __ASSUME_CORRECT_SI_PID - /* Determine the process ID. It might be negative if the thread is - in the middle of a fork() call. */ - pid_t pid = THREAD_GETMEM (THREAD_SELF, pid); - if (__builtin_expect (pid < 0, 0)) - pid = -pid; -#endif /* Safety check. It would be possible to call this function for other signals and send a signal from another process. This is not correct and might even be a security problem. Try to catch as many incorrect invocations as possible. */ if (sig != SIGCANCEL -#ifdef __ASSUME_CORRECT_SI_PID - /* Kernels before 2.5.75 stored the thread ID and not the process - ID in si_pid so we skip this test. */ - || si->si_pid != pid -#endif + || si->si_pid != getpid() || si->si_code != SI_TKILL) return; @@ -125,24 +114,13 @@ struct xid_command *__xidcmd attribute_hidden; static void sighandler_setxid (int sig, siginfo_t *si, void *ctx) { -#ifdef __ASSUME_CORRECT_SI_PID - /* Determine the process ID. It might be negative if the thread is - in the middle of a fork() call. */ - pid_t pid = THREAD_GETMEM (THREAD_SELF, pid); - if (__builtin_expect (pid < 0, 0)) - pid = -pid; -#endif /* Safety check. It would be possible to call this function for other signals and send a signal from another process. This is not correct and might even be a security problem. Try to catch as many incorrect invocations as possible. */ if (sig != SIGSETXID -#ifdef __ASSUME_CORRECT_SI_PID - /* Kernels before 2.5.75 stored the thread ID and not the process - ID in si_pid so we skip this test. */ - || si->si_pid != pid -#endif + || si->si_pid != getpid() || si->si_code != SI_TKILL) return; @@ -191,7 +169,7 @@ __pthread_initialize_minimal_internal (void) /* Minimal initialization of the thread descriptor. */ struct pthread *pd = THREAD_SELF; INTERNAL_SYSCALL_DECL (err); - pd->pid = pd->tid = INTERNAL_SYSCALL (set_tid_address, err, 1, &pd->tid); + pd->tid = INTERNAL_SYSCALL (set_tid_address, err, 1, &pd->tid); THREAD_SETMEM (pd, specific[0], &pd->specific_1stblock[0]); THREAD_SETMEM (pd, user_stack, true); if (LLL_LOCK_INITIALIZER != 0) |