frv: fix kernel/user segment handling in NOMMU mode

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Wednesday, April 7, 2010 - 9:59 am

Gitweb:     http://git.kernel.org/linus/08dc179b9b00cfbed006ae6f5d0e471ef79dc69c
Commit:     08dc179b9b00cfbed006ae6f5d0e471ef79dc69c
Parent:     ea56f411ec2d4d8689eb7f3bcd24e860acf87c47
Author:     David Howells <dhowells@redhat.com>
AuthorDate: Tue Apr 6 14:35:09 2010 -0700
Committer:  Linus Torvalds <torvalds@linux-foundation.org>
CommitDate: Wed Apr 7 08:38:05 2010 -0700

    frv: fix kernel/user segment handling in NOMMU mode
    
    In NOMMU mode, the FRV segment handling is broken because KERNEL_DS ==
    USER_DS.  This causes tests of the following sort:
    
    	/* don't pin down non-user-based iovecs */
    	if (segment_eq(get_fs(), KERNEL_DS))
    		return NULL;
    
    to malfunction.
    
    To fix this, make USER_DS the top of RAM instead of the top of the non-IO
    address space, and make KERNEL_DS one more than the top of the non-IO
    address space.
    
    Also get rid of FRV's __addr_ok() as nothing uses it.
    
    Signed-off-by: David Howells <dhowells@redhat.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
 arch/frv/include/asm/segment.h |    6 +++---
 arch/frv/include/asm/uaccess.h |    2 --
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/arch/frv/include/asm/segment.h b/arch/frv/include/asm/segment.h
index e3616a6..a2320a4 100644
--- a/arch/frv/include/asm/segment.h
+++ b/arch/frv/include/asm/segment.h
@@ -21,12 +21,12 @@ typedef struct {
 
 #define MAKE_MM_SEG(s)	((mm_segment_t) { (s) })
 
-#define KERNEL_DS		MAKE_MM_SEG(0xdfffffffUL)
-
 #ifdef CONFIG_MMU
 #define USER_DS			MAKE_MM_SEG(TASK_SIZE - 1)
+#define KERNEL_DS		MAKE_MM_SEG(0xdfffffffUL)
 #else
-#define USER_DS			KERNEL_DS
+#define USER_DS			MAKE_MM_SEG(memory_end)
+#define KERNEL_DS		MAKE_MM_SEG(0xe0000000UL)
 #endif
 
 #define get_ds()		(KERNEL_DS)
diff --git a/arch/frv/include/asm/uaccess.h b/arch/frv/include/asm/uaccess.h
index 53650c9..0b67ec5 100644
--- a/arch/frv/include/asm/uaccess.h
+++ b/arch/frv/include/asm/uaccess.h
@@ -27,8 +27,6 @@
 #define VERIFY_READ	0
 #define VERIFY_WRITE	1
 
-#define __addr_ok(addr) ((unsigned long)(addr) < get_addr_limit())
-
 /*
  * check that a range of addresses falls within the current address limit
  */
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
frv: fix kernel/user segment handling in NOMMU mode, Linux Kernel Mailing ..., (Wed Apr 7, 9:59 am)