[PATCH] nommu: reject MAP_HUGETLB

From: Hugh Dickins
Date: Tue Jan 05 2010 - 07:37:32 EST


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@xxxxxxxxxxxxx>
---

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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/