From: Hugh Dickins <hugh.dickins@tiscali.co.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Eric B Munson <ebmunson@us.ibm.com>,
Andrew Morton <akpm@linux-foundation.org>,
Al Viro <viro@ZenIV.linux.org.uk>,
David Howells <dhowells@redhat.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: [PATCH] nommu: reject MAP_HUGETLB
Date: Tue, 5 Jan 2010 12:37:19 +0000 (GMT) [thread overview]
Message-ID: <alpine.LSU.2.00.1001051232530.1055@sister.anvils> (raw)
In-Reply-To: <20100104123858.GA5045@us.ibm.com>
We've agreed to restore the rejection of MAP_HUGETLB to nommu.
Mimic what happens with mmu when hugetlb is not configured in:
say -ENOSYS, but -EINVAL if MAP_ANONYMOUS was not given too.
Signed-off-by: Hugh Dickins <hugh.dickins@tiscali.co.uk>
---
mm/nommu.c | 8 ++++++++
1 file changed, 8 insertions(+)
--- 2.6.33-rc2-git/mm/nommu.c 2009-12-31 08:08:16.000000000 +0000
+++ linux/mm/nommu.c 2010-01-05 12:08:01.000000000 +0000
@@ -1405,6 +1405,14 @@ SYSCALL_DEFINE6(mmap_pgoff, unsigned lon
struct file *file = NULL;
unsigned long retval = -EBADF;
+ if (unlikely(flags & MAP_HUGETLB)) {
+ if (flags & MAP_ANONYMOUS)
+ retval = -ENOSYS; /* like hugetlb_file_setup */
+ else
+ retval = -EINVAL;
+ goto out;
+ }
+
if (!(flags & MAP_ANONYMOUS)) {
file = fget(fd);
if (!file)
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2010-01-05 12:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-30 20:17 [PATCH] mm: move sys_mmap_pgoff from util.c Hugh Dickins
2010-01-04 12:38 ` Eric B Munson
2010-01-04 17:21 ` Hugh Dickins
2010-01-05 12:37 ` Hugh Dickins [this message]
2010-01-05 12:47 ` [PATCH] nommu: reject MAP_HUGETLB Eric B Munson
2010-01-05 15:23 ` David Howells
2010-01-05 16:16 ` Hugh Dickins
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LSU.2.00.1001051232530.1055@sister.anvils \
--to=hugh.dickins@tiscali.co.uk \
--cc=akpm@linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=ebmunson@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=torvalds@linux-foundation.org \
--cc=viro@ZenIV.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox