aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/Kconfig.binfmt3
-rw-r--r--fs/binfmt_aout.c3
-rw-r--r--fs/binfmt_elf.c34
-rw-r--r--fs/exec.c2
4 files changed, 31 insertions, 11 deletions
diff --git a/fs/Kconfig.binfmt b/fs/Kconfig.binfmt
index 7c3d5f923da1..b5c3b6114add 100644
--- a/fs/Kconfig.binfmt
+++ b/fs/Kconfig.binfmt
@@ -61,7 +61,8 @@ config BINFMT_SHARED_FLAT
61 61
62config BINFMT_AOUT 62config BINFMT_AOUT
63 tristate "Kernel support for a.out and ECOFF binaries" 63 tristate "Kernel support for a.out and ECOFF binaries"
64 depends on X86_32 || ALPHA || ARM || M68K || SPARC32 64 depends on ARCH_SUPPORTS_AOUT && \
65 (X86_32 || ALPHA || ARM || M68K || SPARC32)
65 ---help--- 66 ---help---
66 A.out (Assembler.OUTput) is a set of formats for libraries and 67 A.out (Assembler.OUTput) is a set of formats for libraries and
67 executables used in the earliest versions of UNIX. Linux used 68 executables used in the earliest versions of UNIX. Linux used
diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c
index 7f65e71bf859..a1bb2244cac7 100644
--- a/fs/binfmt_aout.c
+++ b/fs/binfmt_aout.c
@@ -28,6 +28,7 @@
28#include <asm/system.h> 28#include <asm/system.h>
29#include <asm/uaccess.h> 29#include <asm/uaccess.h>
30#include <asm/cacheflush.h> 30#include <asm/cacheflush.h>
31#include <asm/a.out-core.h>
31 32
32static int load_aout_binary(struct linux_binprm *, struct pt_regs * regs); 33static int load_aout_binary(struct linux_binprm *, struct pt_regs * regs);
33static int load_aout_library(struct file*); 34static int load_aout_library(struct file*);
@@ -118,7 +119,7 @@ static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file, u
118 dump.u_ar0 = offsetof(struct user, regs); 119 dump.u_ar0 = offsetof(struct user, regs);
119#endif 120#endif
120 dump.signal = signr; 121 dump.signal = signr;
121 dump_thread(regs, &dump); 122 aout_dump_thread(regs, &dump);
122 123
123/* If the size of the dump file exceeds the rlimit, then see what would happen 124/* If the size of the dump file exceeds the rlimit, then see what would happen
124 if we wrote the stack, but not the data area. */ 125 if we wrote the stack, but not the data area. */
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 111771d38e6e..a93b1170551b 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -513,6 +513,7 @@ out:
513 return error; 513 return error;
514} 514}
515 515
516#ifdef CONFIG_ARCH_SUPPORTS_AOUT
516static unsigned long load_aout_interp(struct exec *interp_ex, 517static unsigned long load_aout_interp(struct exec *interp_ex,
517 struct file *interpreter) 518 struct file *interpreter)
518{ 519{
@@ -558,6 +559,14 @@ static unsigned long load_aout_interp(struct exec *interp_ex,
558out: 559out:
559 return elf_entry; 560 return elf_entry;
560} 561}
562#else
563/* dummy extern - the function should never be called if !CONFIG_AOUT_BINFMT */
564static inline unsigned long load_aout_interp(struct exec *interp_ex,
565 struct file *interpreter)
566{
567 return -ELIBACC;
568}
569#endif
561 570
562/* 571/*
563 * These are the functions used to load ELF style executables and shared 572 * These are the functions used to load ELF style executables and shared
@@ -565,9 +574,15 @@ out:
565 */ 574 */
566 575
567#define INTERPRETER_NONE 0 576#define INTERPRETER_NONE 0
568#define INTERPRETER_AOUT 1
569#define INTERPRETER_ELF 2 577#define INTERPRETER_ELF 2
570 578
579#ifdef CONFIG_ARCH_SUPPORTS_AOUT
580#define INTERPRETER_AOUT 1
581#define IS_AOUT_INTERP(x) ((x) == INTERPRETER_AOUT)
582#else
583#define IS_AOUT_INTERP(x) (0)
584#endif
585
571#ifndef STACK_RND_MASK 586#ifndef STACK_RND_MASK
572#define STACK_RND_MASK (0x7ff >> (PAGE_SHIFT - 12)) /* 8MB of VA */ 587#define STACK_RND_MASK (0x7ff >> (PAGE_SHIFT - 12)) /* 8MB of VA */
573#endif 588#endif
@@ -775,6 +790,7 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
775 /* Some simple consistency checks for the interpreter */ 790 /* Some simple consistency checks for the interpreter */
776 if (elf_interpreter) { 791 if (elf_interpreter) {
777 static int warn; 792 static int warn;
793#ifdef CONFIG_ARCH_SUPPORTS_AOUT
778 interpreter_type = INTERPRETER_ELF | INTERPRETER_AOUT; 794 interpreter_type = INTERPRETER_ELF | INTERPRETER_AOUT;
779 795
780 /* Now figure out which format our binary is */ 796 /* Now figure out which format our binary is */
@@ -782,11 +798,13 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
782 (N_MAGIC(loc->interp_ex) != ZMAGIC) && 798 (N_MAGIC(loc->interp_ex) != ZMAGIC) &&
783 (N_MAGIC(loc->interp_ex) != QMAGIC)) 799 (N_MAGIC(loc->interp_ex) != QMAGIC))
784 interpreter_type = INTERPRETER_ELF; 800 interpreter_type = INTERPRETER_ELF;
785 801#else
802 interpreter_type = INTERPRETER_ELF;
803#endif
786 if (memcmp(loc->interp_elf_ex.e_ident, ELFMAG, SELFMAG) != 0) 804 if (memcmp(loc->interp_elf_ex.e_ident, ELFMAG, SELFMAG) != 0)
787 interpreter_type &= ~INTERPRETER_ELF; 805 interpreter_type &= ~INTERPRETER_ELF;
788 806
789 if (interpreter_type == INTERPRETER_AOUT && warn < 10) { 807 if (IS_AOUT_INTERP(interpreter_type) && warn < 10) {
790 printk(KERN_WARNING "a.out ELF interpreter %s is " 808 printk(KERN_WARNING "a.out ELF interpreter %s is "
791 "deprecated and will not be supported " 809 "deprecated and will not be supported "
792 "after Linux 2.6.25\n", elf_interpreter); 810 "after Linux 2.6.25\n", elf_interpreter);
@@ -815,7 +833,7 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
815 833
816 /* OK, we are done with that, now set up the arg stuff, 834 /* OK, we are done with that, now set up the arg stuff,
817 and then start this sucker up */ 835 and then start this sucker up */
818 if ((!bprm->sh_bang) && (interpreter_type == INTERPRETER_AOUT)) { 836 if (IS_AOUT_INTERP(interpreter_type) && !bprm->sh_bang) {
819 char *passed_p = passed_fileno; 837 char *passed_p = passed_fileno;
820 sprintf(passed_fileno, "%d", elf_exec_fileno); 838 sprintf(passed_fileno, "%d", elf_exec_fileno);
821 839
@@ -1004,7 +1022,7 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
1004 } 1022 }
1005 1023
1006 if (elf_interpreter) { 1024 if (elf_interpreter) {
1007 if (interpreter_type == INTERPRETER_AOUT) { 1025 if (IS_AOUT_INTERP(interpreter_type)) {
1008 elf_entry = load_aout_interp(&loc->interp_ex, 1026 elf_entry = load_aout_interp(&loc->interp_ex,
1009 interpreter); 1027 interpreter);
1010 } else { 1028 } else {
@@ -1045,7 +1063,7 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
1045 1063
1046 kfree(elf_phdata); 1064 kfree(elf_phdata);
1047 1065
1048 if (interpreter_type != INTERPRETER_AOUT) 1066 if (!IS_AOUT_INTERP(interpreter_type))
1049 sys_close(elf_exec_fileno); 1067 sys_close(elf_exec_fileno);
1050 1068
1051 set_binfmt(&elf_format); 1069 set_binfmt(&elf_format);
@@ -1061,14 +1079,14 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
1061 compute_creds(bprm); 1079 compute_creds(bprm);
1062 current->flags &= ~PF_FORKNOEXEC; 1080 current->flags &= ~PF_FORKNOEXEC;
1063 retval = create_elf_tables(bprm, &loc->elf_ex, 1081 retval = create_elf_tables(bprm, &loc->elf_ex,
1064 (interpreter_type == INTERPRETER_AOUT), 1082 IS_AOUT_INTERP(interpreter_type),
1065 load_addr, interp_load_addr); 1083 load_addr, interp_load_addr);
1066 if (retval < 0) { 1084 if (retval < 0) {
1067 send_sig(SIGKILL, current, 0); 1085 send_sig(SIGKILL, current, 0);
1068 goto out; 1086 goto out;
1069 } 1087 }
1070 /* N.B. passed_fileno might not be initialized? */ 1088 /* N.B. passed_fileno might not be initialized? */
1071 if (interpreter_type == INTERPRETER_AOUT) 1089 if (IS_AOUT_INTERP(interpreter_type))
1072 current->mm->arg_start += strlen(passed_fileno) + 1; 1090 current->mm->arg_start += strlen(passed_fileno) + 1;
1073 current->mm->end_code = end_code; 1091 current->mm->end_code = end_code;
1074 current->mm->start_code = start_code; 1092 current->mm->start_code = start_code;
diff --git a/fs/exec.c b/fs/exec.c
index 927a7c5ef4af..9f9c27224d7c 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1166,7 +1166,7 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
1166{ 1166{
1167 int try,retval; 1167 int try,retval;
1168 struct linux_binfmt *fmt; 1168 struct linux_binfmt *fmt;
1169#ifdef __alpha__ 1169#if defined(__alpha__) && defined(CONFIG_ARCH_SUPPORTS_AOUT)
1170 /* handle /sbin/loader.. */ 1170 /* handle /sbin/loader.. */
1171 { 1171 {
1172 struct exec * eh = (struct exec *) bprm->buf; 1172 struct exec * eh = (struct exec *) bprm->buf;