1#ifndef _LINUX_BINFMTS_H
2#define _LINUX_BINFMTS_H
3
4#include <linux/capability.h>
5
6struct pt_regs;
7
8
9
10
11
12
13#define MAX_ARG_PAGES 32
14
15
16#define BINPRM_BUF_SIZE 128
17
18#ifdef __KERNEL__
19
20
21
22
23struct linux_binprm{
24 char buf[BINPRM_BUF_SIZE];
25 struct page *page[MAX_ARG_PAGES];
26 struct mm_struct *mm;
27 unsigned long p;
28 int sh_bang;
29 struct file * file;
30 int e_uid, e_gid;
31 kernel_cap_t cap_inheritable, cap_permitted, cap_effective;
32 void *security;
33 int argc, envc;
34 char * filename;
35 char * interp;
36
37
38 unsigned interp_flags;
39 unsigned interp_data;
40 unsigned long loader, exec;
41};
42
43#define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0
44#define BINPRM_FLAGS_ENFORCE_NONDUMP (1 << BINPRM_FLAGS_ENFORCE_NONDUMP_BIT)
45
46
47#define BINPRM_FLAGS_EXECFD_BIT 1
48#define BINPRM_FLAGS_EXECFD (1 << BINPRM_FLAGS_EXECFD_BIT)
49
50
51
52
53
54
55struct linux_binfmt {
56 struct linux_binfmt * next;
57 struct module *module;
58 int (*load_binary)(struct linux_binprm *, struct pt_regs * regs);
59 int (*load_shlib)(struct file *);
60 int (*core_dump)(long signr, struct pt_regs * regs, struct file * file);
61 unsigned long min_coredump;
62};
63
64extern int register_binfmt(struct linux_binfmt *);
65extern int unregister_binfmt(struct linux_binfmt *);
66
67extern int prepare_binprm(struct linux_binprm *);
68extern void remove_arg_zero(struct linux_binprm *);
69extern int search_binary_handler(struct linux_binprm *,struct pt_regs *);
70extern int flush_old_exec(struct linux_binprm * bprm);
71
72extern int suid_dumpable;
73#define SUID_DUMP_DISABLE 0
74#define SUID_DUMP_USER 1
75#define SUID_DUMP_ROOT 2
76
77
78#define EXSTACK_DEFAULT 0
79#define EXSTACK_DISABLE_X 1
80#define EXSTACK_ENABLE_X 2
81
82extern int setup_arg_pages(struct linux_binprm * bprm,
83 unsigned long stack_top,
84 int executable_stack);
85extern int copy_strings_kernel(int argc,char ** argv,struct linux_binprm *bprm);
86extern void compute_creds(struct linux_binprm *binprm);
87extern int do_coredump(long signr, int exit_code, struct pt_regs * regs);
88extern int set_binfmt(struct linux_binfmt *new);
89
90#endif
91#endif
92