x86/speculation/mds: Fix documentation typo
[linux/fpc-iii.git] / arch / alpha / kernel / binfmt_loader.c
bloba8d0d6e06526037b60a45a49b0a99b55c0cfa5c1
1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/init.h>
3 #include <linux/fs.h>
4 #include <linux/file.h>
5 #include <linux/mm_types.h>
6 #include <linux/binfmts.h>
7 #include <linux/a.out.h>
9 static int load_binary(struct linux_binprm *bprm)
11 struct exec *eh = (struct exec *)bprm->buf;
12 unsigned long loader;
13 struct file *file;
14 int retval;
16 if (eh->fh.f_magic != 0x183 || (eh->fh.f_flags & 0x3000) != 0x3000)
17 return -ENOEXEC;
19 if (bprm->loader)
20 return -ENOEXEC;
22 allow_write_access(bprm->file);
23 fput(bprm->file);
24 bprm->file = NULL;
26 loader = bprm->vma->vm_end - sizeof(void *);
28 file = open_exec("/sbin/loader");
29 retval = PTR_ERR(file);
30 if (IS_ERR(file))
31 return retval;
33 /* Remember if the application is TASO. */
34 bprm->taso = eh->ah.entry < 0x100000000UL;
36 bprm->file = file;
37 bprm->loader = loader;
38 retval = prepare_binprm(bprm);
39 if (retval < 0)
40 return retval;
41 return search_binary_handler(bprm);
44 static struct linux_binfmt loader_format = {
45 .load_binary = load_binary,
48 static int __init init_loader_binfmt(void)
50 insert_binfmt(&loader_format);
51 return 0;
53 arch_initcall(init_loader_binfmt);