]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[Blackfin] arch: This allows XIP to work with FD-PIC.
authorBernd Schmidt <bernds_cb1@t-online.de>
Wed, 23 Apr 2008 19:06:15 +0000 (03:06 +0800)
committerBryan Wu <cooloney@kernel.org>
Wed, 23 Apr 2008 19:06:15 +0000 (03:06 +0800)
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>
arch/blackfin/kernel/process.c
include/asm-blackfin/processor.h

index fb94cbeafad6b625bf9c6114641fd7c9634b4598..be9fdd00d7cb2c55ef0dcd1d83a9c0bb9beb6c85 100644 (file)
@@ -324,6 +324,12 @@ int _access_ok(unsigned long addr, unsigned long size)
                return 1;
        if (addr >= memory_mtd_end && (addr + size) <= physical_mem_end)
                return 1;
+
+#ifdef CONFIG_ROMFS_MTD_FS
+       /* For XIP, allow user space to use pointers within the ROMFS.  */
+       if (addr >= memory_mtd_start && (addr + size) <= memory_mtd_end)
+               return 1;
+#endif
 #else
        if (addr >= memory_start && (addr + size) <= physical_mem_end)
                return 1;
index 1033e5c7601190089dfbd6cf7a19b95d32e796d2..1c004072461257a2b7ebb2c850858103f30cf620 100644 (file)
@@ -26,9 +26,10 @@ static inline void wrusp(unsigned long usp)
 
 /*
  * User space process size: 1st byte beyond user address space.
+ * Fairly meaningless on nommu.  Parts of user programs can be scattered
+ * in a lot of places, so just disable this by setting it to 0xFFFFFFFF.
  */
-extern unsigned long memory_end;
-#define TASK_SIZE      (memory_end)
+#define TASK_SIZE      0xFFFFFFFF
 
 #ifdef __KERNEL__
 #define STACK_TOP      TASK_SIZE