diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /include/linux/binfmts.h | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'include/linux/binfmts.h')
-rw-r--r-- | include/linux/binfmts.h | 44 |
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> | 6 | struct 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 */ |
58 | struct coredump_params { | 73 | struct 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 { | |||
70 | struct linux_binfmt { | 85 | struct 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 | ||
79 | extern void __register_binfmt(struct linux_binfmt *fmt, int insert); | 94 | extern int __register_binfmt(struct linux_binfmt *fmt, int insert); |
80 | 95 | ||
81 | /* Registration of default binfmt handlers */ | 96 | /* Registration of default binfmt handlers */ |
82 | static inline void register_binfmt(struct linux_binfmt *fmt) | 97 | static 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 */ |
87 | static inline void insert_binfmt(struct linux_binfmt *fmt) | 102 | static 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 | ||
92 | extern void unregister_binfmt(struct linux_binfmt *); | 107 | extern void unregister_binfmt(struct linux_binfmt *); |
93 | 108 | ||
94 | extern int prepare_binprm(struct linux_binprm *); | 109 | extern int prepare_binprm(struct linux_binprm *); |
95 | extern int __must_check remove_arg_zero(struct linux_binprm *); | 110 | extern int __must_check remove_arg_zero(struct linux_binprm *); |
96 | extern int search_binary_handler(struct linux_binprm *); | 111 | extern int search_binary_handler(struct linux_binprm *, struct pt_regs *); |
97 | extern int flush_old_exec(struct linux_binprm * bprm); | 112 | extern int flush_old_exec(struct linux_binprm * bprm); |
98 | extern void setup_new_exec(struct linux_binprm * bprm); | 113 | extern void setup_new_exec(struct linux_binprm * bprm); |
99 | extern void would_dump(struct linux_binprm *, struct file *); | 114 | extern 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); |
114 | extern int bprm_mm_init(struct linux_binprm *bprm); | 129 | extern int bprm_mm_init(struct linux_binprm *bprm); |
115 | extern int bprm_change_interp(char *interp, struct linux_binprm *bprm); | ||
116 | extern int copy_strings_kernel(int argc, const char *const *argv, | 130 | extern int copy_strings_kernel(int argc, const char *const *argv, |
117 | struct linux_binprm *bprm); | 131 | struct linux_binprm *bprm); |
118 | extern int prepare_bprm_creds(struct linux_binprm *bprm); | 132 | extern int prepare_bprm_creds(struct linux_binprm *bprm); |
119 | extern void install_exec_creds(struct linux_binprm *bprm); | 133 | extern void install_exec_creds(struct linux_binprm *bprm); |
134 | extern void do_coredump(long signr, int exit_code, struct pt_regs *regs); | ||
120 | extern void set_binfmt(struct linux_binfmt *new); | 135 | extern void set_binfmt(struct linux_binfmt *new); |
121 | extern void free_bprm(struct linux_binprm *); | 136 | extern void free_bprm(struct linux_binprm *); |
122 | 137 | ||
138 | #endif /* __KERNEL__ */ | ||
123 | #endif /* _LINUX_BINFMTS_H */ | 139 | #endif /* _LINUX_BINFMTS_H */ |