diff options
-rw-r--r-- | arch/alpha/kernel/Makefile | 6 | ||||
-rw-r--r-- | arch/alpha/kernel/binfmt_loader.c | 2 | ||||
-rw-r--r-- | fs/exec.c | 7 | ||||
-rw-r--r-- | include/linux/binfmts.h | 14 |
4 files changed, 23 insertions, 6 deletions
diff --git a/arch/alpha/kernel/Makefile b/arch/alpha/kernel/Makefile index a427538252f8..7739a62440a7 100644 --- a/arch/alpha/kernel/Makefile +++ b/arch/alpha/kernel/Makefile | |||
@@ -8,7 +8,7 @@ EXTRA_CFLAGS := -Werror -Wno-sign-compare | |||
8 | 8 | ||
9 | obj-y := entry.o traps.o process.o init_task.o osf_sys.o irq.o \ | 9 | obj-y := entry.o traps.o process.o init_task.o osf_sys.o irq.o \ |
10 | irq_alpha.o signal.o setup.o ptrace.o time.o \ | 10 | irq_alpha.o signal.o setup.o ptrace.o time.o \ |
11 | alpha_ksyms.o systbls.o err_common.o io.o binfmt_loader.o | 11 | alpha_ksyms.o systbls.o err_common.o io.o |
12 | 12 | ||
13 | obj-$(CONFIG_VGA_HOSE) += console.o | 13 | obj-$(CONFIG_VGA_HOSE) += console.o |
14 | obj-$(CONFIG_SMP) += smp.o | 14 | obj-$(CONFIG_SMP) += smp.o |
@@ -43,6 +43,10 @@ else | |||
43 | # Misc support | 43 | # Misc support |
44 | obj-$(CONFIG_ALPHA_SRM) += srmcons.o | 44 | obj-$(CONFIG_ALPHA_SRM) += srmcons.o |
45 | 45 | ||
46 | ifdef CONFIG_BINFMT_AOUT | ||
47 | obj-y += binfmt_loader.o | ||
48 | endif | ||
49 | |||
46 | # Core logic support | 50 | # Core logic support |
47 | obj-$(CONFIG_ALPHA_APECS) += core_apecs.o | 51 | obj-$(CONFIG_ALPHA_APECS) += core_apecs.o |
48 | obj-$(CONFIG_ALPHA_CIA) += core_cia.o | 52 | obj-$(CONFIG_ALPHA_CIA) += core_cia.o |
diff --git a/arch/alpha/kernel/binfmt_loader.c b/arch/alpha/kernel/binfmt_loader.c index 4a0af906b00a..3fcfad410130 100644 --- a/arch/alpha/kernel/binfmt_loader.c +++ b/arch/alpha/kernel/binfmt_loader.c | |||
@@ -46,6 +46,6 @@ static struct linux_binfmt loader_format = { | |||
46 | 46 | ||
47 | static int __init init_loader_binfmt(void) | 47 | static int __init init_loader_binfmt(void) |
48 | { | 48 | { |
49 | return register_binfmt(&loader_format); | 49 | return insert_binfmt(&loader_format); |
50 | } | 50 | } |
51 | arch_initcall(init_loader_binfmt); | 51 | arch_initcall(init_loader_binfmt); |
@@ -69,17 +69,18 @@ int suid_dumpable = 0; | |||
69 | static LIST_HEAD(formats); | 69 | static LIST_HEAD(formats); |
70 | static DEFINE_RWLOCK(binfmt_lock); | 70 | static DEFINE_RWLOCK(binfmt_lock); |
71 | 71 | ||
72 | int register_binfmt(struct linux_binfmt * fmt) | 72 | int __register_binfmt(struct linux_binfmt * fmt, int insert) |
73 | { | 73 | { |
74 | if (!fmt) | 74 | if (!fmt) |
75 | return -EINVAL; | 75 | return -EINVAL; |
76 | write_lock(&binfmt_lock); | 76 | write_lock(&binfmt_lock); |
77 | list_add(&fmt->lh, &formats); | 77 | insert ? list_add(&fmt->lh, &formats) : |
78 | list_add_tail(&fmt->lh, &formats); | ||
78 | write_unlock(&binfmt_lock); | 79 | write_unlock(&binfmt_lock); |
79 | return 0; | 80 | return 0; |
80 | } | 81 | } |
81 | 82 | ||
82 | EXPORT_SYMBOL(register_binfmt); | 83 | EXPORT_SYMBOL(__register_binfmt); |
83 | 84 | ||
84 | void unregister_binfmt(struct linux_binfmt * fmt) | 85 | void unregister_binfmt(struct linux_binfmt * fmt) |
85 | { | 86 | { |
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index 6638b8148de7..61ee18c1bdb4 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h | |||
@@ -82,7 +82,19 @@ struct linux_binfmt { | |||
82 | int hasvdso; | 82 | int hasvdso; |
83 | }; | 83 | }; |
84 | 84 | ||
85 | extern int register_binfmt(struct linux_binfmt *); | 85 | extern int __register_binfmt(struct linux_binfmt *fmt, int insert); |
86 | |||
87 | /* Registration of default binfmt handlers */ | ||
88 | static inline int register_binfmt(struct linux_binfmt *fmt) | ||
89 | { | ||
90 | return __register_binfmt(fmt, 0); | ||
91 | } | ||
92 | /* Same as above, but adds a new binfmt at the top of the list */ | ||
93 | static inline int insert_binfmt(struct linux_binfmt *fmt) | ||
94 | { | ||
95 | return __register_binfmt(fmt, 1); | ||
96 | } | ||
97 | |||
86 | extern void unregister_binfmt(struct linux_binfmt *); | 98 | extern void unregister_binfmt(struct linux_binfmt *); |
87 | 99 | ||
88 | extern int prepare_binprm(struct linux_binprm *); | 100 | extern int prepare_binprm(struct linux_binprm *); |