Blame view
include/linux/binfmts.h
4.4 KB
1da177e4c Linux-2.6.12-rc2 |
1 2 3 4 5 6 7 8 |
#ifndef _LINUX_BINFMTS_H #define _LINUX_BINFMTS_H #include <linux/capability.h> struct pt_regs; /* |
b6a2fea39 mm: variable leng... |
9 10 11 12 |
* These are the maximum length and maximum number of strings passed to the * execve() system call. MAX_ARG_STRLEN is essentially random but serves to * prevent the kernel from being unduly impacted by misaddressed pointers. * MAX_ARG_STRINGS is chosen to fit in a signed 32-bit integer. |
1da177e4c Linux-2.6.12-rc2 |
13 |
*/ |
b6a2fea39 mm: variable leng... |
14 15 |
#define MAX_ARG_STRLEN (PAGE_SIZE * 32) #define MAX_ARG_STRINGS 0x7FFFFFFF |
1da177e4c Linux-2.6.12-rc2 |
16 17 18 19 20 |
/* sizeof(linux_binprm->buf) */ #define BINPRM_BUF_SIZE 128 #ifdef __KERNEL__ |
5cf0cc4e6 binfmts.h: includ... |
21 |
#include <linux/list.h> |
1da177e4c Linux-2.6.12-rc2 |
22 |
|
71ce92f3f make sysctl/kerne... |
23 |
#define CORENAME_MAX_SIZE 128 |
1da177e4c Linux-2.6.12-rc2 |
24 25 26 |
/* * This structure is used to hold the arguments that are used when loading binaries. */ |
f670d0ecd binfmt_elf: cleanups |
27 |
struct linux_binprm { |
1da177e4c Linux-2.6.12-rc2 |
28 |
char buf[BINPRM_BUF_SIZE]; |
b6a2fea39 mm: variable leng... |
29 30 |
#ifdef CONFIG_MMU struct vm_area_struct *vma; |
3c77f8457 exec: make argv/e... |
31 |
unsigned long vma_pages; |
b6a2fea39 mm: variable leng... |
32 33 |
#else # define MAX_ARG_PAGES 32 |
1da177e4c Linux-2.6.12-rc2 |
34 |
struct page *page[MAX_ARG_PAGES]; |
b6a2fea39 mm: variable leng... |
35 |
#endif |
1da177e4c Linux-2.6.12-rc2 |
36 37 |
struct mm_struct *mm; unsigned long p; /* current top of mem */ |
a50b0aa4b struct linux_binp... |
38 |
unsigned int |
a6f76f23d CRED: Make execve... |
39 40 41 42 43 |
cred_prepared:1,/* true if creds already prepared (multiple * preps happen for interpreters) */ cap_effective:1;/* true if has elevated effective capabilities, * false if not; except for init which inherits * its parent's caps anyway */ |
53112488b alpha: introduce ... |
44 45 46 |
#ifdef __alpha__ unsigned int taso:1; #endif |
bf2a9a396 Allow recursion i... |
47 |
unsigned int recursion_depth; |
1da177e4c Linux-2.6.12-rc2 |
48 |
struct file * file; |
a6f76f23d CRED: Make execve... |
49 50 51 |
struct cred *cred; /* new credentials */ int unsafe; /* how unsafe this exec is (mask of LSM_UNSAFE_*) */ unsigned int per_clear; /* bits to clear in current->personality */ |
1da177e4c Linux-2.6.12-rc2 |
52 |
int argc, envc; |
d7627467b Make do_execve() ... |
53 54 |
const char * filename; /* Name of binary as seen by procps */ const char * interp; /* Name of the binary really executed. Most |
1da177e4c Linux-2.6.12-rc2 |
55 56 57 58 59 60 61 62 63 64 65 66 67 |
of the time same as filename, but could be different for binfmt_{misc,script} */ unsigned interp_flags; unsigned interp_data; unsigned long loader, exec; }; #define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0 #define BINPRM_FLAGS_ENFORCE_NONDUMP (1 << BINPRM_FLAGS_ENFORCE_NONDUMP_BIT) /* fd of the binary should be passed to the interpreter */ #define BINPRM_FLAGS_EXECFD_BIT 1 #define BINPRM_FLAGS_EXECFD (1 << BINPRM_FLAGS_EXECFD_BIT) |
bf2a9a396 Allow recursion i... |
68 |
#define BINPRM_MAX_RECURSION 4 |
1da177e4c Linux-2.6.12-rc2 |
69 |
|
f6151dfea mm: introduce cor... |
70 71 72 73 74 75 |
/* Function parameter for binfmt->coredump */ struct coredump_params { long signr; struct pt_regs *regs; struct file *file; unsigned long limit; |
30736a4d4 coredump: pass mm... |
76 |
unsigned long mm_flags; |
f6151dfea mm: introduce cor... |
77 |
}; |
1da177e4c Linux-2.6.12-rc2 |
78 79 80 81 82 |
/* * This structure defines the functions that are used to load the binary formats that * linux accepts. */ struct linux_binfmt { |
e4dc1b14d Use list_head in ... |
83 |
struct list_head lh; |
1da177e4c Linux-2.6.12-rc2 |
84 85 86 |
struct module *module; int (*load_binary)(struct linux_binprm *, struct pt_regs * regs); int (*load_shlib)(struct file *); |
f6151dfea mm: introduce cor... |
87 |
int (*core_dump)(struct coredump_params *cprm); |
1da177e4c Linux-2.6.12-rc2 |
88 89 |
unsigned long min_coredump; /* minimal dump size */ }; |
74641f584 alpha: binfmt_aou... |
90 91 92 93 94 95 96 97 98 99 100 101 |
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); } |
f6b450d48 Make unregister_b... |
102 |
extern void unregister_binfmt(struct linux_binfmt *); |
1da177e4c Linux-2.6.12-rc2 |
103 104 |
extern int prepare_binprm(struct linux_binprm *); |
b6a2fea39 mm: variable leng... |
105 |
extern int __must_check remove_arg_zero(struct linux_binprm *); |
f670d0ecd binfmt_elf: cleanups |
106 |
extern int search_binary_handler(struct linux_binprm *, struct pt_regs *); |
1da177e4c Linux-2.6.12-rc2 |
107 |
extern int flush_old_exec(struct linux_binprm * bprm); |
221af7f87 Split 'flush_old_... |
108 |
extern void setup_new_exec(struct linux_binprm * bprm); |
1b5d783c9 consolidate BINPR... |
109 |
extern void would_dump(struct linux_binprm *, struct file *); |
1da177e4c Linux-2.6.12-rc2 |
110 |
|
d6e711448 [PATCH] setuid co... |
111 112 113 114 |
extern int suid_dumpable; #define SUID_DUMP_DISABLE 0 /* No setuid dumping */ #define SUID_DUMP_USER 1 /* Dump as user of process */ #define SUID_DUMP_ROOT 2 /* Dump as root */ |
1da177e4c Linux-2.6.12-rc2 |
115 116 117 118 119 120 121 122 |
/* Stack area protections */ #define EXSTACK_DEFAULT 0 /* Whatever the arch defaults to */ #define EXSTACK_DISABLE_X 1 /* Disable executable stacks */ #define EXSTACK_ENABLE_X 2 /* Enable executable stacks */ extern int setup_arg_pages(struct linux_binprm * bprm, unsigned long stack_top, int executable_stack); |
b6a2fea39 mm: variable leng... |
123 |
extern int bprm_mm_init(struct linux_binprm *bprm); |
d7627467b Make do_execve() ... |
124 125 |
extern int copy_strings_kernel(int argc, const char *const *argv, struct linux_binprm *bprm); |
a2a8474c3 exec: do not slee... |
126 |
extern int prepare_bprm_creds(struct linux_binprm *bprm); |
a6f76f23d CRED: Make execve... |
127 |
extern void install_exec_creds(struct linux_binprm *bprm); |
8cd3ac3ac fs/exec.c: make d... |
128 |
extern void do_coredump(long signr, int exit_code, struct pt_regs *regs); |
964ee7df9 exec: fix set_bin... |
129 |
extern void set_binfmt(struct linux_binfmt *new); |
08a6fac1c [PATCH] get rid o... |
130 |
extern void free_bprm(struct linux_binprm *); |
1da177e4c Linux-2.6.12-rc2 |
131 132 133 |
#endif /* __KERNEL__ */ #endif /* _LINUX_BINFMTS_H */ |