diff options
Diffstat (limited to 'arch/mips/kernel/binfmt_elfo32.c')
| -rw-r--r-- | arch/mips/kernel/binfmt_elfo32.c | 14 | 
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/mips/kernel/binfmt_elfo32.c b/arch/mips/kernel/binfmt_elfo32.c index 202e581e609..7faf5f2bee2 100644 --- a/arch/mips/kernel/binfmt_elfo32.c +++ b/arch/mips/kernel/binfmt_elfo32.c @@ -28,6 +28,18 @@ typedef double elf_fpreg_t;  typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];  /* + * In order to be sure that we don't attempt to execute an O32 binary which + * requires 64 bit FP (FR=1) on a system which does not support it we refuse + * to execute any binary which has bits specified by the following macro set + * in its ELF header flags. + */ +#ifdef CONFIG_MIPS_O32_FP64_SUPPORT +# define __MIPS_O32_FP64_MUST_BE_ZERO	0 +#else +# define __MIPS_O32_FP64_MUST_BE_ZERO	EF_MIPS_FP64 +#endif + +/*   * This is used to ensure we don't load something for the wrong architecture.   */  #define elf_check_arch(hdr)						\ @@ -44,6 +56,8 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];  	if (((__h->e_flags & EF_MIPS_ABI) != 0) &&			\  	    ((__h->e_flags & EF_MIPS_ABI) != EF_MIPS_ABI_O32))		\  		__res = 0;						\ +	if (__h->e_flags & __MIPS_O32_FP64_MUST_BE_ZERO)		\ +		__res = 0;						\  									\  	__res;								\  })  | 
