mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-01 06:33:07 +00:00
binfmt_flat: replace flat_argvp_envp_on_stack with a Kconfig variable
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>
This commit is contained in:
parent
1d52dca117
commit
bdd15a2884
12 changed files with 9 additions and 12 deletions
|
@ -30,6 +30,7 @@ config ARM
|
||||||
select ARCH_USE_BUILTIN_BSWAP
|
select ARCH_USE_BUILTIN_BSWAP
|
||||||
select ARCH_USE_CMPXCHG_LOCKREF
|
select ARCH_USE_CMPXCHG_LOCKREF
|
||||||
select ARCH_WANT_IPC_PARSE_VERSION
|
select ARCH_WANT_IPC_PARSE_VERSION
|
||||||
|
select BINFMT_FLAT_ARGVP_ENVP_ON_STACK
|
||||||
select BUILDTIME_EXTABLE_SORT if MMU
|
select BUILDTIME_EXTABLE_SORT if MMU
|
||||||
select CLONE_BACKWARDS
|
select CLONE_BACKWARDS
|
||||||
select CPU_PM if SUSPEND || CPU_IDLE
|
select CPU_PM if SUSPEND || CPU_IDLE
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
|
|
||||||
#include <linux/uaccess.h>
|
#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,
|
static inline int flat_get_addr_from_rp(u32 __user *rp, u32 relval, u32 flags,
|
||||||
u32 *addr, u32 *persistent)
|
u32 *addr, u32 *persistent)
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
#include <asm/unaligned.h>
|
#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,
|
static inline int flat_get_addr_from_rp(u32 __user *rp, u32 relval, u32 flags,
|
||||||
u32 *addr, u32 *persistent)
|
u32 *addr, u32 *persistent)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
config H8300
|
config H8300
|
||||||
def_bool y
|
def_bool y
|
||||||
select ARCH_32BIT_OFF_T
|
select ARCH_32BIT_OFF_T
|
||||||
|
select BINFMT_FLAT_ARGVP_ENVP_ON_STACK
|
||||||
select BINFMT_FLAT_OLD_ALWAYS_RAM
|
select BINFMT_FLAT_OLD_ALWAYS_RAM
|
||||||
select GENERIC_ATOMIC64
|
select GENERIC_ATOMIC64
|
||||||
select HAVE_UID16
|
select HAVE_UID16
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
|
|
||||||
#include <asm/unaligned.h>
|
#include <asm/unaligned.h>
|
||||||
|
|
||||||
#define flat_argvp_envp_on_stack() 1
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* on the H8 a couple of the relocations have an instruction in the
|
* 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
|
* top byte. As there can only be 24bits of address space, we just
|
||||||
|
|
|
@ -7,6 +7,7 @@ config M68K
|
||||||
select ARCH_MIGHT_HAVE_PC_PARPORT if ISA
|
select ARCH_MIGHT_HAVE_PC_PARPORT if ISA
|
||||||
select ARCH_NO_COHERENT_DMA_MMAP if !MMU
|
select ARCH_NO_COHERENT_DMA_MMAP if !MMU
|
||||||
select ARCH_NO_PREEMPT if !COLDFIRE
|
select ARCH_NO_PREEMPT if !COLDFIRE
|
||||||
|
select BINFMT_FLAT_ARGVP_ENVP_ON_STACK
|
||||||
select HAVE_IDE
|
select HAVE_IDE
|
||||||
select HAVE_AOUT if MMU
|
select HAVE_AOUT if MMU
|
||||||
select HAVE_DEBUG_BUGVERBOSE
|
select HAVE_DEBUG_BUGVERBOSE
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
#include <linux/uaccess.h>
|
#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,
|
static inline int flat_get_addr_from_rp(u32 __user *rp, u32 relval, u32 flags,
|
||||||
u32 *addr, u32 *persistent)
|
u32 *addr, u32 *persistent)
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,8 +13,6 @@
|
||||||
|
|
||||||
#include <asm/unaligned.h>
|
#include <asm/unaligned.h>
|
||||||
|
|
||||||
#define flat_argvp_envp_on_stack() 0
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Microblaze works a little differently from other arches, because
|
* Microblaze works a little differently from other arches, because
|
||||||
* of the MICROBLAZE_64 reloc type. Here, a 32 bit address is split
|
* of the MICROBLAZE_64 reloc type. Here, a 32 bit address is split
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
|
|
||||||
#include <asm/unaligned.h>
|
#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,
|
static inline int flat_get_addr_from_rp(u32 __user *rp, u32 relval, u32 flags,
|
||||||
u32 *addr, u32 *persistent)
|
u32 *addr, u32 *persistent)
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
#include <asm/unaligned.h>
|
#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,
|
static inline int flat_get_addr_from_rp(u32 __user *rp, u32 relval, u32 flags,
|
||||||
u32 *addr, u32 *persistent)
|
u32 *addr, u32 *persistent)
|
||||||
{
|
{
|
||||||
|
|
|
@ -97,6 +97,9 @@ config BINFMT_FLAT
|
||||||
help
|
help
|
||||||
Support uClinux FLAT format binaries.
|
Support uClinux FLAT format binaries.
|
||||||
|
|
||||||
|
config BINFMT_FLAT_ARGVP_ENVP_ON_STACK
|
||||||
|
bool
|
||||||
|
|
||||||
config BINFMT_FLAT_OLD_ALWAYS_RAM
|
config BINFMT_FLAT_OLD_ALWAYS_RAM
|
||||||
bool
|
bool
|
||||||
|
|
||||||
|
|
|
@ -124,14 +124,15 @@ static int create_flat_tables(struct linux_binprm *bprm, unsigned long arg_start
|
||||||
|
|
||||||
sp -= bprm->envc + 1;
|
sp -= bprm->envc + 1;
|
||||||
sp -= bprm->argc + 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 */
|
sp -= 1; /* &argc */
|
||||||
|
|
||||||
current->mm->start_stack = (unsigned long)sp & -FLAT_STACK_ALIGN;
|
current->mm->start_stack = (unsigned long)sp & -FLAT_STACK_ALIGN;
|
||||||
sp = (unsigned long __user *)current->mm->start_stack;
|
sp = (unsigned long __user *)current->mm->start_stack;
|
||||||
|
|
||||||
__put_user(bprm->argc, sp++);
|
__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;
|
unsigned long argv, envp;
|
||||||
argv = (unsigned long)(sp + 2);
|
argv = (unsigned long)(sp + 2);
|
||||||
envp = (unsigned long)(sp + 2 + bprm->argc + 1);
|
envp = (unsigned long)(sp + 2 + bprm->argc + 1);
|
||||||
|
|
Loading…
Reference in a new issue