diff options
author | Bernd Schmidt <bernds_cb1@t-online.de> | 2008-04-23 15:06:15 -0400 |
---|---|---|
committer | Bryan Wu <cooloney@kernel.org> | 2008-04-23 15:06:15 -0400 |
commit | d5adb029efad3c51db376d620319abe65d1efc21 (patch) | |
tree | 660caff4c28e904f00a040c0ed4a17d5010c6f20 | |
parent | 1ebc723cf04b55e7aeeec2e758293575d29a9c2b (diff) |
[Blackfin] arch: This allows XIP to work with FD-PIC.
Previously, init failed to do anything meaningful;
it turns out that the reason is that FD-PIC has a readonly data
section which can be located in the XIP filesystem, and various address checks
in the kernel reject such addresses for syscall arguments. Hence, init's
execve ("/bin/sh", ...)
failed with error code EFAULT.
There's room for improvement here: in case people want to have filesystems
on flash rather than in main memory, _access_ok should be modified to
allow this.
This bug fix is also dedicated to Michael Hennerich.
Signed-off-by: Bernd Schmidt <bernds_cb1@t-online.de>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
-rw-r--r-- | arch/blackfin/kernel/process.c | 6 | ||||
-rw-r--r-- | include/asm-blackfin/processor.h | 5 |
2 files changed, 9 insertions, 2 deletions
diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c index fb94cbeafad6..be9fdd00d7cb 100644 --- a/arch/blackfin/kernel/process.c +++ b/arch/blackfin/kernel/process.c | |||
@@ -324,6 +324,12 @@ int _access_ok(unsigned long addr, unsigned long size) | |||
324 | return 1; | 324 | return 1; |
325 | if (addr >= memory_mtd_end && (addr + size) <= physical_mem_end) | 325 | if (addr >= memory_mtd_end && (addr + size) <= physical_mem_end) |
326 | return 1; | 326 | return 1; |
327 | |||
328 | #ifdef CONFIG_ROMFS_MTD_FS | ||
329 | /* For XIP, allow user space to use pointers within the ROMFS. */ | ||
330 | if (addr >= memory_mtd_start && (addr + size) <= memory_mtd_end) | ||
331 | return 1; | ||
332 | #endif | ||
327 | #else | 333 | #else |
328 | if (addr >= memory_start && (addr + size) <= physical_mem_end) | 334 | if (addr >= memory_start && (addr + size) <= physical_mem_end) |
329 | return 1; | 335 | return 1; |
diff --git a/include/asm-blackfin/processor.h b/include/asm-blackfin/processor.h index 1033e5c76011..1c0040724612 100644 --- a/include/asm-blackfin/processor.h +++ b/include/asm-blackfin/processor.h | |||
@@ -26,9 +26,10 @@ static inline void wrusp(unsigned long usp) | |||
26 | 26 | ||
27 | /* | 27 | /* |
28 | * User space process size: 1st byte beyond user address space. | 28 | * User space process size: 1st byte beyond user address space. |
29 | * Fairly meaningless on nommu. Parts of user programs can be scattered | ||
30 | * in a lot of places, so just disable this by setting it to 0xFFFFFFFF. | ||
29 | */ | 31 | */ |
30 | extern unsigned long memory_end; | 32 | #define TASK_SIZE 0xFFFFFFFF |
31 | #define TASK_SIZE (memory_end) | ||
32 | 33 | ||
33 | #ifdef __KERNEL__ | 34 | #ifdef __KERNEL__ |
34 | #define STACK_TOP TASK_SIZE | 35 | #define STACK_TOP TASK_SIZE |