]> git.baikalelectronics.ru Git - kernel.git/commit
shm: handle separate PID namespaces case
authorVasiliy Kulikov <segoon@openwall.com>
Thu, 28 Jul 2011 23:55:31 +0000 (03:55 +0400)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 30 Jul 2011 18:44:19 +0000 (08:44 -1000)
commiteddf712bc489d2afc48f94b42b086cdfc8c9e51e
tree74174553e2729fd582dc73f9d61b2a54286b3ede
parent7bb1fbb9d00ab8abf16d70db444cfa6563898c7f
shm: handle separate PID namespaces case

shm_try_destroy_orphaned() and shm_try_destroy_current() didn't handle
the case of separate PID namespaces, but a single IPC namespace.  If
there are tasks with the same PID values using the same shmem object,
the wrong destroy decision could be reached.

On shm segment creation store the pointer to the creator task in
shmid_kernel->shm_creator field and zero it on task exit.  Then
use the ->shm_creator insread of shm_cprid in both functions.  As
shmid_kernel object is already locked at this stage, no additional
locking is needed.

Signed-off-by: Vasiliy Kulikov <segoon@openwall.com>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/shm.h
ipc/shm.c