about summary refs log tree commit diff
path: root/nptl/init.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-07-08 03:40:49 +0000
committerUlrich Drepper <drepper@redhat.com>2003-07-08 03:40:49 +0000
commitdb54f488ee24b14027c485e0005950dfdd5ef885 (patch)
tree2a07a1746c1ffa758a34484f65263c737818d162 /nptl/init.c
parent5fee5ad11c5307141f76aa7ea28ec1e1b6418fea (diff)
downloadglibc-db54f488ee24b14027c485e0005950dfdd5ef885.tar.gz
glibc-db54f488ee24b14027c485e0005950dfdd5ef885.tar.xz
glibc-db54f488ee24b14027c485e0005950dfdd5ef885.zip
Update.
2003-07-07  Ulrich Drepper  <drepper@redhat.com>

	* descr.h (struct pthread): Add pid field.
	* allocatestack.c (allocate_stack): Initialize pid field in descriptor.
	(__reclaim_stacks): Likewise.
	* init.c (sigcancel_handler): If __ASSUME_CORRECT_SI_PID is defined
	also check for PID of the signal source.
	(__pthread_initialize_minimal_internal): Also initialize pid field
	of initial thread's descriptor.
	* pthread_cancel.c: Use tgkill instead of tkill if possible.
	* sysdeps/unix/sysv/linux/fork.c: Likewise.
	* sysdeps/unix/sysv/linux/pt-raise.c: Likewise.
	* sysdeps/unix/sysv/linux/pthread_kill.c: Likewise.
	* sysdeps/unix/sysv/linux/raise.c: Likewise.
Diffstat (limited to 'nptl/init.c')
-rw-r--r--nptl/init.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/nptl/init.c b/nptl/init.c
index abc785730a..9c76773504 100644
--- a/nptl/init.c
+++ b/nptl/init.c
@@ -139,10 +139,12 @@ sigcancel_handler (int sig, siginfo_t *si, void *ctx)
      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 != THREAD_GETMEM (THREAD_SELF, pid)
+#endif
       || si->si_code != SI_TKILL)
-    /* XXX The Linux kernel currently does not report the correct PID
-       in the si->si_pid field.  Once this is changed another test
-       will be added.  */
     return;
 
   struct pthread *self = THREAD_SELF;
@@ -202,7 +204,7 @@ __pthread_initialize_minimal_internal (void)
   /* Minimal initialization of the thread descriptor.  */
   struct pthread *pd = THREAD_SELF;
   INTERNAL_SYSCALL_DECL (err);
-  pd->tid = INTERNAL_SYSCALL (set_tid_address, err, 1, &pd->tid);
+  pd->pid = 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)