diff options
author | Jakub Jelinek <jakub@redhat.com> | 2006-04-24 08:55:46 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2006-04-24 08:55:46 +0000 |
commit | d0145e03799e484f3a53d79de3b3f34162ee9d3c (patch) | |
tree | d8c51a0952204f9015de0db3319d4c820e8646e0 /nptl/init.c | |
parent | f5ce81c94cc27035f44d37bffa7f7e08dbce7631 (diff) |
Updated to fedora-glibc-20060424T0820
Diffstat (limited to 'nptl/init.c')
-rw-r--r-- | nptl/init.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/nptl/init.c b/nptl/init.c index 4db3e0c828..7cfe803c42 100644 --- a/nptl/init.c +++ b/nptl/init.c @@ -148,6 +148,14 @@ static const struct pthread_functions pthread_functions = 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 @@ -156,7 +164,7 @@ sigcancel_handler (int sig, siginfo_t *si, void *ctx) #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 != THREAD_GETMEM (THREAD_SELF, pid) + || si->si_pid != pid #endif || si->si_code != SI_TKILL) return; @@ -201,6 +209,14 @@ 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 @@ -209,7 +225,7 @@ sighandler_setxid (int sig, siginfo_t *si, void *ctx) #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 != THREAD_GETMEM (THREAD_SELF, pid) + || si->si_pid != pid #endif || si->si_code != SI_TKILL) return; |