Print this page
11909 THREAD_KPRI_RELEASE does nothing of the sort
Reviewed by: Bryan Cantrill <bryan@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/sparc/os/syscall.c
+++ new/usr/src/uts/sparc/os/syscall.c
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
↓ open down ↓ |
13 lines elided |
↑ open up ↑ |
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 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
24 + * Copyright 2019 Joyent, Inc.
24 25 */
25 26
26 27 #include <sys/param.h>
27 28 #include <sys/vmparam.h>
28 29 #include <sys/types.h>
29 30 #include <sys/sysmacros.h>
30 31 #include <sys/systm.h>
31 32 #include <sys/cmn_err.h>
32 33 #include <sys/signal.h>
33 34 #include <sys/stack.h>
34 35 #include <sys/cred.h>
35 36 #include <sys/user.h>
36 37 #include <sys/debug.h>
37 38 #include <sys/errno.h>
38 39 #include <sys/proc.h>
39 40 #include <sys/var.h>
40 41 #include <sys/inline.h>
41 42 #include <sys/syscall.h>
42 43 #include <sys/ucontext.h>
43 44 #include <sys/cpuvar.h>
44 45 #include <sys/siginfo.h>
45 46 #include <sys/trap.h>
46 47 #include <sys/machtrap.h>
47 48 #include <sys/sysinfo.h>
48 49 #include <sys/procfs.h>
49 50 #include <sys/prsystm.h>
50 51 #include <sys/fpu/fpusystm.h>
51 52 #include <sys/modctl.h>
52 53 #include <sys/aio_impl.h>
53 54 #include <c2/audit.h>
54 55 #include <sys/tnf.h>
55 56 #include <sys/tnf_probe.h>
56 57 #include <sys/machpcb.h>
57 58 #include <sys/privregs.h>
58 59 #include <sys/copyops.h>
59 60 #include <sys/timer.h>
60 61 #include <sys/priv.h>
61 62 #include <sys/msacct.h>
62 63
63 64 int syscalltrace = 0;
64 65 #ifdef SYSCALLTRACE
65 66 static kmutex_t systrace_lock; /* syscall tracing lock */
66 67 #endif /* SYSCALLTRACE */
67 68
68 69 static krwlock_t *lock_syscall(struct sysent *, uint_t);
69 70
70 71 #ifdef _SYSCALL32_IMPL
71 72 static struct sysent *
72 73 lwp_getsysent(klwp_t *lwp)
73 74 {
74 75 if (lwp_getdatamodel(lwp) == DATAMODEL_NATIVE)
75 76 return (sysent);
76 77 return (sysent32);
77 78 }
78 79 #define LWP_GETSYSENT(lwp) (lwp_getsysent(lwp))
79 80 #else
80 81 #define LWP_GETSYSENT(lwp) (sysent)
81 82 #endif
82 83
83 84 /*
84 85 * Called to restore the lwp's register window just before
85 86 * returning to user level (only if the registers have been
86 87 * fetched or modified through /proc).
87 88 */
88 89 /*ARGSUSED1*/
89 90 void
90 91 xregrestore(klwp_t *lwp, int shared)
91 92 {
92 93 /*
93 94 * If locals+ins were modified by /proc copy them out.
94 95 * Also copy to the shared window, if necessary.
95 96 */
96 97 if (lwp->lwp_pcb.pcb_xregstat == XREGMODIFIED) {
97 98 struct machpcb *mpcb = lwptompcb(lwp);
98 99 caddr_t sp = (caddr_t)lwptoregs(lwp)->r_sp;
99 100
100 101 size_t rwinsize;
101 102 caddr_t rwp;
102 103 int is64;
103 104
104 105 if (lwp_getdatamodel(lwp) == DATAMODEL_LP64) {
105 106 rwinsize = sizeof (struct rwindow);
106 107 rwp = sp + STACK_BIAS;
107 108 is64 = 1;
108 109 } else {
109 110 rwinsize = sizeof (struct rwindow32);
110 111 sp = (caddr_t)(uintptr_t)(caddr32_t)(uintptr_t)sp;
111 112 rwp = sp;
112 113 is64 = 0;
113 114 }
114 115
115 116 if (is64)
116 117 (void) copyout_nowatch(&lwp->lwp_pcb.pcb_xregs,
117 118 rwp, rwinsize);
118 119 else {
119 120 struct rwindow32 rwindow32;
120 121 int watched;
121 122
122 123 watched = watch_disable_addr(rwp, rwinsize, S_WRITE);
123 124 rwindow_nto32(&lwp->lwp_pcb.pcb_xregs, &rwindow32);
124 125 (void) copyout(&rwindow32, rwp, rwinsize);
125 126 if (watched)
126 127 watch_enable_addr(rwp, rwinsize, S_WRITE);
127 128 }
128 129
129 130 /* also copy to the user return window */
130 131 mpcb->mpcb_rsp[0] = sp;
131 132 mpcb->mpcb_rsp[1] = NULL;
132 133 bcopy(&lwp->lwp_pcb.pcb_xregs, &mpcb->mpcb_rwin[0],
133 134 sizeof (lwp->lwp_pcb.pcb_xregs));
134 135 }
135 136 lwp->lwp_pcb.pcb_xregstat = XREGNONE;
136 137 }
137 138
138 139
139 140 /*
140 141 * Get the arguments to the current system call.
141 142 * lwp->lwp_ap normally points to the out regs in the reg structure.
142 143 * If the user is going to change the out registers and might want to
143 144 * get the args (for /proc tracing), it must copy the args elsewhere
144 145 * via save_syscall_args().
145 146 */
146 147 uint_t
147 148 get_syscall_args(klwp_t *lwp, long *argp, int *nargsp)
148 149 {
149 150 kthread_t *t = lwptot(lwp);
150 151 uint_t code = t->t_sysnum;
151 152 long mask;
152 153 long *ap;
153 154 int nargs;
154 155
155 156 if (lwptoproc(lwp)->p_model == DATAMODEL_ILP32)
156 157 mask = (uint32_t)0xffffffffU;
157 158 else
158 159 mask = 0xffffffffffffffff;
159 160
160 161 if (code != 0 && code < NSYSCALL) {
161 162
162 163 nargs = LWP_GETSYSENT(lwp)[code].sy_narg;
163 164
164 165 ASSERT(nargs <= MAXSYSARGS);
165 166
166 167 *nargsp = nargs;
167 168 ap = lwp->lwp_ap;
168 169 while (nargs-- > 0)
169 170 *argp++ = *ap++ & mask;
170 171 } else {
171 172 *nargsp = 0;
172 173 }
173 174 return (code);
174 175 }
175 176
176 177 #ifdef _SYSCALL32_IMPL
177 178 /*
178 179 * Get the arguments to the current 32-bit system call.
179 180 */
180 181 uint_t
181 182 get_syscall32_args(klwp_t *lwp, int *argp, int *nargsp)
182 183 {
183 184 long args[MAXSYSARGS];
↓ open down ↓ |
150 lines elided |
↑ open up ↑ |
184 185 uint_t i, code;
185 186
186 187 code = get_syscall_args(lwp, args, nargsp);
187 188 for (i = 0; i != *nargsp; i++)
188 189 *argp++ = (int)args[i];
189 190 return (code);
190 191 }
191 192 #endif
192 193
193 194 /*
194 - * Save the system call arguments in a safe place.
195 + * Save the system call arguments in a safe place.
195 196 * lwp->lwp_ap normally points to the out regs in the reg structure.
196 197 * If the user is going to change the out registers, g1, or the stack,
197 198 * and might want to get the args (for /proc tracing), it must copy
198 199 * the args elsewhere via save_syscall_args().
199 200 *
200 201 * This may be called from stop() even when we're not in a system call.
201 202 * Since there's no easy way to tell, this must be safe (not panic).
202 203 * If the copyins get data faults, return non-zero.
203 204 */
204 205 int
205 206 save_syscall_args()
206 207 {
207 208 kthread_t *t = curthread;
208 209 klwp_t *lwp = ttolwp(t);
209 210 struct regs *rp = lwptoregs(lwp);
210 211 uint_t code = t->t_sysnum;
211 212 uint_t nargs;
212 213 int i;
213 214 caddr_t ua;
214 215 model_t datamodel;
215 216
216 217 if (lwp->lwp_argsaved || code == 0)
217 218 return (0); /* args already saved or not needed */
218 219
219 220 if (code >= NSYSCALL) {
220 221 nargs = 0; /* illegal syscall */
221 222 } else {
222 223 struct sysent *se = LWP_GETSYSENT(lwp);
223 224 struct sysent *callp = se + code;
224 225
225 226 nargs = callp->sy_narg;
226 227 if (LOADABLE_SYSCALL(callp) && nargs == 0) {
227 228 krwlock_t *module_lock;
228 229
229 230 /*
230 231 * Find out how many arguments the system
231 232 * call uses.
232 233 *
233 234 * We have the property that loaded syscalls
234 235 * never change the number of arguments they
235 236 * use after they've been loaded once. This
236 237 * allows us to stop for /proc tracing without
237 238 * holding the module lock.
238 239 * /proc is assured that sy_narg is valid.
239 240 */
240 241 module_lock = lock_syscall(se, code);
241 242 nargs = callp->sy_narg;
242 243 rw_exit(module_lock);
243 244 }
244 245 }
245 246
246 247 /*
247 248 * Fetch the system call arguments.
248 249 */
249 250 if (nargs == 0)
250 251 goto out;
251 252
252 253
253 254 ASSERT(nargs <= MAXSYSARGS);
254 255
255 256 if ((datamodel = lwp_getdatamodel(lwp)) == DATAMODEL_ILP32) {
256 257
257 258 if (rp->r_g1 == 0) { /* indirect syscall */
258 259
259 260 lwp->lwp_arg[0] = (uint32_t)rp->r_o1;
260 261 lwp->lwp_arg[1] = (uint32_t)rp->r_o2;
261 262 lwp->lwp_arg[2] = (uint32_t)rp->r_o3;
262 263 lwp->lwp_arg[3] = (uint32_t)rp->r_o4;
263 264 lwp->lwp_arg[4] = (uint32_t)rp->r_o5;
264 265 if (nargs > 5) {
265 266 ua = (caddr_t)(uintptr_t)(caddr32_t)(uintptr_t)
266 267 (rp->r_sp + MINFRAME32);
267 268 for (i = 5; i < nargs; i++) {
268 269 uint32_t a;
269 270 if (fuword32(ua, &a) != 0)
270 271 return (-1);
271 272 lwp->lwp_arg[i] = a;
272 273 ua += sizeof (a);
273 274 }
274 275 }
275 276 } else {
276 277 lwp->lwp_arg[0] = (uint32_t)rp->r_o0;
277 278 lwp->lwp_arg[1] = (uint32_t)rp->r_o1;
278 279 lwp->lwp_arg[2] = (uint32_t)rp->r_o2;
279 280 lwp->lwp_arg[3] = (uint32_t)rp->r_o3;
280 281 lwp->lwp_arg[4] = (uint32_t)rp->r_o4;
281 282 lwp->lwp_arg[5] = (uint32_t)rp->r_o5;
282 283 if (nargs > 6) {
283 284 ua = (caddr_t)(uintptr_t)(caddr32_t)(uintptr_t)
284 285 (rp->r_sp + MINFRAME32);
285 286 for (i = 6; i < nargs; i++) {
286 287 uint32_t a;
287 288 if (fuword32(ua, &a) != 0)
288 289 return (-1);
289 290 lwp->lwp_arg[i] = a;
290 291 ua += sizeof (a);
291 292 }
292 293 }
293 294 }
294 295 } else {
295 296 ASSERT(datamodel == DATAMODEL_LP64);
296 297 lwp->lwp_arg[0] = rp->r_o0;
297 298 lwp->lwp_arg[1] = rp->r_o1;
298 299 lwp->lwp_arg[2] = rp->r_o2;
299 300 lwp->lwp_arg[3] = rp->r_o3;
300 301 lwp->lwp_arg[4] = rp->r_o4;
301 302 lwp->lwp_arg[5] = rp->r_o5;
302 303 if (nargs > 6) {
303 304 ua = (caddr_t)rp->r_sp + MINFRAME + STACK_BIAS;
304 305 for (i = 6; i < nargs; i++) {
305 306 unsigned long a;
306 307 if (fulword(ua, &a) != 0)
307 308 return (-1);
308 309 lwp->lwp_arg[i] = a;
309 310 ua += sizeof (a);
310 311 }
311 312 }
312 313 }
313 314
314 315 out:
315 316 lwp->lwp_ap = lwp->lwp_arg;
316 317 lwp->lwp_argsaved = 1;
317 318 t->t_post_sys = 1; /* so lwp_ap will be reset */
318 319 return (0);
319 320 }
320 321
321 322 void
322 323 reset_syscall_args(void)
323 324 {
324 325 klwp_t *lwp = ttolwp(curthread);
325 326
326 327 lwp->lwp_ap = (long *)&lwptoregs(lwp)->r_o0;
327 328 lwp->lwp_argsaved = 0;
328 329 }
329 330
330 331 /*
331 332 * nonexistent system call-- signal lwp (may want to handle it)
332 333 * flag error if lwp won't see signal immediately
333 334 * This works for old or new calling sequence.
334 335 */
335 336 int64_t
336 337 nosys()
337 338 {
338 339 tsignal(curthread, SIGSYS);
339 340 return ((int64_t)set_errno(ENOSYS));
340 341 }
341 342
342 343 /*
343 344 * Perform pre-system-call processing, including stopping for tracing,
344 345 * auditing, microstate-accounting, etc.
345 346 *
346 347 * This routine is called only if the t_pre_sys flag is set. Any condition
347 348 * requiring pre-syscall handling must set the t_pre_sys flag. If the
348 349 * condition is persistent, this routine will repost t_pre_sys.
349 350 */
350 351 int
351 352 pre_syscall(int arg0)
352 353 {
353 354 unsigned int code;
354 355 kthread_t *t = curthread;
355 356 proc_t *p = ttoproc(t);
356 357 klwp_t *lwp = ttolwp(t);
357 358 struct regs *rp = lwptoregs(lwp);
358 359 int repost;
359 360
360 361 t->t_pre_sys = repost = 0; /* clear pre-syscall processing flag */
361 362
362 363 ASSERT(t->t_schedflag & TS_DONT_SWAP);
363 364
364 365 syscall_mstate(LMS_USER, LMS_SYSTEM);
365 366
366 367 /*
367 368 * The syscall arguments in the out registers should be pointed to
368 369 * by lwp_ap. If the args need to be copied so that the outs can
369 370 * be changed without losing the ability to get the args for /proc,
370 371 * they can be saved by save_syscall_args(), and lwp_ap will be
371 372 * restored by post_syscall().
372 373 */
373 374 ASSERT(lwp->lwp_ap == (long *)&rp->r_o0);
374 375
375 376 /*
376 377 * Make sure the thread is holding the latest credentials for the
377 378 * process. The credentials in the process right now apply to this
378 379 * thread for the entire system call.
379 380 */
380 381 if (t->t_cred != p->p_cred) {
381 382 cred_t *oldcred = t->t_cred;
382 383 /*
383 384 * DTrace accesses t_cred in probe context. t_cred must
384 385 * always be either NULL, or point to a valid, allocated cred
385 386 * structure.
386 387 */
387 388 t->t_cred = crgetcred();
388 389 crfree(oldcred);
389 390 }
390 391
391 392 /*
392 393 * Undo special arrangements to single-step the lwp
393 394 * so that a debugger will see valid register contents.
394 395 * Also so that the pc is valid for syncfpu().
395 396 * Also so that a syscall like exec() can be stepped.
396 397 */
397 398 if (lwp->lwp_pcb.pcb_step != STEP_NONE) {
398 399 (void) prundostep();
399 400 repost = 1;
400 401 }
401 402
402 403 /*
403 404 * Check for indirect system call in case we stop for tracing.
404 405 * Don't allow multiple indirection.
405 406 */
406 407 code = t->t_sysnum;
407 408 if (code == 0 && arg0 != 0) { /* indirect syscall */
408 409 code = arg0;
409 410 t->t_sysnum = arg0;
410 411 }
411 412
412 413 /*
413 414 * From the proc(4) manual page:
414 415 * When entry to a system call is being traced, the traced process
415 416 * stops after having begun the call to the system but before the
416 417 * system call arguments have been fetched from the process.
417 418 * If proc changes the args we must refetch them after starting.
418 419 */
419 420 if (PTOU(p)->u_systrap) {
420 421 if (prismember(&PTOU(p)->u_entrymask, code)) {
421 422 /*
422 423 * Recheck stop condition, now that lock is held.
423 424 */
424 425 mutex_enter(&p->p_lock);
425 426 if (PTOU(p)->u_systrap &&
426 427 prismember(&PTOU(p)->u_entrymask, code)) {
427 428 stop(PR_SYSENTRY, code);
428 429 /*
429 430 * Must refetch args since they were
430 431 * possibly modified by /proc. Indicate
431 432 * that the valid copy is in the
432 433 * registers.
433 434 */
434 435 lwp->lwp_argsaved = 0;
435 436 lwp->lwp_ap = (long *)&rp->r_o0;
436 437 }
437 438 mutex_exit(&p->p_lock);
438 439 }
439 440 repost = 1;
440 441 }
441 442
442 443 if (lwp->lwp_sysabort) {
443 444 /*
444 445 * lwp_sysabort may have been set via /proc while the process
445 446 * was stopped on PR_SYSENTRY. If so, abort the system call.
446 447 * Override any error from the copyin() of the arguments.
447 448 */
448 449 lwp->lwp_sysabort = 0;
449 450 (void) set_errno(EINTR); /* sets post-sys processing */
450 451 t->t_pre_sys = 1; /* repost anyway */
451 452 return (1); /* don't do system call, return EINTR */
452 453 }
453 454
454 455 /* begin auditing for this syscall */
455 456 if (audit_active == C2AUDIT_LOADED) {
456 457 uint32_t auditing = au_zone_getstate(NULL);
457 458
458 459 if (auditing & AU_AUDIT_MASK) {
459 460 int error;
460 461 if (error = audit_start(T_SYSCALL, code, auditing, \
461 462 0, lwp)) {
462 463 t->t_pre_sys = 1; /* repost anyway */
463 464 lwp->lwp_error = 0; /* for old drivers */
464 465 return (error);
465 466 }
466 467 repost = 1;
467 468 }
468 469 }
469 470
470 471 #ifndef NPROBE
471 472 /* Kernel probe */
472 473 if (tnf_tracing_active) {
473 474 TNF_PROBE_1(syscall_start, "syscall thread", /* CSTYLED */,
474 475 tnf_sysnum, sysnum, t->t_sysnum);
475 476 t->t_post_sys = 1; /* make sure post_syscall runs */
476 477 repost = 1;
477 478 }
478 479 #endif /* NPROBE */
479 480
480 481 #ifdef SYSCALLTRACE
481 482 if (syscalltrace) {
482 483 int i;
483 484 long *ap;
484 485 char *cp;
485 486 char *sysname;
486 487 struct sysent *callp;
487 488
488 489 if (code >= NSYSCALL)
489 490 callp = &nosys_ent; /* nosys has no args */
490 491 else
491 492 callp = LWP_GETSYSENT(lwp) + code;
492 493 (void) save_syscall_args();
493 494 mutex_enter(&systrace_lock);
494 495 printf("%d: ", p->p_pid);
495 496 if (code >= NSYSCALL)
496 497 printf("0x%x", code);
497 498 else {
498 499 sysname = mod_getsysname(code);
499 500 printf("%s[0x%x]", sysname == NULL ? "NULL" :
500 501 sysname, code);
501 502 }
502 503 cp = "(";
503 504 for (i = 0, ap = lwp->lwp_ap; i < callp->sy_narg; i++, ap++) {
504 505 printf("%s%lx", cp, *ap);
505 506 cp = ", ";
506 507 }
507 508 if (i)
508 509 printf(")");
509 510 printf(" %s id=0x%p\n", PTOU(p)->u_comm, curthread);
510 511 mutex_exit(&systrace_lock);
511 512 }
512 513 #endif /* SYSCALLTRACE */
513 514
514 515 /*
515 516 * If there was a continuing reason for pre-syscall processing,
516 517 * set the t_pre_sys flag for the next system call.
517 518 */
518 519 if (repost)
519 520 t->t_pre_sys = 1;
520 521 lwp->lwp_error = 0; /* for old drivers */
521 522 lwp->lwp_badpriv = PRIV_NONE; /* for privilege tracing */
522 523 return (0);
523 524 }
524 525
525 526 /*
526 527 * Post-syscall processing. Perform abnormal system call completion
527 528 * actions such as /proc tracing, profiling, signals, preemption, etc.
528 529 *
529 530 * This routine is called only if t_post_sys, t_sig_check, or t_astflag is set.
530 531 * Any condition requiring pre-syscall handling must set one of these.
531 532 * If the condition is persistent, this routine will repost t_post_sys.
532 533 */
533 534 void
534 535 post_syscall(long rval1, long rval2)
535 536 {
536 537 kthread_t *t = curthread;
537 538 proc_t *p = curproc;
538 539 klwp_t *lwp = ttolwp(t);
539 540 struct regs *rp = lwptoregs(lwp);
540 541 uint_t error;
541 542 int code = t->t_sysnum;
542 543 int repost = 0;
543 544 int proc_stop = 0; /* non-zero if stopping for /proc */
544 545 int sigprof = 0; /* non-zero if sending SIGPROF */
545 546
546 547 t->t_post_sys = 0;
547 548
548 549 error = lwp->lwp_errno;
549 550
550 551 /*
551 552 * Code can be zero if this is a new LWP returning after a forkall(),
552 553 * other than the one which matches the one in the parent which called
553 554 * forkall(). In these LWPs, skip most of post-syscall activity.
554 555 */
555 556 if (code == 0)
556 557 goto sig_check;
557 558
558 559 /* put out audit record for this syscall */
559 560 if (AU_AUDITING()) {
560 561 rval_t rval; /* fix audit_finish() someday */
561 562
562 563 /* XX64 -- truncation of 64-bit return values? */
563 564 rval.r_val1 = (int)rval1;
564 565 rval.r_val2 = (int)rval2;
565 566 audit_finish(T_SYSCALL, code, error, &rval);
566 567 repost = 1;
567 568 }
568 569
569 570 if (curthread->t_pdmsg != NULL) {
570 571 char *m = curthread->t_pdmsg;
571 572
572 573 uprintf("%s", m);
573 574 kmem_free(m, strlen(m) + 1);
574 575 curthread->t_pdmsg = NULL;
575 576 }
576 577
577 578 /*
578 579 * If we're going to stop for /proc tracing, set the flag and
579 580 * save the arguments so that the return values don't smash them.
580 581 */
581 582 if (PTOU(p)->u_systrap) {
582 583 if (prismember(&PTOU(p)->u_exitmask, code)) {
583 584 proc_stop = 1;
584 585 (void) save_syscall_args();
585 586 }
586 587 repost = 1;
587 588 }
588 589
589 590 /*
590 591 * Similarly check to see if SIGPROF might be sent.
591 592 */
592 593 if (curthread->t_rprof != NULL &&
593 594 curthread->t_rprof->rp_anystate != 0) {
594 595 (void) save_syscall_args();
595 596 sigprof = 1;
596 597 }
597 598
598 599 if (lwp->lwp_eosys == NORMALRETURN) {
599 600 if (error == 0) {
600 601 #ifdef SYSCALLTRACE
601 602 if (syscalltrace) {
602 603 mutex_enter(&systrace_lock);
603 604 printf(
604 605 "%d: r_val1=0x%lx, r_val2=0x%lx, id 0x%p\n",
605 606 p->p_pid, rval1, rval2, curthread);
606 607 mutex_exit(&systrace_lock);
607 608 }
608 609 #endif /* SYSCALLTRACE */
609 610 rp->r_tstate &= ~TSTATE_IC;
610 611 rp->r_o0 = rval1;
611 612 rp->r_o1 = rval2;
612 613 } else {
613 614 int sig;
614 615
615 616 #ifdef SYSCALLTRACE
616 617 if (syscalltrace) {
617 618 mutex_enter(&systrace_lock);
618 619 printf("%d: error=%d, id 0x%p\n",
619 620 p->p_pid, error, curthread);
620 621 mutex_exit(&systrace_lock);
621 622 }
622 623 #endif /* SYSCALLTRACE */
623 624 if (error == EINTR && t->t_activefd.a_stale)
624 625 error = EBADF;
625 626 if (error == EINTR &&
626 627 (sig = lwp->lwp_cursig) != 0 &&
627 628 sigismember(&PTOU(p)->u_sigrestart, sig) &&
628 629 PTOU(p)->u_signal[sig - 1] != SIG_DFL &&
629 630 PTOU(p)->u_signal[sig - 1] != SIG_IGN)
630 631 error = ERESTART;
631 632 rp->r_o0 = error;
632 633 rp->r_tstate |= TSTATE_IC;
633 634 }
634 635 /*
635 636 * The default action is to redo the trap instruction.
636 637 * We increment the pc and npc past it for NORMALRETURN.
637 638 * JUSTRETURN has set up a new pc and npc already.
638 639 * If we are a cloned thread of forkall(), don't
639 640 * adjust here because we have already inherited
640 641 * the adjusted values from our clone.
641 642 */
642 643 if (!(t->t_flag & T_FORKALL)) {
643 644 rp->r_pc = rp->r_npc;
644 645 rp->r_npc += 4;
645 646 }
646 647 }
647 648
648 649 /*
649 650 * From the proc(4) manual page:
650 651 * When exit from a system call is being traced, the traced process
651 652 * stops on completion of the system call just prior to checking for
652 653 * signals and returning to user level. At this point all return
653 654 * values have been stored into the traced process's saved registers.
654 655 */
655 656 if (proc_stop) {
656 657 mutex_enter(&p->p_lock);
657 658 if (PTOU(p)->u_systrap &&
658 659 prismember(&PTOU(p)->u_exitmask, code))
659 660 stop(PR_SYSEXIT, code);
660 661 mutex_exit(&p->p_lock);
661 662 }
662 663
663 664 /*
664 665 * If we are the parent returning from a successful
665 666 * vfork, wait for the child to exec or exit.
666 667 * This code must be here and not in the bowels of the system
667 668 * so that /proc can intercept exit from vfork in a timely way.
668 669 */
669 670 if (t->t_flag & T_VFPARENT) {
670 671 ASSERT(code == SYS_vfork || code == SYS_forksys);
671 672 ASSERT(rp->r_o1 == 0 && error == 0);
672 673 vfwait((pid_t)rval1);
673 674 t->t_flag &= ~T_VFPARENT;
674 675 }
675 676
676 677 /*
677 678 * If profiling is active, bill the current PC in user-land
678 679 * and keep reposting until profiling is disabled.
679 680 */
680 681 if (p->p_prof.pr_scale) {
681 682 if (lwp->lwp_oweupc)
682 683 profil_tick(rp->r_pc);
683 684 repost = 1;
684 685 }
685 686
686 687 sig_check:
687 688 /*
688 689 * Reset flag for next time.
689 690 * We must do this after stopping on PR_SYSEXIT
690 691 * because /proc uses the information in lwp_eosys.
691 692 */
692 693 lwp->lwp_eosys = NORMALRETURN;
693 694 clear_stale_fd();
694 695 t->t_flag &= ~T_FORKALL;
695 696
696 697 if (t->t_astflag | t->t_sig_check) {
697 698 /*
698 699 * Turn off the AST flag before checking all the conditions that
699 700 * may have caused an AST. This flag is on whenever a signal or
700 701 * unusual condition should be handled after the next trap or
701 702 * syscall.
702 703 */
703 704 astoff(t);
704 705 t->t_sig_check = 0;
705 706
706 707 /*
707 708 * The following check is legal for the following reasons:
708 709 * 1) The thread we are checking, is ourselves, so there is
709 710 * no way the proc can go away.
710 711 * 2) The only time we need to be protected by the
711 712 * lock is if the binding is changed.
712 713 *
713 714 * Note we will still take the lock and check the binding
714 715 * if the condition was true without the lock held. This
715 716 * prevents lock contention among threads owned by the
716 717 * same proc.
717 718 */
718 719
719 720 if (curthread->t_proc_flag & TP_CHANGEBIND) {
720 721 mutex_enter(&p->p_lock);
721 722 if (curthread->t_proc_flag & TP_CHANGEBIND) {
722 723 timer_lwpbind();
723 724 curthread->t_proc_flag &= ~TP_CHANGEBIND;
724 725 }
725 726 mutex_exit(&p->p_lock);
726 727 }
727 728
728 729 /*
729 730 * for kaio requests on the special kaio poll queue,
730 731 * copyout their results to user memory.
731 732 */
732 733 if (p->p_aio)
733 734 aio_cleanup(0);
734 735
735 736 /*
736 737 * If this LWP was asked to hold, call holdlwp(), which will
737 738 * stop. holdlwps() sets this up and calls pokelwps() which
738 739 * sets the AST flag.
739 740 *
740 741 * Also check TP_EXITLWP, since this is used by fresh new LWPs
741 742 * through lwp_rtt(). That flag is set if the lwp_create(2)
742 743 * syscall failed after creating the LWP.
743 744 */
744 745 if (ISHOLD(p) || (t->t_proc_flag & TP_EXITLWP))
745 746 holdlwp();
746 747
747 748 /*
748 749 * All code that sets signals and makes ISSIG_PENDING
749 750 * evaluate true must set t_sig_check afterwards.
750 751 */
751 752 if (ISSIG_PENDING(t, lwp, p)) {
752 753 if (issig(FORREAL))
753 754 psig();
754 755 t->t_sig_check = 1; /* recheck next time */
755 756 }
756 757
757 758 if (sigprof) {
758 759 int nargs = (code > 0 && code < NSYSCALL)?
759 760 LWP_GETSYSENT(lwp)[code].sy_narg : 0;
760 761 realsigprof(code, nargs, error);
761 762 t->t_sig_check = 1; /* recheck next time */
762 763 }
763 764
764 765 /*
765 766 * If a performance counter overflow interrupt was
766 767 * delivered *during* the syscall, then re-enable the
767 768 * AST so that we take a trip through trap() to cause
768 769 * the SIGEMT to be delivered.
769 770 */
770 771 if (lwp->lwp_pcb.pcb_flags & CPC_OVERFLOW)
771 772 aston(t);
772 773
773 774 /*
774 775 * If an asynchronous hardware error is pending, turn AST flag
775 776 * back on. AST will be checked again before we return to user
776 777 * mode and we'll come back through trap() to handle the error.
777 778 */
778 779 if (lwp->lwp_pcb.pcb_flags & ASYNC_HWERR)
779 780 aston(t);
780 781 }
781 782
782 783 /*
783 784 * Restore register window if a debugger modified it.
784 785 * Set up to perform a single-step if a debugger requested it.
785 786 */
786 787 if (lwp->lwp_pcb.pcb_xregstat != XREGNONE)
787 788 xregrestore(lwp, 1);
788 789
789 790 lwp->lwp_errno = 0; /* clear error for next time */
790 791
791 792 #ifndef NPROBE
792 793 /* Kernel probe */
793 794 if (tnf_tracing_active) {
794 795 TNF_PROBE_3(syscall_end, "syscall thread", /* CSTYLED */,
795 796 tnf_long, rval1, rval1,
796 797 tnf_long, rval2, rval2,
797 798 tnf_long, errno, (long)error);
798 799 repost = 1;
799 800 }
800 801 #endif /* NPROBE */
801 802
802 803 /*
803 804 * Set state to LWP_USER here so preempt won't give us a kernel
804 805 * priority if it occurs after this point. Call CL_TRAPRET() to
805 806 * restore the user-level priority.
806 807 *
807 808 * It is important that no locks (other than spinlocks) be entered
808 809 * after this point before returning to user mode (unless lwp_state
809 810 * is set back to LWP_SYS).
810 811 *
811 812 * Sampled times past this point are charged to the user.
812 813 */
813 814 lwp->lwp_state = LWP_USER;
814 815
815 816 if (t->t_trapret) {
816 817 t->t_trapret = 0;
817 818 thread_lock(t);
818 819 CL_TRAPRET(t);
819 820 thread_unlock(t);
820 821 }
821 822 if (CPU->cpu_runrun || t->t_schedflag & TS_ANYWAITQ)
822 823 preempt();
823 824 prunstop();
824 825
825 826 /*
826 827 * t_post_sys will be set if pcb_step is active.
827 828 */
828 829 if (lwp->lwp_pcb.pcb_step != STEP_NONE) {
829 830 prdostep();
830 831 repost = 1;
831 832 }
832 833
833 834 t->t_sysnum = 0; /* no longer in a system call */
834 835
835 836 /*
836 837 * In case the args were copied to the lwp, reset the
837 838 * pointer so the next syscall will have the right lwp_ap pointer.
838 839 */
839 840 lwp->lwp_ap = (long *)&rp->r_o0;
840 841 lwp->lwp_argsaved = 0;
841 842
842 843 /*
843 844 * If there was a continuing reason for post-syscall processing,
844 845 * set the t_post_sys flag for the next system call.
845 846 */
846 847 if (repost)
847 848 t->t_post_sys = 1;
848 849
849 850 /*
850 851 * If there is a ustack registered for this lwp, and the stack rlimit
851 852 * has been altered, read in the ustack. If the saved stack rlimit
852 853 * matches the bounds of the ustack, update the ustack to reflect
853 854 * the new rlimit. If the new stack rlimit is RLIM_INFINITY, disable
854 855 * stack checking by setting the size to 0.
855 856 */
856 857 if (lwp->lwp_ustack != 0 && lwp->lwp_old_stk_ctl != 0) {
857 858 rlim64_t new_size;
858 859 model_t model;
859 860 caddr_t top;
860 861 struct rlimit64 rl;
861 862
862 863 mutex_enter(&p->p_lock);
863 864 new_size = p->p_stk_ctl;
864 865 model = p->p_model;
865 866 top = p->p_usrstack;
866 867 (void) rctl_rlimit_get(rctlproc_legacy[RLIMIT_STACK], p, &rl);
867 868 mutex_exit(&p->p_lock);
868 869
869 870 if (rl.rlim_cur == RLIM64_INFINITY)
870 871 new_size = 0;
871 872
872 873 if (model == DATAMODEL_NATIVE) {
873 874 stack_t stk;
874 875
875 876 if (copyin((stack_t *)lwp->lwp_ustack, &stk,
876 877 sizeof (stack_t)) == 0 &&
877 878 (stk.ss_size == lwp->lwp_old_stk_ctl ||
878 879 stk.ss_size == 0) &&
879 880 stk.ss_sp == top - stk.ss_size) {
880 881 stk.ss_sp = (void *)((uintptr_t)stk.ss_sp +
881 882 stk.ss_size - new_size);
882 883 stk.ss_size = new_size;
883 884
884 885 (void) copyout(&stk,
885 886 (stack_t *)lwp->lwp_ustack,
886 887 sizeof (stack_t));
887 888 }
888 889 } else {
889 890 stack32_t stk32;
890 891
891 892 if (copyin((stack32_t *)lwp->lwp_ustack, &stk32,
892 893 sizeof (stack32_t)) == 0 &&
893 894 (stk32.ss_size == lwp->lwp_old_stk_ctl ||
894 895 stk32.ss_size == 0) &&
895 896 stk32.ss_sp ==
896 897 (caddr32_t)(uintptr_t)(top - stk32.ss_size)) {
897 898 stk32.ss_sp += stk32.ss_size - new_size;
898 899 stk32.ss_size = new_size;
899 900
900 901 (void) copyout(&stk32,
901 902 (stack32_t *)lwp->lwp_ustack,
902 903 sizeof (stack32_t));
903 904 }
904 905 }
905 906
906 907 lwp->lwp_old_stk_ctl = 0;
907 908 }
908 909
909 910 syscall_mstate(LMS_SYSTEM, LMS_USER);
910 911 }
911 912
912 913 /*
913 914 * Call a system call which takes a pointer to the user args struct and
914 915 * a pointer to the return values. This is a bit slower than the standard
915 916 * C arg-passing method in some cases.
916 917 */
917 918 int64_t
918 919 syscall_ap()
919 920 {
920 921 uint_t error;
921 922 struct sysent *callp;
922 923 rval_t rval;
923 924 klwp_t *lwp = ttolwp(curthread);
924 925 struct regs *rp = lwptoregs(lwp);
925 926
926 927 callp = LWP_GETSYSENT(lwp) + curthread->t_sysnum;
927 928
928 929 /*
929 930 * If the arguments don't fit in registers %o0 - o5, make sure they
930 931 * have been copied to the lwp_arg array.
931 932 */
932 933 if (callp->sy_narg > 6 && save_syscall_args())
933 934 return ((int64_t)set_errno(EFAULT));
934 935
935 936 rval.r_val1 = 0;
936 937 rval.r_val2 = (int)rp->r_o1;
937 938 lwp->lwp_error = 0; /* for old drivers */
938 939 error = (*(callp->sy_call))(lwp->lwp_ap, &rval);
939 940 if (error)
940 941 return ((int64_t)set_errno(error));
941 942 return (rval.r_vals);
942 943 }
943 944
944 945 /*
945 946 * Load system call module.
946 947 * Returns with pointer to held read lock for module.
947 948 */
948 949 static krwlock_t *
949 950 lock_syscall(struct sysent *table, uint_t code)
950 951 {
951 952 krwlock_t *module_lock;
952 953 struct modctl *modp;
953 954 int id;
954 955 struct sysent *callp;
955 956
956 957 module_lock = table[code].sy_lock;
957 958 callp = &table[code];
958 959
959 960 /*
960 961 * Optimization to only call modload if we don't have a loaded
961 962 * syscall.
962 963 */
963 964 rw_enter(module_lock, RW_READER);
964 965 if (LOADED_SYSCALL(callp))
965 966 return (module_lock);
966 967 rw_exit(module_lock);
967 968
968 969 for (;;) {
969 970 if ((id = modload("sys", syscallnames[code])) == -1)
970 971 break;
971 972
972 973 /*
973 974 * If we loaded successfully at least once, the modctl
974 975 * will still be valid, so we try to grab it by filename.
975 976 * If this call fails, it's because the mod_filename
976 977 * was changed after the call to modload() (mod_hold_by_name()
977 978 * is the likely culprit). We can safely just take
978 979 * another lap if this is the case; the modload() will
979 980 * change the mod_filename back to one by which we can
980 981 * find the modctl.
981 982 */
982 983 modp = mod_find_by_filename("sys", syscallnames[code]);
983 984
984 985 if (modp == NULL)
985 986 continue;
986 987
987 988 mutex_enter(&mod_lock);
988 989
989 990 if (!modp->mod_installed) {
990 991 mutex_exit(&mod_lock);
991 992 continue;
992 993 }
993 994 break;
994 995 }
995 996
996 997 rw_enter(module_lock, RW_READER);
↓ open down ↓ |
792 lines elided |
↑ open up ↑ |
997 998
998 999 if (id != -1)
999 1000 mutex_exit(&mod_lock);
1000 1001
1001 1002 return (module_lock);
1002 1003 }
1003 1004
1004 1005 /*
1005 1006 * Loadable syscall support.
1006 1007 * If needed, load the module, then reserve it by holding a read
1007 - * lock for the duration of the call.
1008 + * lock for the duration of the call.
1008 1009 * Later, if the syscall is not unloadable, it could patch the vector.
1009 1010 */
1010 1011 /*ARGSUSED*/
1011 1012 int64_t
1012 1013 loadable_syscall(
1013 1014 long a0, long a1, long a2, long a3,
1014 1015 long a4, long a5, long a6, long a7)
1015 1016 {
1016 1017 int64_t rval;
1017 1018 struct sysent *callp;
1018 1019 struct sysent *se = LWP_GETSYSENT(ttolwp(curthread));
↓ open down ↓ |
1 lines elided |
↑ open up ↑ |
1019 1020 krwlock_t *module_lock;
1020 1021 int code;
1021 1022
1022 1023 code = curthread->t_sysnum;
1023 1024 callp = se + code;
1024 1025
1025 1026 /*
1026 1027 * Try to autoload the system call if necessary.
1027 1028 */
1028 1029 module_lock = lock_syscall(se, code);
1029 - THREAD_KPRI_RELEASE(); /* drop priority given by rw_enter */
1030 1030
1031 1031 /*
1032 1032 * we've locked either the loaded syscall or nosys
1033 1033 */
1034 1034 if (callp->sy_flags & SE_ARGC) {
1035 1035 int64_t (*sy_call)();
1036 1036
1037 1037 sy_call = (int64_t (*)())callp->sy_call;
1038 1038 rval = (*sy_call)(a0, a1, a2, a3, a4, a5);
1039 1039 } else {
1040 1040 rval = syscall_ap();
1041 1041 }
1042 1042
1043 - THREAD_KPRI_REQUEST(); /* regain priority from read lock */
1044 1043 rw_exit(module_lock);
1045 1044 return (rval);
1046 1045 }
1047 1046
1048 1047 /*
1049 1048 * Handle indirect system calls.
1050 1049 * This interface should be deprecated. The library can handle
1051 1050 * this more efficiently, but keep this implementation for old binaries.
1052 1051 *
1053 1052 * XX64 Needs some work.
1054 1053 */
1055 1054 int64_t
1056 1055 indir(int code, long a0, long a1, long a2, long a3, long a4)
1057 1056 {
1058 1057 klwp_t *lwp = ttolwp(curthread);
1059 1058 struct sysent *callp;
1060 1059
1061 1060 if (code <= 0 || code >= NSYSCALL)
1062 1061 return (nosys());
↓ open down ↓ |
9 lines elided |
↑ open up ↑ |
1063 1062
1064 1063 ASSERT(lwp->lwp_ap != NULL);
1065 1064
1066 1065 curthread->t_sysnum = code;
1067 1066 callp = LWP_GETSYSENT(lwp) + code;
1068 1067
1069 1068 /*
1070 1069 * Handle argument setup, unless already done in pre_syscall().
1071 1070 */
1072 1071 if (callp->sy_narg > 5) {
1073 - if (save_syscall_args()) /* move args to LWP array */
1072 + if (save_syscall_args()) /* move args to LWP array */
1074 1073 return ((int64_t)set_errno(EFAULT));
1075 1074 } else if (!lwp->lwp_argsaved) {
1076 1075 long *ap;
1077 1076
1078 1077 ap = lwp->lwp_ap; /* args haven't been saved */
1079 1078 lwp->lwp_ap = ap + 1; /* advance arg pointer */
1080 1079 curthread->t_post_sys = 1; /* so lwp_ap will be reset */
1081 1080 }
1082 1081 return ((*callp->sy_callc)(a0, a1, a2, a3, a4, lwp->lwp_arg[5]));
1083 1082 }
1084 1083
1085 1084 /*
1086 1085 * set_errno - set an error return from the current system call.
1087 1086 * This could be a macro.
1088 1087 * This returns the value it is passed, so that the caller can
1089 1088 * use tail-recursion-elimination and do return (set_errno(ERRNO));
1090 1089 */
1091 1090 uint_t
1092 1091 set_errno(uint_t error)
1093 1092 {
1094 1093 ASSERT(error != 0); /* must not be used to clear errno */
1095 1094
1096 1095 curthread->t_post_sys = 1; /* have post_syscall do error return */
1097 1096 return (ttolwp(curthread)->lwp_errno = error);
1098 1097 }
1099 1098
1100 1099 /*
1101 1100 * set_proc_pre_sys - Set pre-syscall processing for entire process.
1102 1101 */
1103 1102 void
1104 1103 set_proc_pre_sys(proc_t *p)
1105 1104 {
1106 1105 kthread_t *t;
1107 1106 kthread_t *first;
1108 1107
1109 1108 ASSERT(MUTEX_HELD(&p->p_lock));
1110 1109
1111 1110 t = first = p->p_tlist;
1112 1111 do {
1113 1112 t->t_pre_sys = 1;
1114 1113 } while ((t = t->t_forw) != first);
1115 1114 }
1116 1115
1117 1116 /*
1118 1117 * set_proc_post_sys - Set post-syscall processing for entire process.
1119 1118 */
1120 1119 void
1121 1120 set_proc_post_sys(proc_t *p)
1122 1121 {
1123 1122 kthread_t *t;
1124 1123 kthread_t *first;
1125 1124
1126 1125 ASSERT(MUTEX_HELD(&p->p_lock));
1127 1126
1128 1127 t = first = p->p_tlist;
1129 1128 do {
1130 1129 t->t_post_sys = 1;
1131 1130 } while ((t = t->t_forw) != first);
1132 1131 }
1133 1132
1134 1133 /*
1135 1134 * set_proc_sys - Set pre- and post-syscall processing for entire process.
1136 1135 */
1137 1136 void
1138 1137 set_proc_sys(proc_t *p)
1139 1138 {
1140 1139 kthread_t *t;
1141 1140 kthread_t *first;
1142 1141
1143 1142 ASSERT(MUTEX_HELD(&p->p_lock));
1144 1143
1145 1144 t = first = p->p_tlist;
1146 1145 do {
1147 1146 t->t_pre_sys = 1;
1148 1147 t->t_post_sys = 1;
1149 1148 } while ((t = t->t_forw) != first);
1150 1149 }
1151 1150
1152 1151 /*
1153 1152 * set_all_proc_sys - set pre- and post-syscall processing flags for all
1154 1153 * user processes.
1155 1154 *
1156 1155 * This is needed when auditing, tracing, or other facilities which affect
1157 1156 * all processes are turned on.
1158 1157 */
1159 1158 void
1160 1159 set_all_proc_sys()
1161 1160 {
1162 1161 kthread_t *t;
1163 1162 kthread_t *first;
1164 1163
1165 1164 mutex_enter(&pidlock);
1166 1165 t = first = curthread;
1167 1166 do {
1168 1167 t->t_pre_sys = 1;
1169 1168 t->t_post_sys = 1;
1170 1169 } while ((t = t->t_next) != first);
1171 1170 mutex_exit(&pidlock);
1172 1171 }
1173 1172
1174 1173 /*
1175 1174 * set_all_zone_usr_proc_sys - set pre- and post-syscall processing flags for
1176 1175 * all user processes running in the zone of the current process
1177 1176 *
1178 1177 * This is needed when auditing is turned on.
1179 1178 */
1180 1179 void
1181 1180 set_all_zone_usr_proc_sys(zoneid_t zoneid)
1182 1181 {
1183 1182 proc_t *p;
1184 1183 kthread_t *t;
1185 1184
1186 1185 mutex_enter(&pidlock);
1187 1186 for (p = practive; p != NULL; p = p->p_next) {
1188 1187 /* skip kernel processes */
1189 1188 if (p->p_exec == NULLVP || p->p_as == &kas ||
1190 1189 p->p_stat == SIDL || p->p_stat == SZOMB ||
1191 1190 (p->p_flag & (SSYS | SEXITING | SEXITLWPS)))
1192 1191 continue;
1193 1192 /*
1194 1193 * Only processes in the given zone (eventually in
1195 1194 * all zones) are taken into account
1196 1195 */
1197 1196 if (zoneid == ALL_ZONES || p->p_zone->zone_id == zoneid) {
1198 1197 mutex_enter(&p->p_lock);
1199 1198 if ((t = p->p_tlist) == NULL) {
1200 1199 mutex_exit(&p->p_lock);
1201 1200 continue;
1202 1201 }
1203 1202 /*
1204 1203 * Set pre- and post-syscall processing flags
1205 1204 * for all threads of the process
1206 1205 */
1207 1206 do {
1208 1207 t->t_pre_sys = 1;
1209 1208 t->t_post_sys = 1;
1210 1209 } while (p->p_tlist != (t = t->t_forw));
1211 1210 mutex_exit(&p->p_lock);
1212 1211 }
1213 1212 }
1214 1213 mutex_exit(&pidlock);
1215 1214 }
1216 1215
1217 1216 /*
1218 1217 * set_proc_ast - Set asynchronous service trap (AST) flag for all
1219 1218 * threads in process.
1220 1219 */
1221 1220 void
1222 1221 set_proc_ast(proc_t *p)
1223 1222 {
1224 1223 kthread_t *t;
1225 1224 kthread_t *first;
1226 1225
1227 1226 ASSERT(MUTEX_HELD(&p->p_lock));
1228 1227
1229 1228 t = first = p->p_tlist;
1230 1229 do {
1231 1230 aston(t);
1232 1231 } while ((t = t->t_forw) != first);
1233 1232 }
↓ open down ↓ |
150 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX