SEND_SIG_NOINFO: set si_pid to tgid instead of pid
authorSukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Tue, 6 Jan 2009 22:42:46 +0000 (14:42 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 6 Jan 2009 23:59:29 +0000 (15:59 -0800)
POSIX requires the si_pid to be the process id of the sender, so ->si_pid
should really be set to 'tgid'.  This change does have following changes
in behavior:

- When sending pdeath_signal on re-parent to a sub-thread, ->si_pid
  cannot be used to identify the thread that did the re-parent since
  it will now show the tgid instead of thread id.

- A multi-threaded application that expects to find the specific
  thread that encountered a SIGPIPE using the ->si_pid will now
  break.

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Acked-By: Roland McGrath <roland@redhat.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/signal.c

index 31db63b3f88b5f2be231dcdb88b0775fd7a9cefa..3152ac3b62e254390a39439a98ed53402d4ed6c1 100644 (file)
@@ -858,7 +858,7 @@ static int send_signal(int sig, struct siginfo *info, struct task_struct *t,
                        q->info.si_signo = sig;
                        q->info.si_errno = 0;
                        q->info.si_code = SI_USER;
-                       q->info.si_pid = task_pid_nr_ns(current,
+                       q->info.si_pid = task_tgid_nr_ns(current,
                                                        task_active_pid_ns(t));
                        q->info.si_uid = current_uid();
                        break;