summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorIvan Kokshaysky <ink@jurassic.park.msu.ru>2009-04-30 15:08:49 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2009-05-02 15:36:10 -0700
commit74641f584da8eccf30becfbb5507ab457187db22 (patch)
treeda212b7ae1b5a2a50a4314b3a75df5763623295e /include/linux
parent77b4cf5cb0c9d6010a18030a0e0a8d2aaf6b43ec (diff)
downloadlinux-3.10-74641f584da8eccf30becfbb5507ab457187db22.tar.gz
linux-3.10-74641f584da8eccf30becfbb5507ab457187db22.tar.bz2
linux-3.10-74641f584da8eccf30becfbb5507ab457187db22.zip
alpha: binfmt_aout fix
This fixes the problem introduced by commit 3bfacef412 (get rid of special-casing the /sbin/loader on alpha): osf/1 ecoff binary segfaults when binfmt_aout built as module. That happens because aout binary handler gets on the top of the binfmt list due to late registration, and kernel attempts to execute the binary without preparatory work that must be done by binfmt_loader. Fixed by changing the registration order of the default binfmt handlers using list_add_tail() and introducing insert_binfmt() function which places new handler on the top of the binfmt list. This might be generally useful for installing arch-specific frontends for default handlers or just for overriding them. Signed-off-by: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Cc: Al Viro <viro@ZenIV.linux.org.uk> Cc: Richard Henderson <rth@twiddle.net Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/binfmts.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index 6638b8148de..61ee18c1bdb 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -82,7 +82,19 @@ struct linux_binfmt {
int hasvdso;
};
-extern int register_binfmt(struct linux_binfmt *);
+extern int __register_binfmt(struct linux_binfmt *fmt, int insert);
+
+/* Registration of default binfmt handlers */
+static inline int register_binfmt(struct linux_binfmt *fmt)
+{
+ return __register_binfmt(fmt, 0);
+}
+/* Same as above, but adds a new binfmt at the top of the list */
+static inline int insert_binfmt(struct linux_binfmt *fmt)
+{
+ return __register_binfmt(fmt, 1);
+}
+
extern void unregister_binfmt(struct linux_binfmt *);
extern int prepare_binprm(struct linux_binprm *);