PERFORCE change 115016 for review

Roman Divacky rdivacky at FreeBSD.org
Sun Feb 25 10:24:49 UTC 2007


http://perforce.freebsd.org/chv.cgi?CH=115016

Change 115016 by rdivacky at rdivacky_witten on 2007/02/25 10:24:38

	Return EINVAL for invalid flags combination or non-page aligned
	addr in mremap(). This fixes mremap02 LTP test.

Affected files ...

.. //depot/projects/linuxolator/src/sys/compat/linux/linux_misc.c#61 edit
.. //depot/projects/linuxolator/src/sys/compat/linux/linux_misc.h#5 edit

Differences ...

==== //depot/projects/linuxolator/src/sys/compat/linux/linux_misc.c#61 (text+ko) ====

@@ -591,6 +591,18 @@
 		    (unsigned long)args->new_len,
 		    (unsigned long)args->flags);
 #endif
+
+	if (args->flags & ~(LINUX_MREMAP_FIXED | LINUX_MREMAP_MAYMOVE)) {
+		td->td_retval[0] = 0;
+		return (EINVAL);
+	}
+
+	/* Linux defines PAGE_MASK to be FreeBSD ~PAGE_MASK */
+	if (args->addr & PAGE_MASK) {
+		td->td_retval[0] = 0;
+		return (EINVAL);
+	}
+
 	args->new_len = round_page(args->new_len);
 	args->old_len = round_page(args->old_len);
 

==== //depot/projects/linuxolator/src/sys/compat/linux/linux_misc.h#5 (text+ko) ====

@@ -42,4 +42,7 @@
 
 #define	LINUX_MAX_COMM_LEN	16	/* Maximum length of the process name. */
 
+#define	LINUX_MREMAP_MAYMOVE	1
+#define	LINUX_MREMAP_FIXED	2
+
 #endif	/* _LINUX_MISC_H_ */


More information about the p4-projects mailing list