Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 25 Feb 2007 10:24:47 GMT
From:      Roman Divacky <rdivacky@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 115016 for review
Message-ID:  <200702251024.l1PAOlUp020280@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help

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

Change 115016 by rdivacky@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_ */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200702251024.l1PAOlUp020280>