public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix remap of shared read only mappings
@ 2003-09-04 14:49 James Bottomley
  2003-09-04 21:48 ` Jamie Lokier
  0 siblings, 1 reply; 13+ messages in thread
From: James Bottomley @ 2003-09-04 14:49 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Linux Kernel

When mmap MAP_SHARED is done on a file, it gets marked with VM_MAYSHARE
and, if it's read/write, VM_SHARED.  However, if it is remapped with
mremap(), the MAP_SHARED is only passed into the new mapping based on
VM_SHARED.  This means that remapped read only MAP_SHARED mappings lose
VM_MAYSHARE.  This is causing us a problem on parisc because we have to
align all shared mappings carefully to mitigate cache aliasing problems.

The fix is to key passing the MAP_SHARED flag back into the remapped are
off VM_MAYSHARE not VM_SHARED.

James

===== mremap.c 1.32 vs 1.33 =====
--- 1.32/mm/mremap.c	Thu Aug  7 12:29:10 2003
+++ 1.33/mm/mremap.c	Sun Aug 24 06:50:10 2003
@@ -420,7 +420,7 @@
 	if (flags & MREMAP_MAYMOVE) {
 		if (!(flags & MREMAP_FIXED)) {
 			unsigned long map_flags = 0;
-			if (vma->vm_flags & VM_SHARED)
+			if (vma->vm_flags & VM_MAYSHARE)
 				map_flags |= MAP_SHARED;
 
 			new_addr = get_unmapped_area(vma->vm_file, 0, new_len,


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2003-09-05  4:35 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-04 14:49 [PATCH] fix remap of shared read only mappings James Bottomley
2003-09-04 21:48 ` Jamie Lokier
2003-09-04 22:33   ` James Bottomley
2003-09-04 22:56     ` Jamie Lokier
2003-09-04 23:23       ` James Bottomley
2003-09-04 23:40         ` Jamie Lokier
2003-09-05  0:49     ` Daniel Phillips
2003-09-05  0:49       ` Linus Torvalds
2003-09-05  1:07         ` Alan Cox
2003-09-05  1:31           ` Daniel Phillips
2003-09-05  4:35           ` Linus Torvalds
2003-09-05  0:52       ` James Bottomley
2003-09-05  1:21         ` Daniel Phillips

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox