Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

David Howells and committed by
Linus Torvalds
08dc179b ea56f411

+3 -5
+3 -3
arch/frv/include/asm/segment.h
··· 21 21 22 22 #define MAKE_MM_SEG(s) ((mm_segment_t) { (s) }) 23 23 24 - #define KERNEL_DS MAKE_MM_SEG(0xdfffffffUL) 25 - 26 24 #ifdef CONFIG_MMU 27 25 #define USER_DS MAKE_MM_SEG(TASK_SIZE - 1) 26 + #define KERNEL_DS MAKE_MM_SEG(0xdfffffffUL) 28 27 #else 29 - #define USER_DS KERNEL_DS 28 + #define USER_DS MAKE_MM_SEG(memory_end) 29 + #define KERNEL_DS MAKE_MM_SEG(0xe0000000UL) 30 30 #endif 31 31 32 32 #define get_ds() (KERNEL_DS)
-2
arch/frv/include/asm/uaccess.h
··· 27 27 #define VERIFY_READ 0 28 28 #define VERIFY_WRITE 1 29 29 30 - #define __addr_ok(addr) ((unsigned long)(addr) < get_addr_limit()) 31 - 32 30 /* 33 31 * check that a range of addresses falls within the current address limit 34 32 */