linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC][PATCH 11/18] arch_mmap_check() on mn10300
@ 2009-12-05 19:08 Al Viro
  2009-12-05 19:08 ` Al Viro
  2009-12-06 17:38 ` David Howells
  0 siblings, 2 replies; 4+ messages in thread
From: Al Viro @ 2009-12-05 19:08 UTC (permalink / raw)
  To: linux-arch; +Cc: torvalds, linux-kernel


Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 arch/mn10300/include/asm/mman.h   |    5 +++++
 arch/mn10300/kernel/sys_mn10300.c |    5 -----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/mn10300/include/asm/mman.h b/arch/mn10300/include/asm/mman.h
index 8eebf89..712f7b0 100644
--- a/arch/mn10300/include/asm/mman.h
+++ b/arch/mn10300/include/asm/mman.h
@@ -1 +1,6 @@
 #include <asm-generic/mman.h>
+
+#define MIN_MAP_ADDR	PAGE_SIZE	/* minimum fixed mmap address */
+
+#define arch_mmap_chech(addr, len, flags) \
+	(((flags) & MAP_FIXED && (addr) < MIN_MAP_ADDR) ? -EINVAL : 0)
diff --git a/arch/mn10300/kernel/sys_mn10300.c b/arch/mn10300/kernel/sys_mn10300.c
index 8ca5af0..ec4100d 100644
--- a/arch/mn10300/kernel/sys_mn10300.c
+++ b/arch/mn10300/kernel/sys_mn10300.c
@@ -23,8 +23,6 @@
 
 #include <asm/uaccess.h>
 
-#define MIN_MAP_ADDR	PAGE_SIZE	/* minimum fixed mmap address */
-
 /*
  * memory mapping syscall
  */
@@ -37,9 +35,6 @@ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
 
 	flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
 
-	if (flags & MAP_FIXED && addr < MIN_MAP_ADDR)
-		goto out;
-
 	error = -EBADF;
 	if (!(flags & MAP_ANONYMOUS)) {
 		file = fget(fd);
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [RFC][PATCH 11/18] arch_mmap_check() on mn10300
  2009-12-05 19:08 [RFC][PATCH 11/18] arch_mmap_check() on mn10300 Al Viro
@ 2009-12-05 19:08 ` Al Viro
  2009-12-06 17:38 ` David Howells
  1 sibling, 0 replies; 4+ messages in thread
From: Al Viro @ 2009-12-05 19:08 UTC (permalink / raw)
  To: linux-arch; +Cc: torvalds, linux-kernel


Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 arch/mn10300/include/asm/mman.h   |    5 +++++
 arch/mn10300/kernel/sys_mn10300.c |    5 -----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/mn10300/include/asm/mman.h b/arch/mn10300/include/asm/mman.h
index 8eebf89..712f7b0 100644
--- a/arch/mn10300/include/asm/mman.h
+++ b/arch/mn10300/include/asm/mman.h
@@ -1 +1,6 @@
 #include <asm-generic/mman.h>
+
+#define MIN_MAP_ADDR	PAGE_SIZE	/* minimum fixed mmap address */
+
+#define arch_mmap_chech(addr, len, flags) \
+	(((flags) & MAP_FIXED && (addr) < MIN_MAP_ADDR) ? -EINVAL : 0)
diff --git a/arch/mn10300/kernel/sys_mn10300.c b/arch/mn10300/kernel/sys_mn10300.c
index 8ca5af0..ec4100d 100644
--- a/arch/mn10300/kernel/sys_mn10300.c
+++ b/arch/mn10300/kernel/sys_mn10300.c
@@ -23,8 +23,6 @@
 
 #include <asm/uaccess.h>
 
-#define MIN_MAP_ADDR	PAGE_SIZE	/* minimum fixed mmap address */
-
 /*
  * memory mapping syscall
  */
@@ -37,9 +35,6 @@ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
 
 	flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
 
-	if (flags & MAP_FIXED && addr < MIN_MAP_ADDR)
-		goto out;
-
 	error = -EBADF;
 	if (!(flags & MAP_ANONYMOUS)) {
 		file = fget(fd);
-- 
1.5.6.5



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [RFC][PATCH 11/18] arch_mmap_check() on mn10300
  2009-12-05 19:08 [RFC][PATCH 11/18] arch_mmap_check() on mn10300 Al Viro
  2009-12-05 19:08 ` Al Viro
@ 2009-12-06 17:38 ` David Howells
  2009-12-06 17:41   ` Al Viro
  1 sibling, 1 reply; 4+ messages in thread
From: David Howells @ 2009-12-06 17:38 UTC (permalink / raw)
  To: Al Viro; +Cc: dhowells, linux-arch, torvalds, linux-kernel

Al Viro <viro@ftp.linux.org.uk> wrote:

> +#define arch_mmap_chech(addr, len, flags) \
> +	(((flags) & MAP_FIXED && (addr) < MIN_MAP_ADDR) ? -EINVAL : 0)

I believe that should be arch_mmap_check().

David

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC][PATCH 11/18] arch_mmap_check() on mn10300
  2009-12-06 17:38 ` David Howells
@ 2009-12-06 17:41   ` Al Viro
  0 siblings, 0 replies; 4+ messages in thread
From: Al Viro @ 2009-12-06 17:41 UTC (permalink / raw)
  To: David Howells; +Cc: Al Viro, linux-arch, torvalds, linux-kernel

On Sun, Dec 06, 2009 at 05:38:12PM +0000, David Howells wrote:
> Al Viro <viro@ftp.linux.org.uk> wrote:
> 
> > +#define arch_mmap_chech(addr, len, flags) \
> > +	(((flags) & MAP_FIXED && (addr) < MIN_MAP_ADDR) ? -EINVAL : 0)
> 
> I believe that should be arch_mmap_check().

D'oh.  Thanks for spotting (and that, BTW, is a nice demonstration
of the reasons why "arch hooks with default" thing is bad).  Fixed in
my tree, will go in the next repost.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-12-06 17:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-05 19:08 [RFC][PATCH 11/18] arch_mmap_check() on mn10300 Al Viro
2009-12-05 19:08 ` Al Viro
2009-12-06 17:38 ` David Howells
2009-12-06 17:41   ` Al Viro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).