1 #ifndef _LINUX_BINFMTS_H
2 #define _LINUX_BINFMTS_H
4 #include <linux/capability.h>
9 * MAX_ARG_PAGES defines the number of pages allocated for arguments
10 * and envelope for the new program. 32 should suffice, this gives
11 * a maximum env+arg of 128kB w/4KB pages!
13 #define MAX_ARG_PAGES 32
15 /* sizeof(linux_binprm->buf) */
16 #define BINPRM_BUF_SIZE 128
21 * This structure is used to hold the arguments that are used when loading binaries.
24 char buf
[BINPRM_BUF_SIZE
];
25 struct page
*page
[MAX_ARG_PAGES
];
27 unsigned long p
; /* current top of mem */
31 kernel_cap_t cap_inheritable
, cap_permitted
, cap_effective
;
34 char * filename
; /* Name of binary as seen by procps */
35 char * interp
; /* Name of the binary really executed. Most
36 of the time same as filename, but could be
37 different for binfmt_{misc,script} */
38 unsigned interp_flags
;
40 unsigned long loader
, exec
;
43 #define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0
44 #define BINPRM_FLAGS_ENFORCE_NONDUMP (1 << BINPRM_FLAGS_ENFORCE_NONDUMP_BIT)
46 /* fd of the binary should be passed to the interpreter */
47 #define BINPRM_FLAGS_EXECFD_BIT 1
48 #define BINPRM_FLAGS_EXECFD (1 << BINPRM_FLAGS_EXECFD_BIT)
52 * This structure defines the functions that are used to load the binary formats that
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
; /* minimal dump size */
64 extern int register_binfmt(struct linux_binfmt
*);
65 extern int unregister_binfmt(struct linux_binfmt
*);
67 extern int prepare_binprm(struct linux_binprm
*);
68 extern void remove_arg_zero(struct linux_binprm
*);
69 extern int search_binary_handler(struct linux_binprm
*,struct pt_regs
*);
70 extern int flush_old_exec(struct linux_binprm
* bprm
);
72 /* Stack area protections */
73 #define EXSTACK_DEFAULT 0 /* Whatever the arch defaults to */
74 #define EXSTACK_DISABLE_X 1 /* Disable executable stacks */
75 #define EXSTACK_ENABLE_X 2 /* Enable executable stacks */
77 extern int setup_arg_pages(struct linux_binprm
* bprm
,
78 unsigned long stack_top
,
79 int executable_stack
);
80 extern int copy_strings_kernel(int argc
,char ** argv
,struct linux_binprm
*bprm
);
81 extern void compute_creds(struct linux_binprm
*binprm
);
82 extern int do_coredump(long signr
, int exit_code
, struct pt_regs
* regs
);
83 extern int set_binfmt(struct linux_binfmt
*new);
85 #endif /* __KERNEL__ */
86 #endif /* _LINUX_BINFMTS_H */