]> git.karo-electronics.de Git - karo-tx-linux.git/commit
[PATCH] shmdt cannot detach not-alined shm segment cleanly.
authorKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Thu, 9 Feb 2006 10:03:17 +0000 (02:03 -0800)
committerChris Wright <chrisw@sous-sol.org>
Wed, 1 Mar 2006 22:36:31 +0000 (14:36 -0800)
commitbde2fcb4fcc69afb0a6ebd1d8c27a83e475480ed
tree5f2719e5d73a2e26a68827e5ce483fc2ae012ad8
parent8bd69ca8a395caf9385b06713f34ef1562ff362c
[PATCH] shmdt cannot detach not-alined shm segment cleanly.

sys_shmdt() can manage shm segments which are covered by multiple vmas.  (This
can happen when a user uses mprotect() after shmat().)

This works well if shm is aligned to PAGE_SIZE, but if not, the last
segment cannot be detached.  It is because a comparison in sys_shmdt()

(vma->vm_end - addr) < size
addr == return address of shmat()
size == shmsize, argments to shmget()

size should be aligned to PAGE_SIZE before being compared with vma->vm_end,
which is aligned.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Manfred Spraul <manfred@colorfullife.com>
Cc: Hugh Dickins <hugh@veritas.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
ipc/shm.c