1 #include <linux/init.h>
3 #include <linux/file.h>
4 #include <linux/mm_types.h>
5 #include <linux/binfmts.h>
6 #include <linux/a.out.h>
8 static int load_binary(struct linux_binprm
*bprm
)
10 struct exec
*eh
= (struct exec
*)bprm
->buf
;
15 if (eh
->fh
.f_magic
!= 0x183 || (eh
->fh
.f_flags
& 0x3000) != 0x3000)
21 allow_write_access(bprm
->file
);
25 loader
= bprm
->vma
->vm_end
- sizeof(void *);
27 file
= open_exec("/sbin/loader");
28 retval
= PTR_ERR(file
);
32 /* Remember if the application is TASO. */
33 bprm
->taso
= eh
->ah
.entry
< 0x100000000UL
;
36 bprm
->loader
= loader
;
37 retval
= prepare_binprm(bprm
);
40 return search_binary_handler(bprm
);
43 static struct linux_binfmt loader_format
= {
44 .load_binary
= load_binary
,
47 static int __init
init_loader_binfmt(void)
49 insert_binfmt(&loader_format
);
52 arch_initcall(init_loader_binfmt
);