Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Mar 2013 17:08:14 +0000 (UTC)
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r247643 - in user/dchagin/lemul/sys: amd64/linux32 i386/linux
Message-ID:  <201303021708.r22H8E9S068049@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dchagin
Date: Sat Mar  2 17:08:14 2013
New Revision: 247643
URL: http://svnweb.freebsd.org/changeset/base/247643

Log:
  Linux do not allow an mmap() offset which is not modulo the pagesize.

Modified:
  user/dchagin/lemul/sys/amd64/linux32/linux32_machdep.c
  user/dchagin/lemul/sys/i386/linux/linux_machdep.c

Modified: user/dchagin/lemul/sys/amd64/linux32/linux32_machdep.c
==============================================================================
--- user/dchagin/lemul/sys/amd64/linux32/linux32_machdep.c	Sat Mar  2 17:06:39 2013	(r247642)
+++ user/dchagin/lemul/sys/amd64/linux32/linux32_machdep.c	Sat Mar  2 17:08:14 2013	(r247643)
@@ -522,6 +522,13 @@ linux_mmap_common(struct thread *td, l_u
 	fp = NULL;
 
 	/*
+	 * Linux do not allow an offset which is not
+	 * modulo the pagesize.
+	 */
+	if (pos & PAGE_MASK)
+		return (EINVAL);
+
+	/*
 	 * Linux mmap(2):
 	 * You must specify exactly one of MAP_SHARED and MAP_PRIVATE
 	 */

Modified: user/dchagin/lemul/sys/i386/linux/linux_machdep.c
==============================================================================
--- user/dchagin/lemul/sys/i386/linux/linux_machdep.c	Sat Mar  2 17:06:39 2013	(r247642)
+++ user/dchagin/lemul/sys/i386/linux/linux_machdep.c	Sat Mar  2 17:08:14 2013	(r247643)
@@ -426,6 +426,13 @@ linux_mmap_common(struct thread *td, l_u
 	fp = NULL;
 
 	/*
+	 * Linux do not allow an offset which is not
+	 * modulo the pagesize.
+	 */
+	if (pos & PAGE_MASK)
+		return (EINVAL);
+
+	/*
 	 * Linux mmap(2):
 	 * You must specify exactly one of MAP_SHARED and MAP_PRIVATE
 	 */



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