Print this page
OS-5192 need faster clock_gettime
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Joshua M. Clulow <jmc@joyent.com>
Reviewed by: Ryan Zezeski <ryan@zinascii.com>
OS-5072 lxbrand support PT_GNU_STACK
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
OS-4119 lxbrand panic when running native perl inside lx zone
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
OS-3611 lx brand: 64-bit processes should not use VAs above VA hole
OS-3517 lx brand: branded zones don't interpret .interp section
OS-3280 need a way to specify the root of a native system in the lx brand
OS-3279 lx brand should allow delegated datasets
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
OS-2877 lx_librtld_db falls to load due to NULL DT_DEBUG
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/common/sys/exec.h
+++ new/usr/src/uts/common/sys/exec.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
|
↓ open down ↓ |
18 lines elided |
↑ open up ↑ |
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
24 24 */
25 25
26 26 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
27 27 /* All Rights Reserved */
28 28
29 +/*
30 + * Copyright 2016, Joyent, Inc.
31 + */
32 +
29 33 #ifndef _SYS_EXEC_H
30 34 #define _SYS_EXEC_H
31 35
32 36 #include <sys/systm.h>
33 37 #include <vm/seg.h>
34 38 #include <vm/seg_vn.h>
35 39 #include <sys/model.h>
36 40 #include <sys/uio.h>
37 41 #include <sys/corectl.h>
38 42 #include <sys/machelf.h>
39 43
40 44 #ifdef __cplusplus
41 45 extern "C" {
42 46 #endif
43 47
44 48 /*
45 49 * Number of bytes to read for magic string
46 50 */
47 51 #define MAGIC_BYTES 8
48 52
49 53 #define getexmag(x) (((x)[0] << 8) + (x)[1])
50 54
51 55 typedef struct execa {
52 56 const char *fname;
53 57 const char **argp;
54 58 const char **envp;
55 59 } execa_t;
56 60
57 61 typedef struct execenv {
58 62 caddr_t ex_bssbase;
59 63 caddr_t ex_brkbase;
60 64 size_t ex_brksize;
61 65 vnode_t *ex_vp;
62 66 short ex_magic;
63 67 } execenv_t;
64 68
65 69 #ifdef _KERNEL
66 70
67 71 #define LOADABLE_EXEC(e) ((e)->exec_lock)
68 72 #define LOADED_EXEC(e) ((e)->exec_func)
69 73
70 74
71 75 /*
72 76 * User argument structure for passing exec information around between the
73 77 * common and machine-dependent portions of exec and the exec modules.
74 78 */
75 79 typedef struct uarg {
76 80 ssize_t na;
77 81 ssize_t ne;
78 82 ssize_t nc;
79 83 ssize_t arglen;
80 84 char *fname;
81 85 char *pathname;
82 86 ssize_t auxsize;
83 87 caddr_t stackend;
84 88 size_t stk_align;
85 89 size_t stk_size;
86 90 char *stk_base;
87 91 char *stk_strp;
88 92 int *stk_offp;
89 93 size_t usrstack_size;
90 94 uint_t stk_prot;
91 95 uint_t dat_prot;
92 96 int traceinval;
93 97 int addr32;
94 98 model_t to_model;
|
↓ open down ↓ |
56 lines elided |
↑ open up ↑ |
95 99 model_t from_model;
96 100 size_t to_ptrsize;
97 101 size_t from_ptrsize;
98 102 size_t ncargs;
99 103 struct execsw *execswp;
100 104 uintptr_t entry;
101 105 uintptr_t thrptr;
102 106 vnode_t *ex_vp;
103 107 char *emulator;
104 108 char *brandname;
109 + const char *brand_nroot;
105 110 char *auxp_auxflags; /* addr of auxflags auxv on the user stack */
106 111 char *auxp_brand; /* address of first brand auxv on user stack */
107 112 cred_t *pfcred;
108 113 boolean_t scrubenv;
114 + uintptr_t maxstack;
115 + boolean_t stk_prot_override;
116 + uintptr_t commpage;
109 117 } uarg_t;
110 118
111 119 /*
112 120 * Possible brand actions for exec.
113 121 */
114 122 #define EBA_NONE 0
115 123 #define EBA_NATIVE 1
116 124 #define EBA_BRAND 2
117 125
118 126 /*
119 127 * The following macro is a machine dependent encapsulation of
120 128 * postfix processing to hide the stack direction from elf.c
121 129 * thereby making the elf.c code machine independent.
122 130 */
123 131 #define execpoststack(ARGS, ARRAYADDR, BYTESIZE) \
124 132 (copyout((caddr_t)(ARRAYADDR), (ARGS)->stackend, (BYTESIZE)) ? EFAULT \
125 133 : (((ARGS)->stackend += (BYTESIZE)), 0))
126 134
127 135 /*
128 136 * This provides the current user stack address for an object of size BYTESIZE.
129 137 * Used to determine the stack address just before applying execpoststack().
130 138 */
131 139 #define stackaddress(ARGS, BYTESIZE) ((ARGS)->stackend)
132 140
133 141 /*
134 142 * Macro to add attribute/values the aux vector under construction.
135 143 */
136 144 /* BEGIN CSTYLED */
137 145 #if ((_LONG_ALIGNMENT == (2 * _INT_ALIGNMENT)) || \
138 146 (_POINTER_ALIGNMENT == (2 * _INT_ALIGNMENT)))
139 147 /* END CSTYLED */
140 148 /*
141 149 * This convoluted stuff is necessitated by the fact that there is
142 150 * potential padding in the aux vector, but not necessarily and
143 151 * without clearing the padding there is a small, but potential
144 152 * security hole.
145 153 */
146 154 #define ADDAUX(p, a, v) { \
147 155 (&(p)->a_type)[1] = 0; \
148 156 (p)->a_type = (a); \
149 157 (p)->a_un.a_val = (v); \
150 158 ++(p); \
151 159 }
152 160 #else
153 161 #define ADDAUX(p, a, v) { \
154 162 (p)->a_type = (a); \
155 163 ((p)++)->a_un.a_val = (v); \
156 164 }
157 165 #endif
158 166
159 167 #define INTPSZ MAXPATHLEN
160 168 #define INTP_MAXDEPTH 5 /* Nested interpreter depth matches Linux */
161 169 typedef struct intpdata {
162 170 char *intp;
163 171 char *intp_name[INTP_MAXDEPTH];
164 172 char *intp_arg[INTP_MAXDEPTH];
165 173 } intpdata_t;
166 174
167 175 #define EXECSETID_SETID 0x1 /* setid exec */
|
↓ open down ↓ |
49 lines elided |
↑ open up ↑ |
168 176 #define EXECSETID_UGIDS 0x2 /* [ug]ids mismatch */
169 177 #define EXECSETID_PRIVS 0x4 /* more privs than before */
170 178
171 179 struct execsw {
172 180 char *exec_magic;
173 181 int exec_magoff;
174 182 int exec_maglen;
175 183 int (*exec_func)(struct vnode *vp, struct execa *uap,
176 184 struct uarg *args, struct intpdata *idata, int level,
177 185 long *execsz, int setid, caddr_t exec_file,
178 - struct cred *cred, int brand_action);
186 + struct cred *cred, int *brand_action);
179 187 int (*exec_core)(struct vnode *vp, struct proc *p,
180 188 struct cred *cred, rlim64_t rlimit, int sig,
181 189 core_content_t content);
182 190 krwlock_t *exec_lock;
183 191 };
184 192
185 193 extern int nexectype; /* number of elements in execsw */
186 194 extern struct execsw execsw[];
187 195 extern kmutex_t execsw_lock;
188 196
189 197 extern short elfmagic;
190 198 extern short intpmagic;
191 199 extern short javamagic;
192 200 #if defined(__sparc)
193 201 extern short aout_zmagic;
194 202 extern short aout_nmagic;
195 203 extern short aout_omagic;
196 204 #endif
197 205 extern short nomagic;
198 206
199 207 extern char elf32magicstr[];
200 208 extern char elf64magicstr[];
201 209 extern char intpmagicstr[];
202 210 extern char javamagicstr[];
203 211 #if defined(__sparc)
204 212 extern char aout_nmagicstr[];
205 213 extern char aout_zmagicstr[];
|
↓ open down ↓ |
17 lines elided |
↑ open up ↑ |
206 214 extern char aout_omagicstr[];
207 215 #endif
208 216 extern char nomagicstr[];
209 217
210 218 extern int exec_args(execa_t *, uarg_t *, intpdata_t *, void **);
211 219 extern int exece(const char *fname, const char **argp, const char **envp);
212 220 extern int exec_common(const char *fname, const char **argp,
213 221 const char **envp, int brand_action);
214 222 extern int gexec(vnode_t **vp, struct execa *uap, struct uarg *args,
215 223 struct intpdata *idata, int level, long *execsz, caddr_t exec_file,
216 - struct cred *cred, int brand_action);
224 + struct cred *cred, int *brand_action);
217 225 extern struct execsw *allocate_execsw(char *name, char *magic,
218 226 size_t magic_size);
219 227 extern struct execsw *findexecsw(char *magic);
220 228 extern struct execsw *findexec_by_hdr(char *header);
221 229 extern struct execsw *findexec_by_magic(char *magic);
222 230 extern int execpermissions(struct vnode *vp, struct vattr *vattrp,
223 231 struct uarg *args);
224 232 extern int execmap(vnode_t *vp, caddr_t addr, size_t len, size_t zfodlen,
225 233 off_t offset, int prot, int page, uint_t);
226 234 extern void setexecenv(struct execenv *ep);
227 235 extern int execopen(struct vnode **vpp, int *fdp);
228 236 extern int execclose(int fd);
229 237 extern void setregs(uarg_t *);
230 238 extern void exec_set_sp(size_t);
|
↓ open down ↓ |
4 lines elided |
↑ open up ↑ |
231 239
232 240 /*
233 241 * Utility functions for branded process executing
234 242 */
235 243 #if !defined(_ELF32_COMPAT)
236 244 /*
237 245 * When compiling 64-bit kernels we don't want these definitions included
238 246 * when compiling the 32-bit compatability elf code in the elfexec module.
239 247 */
240 248 extern int elfexec(vnode_t *, execa_t *, uarg_t *, intpdata_t *, int,
241 - long *, int, caddr_t, cred_t *, int);
249 + long *, int, caddr_t, cred_t *, int *);
242 250 extern int mapexec_brand(vnode_t *, uarg_t *, Ehdr *, Addr *,
243 - intptr_t *, caddr_t, int *, caddr_t *, caddr_t *, size_t *, uintptr_t *);
251 + intptr_t *, caddr_t, char **, caddr_t *, caddr_t *, size_t *,
252 + uintptr_t *, uintptr_t *);
253 +extern int elfreadhdr(vnode_t *, cred_t *, Ehdr *, int *, caddr_t *,
254 + ssize_t *);
244 255 #endif /* !_ELF32_COMPAT */
245 256
246 257 #if defined(_LP64)
247 258 extern int elf32exec(vnode_t *, execa_t *, uarg_t *, intpdata_t *, int,
248 - long *, int, caddr_t, cred_t *, int);
259 + long *, int, caddr_t, cred_t *, int *);
249 260 extern int mapexec32_brand(vnode_t *, uarg_t *, Elf32_Ehdr *, Elf32_Addr *,
250 - intptr_t *, caddr_t, int *, caddr_t *, caddr_t *, size_t *, uintptr_t *);
261 + intptr_t *, caddr_t, char **, caddr_t *, caddr_t *, size_t *,
262 + uintptr_t *, uintptr_t *);
263 +extern int elf32readhdr(vnode_t *, cred_t *, Elf32_Ehdr *, int *, caddr_t *,
264 + ssize_t *);
251 265 #endif /* _LP64 */
252 266
253 267 /*
254 268 * Utility functions for exec module core routines:
255 269 */
256 270 extern int core_seg(proc_t *, vnode_t *, offset_t, caddr_t,
257 271 size_t, rlim64_t, cred_t *);
258 272
259 273 extern int core_write(vnode_t *, enum uio_seg, offset_t,
260 274 const void *, size_t, rlim64_t, cred_t *);
261 275
262 276 /* a.out stuff */
263 277
264 278 struct exec;
265 279
266 280 extern caddr_t gettmem(struct exec *exp);
267 281 extern caddr_t getdmem(struct exec *exp);
268 282 extern ulong_t getdfile(struct exec *exp);
269 283 extern uint_t gettfile(struct exec *exp);
270 284 extern int chkaout(struct exdata *exp);
271 285 extern void getexinfo(struct exdata *edp_in, struct exdata *edp_out,
272 286 int *pagetext, int *pagedata);
273 287
274 288 #endif /* _KERNEL */
275 289
276 290 #ifdef __cplusplus
277 291 }
278 292 #endif
279 293
280 294 #endif /* _SYS_EXEC_H */
|
↓ open down ↓ |
20 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX