linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Thayne Harbaugh <thayne@c2.net>
To: linux-kernel@vger.kernel.org
Cc: ak@suse.de, linux-mm@kvack.org, discuss@x86-64.org
Subject: [PATCH] Inconsistent mmap()/mremap() flags
Date: Thu, 27 Sep 2007 23:46:33 -0600	[thread overview]
Message-ID: <1190958393.5128.85.camel@phantasm.home.enterpriseandprosperity.com> (raw)

The x86_64 mmap() accepts the MAP_32BIT flag to request 32-bit clean
addresses.  It seems to me that for consistency x86_64 mremap() should
also accept this (or an equivalent) flag.

Here is a trivial and untested patch for basis of discussion:

--- linux-source-2.6.22/mm/mremap.c.orig	2007-09-27 23:02:13.000000000 -0600
+++ linux-source-2.6.22/mm/mremap.c	2007-09-27 23:07:29.000000000 -0600
@@ -23,6 +23,11 @@
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>

+/* MAP_32BIT possibly defined in asm/mman.h */
+#ifndef MAP_32BIT
+#define MAP_32BIT 0
+#endif
+
 static pmd_t *get_old_pmd(struct mm_struct *mm, unsigned long addr)
 {
 	pgd_t *pgd;
@@ -255,7 +259,7 @@
 	unsigned long ret = -EINVAL;
 	unsigned long charged = 0;
 
-	if (flags & ~(MREMAP_FIXED | MREMAP_MAYMOVE))
+	if (flags & ~(MREMAP_FIXED | MREMAP_MAYMOVE | MAP_32BIT))
 		goto out;
 
 	if (addr & ~PAGE_MASK)
@@ -388,6 +392,9 @@
 			if (vma->vm_flags & VM_MAYSHARE)
 				map_flags |= MAP_SHARED;
 
+			if (flags & MAP_32BIT)
+				map_flags |= MAP_32BIT;
+
 			new_addr = get_unmapped_area(vma->vm_file, 0, new_len,
 						vma->vm_pgoff, map_flags);
 			ret = new_addr;


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

             reply	other threads:[~2007-09-28  5:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-28  5:46 Thayne Harbaugh [this message]
2007-10-01 11:13 ` Andi Kleen
2007-10-02  2:57   ` Thayne Harbaugh
2007-10-02  5:15     ` Andi Kleen
2007-10-02  7:06       ` Thayne Harbaugh
2007-10-02 12:19         ` Hugh Dickins
2007-10-02 13:45           ` [discuss] " Andi Kleen
2007-10-02 14:16             ` Hugh Dickins
2007-10-02 15:21               ` Thayne Harbaugh

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=1190958393.5128.85.camel@phantasm.home.enterpriseandprosperity.com \
    --to=thayne@c2.net \
    --cc=ak@suse.de \
    --cc=discuss@x86-64.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /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