Blame view
include/linux/binfmts.h
3.96 KB
1da177e4c Linux-2.6.12-rc2 |
1 2 |
#ifndef _LINUX_BINFMTS_H #define _LINUX_BINFMTS_H |
96e02d158 exec: fix use-aft... |
3 |
#include <linux/sched.h> |
282124d18 generic kernel_ex... |
4 |
#include <linux/unistd.h> |
826eba4db the only place th... |
5 |
#include <asm/exec.h> |
607ca46e9 UAPI: (Scripted) ... |
6 |
#include <uapi/linux/binfmts.h> |
1da177e4c Linux-2.6.12-rc2 |
7 |
|
71ce92f3f make sysctl/kerne... |
8 |
#define CORENAME_MAX_SIZE 128 |
1da177e4c Linux-2.6.12-rc2 |
9 10 11 |
/* * This structure is used to hold the arguments that are used when loading binaries. */ |
f670d0ecd binfmt_elf: cleanups |
12 |
struct linux_binprm { |
1da177e4c Linux-2.6.12-rc2 |
13 |
char buf[BINPRM_BUF_SIZE]; |
b6a2fea39 mm: variable leng... |
14 15 |
#ifdef CONFIG_MMU struct vm_area_struct *vma; |
3c77f8457 exec: make argv/e... |
16 |
unsigned long vma_pages; |
b6a2fea39 mm: variable leng... |
17 18 |
#else # define MAX_ARG_PAGES 32 |
1da177e4c Linux-2.6.12-rc2 |
19 |
struct page *page[MAX_ARG_PAGES]; |
b6a2fea39 mm: variable leng... |
20 |
#endif |
1da177e4c Linux-2.6.12-rc2 |
21 22 |
struct mm_struct *mm; unsigned long p; /* current top of mem */ |
a50b0aa4b struct linux_binp... |
23 |
unsigned int |
a6f76f23d CRED: Make execve... |
24 25 26 27 28 |
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 ... |
29 30 31 |
#ifdef __alpha__ unsigned int taso:1; #endif |
131b2f9f1 exec: kill "int d... |
32 |
unsigned int recursion_depth; /* only for search_binary_handler() */ |
1da177e4c Linux-2.6.12-rc2 |
33 |
struct file * file; |
a6f76f23d CRED: Make execve... |
34 35 36 |
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 |
37 |
int argc, envc; |
d7627467b Make do_execve() ... |
38 39 |
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 |
40 41 42 43 44 45 46 47 48 49 50 51 52 |
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) |
51f39a1f0 syscalls: impleme... |
53 54 55 |
/* filename of the binary will be inaccessible after exec */ #define BINPRM_FLAGS_PATH_INACCESSIBLE_BIT 2 #define BINPRM_FLAGS_PATH_INACCESSIBLE (1 << BINPRM_FLAGS_PATH_INACCESSIBLE_BIT) |
f6151dfea mm: introduce cor... |
56 57 |
/* Function parameter for binfmt->coredump */ struct coredump_params { |
ec57941e0 constify do_cored... |
58 |
const siginfo_t *siginfo; |
f6151dfea mm: introduce cor... |
59 60 61 |
struct pt_regs *regs; struct file *file; unsigned long limit; |
30736a4d4 coredump: pass mm... |
62 |
unsigned long mm_flags; |
ecc8c7725 new helper: dump_... |
63 |
loff_t written; |
f6151dfea mm: introduce cor... |
64 |
}; |
1da177e4c Linux-2.6.12-rc2 |
65 66 67 68 69 |
/* * This structure defines the functions that are used to load the binary formats that * linux accepts. */ struct linux_binfmt { |
e4dc1b14d Use list_head in ... |
70 |
struct list_head lh; |
1da177e4c Linux-2.6.12-rc2 |
71 |
struct module *module; |
71613c3b8 get rid of pt_reg... |
72 |
int (*load_binary)(struct linux_binprm *); |
1da177e4c Linux-2.6.12-rc2 |
73 |
int (*load_shlib)(struct file *); |
f6151dfea mm: introduce cor... |
74 |
int (*core_dump)(struct coredump_params *cprm); |
1da177e4c Linux-2.6.12-rc2 |
75 76 |
unsigned long min_coredump; /* minimal dump size */ }; |
8fc3dc5a3 __register_binfmt... |
77 |
extern void __register_binfmt(struct linux_binfmt *fmt, int insert); |
74641f584 alpha: binfmt_aou... |
78 79 |
/* Registration of default binfmt handlers */ |
8fc3dc5a3 __register_binfmt... |
80 |
static inline void register_binfmt(struct linux_binfmt *fmt) |
74641f584 alpha: binfmt_aou... |
81 |
{ |
8fc3dc5a3 __register_binfmt... |
82 |
__register_binfmt(fmt, 0); |
74641f584 alpha: binfmt_aou... |
83 84 |
} /* Same as above, but adds a new binfmt at the top of the list */ |
8fc3dc5a3 __register_binfmt... |
85 |
static inline void insert_binfmt(struct linux_binfmt *fmt) |
74641f584 alpha: binfmt_aou... |
86 |
{ |
8fc3dc5a3 __register_binfmt... |
87 |
__register_binfmt(fmt, 1); |
74641f584 alpha: binfmt_aou... |
88 |
} |
f6b450d48 Make unregister_b... |
89 |
extern void unregister_binfmt(struct linux_binfmt *); |
1da177e4c Linux-2.6.12-rc2 |
90 91 |
extern int prepare_binprm(struct linux_binprm *); |
b6a2fea39 mm: variable leng... |
92 |
extern int __must_check remove_arg_zero(struct linux_binprm *); |
3c456bfc4 get rid of pt_reg... |
93 |
extern int search_binary_handler(struct linux_binprm *); |
1da177e4c Linux-2.6.12-rc2 |
94 |
extern int flush_old_exec(struct linux_binprm * bprm); |
221af7f87 Split 'flush_old_... |
95 |
extern void setup_new_exec(struct linux_binprm * bprm); |
1b5d783c9 consolidate BINPR... |
96 |
extern void would_dump(struct linux_binprm *, struct file *); |
1da177e4c Linux-2.6.12-rc2 |
97 |
|
d6e711448 [PATCH] setuid co... |
98 |
extern int suid_dumpable; |
d6e711448 [PATCH] setuid co... |
99 |
|
1da177e4c Linux-2.6.12-rc2 |
100 101 102 103 104 105 106 107 |
/* 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); |
b66c59840 exec: do not leav... |
108 |
extern int bprm_change_interp(char *interp, struct linux_binprm *bprm); |
d7627467b Make do_execve() ... |
109 110 |
extern int copy_strings_kernel(int argc, const char *const *argv, struct linux_binprm *bprm); |
a2a8474c3 exec: do not slee... |
111 |
extern int prepare_bprm_creds(struct linux_binprm *bprm); |
a6f76f23d CRED: Make execve... |
112 |
extern void install_exec_creds(struct linux_binprm *bprm); |
964ee7df9 exec: fix set_bin... |
113 |
extern void set_binfmt(struct linux_binfmt *new); |
3dc20cb28 new helper: read_... |
114 |
extern ssize_t read_code(struct file *, unsigned long, loff_t, size_t); |
1da177e4c Linux-2.6.12-rc2 |
115 |
|
1da177e4c Linux-2.6.12-rc2 |
116 |
#endif /* _LINUX_BINFMTS_H */ |