/[linux-patches]/genpatches-2.6/trunk/2.6.14/1435_15.5_shmdt-non-aligned-segment.patch
Gentoo

Contents of /genpatches-2.6/trunk/2.6.14/1435_15.5_shmdt-non-aligned-segment.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 328 - (show annotations) (download) (as text)
Tue Mar 14 13:34:17 2006 UTC (14 years, 7 months ago) by johnm
File MIME type: text/x-diff
File size: 1514 byte(s)
2.6.14-11, rebase against local tree
1 From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
2 Date: Thu, 9 Feb 2006 10:03:17 +0000 (-0800)
3 Subject: [PATCH] shmdt cannot detach not-alined shm segment cleanly.
4 X-Git-Url: http://www.kernel.org/git/?p=linux/kernel/git/chrisw/linux-2.6.15.y.git;a=commitdiff;h=bde2fcb4fcc69afb0a6ebd1d8c27a83e475480ed
5
6 [PATCH] shmdt cannot detach not-alined shm segment cleanly.
7
8 sys_shmdt() can manage shm segments which are covered by multiple vmas. (This
9 can happen when a user uses mprotect() after shmat().)
10
11 This works well if shm is aligned to PAGE_SIZE, but if not, the last
12 segment cannot be detached. It is because a comparison in sys_shmdt()
13
14 (vma->vm_end - addr) < size
15 addr == return address of shmat()
16 size == shmsize, argments to shmget()
17
18 size should be aligned to PAGE_SIZE before being compared with vma->vm_end,
19 which is aligned.
20
21 Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
22 Cc: Manfred Spraul <manfred@colorfullife.com>
23 Cc: Hugh Dickins <hugh@veritas.com>
24 Cc: <stable@kernel.org>
25 Signed-off-by: Andrew Morton <akpm@osdl.org>
26 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
27 Signed-off-by: Chris Wright <chrisw@sous-sol.org>
28 ---
29
30 --- a/ipc/shm.c
31 +++ b/ipc/shm.c
32 @@ -863,6 +863,7 @@ asmlinkage long sys_shmdt(char __user *s
33 * could possibly have landed at. Also cast things to loff_t to
34 * prevent overflows and make comparisions vs. equal-width types.
35 */
36 + size = PAGE_ALIGN(size);
37 while (vma && (loff_t)(vma->vm_end - addr) <= size) {
38 next = vma->vm_next;
39

  ViewVC Help
Powered by ViewVC 1.1.20