binfmt_flat: replace flat_argvp_envp_on_stack with a Kconfig variable
authorChristoph Hellwig <hch@lst.de>
Thu, 13 Jun 2019 07:08:51 +0000 (09:08 +0200)
committerGreg Ungerer <gerg@kernel.org>
Sun, 23 Jun 2019 23:16:46 +0000 (09:16 +1000)
This will eventually allow us to kill the need for an <asm/flat.h> for
many cases.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Tested-by: Vladimir Murzin <vladimir.murzin@arm.com>
Reviewed-by: Vladimir Murzin <vladimir.murzin@arm.com>
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
12 files changed:
arch/arm/Kconfig
arch/arm/include/asm/flat.h
arch/c6x/include/asm/flat.h
arch/h8300/Kconfig
arch/h8300/include/asm/flat.h
arch/m68k/Kconfig
arch/m68k/include/asm/flat.h
arch/microblaze/include/asm/flat.h
arch/sh/include/asm/flat.h
arch/xtensa/include/asm/flat.h
fs/Kconfig.binfmt
fs/binfmt_flat.c

index 8869742a85df1a34c56b7da989eb1210bbd22e9e..b1b48c0bde7651358e9aeb6ced583c5f48edfc40 100644 (file)
@@ -30,6 +30,7 @@ config ARM
        select ARCH_USE_BUILTIN_BSWAP
        select ARCH_USE_CMPXCHG_LOCKREF
        select ARCH_WANT_IPC_PARSE_VERSION
+       select BINFMT_FLAT_ARGVP_ENVP_ON_STACK
        select BUILDTIME_EXTABLE_SORT if MMU
        select CLONE_BACKWARDS
        select CPU_PM if SUSPEND || CPU_IDLE
index acf162111ee2add9c749498a02f62a491b4d9834..bbc27901446f07101f6136da9be0133ca1e480a0 100644 (file)
@@ -8,8 +8,6 @@
 
 #include <linux/uaccess.h>
 
-#define        flat_argvp_envp_on_stack()              1
-
 static inline int flat_get_addr_from_rp(u32 __user *rp, u32 relval, u32 flags,
                                        u32 *addr, u32 *persistent)
 {
index 353e4d06e8c05aa4aa60dcf8ac0b9d18dfa758d0..2d57a9204d210323bb6bb3f9bb7679967d45a50f 100644 (file)
@@ -4,7 +4,6 @@
 
 #include <asm/unaligned.h>
 
-#define flat_argvp_envp_on_stack()                     0
 static inline int flat_get_addr_from_rp(u32 __user *rp, u32 relval, u32 flags,
                                        u32 *addr, u32 *persistent)
 {
index d30e8727b02dc28313613d111713d7c4b4b1a9f1..7457f190caaab8656d8cafe5df5c02842a1c9805 100644 (file)
@@ -2,6 +2,7 @@
 config H8300
         def_bool y
        select ARCH_32BIT_OFF_T
+       select BINFMT_FLAT_ARGVP_ENVP_ON_STACK
        select BINFMT_FLAT_OLD_ALWAYS_RAM
        select GENERIC_ATOMIC64
        select HAVE_UID16
index 14cc928d547824c998876202bdc51cfa25bedf49..4683146f0e9e7a6ee4d75e00757a39e60b050a7c 100644 (file)
@@ -8,8 +8,6 @@
 
 #include <asm/unaligned.h>
 
-#define        flat_argvp_envp_on_stack()              1
-
 /*
  * on the H8 a couple of the relocations have an instruction in the
  * top byte.  As there can only be 24bits of address space,  we just
index 218e037ef901a68cc0b1caa73a84288ad9205ed6..fd69ee5ad6ab073246e1d9456d8098cc7b4da05c 100644 (file)
@@ -7,6 +7,7 @@ config M68K
        select ARCH_MIGHT_HAVE_PC_PARPORT if ISA
        select ARCH_NO_COHERENT_DMA_MMAP if !MMU
        select ARCH_NO_PREEMPT if !COLDFIRE
+       select BINFMT_FLAT_ARGVP_ENVP_ON_STACK
        select HAVE_IDE
        select HAVE_AOUT if MMU
        select HAVE_DEBUG_BUGVERBOSE
index 7b1fb5c2809e3bdde8558513786151046284c90f..d7102fcd43ebd36fc9889f38b3c5e5a657d07991 100644 (file)
@@ -8,7 +8,6 @@
 
 #include <linux/uaccess.h>
 
-#define        flat_argvp_envp_on_stack()              1
 static inline int flat_get_addr_from_rp(u32 __user *rp, u32 relval, u32 flags,
                                        u32 *addr, u32 *persistent)
 {
index 1cd8d7f4cf125977ba9c0a4592a15fc2db854597..9e3d8e01d2947410bba24e084c8a12a213162fa4 100644 (file)
@@ -13,8 +13,6 @@
 
 #include <asm/unaligned.h>
 
-#define        flat_argvp_envp_on_stack()      0
-
 /*
  * Microblaze works a little differently from other arches, because
  * of the MICROBLAZE_64 reloc type. Here, a 32 bit address is split
index 015678d7b7711c3a8ada6775b4c89b855f588e9d..1002343dd84a8eeeab8ca91d910b234192d962b8 100644 (file)
@@ -11,7 +11,6 @@
 
 #include <asm/unaligned.h>
 
-#define        flat_argvp_envp_on_stack()              0
 static inline int flat_get_addr_from_rp(u32 __user *rp, u32 relval, u32 flags,
                                        u32 *addr, u32 *persistent)
 {
index b215c1e66958c234ecc707f539e595273f800db2..3d357371b28b803b5a15932f8285e86e50570c80 100644 (file)
@@ -4,7 +4,6 @@
 
 #include <asm/unaligned.h>
 
-#define flat_argvp_envp_on_stack()                     0
 static inline int flat_get_addr_from_rp(u32 __user *rp, u32 relval, u32 flags,
                                        u32 *addr, u32 *persistent)
 {
index 5658e12ad944497ad3a284394bca352ce0bc6379..82f7d7f234f3eab159cb47d20479e130f2b70f7b 100644 (file)
@@ -97,6 +97,9 @@ config BINFMT_FLAT
        help
          Support uClinux FLAT format binaries.
 
+config BINFMT_FLAT_ARGVP_ENVP_ON_STACK
+       bool
+
 config BINFMT_FLAT_OLD_ALWAYS_RAM
        bool
 
index 3e7f4a6cffa25d738b91f9d873c7ff77a3cd8874..a15fdd5d95ed97df70c7fcc192cd42c3d31e8cc2 100644 (file)
@@ -124,14 +124,15 @@ static int create_flat_tables(struct linux_binprm *bprm, unsigned long arg_start
 
        sp -= bprm->envc + 1;
        sp -= bprm->argc + 1;
-       sp -= flat_argvp_envp_on_stack() ? 2 : 0;
+       if (IS_ENABLED(CONFIG_BINFMT_FLAT_ARGVP_ENVP_ON_STACK))
+               sp -= 2; /* argvp + envp */
        sp -= 1;  /* &argc */
 
        current->mm->start_stack = (unsigned long)sp & -FLAT_STACK_ALIGN;
        sp = (unsigned long __user *)current->mm->start_stack;
 
        __put_user(bprm->argc, sp++);
-       if (flat_argvp_envp_on_stack()) {
+       if (IS_ENABLED(CONFIG_BINFMT_FLAT_ARGVP_ENVP_ON_STACK)) {
                unsigned long argv, envp;
                argv = (unsigned long)(sp + 2);
                envp = (unsigned long)(sp + 2 + bprm->argc + 1);