linux_dsm_epyc7002/ipc
Dave Hansen d3c97900b4 ipc/shm.c: fix overly aggressive shmdt() when calls span multiple segments
This is a highly-contrived scenario.  But, a single shmdt() call can be
induced in to unmapping memory from mulitple shm segments.  Example code
is here:

	http://www.sr71.net/~dave/intel/shmfun.c

The fix is pretty simple: Record the 'struct file' for the first VMA we
encounter and then stick to it.  Decline to unmap anything not from the
same file and thus the same segment.

I found this by inspection and the odds of anyone hitting this in practice
are pretty darn small.

Lightly tested, but it's a pretty small patch.

Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Manfred Spraul <manfred@colorfullife.com>
Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-12-13 12:42:52 -08:00
..
compat_mq.c ipc, kernel: use Linux headers 2014-06-06 16:08:14 -07:00
compat.c ipc: resolve shadow warnings 2014-10-14 02:18:23 +02:00
ipc_sysctl.c ipc/msg: increase MSGMNI, remove scaling 2014-12-13 12:42:52 -08:00
Makefile ipc/msg: increase MSGMNI, remove scaling 2014-12-13 12:42:52 -08:00
mq_sysctl.c ipc: convert use of typedef ctl_table to struct ctl_table 2014-06-06 16:08:16 -07:00
mqueue.c new helper: audit_file() 2014-11-19 13:01:26 -05:00
msg.c ipc/msg: increase MSGMNI, remove scaling 2014-12-13 12:42:52 -08:00
msgutil.c ipc, msg: fix message length check for negative values 2013-11-13 12:09:36 +09:00
namespace.c ipc/msg: increase MSGMNI, remove scaling 2014-12-13 12:42:52 -08:00
sem.c ipc/sem.c: change memory barrier in sem_lock() to smp_rmb() 2014-12-13 12:42:52 -08:00
shm.c ipc/shm.c: fix overly aggressive shmdt() when calls span multiple segments 2014-12-13 12:42:52 -08:00
syscall.c get rid of union semop in sys_semctl(2) arguments 2013-03-05 15:14:16 -05:00
util.c ipc/msg: increase MSGMNI, remove scaling 2014-12-13 12:42:52 -08:00
util.h ipc, kernel: clear whitespace 2014-06-06 16:08:14 -07:00