aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/binfmts.h
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /include/linux/binfmts.h
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'include/linux/binfmts.h')
-rw-r--r--include/linux/binfmts.h44
1 files changed, 30 insertions, 14 deletions
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index 0530b986035..fd88a3945aa 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -1,10 +1,24 @@
1#ifndef _LINUX_BINFMTS_H 1#ifndef _LINUX_BINFMTS_H
2#define _LINUX_BINFMTS_H 2#define _LINUX_BINFMTS_H
3 3
4#include <linux/sched.h> 4#include <linux/capability.h>
5#include <linux/unistd.h> 5
6#include <asm/exec.h> 6struct pt_regs;
7#include <uapi/linux/binfmts.h> 7
8/*
9 * These are the maximum length and maximum number of strings passed to the
10 * execve() system call. MAX_ARG_STRLEN is essentially random but serves to
11 * prevent the kernel from being unduly impacted by misaddressed pointers.
12 * MAX_ARG_STRINGS is chosen to fit in a signed 32-bit integer.
13 */
14#define MAX_ARG_STRLEN (PAGE_SIZE * 32)
15#define MAX_ARG_STRINGS 0x7FFFFFFF
16
17/* sizeof(linux_binprm->buf) */
18#define BINPRM_BUF_SIZE 128
19
20#ifdef __KERNEL__
21#include <linux/list.h>
8 22
9#define CORENAME_MAX_SIZE 128 23#define CORENAME_MAX_SIZE 128
10 24
@@ -44,7 +58,6 @@ struct linux_binprm {
44 unsigned interp_flags; 58 unsigned interp_flags;
45 unsigned interp_data; 59 unsigned interp_data;
46 unsigned long loader, exec; 60 unsigned long loader, exec;
47 char tcomm[TASK_COMM_LEN];
48}; 61};
49 62
50#define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0 63#define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0
@@ -54,9 +67,11 @@ struct linux_binprm {
54#define BINPRM_FLAGS_EXECFD_BIT 1 67#define BINPRM_FLAGS_EXECFD_BIT 1
55#define BINPRM_FLAGS_EXECFD (1 << BINPRM_FLAGS_EXECFD_BIT) 68#define BINPRM_FLAGS_EXECFD (1 << BINPRM_FLAGS_EXECFD_BIT)
56 69
70#define BINPRM_MAX_RECURSION 4
71
57/* Function parameter for binfmt->coredump */ 72/* Function parameter for binfmt->coredump */
58struct coredump_params { 73struct coredump_params {
59 siginfo_t *siginfo; 74 long signr;
60 struct pt_regs *regs; 75 struct pt_regs *regs;
61 struct file *file; 76 struct file *file;
62 unsigned long limit; 77 unsigned long limit;
@@ -70,30 +85,30 @@ struct coredump_params {
70struct linux_binfmt { 85struct linux_binfmt {
71 struct list_head lh; 86 struct list_head lh;
72 struct module *module; 87 struct module *module;
73 int (*load_binary)(struct linux_binprm *); 88 int (*load_binary)(struct linux_binprm *, struct pt_regs * regs);
74 int (*load_shlib)(struct file *); 89 int (*load_shlib)(struct file *);
75 int (*core_dump)(struct coredump_params *cprm); 90 int (*core_dump)(struct coredump_params *cprm);
76 unsigned long min_coredump; /* minimal dump size */ 91 unsigned long min_coredump; /* minimal dump size */
77}; 92};
78 93
79extern void __register_binfmt(struct linux_binfmt *fmt, int insert); 94extern int __register_binfmt(struct linux_binfmt *fmt, int insert);
80 95
81/* Registration of default binfmt handlers */ 96/* Registration of default binfmt handlers */
82static inline void register_binfmt(struct linux_binfmt *fmt) 97static inline int register_binfmt(struct linux_binfmt *fmt)
83{ 98{
84 __register_binfmt(fmt, 0); 99 return __register_binfmt(fmt, 0);
85} 100}
86/* Same as above, but adds a new binfmt at the top of the list */ 101/* Same as above, but adds a new binfmt at the top of the list */
87static inline void insert_binfmt(struct linux_binfmt *fmt) 102static inline int insert_binfmt(struct linux_binfmt *fmt)
88{ 103{
89 __register_binfmt(fmt, 1); 104 return __register_binfmt(fmt, 1);
90} 105}
91 106
92extern void unregister_binfmt(struct linux_binfmt *); 107extern void unregister_binfmt(struct linux_binfmt *);
93 108
94extern int prepare_binprm(struct linux_binprm *); 109extern int prepare_binprm(struct linux_binprm *);
95extern int __must_check remove_arg_zero(struct linux_binprm *); 110extern int __must_check remove_arg_zero(struct linux_binprm *);
96extern int search_binary_handler(struct linux_binprm *); 111extern int search_binary_handler(struct linux_binprm *, struct pt_regs *);
97extern int flush_old_exec(struct linux_binprm * bprm); 112extern int flush_old_exec(struct linux_binprm * bprm);
98extern void setup_new_exec(struct linux_binprm * bprm); 113extern void setup_new_exec(struct linux_binprm * bprm);
99extern void would_dump(struct linux_binprm *, struct file *); 114extern void would_dump(struct linux_binprm *, struct file *);
@@ -112,12 +127,13 @@ extern int setup_arg_pages(struct linux_binprm * bprm,
112 unsigned long stack_top, 127 unsigned long stack_top,
113 int executable_stack); 128 int executable_stack);
114extern int bprm_mm_init(struct linux_binprm *bprm); 129extern int bprm_mm_init(struct linux_binprm *bprm);
115extern int bprm_change_interp(char *interp, struct linux_binprm *bprm);
116extern int copy_strings_kernel(int argc, const char *const *argv, 130extern int copy_strings_kernel(int argc, const char *const *argv,
117 struct linux_binprm *bprm); 131 struct linux_binprm *bprm);
118extern int prepare_bprm_creds(struct linux_binprm *bprm); 132extern int prepare_bprm_creds(struct linux_binprm *bprm);
119extern void install_exec_creds(struct linux_binprm *bprm); 133extern void install_exec_creds(struct linux_binprm *bprm);
134extern void do_coredump(long signr, int exit_code, struct pt_regs *regs);
120extern void set_binfmt(struct linux_binfmt *new); 135extern void set_binfmt(struct linux_binfmt *new);
121extern void free_bprm(struct linux_binprm *); 136extern void free_bprm(struct linux_binprm *);
122 137
138#endif /* __KERNEL__ */
123#endif /* _LINUX_BINFMTS_H */ 139#endif /* _LINUX_BINFMTS_H */