lkml.org 
[lkml]   [2004]   [Jan]   [12]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
DateMon, 12 Jan 2004 16:34:42 -0800 (PST)
FromLinus Torvalds <>
SubjectRe: [PATCH] 2.6.1 (not 2.4.24!) mremap fixes broke shm alias mappings

On Sun, 11 Jan 2004, Bart Oldeman wrote:
> 
> DOSEMU needs to alias memory, for instance to emulate the HMA. A long time
> ago this was done using mmaps of /proc/self/mem. This was replaced by
> mremap combined with IPC SHM during 2.1 development.
> 
> According to DOSEMUs changelog you agreed to allow old_len==0:
>             - using _one_ big IPC shm segment and mremap(addr, 0 ...)
>               (Linus agreed on keeping shmat()+mremap(,0,..) functionality)
> so you agreed on something you have removed after all now!

Hey, I wouldn't remember all the special cases that aren't commented. But 
I agree that a zero "old_len" is not bad in itself, and if DOSEMU uses it, 
let's just continue to support it, and document it while we're at it.

So if this makes DOSEMU happy again, let's do it..

Pls confirm.

		Linus

----
===== mm/mremap.c 1.35 vs edited =====
--- 1.35/mm/mremap.c	Wed Jan  7 18:26:37 2004
+++ edited/mm/mremap.c	Mon Jan 12 16:32:15 2004
@@ -315,8 +315,12 @@
 	old_len = PAGE_ALIGN(old_len);
 	new_len = PAGE_ALIGN(new_len);
 
-	/* Don't allow the degenerate cases */
-	if (!old_len || !new_len)
+	/*
+	 * We allow a zero old-len as a special case
+	 * for DOS-emu "duplicate shm area" thing. But
+	 * a zero new-len is nonsensical.
+	 */
+	if (!new_len)
 		goto out;
 
 	/* new_addr is only valid if MREMAP_FIXED is specified */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 14:00    [from the cache]
©2003-2008