]> git.karo-electronics.de Git - karo-tx-linux.git/commit
mqueue: fix si_pid value in mqueue do_notify()
authorSukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Thu, 8 Jan 2009 02:08:50 +0000 (18:08 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 20 Feb 2009 22:36:54 +0000 (14:36 -0800)
commit727cfccf7228713b733297207ae26aa97858f126
tree7a593ba9248faa04208495c6de19f1bf8a17758e
parent724313bf0904f351b8e1c099e14e00f10fe15242
mqueue: fix si_pid value in mqueue do_notify()

commit a6684999f7c6bddd75cf9755ad7ff44435f72fff upstream.

If a process registers for asynchronous notification on a POSIX message
queue, it gets a signal and a siginfo_t structure when a message arrives
on the message queue.  The si_pid in the siginfo_t structure is set to the
PID of the process that sent the message to the message queue.

The principle is the following:
. when mq_notify(SIGEV_SIGNAL) is called, the caller registers for
  notification when a msg arrives. The associated pid structure is stroed into
  inode_info->notify_owner. Let's call this process P1.
. when mq_send() is called by say P2, P2 sends a signal to P1 to notify
  him about msg arrival.

The way .si_pid is set today is not correct, since it doesn't take into account
the fact that the process that is sending the message might not be in the
same namespace as the notified one.

This patch proposes to set si_pid to the sender's pid into the notify_owner
namespace.

Signed-off-by: Nadia Derbey <Nadia.Derbey@bull.net>
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Cc: Roland McGrath <roland@redhat.com>
Cc: Bastian Blank <bastian@waldi.eu.org>
Cc: Pavel Emelyanov <xemul@openvz.org>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
ipc/mqueue.c