summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_proc.c79
-rw-r--r--usr/src/cmd/sgs/elfdump/common/corenote.c102
-rw-r--r--usr/src/cmd/sgs/elfdump/common/elfdump.msg5
-rw-r--r--usr/src/cmd/sgs/elfdump/common/gen_layout_obj.c1
-rw-r--r--usr/src/cmd/sgs/elfdump/common/gen_struct_layout.c12
-rw-r--r--usr/src/cmd/sgs/elfdump/common/struct_layout.h8
-rw-r--r--usr/src/cmd/sgs/elfdump/common/struct_layout_amd64.c9
-rw-r--r--usr/src/cmd/sgs/elfdump/common/struct_layout_i386.c9
-rw-r--r--usr/src/cmd/sgs/elfdump/common/struct_layout_sparc.c9
-rw-r--r--usr/src/cmd/sgs/elfdump/common/struct_layout_sparcv9.c9
-rw-r--r--usr/src/cmd/sgs/include/conv.h12
-rw-r--r--usr/src/cmd/sgs/libconv/common/corenote.c76
-rw-r--r--usr/src/cmd/sgs/libconv/common/corenote.msg18
-rw-r--r--usr/src/cmd/truss/main.c9
-rw-r--r--usr/src/cmd/truss/systable.c3
-rw-r--r--usr/src/head/Makefile1
-rw-r--r--usr/src/head/upanic.h36
-rw-r--r--usr/src/lib/libc/amd64/Makefile1
-rw-r--r--usr/src/lib/libc/i386/Makefile.com1
-rw-r--r--usr/src/lib/libc/port/mapfile-vers5
-rw-r--r--usr/src/lib/libc/port/sys/upanic.c23
-rw-r--r--usr/src/lib/libc/port/threads/assfail.c32
-rw-r--r--usr/src/lib/libc/sparc/Makefile.com1
-rw-r--r--usr/src/lib/libc/sparcv9/Makefile.com1
-rw-r--r--usr/src/lib/libproc/common/Pcontrol.c2
-rw-r--r--usr/src/lib/libproc/common/Pcontrol.h1
-rw-r--r--usr/src/lib/libproc/common/Pcore.c65
-rw-r--r--usr/src/lib/libproc/common/libproc.h6
-rw-r--r--usr/src/lib/libproc/common/mapfile-vers2
-rw-r--r--usr/src/lib/libproc/common/proc_names.c3
-rw-r--r--usr/src/man/man2/Makefile1
-rw-r--r--usr/src/man/man2/upanic.295
-rw-r--r--usr/src/man/man3head/Makefile1
-rw-r--r--usr/src/man/man3head/upanic.h.3head41
-rw-r--r--usr/src/man/man3lib/libproc.3lib7
-rw-r--r--usr/src/man/man3proc/Makefile4
-rw-r--r--usr/src/man/man3proc/Pupanic.3proc103
-rw-r--r--usr/src/man/man4/core.41011
-rw-r--r--usr/src/pkg/manifests/system-header.mf2
-rw-r--r--usr/src/pkg/manifests/system-kernel.man2.inc1
-rw-r--r--usr/src/pkg/manifests/system-library.man3proc.inc2
-rw-r--r--usr/src/uts/common/Makefile.files1
-rw-r--r--usr/src/uts/common/exec/elf/elf_notes.c38
-rw-r--r--usr/src/uts/common/os/exit.c10
-rw-r--r--usr/src/uts/common/os/sysent.c6
-rw-r--r--usr/src/uts/common/os/upanic.c92
-rw-r--r--usr/src/uts/common/sys/elf.h4
-rw-r--r--usr/src/uts/common/sys/proc.h11
-rw-r--r--usr/src/uts/common/sys/procfs.h15
-rw-r--r--usr/src/uts/common/sys/syscall.h46
-rw-r--r--usr/src/uts/intel/os/name_to_sysnum1
-rw-r--r--usr/src/uts/sparc/os/name_to_sysnum1
52 files changed, 1475 insertions, 559 deletions
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_proc.c b/usr/src/cmd/mdb/common/mdb/mdb_proc.c
index af4a6eac23..5169cfb6a5 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb_proc.c
+++ b/usr/src/cmd/mdb/common/mdb/mdb_proc.c
@@ -26,6 +26,7 @@
/*
* Copyright 2018 Joyent, Inc.
* Copyright (c) 2014 by Delphix. All rights reserved.
+ * Copyright 2020 Oxide Computer Company
*/
/*
@@ -103,6 +104,7 @@
#include <stdio_ext.h>
#include <stdlib.h>
#include <string.h>
+#include <ctype.h>
#define PC_FAKE -1UL /* illegal pc value unequal 0 */
#define PANIC_BUFSIZE 1024
@@ -1574,6 +1576,38 @@ pt_print_reason(const lwpstatus_t *psp)
}
}
+static void
+pt_status_dcmd_upanic(prupanic_t *pru)
+{
+ size_t i;
+
+ mdb_printf("process panicked\n");
+ if ((pru->pru_flags & PRUPANIC_FLAG_MSG_ERROR) != 0) {
+ mdb_printf("warning: process upanic message was bad\n");
+ return;
+ }
+
+ if ((pru->pru_flags & PRUPANIC_FLAG_MSG_VALID) == 0)
+ return;
+
+ if ((pru->pru_flags & PRUPANIC_FLAG_MSG_TRUNC) != 0) {
+ mdb_printf("warning: process upanic message truncated\n");
+ }
+
+ mdb_printf("upanic message: ");
+
+ for (i = 0; i < PRUPANIC_BUFLEN; i++) {
+ if (pru->pru_data[i] == '\0')
+ break;
+ if (isascii(pru->pru_data[i]) && isprint(pru->pru_data[i])) {
+ mdb_printf("%c", pru->pru_data[i]);
+ } else {
+ mdb_printf("\\x%02x", pru->pru_data[i]);
+ }
+ }
+ mdb_printf("\n");
+}
+
/*ARGSUSED*/
static int
pt_status_dcmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
@@ -1591,6 +1625,7 @@ pt_status_dcmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
uintptr_t panicstr;
char *panicbuf = mdb_alloc(PANIC_BUFSIZE, UM_SLEEP);
const siginfo_t *sip = &(psp->pr_lwp.pr_info);
+ prupanic_t *pru = NULL;
char execname[MAXPATHLEN], buf[BUFSIZ];
char signame[SIG2STR_MAX + 4]; /* enough for SIG+name+\0 */
@@ -1696,12 +1731,19 @@ pt_status_dcmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
case PS_DEAD:
if (cursig == 0 && WIFSIGNALED(pi.pr_wstat))
cursig = WTERMSIG(pi.pr_wstat);
+
+ (void) Pupanic(P, &pru);
+
/*
- * We can only use pr_wstat == 0 as a test for gcore if
- * an NT_PRCRED note is present; these features were
- * added at the same time in Solaris 8.
+ * Test for upanic first. We can only use pr_wstat == 0
+ * as a test for gcore if an NT_PRCRED note is present;
+ * these features were added at the same time in Solaris
+ * 8.
*/
- if (pi.pr_wstat == 0 && Pstate(P) == PS_DEAD &&
+ if (pru != NULL) {
+ pt_status_dcmd_upanic(pru);
+ Pupanic_free(pru);
+ } else if (pi.pr_wstat == 0 && Pstate(P) == PS_DEAD &&
Pcred(P, &cred, 1) == 0) {
mdb_printf("process core file generated "
"with gcore(1)\n");
@@ -1747,11 +1789,10 @@ pt_status_dcmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
sym.st_value) == sizeof (panicstr) &&
Pread_string(t->t_pshandle, panicbuf,
PANIC_BUFSIZE, panicstr) > 0) {
- mdb_printf("panic message: %s",
+ mdb_printf("libc panic message: %s",
panicbuf);
}
-
break;
case PS_IDLE:
@@ -4681,27 +4722,27 @@ pt_auxv(mdb_tgt_t *t, const auxv_t **auxvp)
static const mdb_tgt_ops_t proc_ops = {
pt_setflags, /* t_setflags */
- (int (*)())(uintptr_t) mdb_tgt_notsup, /* t_setcontext */
+ (int (*)())(uintptr_t)mdb_tgt_notsup, /* t_setcontext */
pt_activate, /* t_activate */
pt_deactivate, /* t_deactivate */
pt_periodic, /* t_periodic */
pt_destroy, /* t_destroy */
pt_name, /* t_name */
- (const char *(*)()) mdb_conf_isa, /* t_isa */
+ (const char *(*)())mdb_conf_isa, /* t_isa */
pt_platform, /* t_platform */
pt_uname, /* t_uname */
pt_dmodel, /* t_dmodel */
- (ssize_t (*)()) mdb_tgt_notsup, /* t_aread */
- (ssize_t (*)()) mdb_tgt_notsup, /* t_awrite */
+ (ssize_t (*)())mdb_tgt_notsup, /* t_aread */
+ (ssize_t (*)())mdb_tgt_notsup, /* t_awrite */
pt_vread, /* t_vread */
pt_vwrite, /* t_vwrite */
- (ssize_t (*)()) mdb_tgt_notsup, /* t_pread */
- (ssize_t (*)()) mdb_tgt_notsup, /* t_pwrite */
+ (ssize_t (*)())mdb_tgt_notsup, /* t_pread */
+ (ssize_t (*)())mdb_tgt_notsup, /* t_pwrite */
pt_fread, /* t_fread */
pt_fwrite, /* t_fwrite */
- (ssize_t (*)()) mdb_tgt_notsup, /* t_ioread */
- (ssize_t (*)()) mdb_tgt_notsup, /* t_iowrite */
- (int (*)())(uintptr_t) mdb_tgt_notsup, /* t_vtop */
+ (ssize_t (*)())mdb_tgt_notsup, /* t_ioread */
+ (ssize_t (*)())mdb_tgt_notsup, /* t_iowrite */
+ (int (*)())(uintptr_t)mdb_tgt_notsup, /* t_vtop */
pt_lookup_by_name, /* t_lookup_by_name */
pt_lookup_by_addr, /* t_lookup_by_addr */
pt_symbol_iter, /* t_symbol_iter */
@@ -4720,9 +4761,9 @@ static const mdb_tgt_ops_t proc_ops = {
pt_signal, /* t_signal */
pt_add_vbrkpt, /* t_add_vbrkpt */
pt_add_sbrkpt, /* t_add_sbrkpt */
- (int (*)())(uintptr_t) mdb_tgt_null, /* t_add_pwapt */
+ (int (*)())(uintptr_t)mdb_tgt_null, /* t_add_pwapt */
pt_add_vwapt, /* t_add_vwapt */
- (int (*)())(uintptr_t) mdb_tgt_null, /* t_add_iowapt */
+ (int (*)())(uintptr_t)mdb_tgt_null, /* t_add_iowapt */
pt_add_sysenter, /* t_add_sysenter */
pt_add_sysexit, /* t_add_sysexit */
pt_add_signal, /* t_add_signal */
@@ -4848,8 +4889,8 @@ pt_lwp_setfpregs(mdb_tgt_t *t, void *tap, mdb_tgt_tid_t tid,
}
static const pt_ptl_ops_t proc_lwp_ops = {
- (int (*)())(uintptr_t) mdb_tgt_nop,
- (void (*)())(uintptr_t) mdb_tgt_nop,
+ (int (*)())(uintptr_t)mdb_tgt_nop,
+ (void (*)())(uintptr_t)mdb_tgt_nop,
pt_lwp_tid,
pt_lwp_iter,
pt_lwp_getregs,
diff --git a/usr/src/cmd/sgs/elfdump/common/corenote.c b/usr/src/cmd/sgs/elfdump/common/corenote.c
index a5ba4e31b8..7b768a0309 100644
--- a/usr/src/cmd/sgs/elfdump/common/corenote.c
+++ b/usr/src/cmd/sgs/elfdump/common/corenote.c
@@ -26,6 +26,7 @@
/*
* Copyright 2012 DEY Storage Systems, Inc. All rights reserved.
* Copyright (c) 2018, Joyent, Inc.
+ * Copyright 2020 Oxide Computer Company
*/
#include <stdlib.h>
@@ -39,6 +40,8 @@
#include <_elfdump.h>
#include <struct_layout.h>
#include <conv.h>
+#include <ctype.h>
+#include <sys/sysmacros.h>
/*
@@ -94,7 +97,6 @@
print_strbuf(state, _title, &layout->_field)
-
/*
* Structure used to maintain state data for a core note, or a subregion
* (sub-struct) of a core note. These values would otherwise need to be
@@ -136,26 +138,59 @@ typedef void (* dump_func_t)(note_state_t *state, const char *title);
static const char *
safe_str(const char *str, size_t n)
{
- static char buf[512];
- char *s;
- size_t i;
+ static char buf[2048];
+ size_t i, used;
if (n == 0)
return (MSG_ORIG(MSG_STR_EMPTY));
- for (i = 0; i < n; i++)
+ /*
+ * If the string is terminated and doesn't need escaping, we can return
+ * it as is.
+ */
+ for (i = 0; i < n; i++) {
if (str[i] == '\0')
return (str);
- i = (n >= sizeof (buf)) ? (sizeof (buf) - 4) : (n - 1);
- (void) memcpy(buf, str, i);
- s = buf + i;
- if (n >= sizeof (buf)) {
- *s++ = '.';
- *s++ = '.';
- *s++ = '.';
+ if (!isascii(str[i]) || !isprint(str[i])) {
+ break;
+ }
}
- *s = '\0';
+
+ for (i = 0, used = 0; i < n; i++) {
+ if (str[i] == '\0') {
+ if (used + 1 > sizeof (buf))
+ break;
+ buf[used++] = str[i];
+ return (buf);
+ } else if (isascii(str[i]) && isprint(str[i])) {
+ if (used + 1 > sizeof (buf))
+ break;
+ buf[used++] = str[i];
+ } else {
+ size_t len = snprintf(NULL, 0, "\\x%02x", str[i]);
+ if (used + len > sizeof (buf))
+ break;
+ (void) snprintf(buf + used, sizeof (buf) - used,
+ "\\x%02x", str[i]);
+ used += len;
+ }
+ }
+
+ if (i == n && used < sizeof (buf)) {
+ buf[used] = '\0';
+ return (buf);
+ }
+
+ /*
+ * If we got here, we would have overflowed. Figure out where we need to
+ * start and truncate.
+ */
+ used = MIN(used, sizeof (buf) - 4);
+ buf[used++] = '.';
+ buf[used++] = '.';
+ buf[used++] = '.';
+ buf[used++] = '\0';
return (buf);
}
@@ -198,7 +233,7 @@ data_present(note_state_t *state, const sl_field_t *fdesc)
/*
* indent_enter/exit are used to start/end output for a subitem.
* On entry, a title is output, and the indentation level is raised
- * by one unit. On exit, the indentation level is restrored to its
+ * by one unit. On exit, the indentation level is restored to its
* previous value.
*/
static void
@@ -1759,6 +1794,40 @@ dump_asrset(note_state_t *state, const char *title)
indent_exit(state);
}
+static void
+dump_upanic(note_state_t *state, const char *title)
+{
+ const sl_prupanic_layout_t *layout = state->ns_arch->prupanic;
+ Conv_upanic_buf_t inv;
+ Word w;
+
+ indent_enter(state, title, &layout->pru_version);
+ w = extract_as_word(state, &layout->pru_version);
+ if (w != PRUPANIC_VERSION_1) {
+ PRINT_DEC(MSG_INTL(MSG_NOTE_BAD_UPANIC_VER), pru_version);
+ dump_hex_bytes(state->ns_data, state->ns_len, state->ns_indent,
+ 4, 3);
+ } else {
+ PRINT_DEC(MSG_ORIG(MSG_CNOTE_T_PRU_VERSION), pru_version);
+ w = extract_as_word(state, &layout->pru_flags);
+ print_str(state, MSG_ORIG(MSG_CNOTE_T_PRU_FLAGS),
+ conv_prupanic(w, 0, &inv));
+
+ if ((w & PRUPANIC_FLAG_MSG_VALID) != 0) {
+ /*
+ * We have a message that is _probably_ a text string,
+ * but the interface allows for arbitrary data. The only
+ * guarantee is that someone using this is probably up
+ * to no good. As a result, we basically try to print
+ * this as a string, but in the face of certain types of
+ * data, we hex escape it.
+ */
+ print_strbuf(state, MSG_ORIG(MSG_CNOTE_T_PRU_DATA),
+ &layout->pru_data);
+ }
+ }
+}
+
corenote_ret_t
corenote(Half mach, int do_swap, Word type,
const char *desc, Word descsz)
@@ -1928,6 +1997,11 @@ corenote(Half mach, int do_swap, Word type,
state.ns_vcol = 20;
dump_lwpname(&state, MSG_ORIG(MSG_CNOTE_DESC_PRLWPNAME_T));
return (CORENOTE_R_OK);
+
+ case NT_UPANIC:
+ state.ns_vcol = 23;
+ dump_upanic(&state, MSG_ORIG(MSG_CNOTE_DESC_PRUPANIC_T));
+ return (CORENOTE_R_OK);
}
return (CORENOTE_R_BADTYPE);
diff --git a/usr/src/cmd/sgs/elfdump/common/elfdump.msg b/usr/src/cmd/sgs/elfdump/common/elfdump.msg
index 20fe3ceb02..239a1f77ac 100644
--- a/usr/src/cmd/sgs/elfdump/common/elfdump.msg
+++ b/usr/src/cmd/sgs/elfdump/common/elfdump.msg
@@ -314,6 +314,7 @@
@ MSG_NOTE_BADCORETYPE "%s: unknown note type %#x\n"
@ MSG_NOTE_BAD_SECFLAGS_VER "unknown prsecflags_t version: "
+@ MSG_NOTE_BAD_UPANIC_VER "unknown prupanic_t version: "
@ _END_
@@ -472,6 +473,7 @@
@ MSG_CNOTE_DESC_PRFDINFO_T "desc: (prfdinfo_core_t)"
@ MSG_CNOTE_DESC_PRSECFLAGS_T "desc: (prsecflags_t)"
@ MSG_CNOTE_DESC_PRLWPNAME_T "desc: (prlwpname_t)"
+@ MSG_CNOTE_DESC_PRUPANIC_T "desc: (prupanic_t)"
@ MSG_CNOTE_FMT_LINE "%*s%-*s%s"
@ MSG_CNOTE_FMT_LINE_2UP "%*s%-*s%-*s%-*s%s"
@@ -646,6 +648,9 @@
@ MSG_CNOTE_T_PR_INO "pr_ino:"
@ MSG_CNOTE_T_PR_FILEFLAGS "pr_fileflags:"
@ MSG_CNOTE_T_PR_FDFLAGS "pr_fdflags:"
+@ MSG_CNOTE_T_PRU_VERSION "pru_version:"
+@ MSG_CNOTE_T_PRU_FLAGS "pru_flags:"
+@ MSG_CNOTE_T_PRU_DATA "pru_data:"
# Names of fake sections generated from program header data
diff --git a/usr/src/cmd/sgs/elfdump/common/gen_layout_obj.c b/usr/src/cmd/sgs/elfdump/common/gen_layout_obj.c
index 657ab05605..b307f40c72 100644
--- a/usr/src/cmd/sgs/elfdump/common/gen_layout_obj.c
+++ b/usr/src/cmd/sgs/elfdump/common/gen_layout_obj.c
@@ -61,3 +61,4 @@ struct utsname uts;
prfdinfo_core_t ptfd;
prsecflags_t psf;
prlwpname_t psn;
+prupanic_t pru;
diff --git a/usr/src/cmd/sgs/elfdump/common/gen_struct_layout.c b/usr/src/cmd/sgs/elfdump/common/gen_struct_layout.c
index 4f3d8b4dac..80e2d4964d 100644
--- a/usr/src/cmd/sgs/elfdump/common/gen_struct_layout.c
+++ b/usr/src/cmd/sgs/elfdump/common/gen_struct_layout.c
@@ -610,6 +610,16 @@ gen_prlwpname(void)
END;
}
+static void
+gen_prupanic(void)
+{
+ START(prupanic, prupanic_t);
+ SCALAR_FIELD(prupanic_t, pru_version, 0);
+ SCALAR_FIELD(prupanic_t, pru_flags, 0);
+ ARRAY_FIELD(prupanic_t, pru_data, 0);
+ END;
+}
+
/*ARGSUSED*/
int
main(int argc, char *argv[])
@@ -652,6 +662,7 @@ main(int argc, char *argv[])
gen_prfdinfo();
gen_prsecflags();
gen_prlwpname();
+ gen_prupanic();
/*
* Generate the full arch_layout description
@@ -681,6 +692,7 @@ main(int argc, char *argv[])
(void) printf(fmt, "prfdinfo");
(void) printf(fmt, "prsecflags");
(void) printf(fmt, "prlwpname");
+ (void) printf(fmt, "prupanic");
(void) printf("};\n");
/*
diff --git a/usr/src/cmd/sgs/elfdump/common/struct_layout.h b/usr/src/cmd/sgs/elfdump/common/struct_layout.h
index 7c43c33f99..6dde111468 100644
--- a/usr/src/cmd/sgs/elfdump/common/struct_layout.h
+++ b/usr/src/cmd/sgs/elfdump/common/struct_layout.h
@@ -543,6 +543,13 @@ typedef struct {
sl_field_t pr_lwpname;
} sl_prlwpname_layout_t;
+typedef struct {
+ sl_field_t sizeof_struct;
+ sl_field_t pru_version;
+ sl_field_t pru_flags;
+ sl_field_t pru_data;
+} sl_prupanic_layout_t;
+
/*
* This type collects all of the layout definitions for
* a given architecture.
@@ -570,6 +577,7 @@ typedef struct {
const sl_prfdinfo_layout_t *prfdinfo; /* prdinfo_t */
const sl_prsecflags_layout_t *prsecflags; /* prsecflags_t */
const sl_prlwpname_layout_t *prlwpname; /* prlwpname_t */
+ const sl_prupanic_layout_t *prupanic; /* prupanic_t */
} sl_arch_layout_t;
diff --git a/usr/src/cmd/sgs/elfdump/common/struct_layout_amd64.c b/usr/src/cmd/sgs/elfdump/common/struct_layout_amd64.c
index f040da7f3d..3107f42948 100644
--- a/usr/src/cmd/sgs/elfdump/common/struct_layout_amd64.c
+++ b/usr/src/cmd/sgs/elfdump/common/struct_layout_amd64.c
@@ -396,6 +396,14 @@ static const sl_prlwpname_layout_t prlwpname_layout = {
};
+static const sl_prupanic_layout_t prupanic_layout = {
+ { 0, 1032, 0, 0 }, /* sizeof (prupanic_t) */
+ { 0, 4, 0, 0 }, /* pru_version */
+ { 4, 4, 0, 0 }, /* pru_flags */
+ { 8, 1, 1024, 0 }, /* pru_data[] */
+};
+
+
static const sl_arch_layout_t layout_amd64 = {
@@ -421,6 +429,7 @@ static const sl_arch_layout_t layout_amd64 = {
&prfdinfo_layout,
&prsecflags_layout,
&prlwpname_layout,
+ &prupanic_layout,
};
diff --git a/usr/src/cmd/sgs/elfdump/common/struct_layout_i386.c b/usr/src/cmd/sgs/elfdump/common/struct_layout_i386.c
index 0e37cc5b95..cbdfee90d6 100644
--- a/usr/src/cmd/sgs/elfdump/common/struct_layout_i386.c
+++ b/usr/src/cmd/sgs/elfdump/common/struct_layout_i386.c
@@ -396,6 +396,14 @@ static const sl_prlwpname_layout_t prlwpname_layout = {
};
+static const sl_prupanic_layout_t prupanic_layout = {
+ { 0, 1032, 0, 0 }, /* sizeof (prupanic_t) */
+ { 0, 4, 0, 0 }, /* pru_version */
+ { 4, 4, 0, 0 }, /* pru_flags */
+ { 8, 1, 1024, 0 }, /* pru_data[] */
+};
+
+
static const sl_arch_layout_t layout_i386 = {
@@ -421,6 +429,7 @@ static const sl_arch_layout_t layout_i386 = {
&prfdinfo_layout,
&prsecflags_layout,
&prlwpname_layout,
+ &prupanic_layout,
};
diff --git a/usr/src/cmd/sgs/elfdump/common/struct_layout_sparc.c b/usr/src/cmd/sgs/elfdump/common/struct_layout_sparc.c
index 3e3abf9d2b..1033e887a3 100644
--- a/usr/src/cmd/sgs/elfdump/common/struct_layout_sparc.c
+++ b/usr/src/cmd/sgs/elfdump/common/struct_layout_sparc.c
@@ -396,6 +396,14 @@ static const sl_prlwpname_layout_t prlwpname_layout = {
};
+static const sl_prupanic_layout_t prupanic_layout = {
+ { 0, 1032, 0, 0 }, /* sizeof (prupanic_t) */
+ { 0, 4, 0, 0 }, /* pru_version */
+ { 4, 4, 0, 0 }, /* pru_flags */
+ { 8, 1, 1024, 0 }, /* pru_data[] */
+};
+
+
static const sl_arch_layout_t layout_sparc = {
@@ -421,6 +429,7 @@ static const sl_arch_layout_t layout_sparc = {
&prfdinfo_layout,
&prsecflags_layout,
&prlwpname_layout,
+ &prupanic_layout,
};
diff --git a/usr/src/cmd/sgs/elfdump/common/struct_layout_sparcv9.c b/usr/src/cmd/sgs/elfdump/common/struct_layout_sparcv9.c
index 7ca7b27b1d..b189261c3a 100644
--- a/usr/src/cmd/sgs/elfdump/common/struct_layout_sparcv9.c
+++ b/usr/src/cmd/sgs/elfdump/common/struct_layout_sparcv9.c
@@ -396,6 +396,14 @@ static const sl_prlwpname_layout_t prlwpname_layout = {
};
+static const sl_prupanic_layout_t prupanic_layout = {
+ { 0, 1032, 0, 0 }, /* sizeof (prupanic_t) */
+ { 0, 4, 0, 0 }, /* pru_version */
+ { 4, 4, 0, 0 }, /* pru_flags */
+ { 8, 1, 1024, 0 }, /* pru_data[] */
+};
+
+
static const sl_arch_layout_t layout_sparcv9 = {
@@ -421,6 +429,7 @@ static const sl_arch_layout_t layout_sparcv9 = {
&prfdinfo_layout,
&prsecflags_layout,
&prlwpname_layout,
+ &prupanic_layout,
};
diff --git a/usr/src/cmd/sgs/include/conv.h b/usr/src/cmd/sgs/include/conv.h
index 4133866e86..c549b6beda 100644
--- a/usr/src/cmd/sgs/include/conv.h
+++ b/usr/src/cmd/sgs/include/conv.h
@@ -27,6 +27,7 @@
* Copyright 2012 DEY Storage Systems, Inc. All rights reserved.
* Copyright (c) 2018, Joyent, Inc.
* Copyright 2016 RackTop Systems.
+ * Copyright 2020 Oxide Computer Company
*/
#ifndef _CONV_H
@@ -335,6 +336,13 @@ typedef union {
char buf[CONV_PRSECFLAGS_BUFSIZE];
} Conv_secflags_buf_t;
+/* conv_prupanic() */
+#define CONV_PRUPANIC_BUFSIZE 56
+typedef union {
+ Conv_inv_buf_t inv_buf;
+ char buf[CONV_PRUPANIC_BUFSIZE];
+} Conv_upanic_buf_t;
+
/* conv_cnote_sigset() */
#define CONV_CNOTE_SIGSET_BUFSIZE 639
typedef union {
@@ -350,7 +358,7 @@ typedef union {
} Conv_cnote_fltset_buf_t;
/* conv_cnote_sysset() */
-#define CONV_CNOTE_SYSSET_BUFSIZE 3195
+#define CONV_CNOTE_SYSSET_BUFSIZE 3227
typedef union {
Conv_inv_buf_t inv_buf;
char buf[CONV_CNOTE_SYSSET_BUFSIZE];
@@ -833,6 +841,8 @@ extern const char *conv_cnote_priv(int, Conv_fmt_flags_t,
Conv_inv_buf_t *);
extern const char *conv_prsecflags(secflagset_t, Conv_fmt_flags_t,
Conv_secflags_buf_t *);
+extern const char *conv_prupanic(uint32_t, Conv_fmt_flags_t,
+ Conv_upanic_buf_t *);
extern const char *conv_cnote_psetid(int, Conv_fmt_flags_t,
Conv_inv_buf_t *);
extern const char *conv_cnote_sa_flags(int, Conv_fmt_flags_t,
diff --git a/usr/src/cmd/sgs/libconv/common/corenote.c b/usr/src/cmd/sgs/libconv/common/corenote.c
index bf6d109916..25c51b3549 100644
--- a/usr/src/cmd/sgs/libconv/common/corenote.c
+++ b/usr/src/cmd/sgs/libconv/common/corenote.c
@@ -26,6 +26,7 @@
/*
* Copyright 2012 DEY Storage Systems, Inc. All rights reserved.
* Copyright (c) 2018 Joyent, Inc.
+ * Copyright 2020 Oxide Computer Company
*/
/*
@@ -59,9 +60,9 @@ conv_cnote_type(Word type, Conv_fmt_flags_t fmt_flags,
MSG_NT_PRPRIVINFO, MSG_NT_CONTENT,
MSG_NT_ZONENAME, MSG_NT_FDINFO,
MSG_NT_SPYMASTER, MSG_NT_SECFLAGS,
- MSG_NT_LWPNAME,
+ MSG_NT_LWPNAME, MSG_NT_UPANIC
};
-#if NT_NUM != NT_LWPNAME
+#if NT_NUM != NT_UPANIC
#error "NT_NUM has grown. Update core note types[]"
#endif
static const conv_ds_msg_t ds_types = {
@@ -254,8 +255,8 @@ conv_cnote_syscall(Word sysnum, Conv_fmt_flags_t fmt_flags,
MSG_SYS_MUNMAP, MSG_SYS_FPATHCONF,
MSG_SYS_VFORK, MSG_SYS_FCHDIR,
MSG_SYS_READV, MSG_SYS_WRITEV,
- MSG_SYS_123, MSG_SYS_124,
- MSG_SYS_125, MSG_SYS_126,
+ MSG_SYS_PREADV, MSG_SYS_PWRITEV,
+ MSG_SYS_UPANIC, MSG_SYS_GETRANDOM,
MSG_SYS_MMAPOBJ, MSG_SYS_SETRLIMIT,
MSG_SYS_GETRLIMIT, MSG_SYS_LCHOWN,
MSG_SYS_MEMCNTL, MSG_SYS_GETPMSG,
@@ -1955,10 +1956,10 @@ conv_cnote_fltset(uint32_t *maskarr, int n_mask,
MSG_SYS_FCHDIR_ALT_SIZE /* 120 */ + \
MSG_SYS_READV_ALT_SIZE /* 121 */ + \
MSG_SYS_WRITEV_ALT_SIZE /* 122 */ + \
- MSG_SYS_123_SIZE /* 123 (unused) */ + \
- MSG_SYS_124_SIZE /* 124 (unused) */ + \
- MSG_SYS_125_SIZE /* 125 (unused) */ + \
- MSG_SYS_126_SIZE /* 126 (unused) */ + \
+ MSG_SYS_PREADV_SIZE /* 123 */ + \
+ MSG_SYS_PWRITEV_SIZE /* 124 */ + \
+ MSG_SYS_UPANIC_SIZE /* 125 */ + \
+ MSG_SYS_GETRANDOM_SIZE /* 126 */ + \
MSG_SYS_MMAPOBJ_ALT_SIZE /* 127 */ + \
MSG_SYS_SETRLIMIT_ALT_SIZE /* 128 */ + \
\
@@ -2278,10 +2279,10 @@ conv_cnote_sysset(uint32_t *maskarr, int n_mask,
{ 0x00800000, MSG_SYS_FCHDIR_ALT },
{ 0x01000000, MSG_SYS_READV_ALT },
{ 0x02000000, MSG_SYS_WRITEV_ALT },
- { 0x04000000, MSG_SYS_123 },
- { 0x08000000, MSG_SYS_124 },
- { 0x10000000, MSG_SYS_125 },
- { 0x20000000, MSG_SYS_126 },
+ { 0x04000000, MSG_SYS_PREADV_ALT },
+ { 0x08000000, MSG_SYS_PWRITEV_ALT },
+ { 0x10000000, MSG_SYS_UPANIC_ALT },
+ { 0x20000000, MSG_SYS_GETRANDOM_ALT },
{ 0x40000000, MSG_SYS_MMAPOBJ_ALT },
{ 0x80000000, MSG_SYS_SETRLIMIT_ALT },
{ 0, 0 }
@@ -2641,3 +2642,54 @@ conv_prsecflags(secflagset_t flags, Conv_fmt_flags_t fmt_flags,
return ((const char *)secflags_buf->buf);
}
+
+
+#define UPANICFLGSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
+ MSG_MSG_VALID_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_MSG_ERROR_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ MSG_MSG_TRUNC_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+ CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
+
+/*
+ * Ensure that Conv_upanic_buf_t is large enough:
+ *
+ * UPANICFLGSZ is the real minimum size of the buffer required by
+ * conv_prsecflags(). However, Conv_upanic_buf_t uses CONV_PRUPANIC_BUFSIZE to
+ * set the buffer size. We do things this way because the definition of
+ * UPANICFLGSZ uses information that is not available in the environment of
+ * other programs that include the conv.h header file.
+ */
+#if (CONV_PRUPANIC_BUFSIZE != UPANICFLGSZ)
+#define REPORT_BUFSIZE UPANICFLGSZ
+#include "report_bufsize.h"
+#error "CONV_PRUPANIC_BUFSIZE does not match UPANICFLGSZ"
+#endif
+
+const char *
+conv_prupanic(uint32_t flags, Conv_fmt_flags_t fmt_flags,
+ Conv_upanic_buf_t *upanic_buf)
+{
+ /*
+ * Unfortunately, we cannot directly use the PRUPANIC_FLAG_* macros here
+ * because of the fact that this is also built natively and that would
+ * create an unresolvable flag day.
+ */
+ static Val_desc vda[] = {
+ { 0x01, MSG_MSG_VALID },
+ { 0x02, MSG_MSG_ERROR },
+ { 0x04, MSG_MSG_TRUNC },
+ { 0, 0 }
+ };
+ static CONV_EXPN_FIELD_ARG conv_arg = {
+ NULL, sizeof (upanic_buf->buf)
+ };
+
+ if (flags == 0)
+ return (MSG_ORIG(MSG_GBL_ZERO));
+
+ conv_arg.buf = upanic_buf->buf;
+ conv_arg.oflags = conv_arg.rflags = flags;
+ (void) conv_expn_field(&conv_arg, vda, fmt_flags);
+
+ return ((const char *)upanic_buf->buf);
+}
diff --git a/usr/src/cmd/sgs/libconv/common/corenote.msg b/usr/src/cmd/sgs/libconv/common/corenote.msg
index a36f2bddf7..b8e7530a49 100644
--- a/usr/src/cmd/sgs/libconv/common/corenote.msg
+++ b/usr/src/cmd/sgs/libconv/common/corenote.msg
@@ -25,6 +25,7 @@
#
# Copyright 2012 DEY Storage Systems, Inc. All rights reserved.
# Copyright (c) 2018 Joyent, Inc.
+# Copyright 2020 Oxide Computer Company
#
@ MSG_NT_PRSTATUS "[ NT_PRSTATUS ]"
@@ -50,6 +51,7 @@
@ MSG_NT_SPYMASTER "[ NT_SPYMASTER ]"
@ MSG_NT_SECFLAGS "[ NT_SECFLAGS ]"
@ MSG_NT_LWPNAME "[ NT_LWPNAME ]"
+@ MSG_NT_UPANIC "[ NT_UPANIC ]"
@ MSG_AUXV_AF_SUN_SETUGID "AF_SUN_SETUGID"
@@ -286,6 +288,10 @@
@ MSG_FORBIDNULLMAP "FORBIDNULLMAP"
@ MSG_NOEXECSTACK "NOEXECSTACK"
+@ MSG_MSG_VALID "MSG_VALID"
+@ MSG_MSG_ERROR "MSG_ERROR"
+@ MSG_MSG_TRUNC "MSG_TRUNC"
+
@ MSG_PS_NONE "[ PS_NONE ]"
@ MSG_PS_QUERY "[ PS_QUERY ]"
@ MSG_PS_MYID "[ PS_MYID ]"
@@ -824,10 +830,14 @@
@ MSG_SYS_READV_ALT "readv"
@ MSG_SYS_WRITEV "[ writev ]" # 122
@ MSG_SYS_WRITEV_ALT "writev"
-@ MSG_SYS_123 "123" # 123(u)
-@ MSG_SYS_124 "124" # 124(u)
-@ MSG_SYS_125 "125" # 125(u)
-@ MSG_SYS_126 "126" # 126(u)
+@ MSG_SYS_PREADV "[ preadv ]" # 123
+@ MSG_SYS_PREADV_ALT "preadv"
+@ MSG_SYS_PWRITEV "[ pwritev ]" # 124
+@ MSG_SYS_PWRITEV_ALT "pwritev"
+@ MSG_SYS_UPANIC "[ upanic ]" # 125
+@ MSG_SYS_UPANIC_ALT "upanic"
+@ MSG_SYS_GETRANDOM "[ getrandom ]" # 126
+@ MSG_SYS_GETRANDOM_ALT "getrandom"
@ MSG_SYS_MMAPOBJ "[ mmapobj ]" # 127
@ MSG_SYS_MMAPOBJ_ALT "mmapobj"
@ MSG_SYS_SETRLIMIT "[ setrlimit ]" # 128
diff --git a/usr/src/cmd/truss/main.c b/usr/src/cmd/truss/main.c
index 23c2056314..9b7d7bac54 100644
--- a/usr/src/cmd/truss/main.c
+++ b/usr/src/cmd/truss/main.c
@@ -22,6 +22,7 @@
/*
* Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2015, Joyent, Inc.
+ * Copyright 2020 Oxide Computer Company
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
@@ -59,7 +60,7 @@
*/
typedef struct proc_set {
pid_t pid;
- const char *lwps;
+ const char *lwps;
} proc_set_t;
/*
@@ -684,6 +685,7 @@ main(int argc, char *argv[])
praddset(&traceeven, SYS_open64);
praddset(&traceeven, SYS_vfork);
praddset(&traceeven, SYS_forksys);
+ praddset(&traceeven, SYS_upanic);
/* for I/O buffer dumps, force tracing of read()s and write()s */
if (!isemptyset(&readfd)) {
@@ -723,8 +725,10 @@ main(int argc, char *argv[])
/* special case -- sysexit never reached */
(void) Psysentry(Proc, SYS_exit, TRUE);
(void) Psysentry(Proc, SYS_lwp_exit, TRUE);
+ (void) Psysentry(Proc, SYS_upanic, TRUE);
(void) Psysexit(Proc, SYS_exit, FALSE);
(void) Psysexit(Proc, SYS_lwp_exit, FALSE);
+ (void) Psysexit(Proc, SYS_upanic, FALSE);
Psetsignal(Proc, &signals); /* trace these signals */
Psetfault(Proc, &faults); /* trace these faults */
@@ -1090,6 +1094,7 @@ worker_thread(void *arg)
switch (what) {
case SYS_exit: /* exit() */
case SYS_lwp_exit: /* lwp_exit() */
+ case SYS_upanic: /* upanic() */
case SYS_context: /* [get|set]context() */
if (dotrace && cflag &&
prismember(&trace, what)) {
@@ -2692,7 +2697,7 @@ letgo(private_t *pri)
*/
int
is_empty(const uint32_t *sp, /* pointer to set (array of int32's) */
- size_t n) /* number of int32's in set */
+ size_t n) /* number of int32's in set */
{
if (n) {
do {
diff --git a/usr/src/cmd/truss/systable.c b/usr/src/cmd/truss/systable.c
index 343d18a120..199c3131a1 100644
--- a/usr/src/cmd/truss/systable.c
+++ b/usr/src/cmd/truss/systable.c
@@ -22,6 +22,7 @@
/*
* Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, Joyent, Inc. All rights reserved.
+ * Copyright 2020 Oxide Computer Company
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
@@ -344,7 +345,7 @@ const struct systable systable[] = {
{"writev", 3, DEC, NOV, DEC, HEX, DEC}, /* 122 */
{"preadv", 4, DEC, NOV, DEC, HEX, DEC, DEC}, /* 123 */
{"pwritev", 4, DEC, NOV, DEC, HEX, DEC, DEC}, /* 124 */
-{ NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX},
+{"upanic", 2, DEC, NOV, HEX, DEC}, /* 125 */
{"getrandom", 3, DEC, NOV, IOB, UNS, GRF}, /* 126 */
{"mmapobj", 5, DEC, NOV, DEC, MOB, HEX, HEX, HEX}, /* 127 */
{"setrlimit", 2, DEC, NOV, RLM, HEX}, /* 128 */
diff --git a/usr/src/head/Makefile b/usr/src/head/Makefile
index bc9c57a6a6..87bf0ce786 100644
--- a/usr/src/head/Makefile
+++ b/usr/src/head/Makefile
@@ -203,6 +203,7 @@ HDRS= $($(MACH)_HDRS) \
ucred.h \
ulimit.h \
unistd.h \
+ upanic.h \
userdefs.h \
ustat.h \
utime.h \
diff --git a/usr/src/head/upanic.h b/usr/src/head/upanic.h
new file mode 100644
index 0000000000..be34d02b84
--- /dev/null
+++ b/usr/src/head/upanic.h
@@ -0,0 +1,36 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright 2020 Oxide Computer Company
+ */
+
+#ifndef _UPANIC_H
+#define _UPANIC_H
+
+/*
+ * Support for guaranteed user process abort-like termination.
+ */
+
+#include <sys/feature_tests.h>
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern _NORETURN_KYWD void upanic(const char *, size_t) __NORETURN;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _UPANIC_H */
diff --git a/usr/src/lib/libc/amd64/Makefile b/usr/src/lib/libc/amd64/Makefile
index a8ca8b1234..7ef34a268d 100644
--- a/usr/src/lib/libc/amd64/Makefile
+++ b/usr/src/lib/libc/amd64/Makefile
@@ -279,6 +279,7 @@ COMSYSOBJS= \
ulimit.o \
umask.o \
umount2.o \
+ upanic.o \
utssys.o \
uucopy.o \
vhangup.o \
diff --git a/usr/src/lib/libc/i386/Makefile.com b/usr/src/lib/libc/i386/Makefile.com
index d3e2c51360..e9e9479ac9 100644
--- a/usr/src/lib/libc/i386/Makefile.com
+++ b/usr/src/lib/libc/i386/Makefile.com
@@ -306,6 +306,7 @@ COMSYSOBJS= \
ulimit.o \
umask.o \
umount2.o \
+ upanic.o \
utssys.o \
uucopy.o \
vhangup.o \
diff --git a/usr/src/lib/libc/port/mapfile-vers b/usr/src/lib/libc/port/mapfile-vers
index 0be36d5e6b..6a85e0d37e 100644
--- a/usr/src/lib/libc/port/mapfile-vers
+++ b/usr/src/lib/libc/port/mapfile-vers
@@ -78,6 +78,11 @@ $if _x86 && _ELF64
$add amd64
$endif
+SYMBOL_VERSION ILLUMOS_0.36 {
+ protected:
+ upanic;
+} ILLUMOS_0.35;
+
SYMBOL_VERSION ILLUMOS_0.35 {
protected:
qsort_r;
diff --git a/usr/src/lib/libc/port/sys/upanic.c b/usr/src/lib/libc/port/sys/upanic.c
new file mode 100644
index 0000000000..2edfe4c4ff
--- /dev/null
+++ b/usr/src/lib/libc/port/sys/upanic.c
@@ -0,0 +1,23 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright 2020 Oxide Computer Company
+ */
+
+#include <sys/types.h>
+#include <sys/syscall.h>
+
+void
+upanic(const void *buf, size_t len)
+{
+ (void) syscall(SYS_upanic, buf, len);
+}
diff --git a/usr/src/lib/libc/port/threads/assfail.c b/usr/src/lib/libc/port/threads/assfail.c
index 1c032d8ea7..4af2fc5664 100644
--- a/usr/src/lib/libc/port/threads/assfail.c
+++ b/usr/src/lib/libc/port/threads/assfail.c
@@ -26,10 +26,12 @@
/*
* Copyright (c) 2012, 2014 by Delphix. All rights reserved.
* Copyright 2015 Joyent, Inc.
+ * Copyright 2020 Oxide Computer Company
*/
#include "lint.h"
#include "thr_uberdata.h"
+#include <upanic.h>
const char *panicstr;
ulwp_t *panic_thread;
@@ -60,35 +62,19 @@ grab_assert_lock()
}
static void
-Abort(const char *msg)
+Abort(const char *msg, size_t buflen)
{
ulwp_t *self;
struct sigaction act;
sigset_t sigmask;
- lwpid_t lwpid;
/* to help with core file debugging */
panicstr = msg;
if ((self = __curthread()) != NULL) {
panic_thread = self;
- lwpid = self->ul_lwpid;
- } else {
- lwpid = _lwp_self();
}
- /* set SIGABRT signal handler to SIG_DFL w/o grabbing any locks */
- (void) memset(&act, 0, sizeof (act));
- act.sa_sigaction = SIG_DFL;
- (void) __sigaction(SIGABRT, &act, NULL);
-
- /* delete SIGABRT from the signal mask */
- (void) sigemptyset(&sigmask);
- (void) sigaddset(&sigmask, SIGABRT);
- (void) __lwp_sigmask(SIG_UNBLOCK, &sigmask);
-
- (void) _lwp_kill(lwpid, SIGABRT); /* never returns */
- (void) kill(getpid(), SIGABRT); /* if it does, try harder */
- _exit(127);
+ upanic(msg, buflen);
}
/*
@@ -117,7 +103,7 @@ common_panic(const char *head, const char *why)
if (msg[len1 - 1] != '\n')
msg[len1++] = '\n';
(void) __write(2, msg, len1);
- Abort(msg);
+ Abort(msg, sizeof (msg));
}
void
@@ -246,7 +232,7 @@ lock_error(const mutex_t *mp, const char *who, void *cv, const char *msg)
(void) strcat(buf, "\n\n");
(void) __write(2, buf, strlen(buf));
if (udp->uberflags.uf_thread_error_detection >= 2)
- Abort(buf);
+ Abort(buf, sizeof (buf));
assert_thread = NULL;
(void) _lwp_mutex_unlock(&assert_lock);
if (self != NULL)
@@ -335,7 +321,7 @@ rwlock_error(const rwlock_t *rp, const char *who, const char *msg)
(void) strcat(buf, "\n\n");
(void) __write(2, buf, strlen(buf));
if (udp->uberflags.uf_thread_error_detection >= 2)
- Abort(buf);
+ Abort(buf, sizeof (buf));
assert_thread = NULL;
(void) _lwp_mutex_unlock(&assert_lock);
if (self != NULL)
@@ -383,7 +369,7 @@ thread_error(const char *msg)
(void) strcat(buf, "\n\n");
(void) __write(2, buf, strlen(buf));
if (udp->uberflags.uf_thread_error_detection >= 2)
- Abort(buf);
+ Abort(buf, sizeof (buf));
assert_thread = NULL;
(void) _lwp_mutex_unlock(&assert_lock);
if (self != NULL)
@@ -455,7 +441,7 @@ __assfail(const char *assertion, const char *filename, int line_num)
* if (self != NULL)
* exit_critical(self);
*/
- Abort(buf);
+ Abort(buf, sizeof (buf));
}
/*
diff --git a/usr/src/lib/libc/sparc/Makefile.com b/usr/src/lib/libc/sparc/Makefile.com
index 8ecec57516..7308fc64f6 100644
--- a/usr/src/lib/libc/sparc/Makefile.com
+++ b/usr/src/lib/libc/sparc/Makefile.com
@@ -322,6 +322,7 @@ COMSYSOBJS= \
ulimit.o \
umask.o \
umount2.o \
+ upanic.o \
utssys.o \
uucopy.o \
vhangup.o \
diff --git a/usr/src/lib/libc/sparcv9/Makefile.com b/usr/src/lib/libc/sparcv9/Makefile.com
index 7036b2e20d..9b7ff53999 100644
--- a/usr/src/lib/libc/sparcv9/Makefile.com
+++ b/usr/src/lib/libc/sparcv9/Makefile.com
@@ -304,6 +304,7 @@ COMSYSOBJS= \
ulimit.o \
umask.o \
umount2.o \
+ upanic.o \
utssys.o \
uucopy.o \
vhangup.o \
diff --git a/usr/src/lib/libproc/common/Pcontrol.c b/usr/src/lib/libproc/common/Pcontrol.c
index 5a135aef17..d9e3c8b9ea 100644
--- a/usr/src/lib/libproc/common/Pcontrol.c
+++ b/usr/src/lib/libproc/common/Pcontrol.c
@@ -1312,6 +1312,8 @@ Psecflags(struct ps_prochandle *P, prsecflags_t **psf)
if ((ret = P->ops.pop_secflags(P, psf, P->data)) == 0) {
if ((*psf)->pr_version != PRSECFLAGS_VERSION_1) {
+ free(*psf);
+ *psf = NULL;
errno = EINVAL;
return (-1);
}
diff --git a/usr/src/lib/libproc/common/Pcontrol.h b/usr/src/lib/libproc/common/Pcontrol.h
index 0eed5042a4..4aa4091d1f 100644
--- a/usr/src/lib/libproc/common/Pcontrol.h
+++ b/usr/src/lib/libproc/common/Pcontrol.h
@@ -171,6 +171,7 @@ typedef struct core_info { /* information specific to core files */
priv_impl_info_t *core_ppii; /* NOTE entry for core_privinfo */
char *core_zonename; /* zone name from core file */
prsecflags_t *core_secflags; /* secflags from core file */
+ prupanic_t *core_upanic; /* upanic from core file */
#if defined(__i386) || defined(__amd64)
struct ssd *core_ldt; /* LDT entries from core file */
uint_t core_nldt; /* number of LDT entries in core file */
diff --git a/usr/src/lib/libproc/common/Pcore.c b/usr/src/lib/libproc/common/Pcore.c
index cd539876b1..39424fad67 100644
--- a/usr/src/lib/libproc/common/Pcore.c
+++ b/usr/src/lib/libproc/common/Pcore.c
@@ -245,6 +245,8 @@ Pfini_core(struct ps_prochandle *P, void *data)
free(core->core_zonename);
if (core->core_secflags != NULL)
free(core->core_secflags);
+ if (core->core_upanic != NULL)
+ free(core->core_upanic);
#ifdef __x86
if (core->core_ldt != NULL)
free(core->core_ldt);
@@ -1201,6 +1203,34 @@ err:
return (-1);
}
+static int
+note_upanic(struct ps_prochandle *P, size_t nbytes)
+{
+ core_info_t *core = P->data;
+ prupanic_t *pru;
+
+ if (core->core_upanic != NULL)
+ return (0);
+
+ if (sizeof (*pru) != nbytes) {
+ dprintf("Pgrab_core: NT_UPANIC changed size."
+ " Need to handle a version change?\n");
+ return (-1);
+ }
+
+ if (nbytes != 0 && ((pru = malloc(nbytes)) != NULL)) {
+ if (read(P->asfd, pru, nbytes) != nbytes) {
+ dprintf("Pgrab_core: failed to read NT_UPANIC\n");
+ free(pru);
+ return (-1);
+ }
+
+ core->core_upanic = pru;
+ }
+
+ return (0);
+}
+
/*ARGSUSED*/
static int
note_notsup(struct ps_prochandle *P, size_t nbytes)
@@ -1266,6 +1296,7 @@ static int (*nhdlrs[])(struct ps_prochandle *, size_t) = {
note_spymaster, /* 23 NT_SPYMASTER */
note_secflags, /* 24 NT_SECFLAGS */
note_lwpname, /* 25 NT_LWPNAME */
+ note_upanic /* 26 NT_UPANIC */
};
static void
@@ -2880,3 +2911,37 @@ Pgrab_core(const char *core, const char *aout, int gflag, int *perr)
return (NULL);
}
+
+int
+Pupanic(struct ps_prochandle *P, prupanic_t **pru)
+{
+ core_info_t *core;
+
+ if (P->state != PS_DEAD) {
+ errno = ENODATA;
+ return (-1);
+ }
+
+ core = P->data;
+ if (core->core_upanic == NULL) {
+ errno = ENOENT;
+ return (-1);
+ }
+
+ if (core->core_upanic->pru_version != PRUPANIC_VERSION_1) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ if ((*pru = calloc(1, sizeof (prupanic_t))) == NULL)
+ return (-1);
+ (void) memcpy(*pru, core->core_upanic, sizeof (prupanic_t));
+
+ return (0);
+}
+
+void
+Pupanic_free(prupanic_t *pru)
+{
+ free(pru);
+}
diff --git a/usr/src/lib/libproc/common/libproc.h b/usr/src/lib/libproc/common/libproc.h
index cdf789a621..a73f8af647 100644
--- a/usr/src/lib/libproc/common/libproc.h
+++ b/usr/src/lib/libproc/common/libproc.h
@@ -792,6 +792,12 @@ extern int proc_finistdio(void);
typedef int proc_fdinfo_f(void *, const prfdinfo_t *);
extern int Pfdinfo_iter(struct ps_prochandle *, proc_fdinfo_f *, void *);
+/*
+ * NT_UPANIC information.
+ */
+extern int Pupanic(struct ps_prochandle *, prupanic_t **);
+extern void Pupanic_free(prupanic_t *);
+
#ifdef __cplusplus
}
#endif
diff --git a/usr/src/lib/libproc/common/mapfile-vers b/usr/src/lib/libproc/common/mapfile-vers
index 1da5918393..61934de499 100644
--- a/usr/src/lib/libproc/common/mapfile-vers
+++ b/usr/src/lib/libproc/common/mapfile-vers
@@ -307,6 +307,8 @@ SYMBOL_VERSION SUNWprivate_1.1 {
Punsetflags;
Pupdate_maps;
Pupdate_syms;
+ Pupanic;
+ Pupanic_free;
Pwait;
Pwrite;
Pxcreate;
diff --git a/usr/src/lib/libproc/common/proc_names.c b/usr/src/lib/libproc/common/proc_names.c
index 314b01fbcd..65332da273 100644
--- a/usr/src/lib/libproc/common/proc_names.c
+++ b/usr/src/lib/libproc/common/proc_names.c
@@ -24,6 +24,7 @@
* Copyright (c) 2015, Joyent, Inc. All rights reserved.
* Copyright 2019, Carlos Neira <cneirabustos@gmail.com>
* Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
+ * Copyright 2020 Oxide Computer Company
*/
#include <stdio.h>
@@ -241,7 +242,7 @@ static const char *const systable[] = {
"writev", /* 122 */
"preadv", /* 123 */
"pwritev", /* 124 */
- NULL, /* 125 */
+ "upanic", /* 125 */
"getrandom", /* 126 */
"mmapobj", /* 127 */
"setrlimit", /* 128 */
diff --git a/usr/src/man/man2/Makefile b/usr/src/man/man2/Makefile
index 8f664a56fc..60ed81daad 100644
--- a/usr/src/man/man2/Makefile
+++ b/usr/src/man/man2/Makefile
@@ -155,6 +155,7 @@ MANFILES= Intro.2 \
umount.2 \
uname.2 \
unlink.2 \
+ upanic.2 \
ustat.2 \
utime.2 \
utimes.2 \
diff --git a/usr/src/man/man2/upanic.2 b/usr/src/man/man2/upanic.2
new file mode 100644
index 0000000000..351b7939d0
--- /dev/null
+++ b/usr/src/man/man2/upanic.2
@@ -0,0 +1,95 @@
+.\"
+.\" This file and its contents are supplied under the terms of the
+.\" Common Development and Distribution License ("CDDL"), version 1.0.
+.\" You may only use this file in accordance with the terms of version
+.\" 1.0 of the CDDL.
+.\"
+.\" A full copy of the text of the CDDL should have accompanied this
+.\" source. A copy of the CDDL is also available via the Internet at
+.\" http://www.illumos.org/license/CDDL.
+.\"
+.\"
+.\" Copyright 2020 Oxide Computer Company
+.\"
+.Dd October 31, 2020
+.Dt UPANIC 2
+.Os
+.Sh NAME
+.Nm upanic
+.Nd user process panic
+.Sh SYNOPSIS
+.In upanic.h
+.Ft void noreturn
+.Fo upanic
+.Fa "const char *msg"
+.Fa "size_t len"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn upanic
+system call terminates the calling process and generates a core file in
+the process, subject to the current core file settings as described in
+.Xr core 4
+and controlled by
+.Xr coreadm 1M .
+.Pp
+Unlike
+.Xr abort 3C ,
+signals are not generated, which avoids two related challenges:
+.Bl -enum
+.It
+A signal handler attempting to catch a
+.Dv SIGABRT .
+.It
+Needing to make multiple system calls and potentially unmasking the
+signal.
+.El
+.Pp
+The
+.Fn upanic
+system call allows an optional message to be transmitted that will be
+put in a
+.Dv NT_UPANIC
+elf note in the resulting core file.
+If a message is not desired, then one should pass
+.Dv NULL
+for
+.Fa msg .
+In general, it is expected that
+.Fa msg
+is a character string with a human-readable message; however, it may
+include binary data.
+The system will copy
+.Fa len
+bytes regardless of whether the string has a NUL character to terminate
+it or not.
+If
+.Fa msg
+points to an invalid value or
+.Fa len
+is a size that is larger than the system's internal maximum size, then
+the process will still terminate; however, this will be noted in the
+.Dv NT_UPANIC
+elf note.
+.Pp
+The
+.Fn upanic
+system call is illumos-specific and not portable to other systems.
+For portable applications, instead use
+.Xr abort 3C .
+.Sh RETURN VALUES
+The
+.Fn upanic
+system call does not return.
+It always terminates the process.
+.Sh INTERFACE STABILITY
+.Sy Committed
+.Sh MT-LEVEL
+.Sy Async-Signal-Safe
+.Sh SEE ALSO
+.Xr elfdump 1 ,
+.Xr mdb 1 ,
+.Xr coreadm 1M ,
+.Xr abort 3 ,
+.Xr upanic.h 3HEAD ,
+.Xr core 4
diff --git a/usr/src/man/man3head/Makefile b/usr/src/man/man3head/Makefile
index e06cc32e57..c7889080a9 100644
--- a/usr/src/man/man3head/Makefile
+++ b/usr/src/man/man3head/Makefile
@@ -103,6 +103,7 @@ MANFILES= acct.h.3head \
ulimit.h.3head \
un.h.3head \
unistd.h.3head \
+ upanic.h.3head \
utime.h.3head \
utmpx.h.3head \
utsname.h.3head \
diff --git a/usr/src/man/man3head/upanic.h.3head b/usr/src/man/man3head/upanic.h.3head
new file mode 100644
index 0000000000..871cbbda7a
--- /dev/null
+++ b/usr/src/man/man3head/upanic.h.3head
@@ -0,0 +1,41 @@
+.\"
+.\" This file and its contents are supplied under the terms of the
+.\" Common Development and Distribution License ("CDDL"), version 1.0.
+.\" You may only use this file in accordance with the terms of version
+.\" 1.0 of the CDDL.
+.\"
+.\" A full copy of the text of the CDDL should have accompanied this
+.\" source. A copy of the CDDL is also available via the Internet at
+.\" http://www.illumos.org/license/CDDL.
+.\"
+.\"
+.\" Copyright 2020 Oxide Computer Company
+.\"
+.Dd October 31, 2020
+.Dt UPANIC.H 3HEAD
+.Os
+.Sh NAME
+.Nm upanic.h
+.Nd user panic header
+.Sh SYNOPSIS
+.In upanic.h
+.Sh DESCRIPTION
+The
+.In upanic.h
+header provides illumos-specific routines that provide a means for a
+process to terminate itself with an optional message left in a core
+file.
+.Pp
+The
+.In upanic.h
+header defines the following functions:
+.Bl -tag -width upanic
+.It Xr upanic 2
+Panic a user process with an optional message, terminating it and
+generating core files.
+.El
+.Sh INTERFACE STABILITY
+.Sy Committed
+.Sh SEE ALSO
+.Xr upanic 2 ,
+.Xr core 4
diff --git a/usr/src/man/man3lib/libproc.3lib b/usr/src/man/man3lib/libproc.3lib
index d68897dad4..72f1a22387 100644
--- a/usr/src/man/man3lib/libproc.3lib
+++ b/usr/src/man/man3lib/libproc.3lib
@@ -13,7 +13,7 @@
.\" Copyright (c) 2019 Carlos Neira <cneirabustos@gmail.com>
.\" Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
.\"
-.Dd May 22, 2020
+.Dd October 31, 2020
.Dt LIBPROC 3LIB
.Os
.Sh NAME
@@ -240,7 +240,8 @@ manipulation of the process itself.
.It Sy Pstatus Ta Sy Pstop
.It Sy Pstopstatus Ta Sy Psync
.It Sy Psysentry Ta Sy Psysexit
-.It Sy Puname Ta Sy Punsetflags
+.It Sy Puname Ta Sy Pupanic
+.It Sy Pupanic_free Ta Sy Punsetflags
.It Sy Pupdate_maps Ta Sy Pupdate_syms
.It Sy Pwait Ta Sy Pwrite
.It Sy Pxecbkpt Ta Sy Pxecwapt
@@ -1208,6 +1209,8 @@ changes may occur which break both source and binary compatibility.
.Xr Psysentry 3PROC ,
.Xr Psysexit 3PROC ,
.Xr Puname 3PROC ,
+.Xr Pupanic 3PROC ,
+.Xr Pupanic_free 3PROC ,
.Xr Punsetflags 3PROC ,
.Xr Pupdate_maps 3PROC ,
.Xr Pupdate_syms 3PROC ,
diff --git a/usr/src/man/man3proc/Makefile b/usr/src/man/man3proc/Makefile
index 422bc9a517..a0963ce22e 100644
--- a/usr/src/man/man3proc/Makefile
+++ b/usr/src/man/man3proc/Makefile
@@ -161,6 +161,7 @@ MANFILES= \
Psync.3proc \
Psysentry.3proc \
Puname.3proc \
+ Pupanic.3proc \
Pupdate_maps.3proc \
Pupdate_syms.3proc \
Pwrite.3proc \
@@ -265,6 +266,7 @@ MANLINKS= \
Psymbol_iter_by_lmid.3proc \
Psymbol_iter_by_name.3proc \
Psysexit.3proc \
+ Pupanic_free.3proc \
Punsetflags.3proc \
Pwait.3proc \
Pxcreate.3proc \
@@ -383,6 +385,8 @@ Lclearsig.3proc := LINKSRC = Pclearsig.3proc
Lsetrun.3proc := LINKSRC = Psetrun.3proc
+Pupanic_free.3proc := LINKSRC = Pupanic.3proc
+
Pzonepath.3proc := LINKSRC = Pzonename.3proc
Pzoneroot.3proc := LINKSRC = Pzonename.3proc
diff --git a/usr/src/man/man3proc/Pupanic.3proc b/usr/src/man/man3proc/Pupanic.3proc
new file mode 100644
index 0000000000..975ca08eec
--- /dev/null
+++ b/usr/src/man/man3proc/Pupanic.3proc
@@ -0,0 +1,103 @@
+.\"
+.\" This file and its contents are supplied under the terms of the
+.\" Common Development and Distribution License ("CDDL"), version 1.0.
+.\" You may only use this file in accordance with the terms of version
+.\" 1.0 of the CDDL.
+.\"
+.\" A full copy of the text of the CDDL should have accompanied this
+.\" source. A copy of the CDDL is also available via the Internet at
+.\" http://www.illumos.org/license/CDDL.
+.\"
+.\"
+.\" Copyright 2020 Oxide Comptuer Company
+.\"
+.Dd October 31, 2020
+.Dt PUPANIC 3PROC
+.Os
+.Sh NAME
+.Nm Pupanic ,
+.Nm Pupanic_free
+.Nd get upanic information from a core file
+.Sh LIBRARY
+.Lb libproc
+.Sh SYNOPSIS
+.In libproc.h
+.Ft int
+.Fo Pupanic
+.Fa "struct ps_prochandle *P"
+.Fa "prupanic_t **prup"
+.Fc
+.Ft void
+.Fo Pupanic_free
+.Fa "prupanic_t *pru"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn Pupanic
+function copies the contents of the
+.Dv NT_UPANIC
+elf note from the process handle
+.Fa P
+that corresponds to a core file into
+.Fa prup .
+.Pp
+The library will allocate the memory needed for a
+.Ft prupanic_t
+and it is the caller's responsibility to release it by calling the
+.Fn Pupanic_free
+function with the returned data when they are done with the data.
+.Pp
+The allocated data stored in
+.Fa prup
+has a lifetime independent of the underlying process handle
+.Fa P .
+That is, it is safe to continue using it whether the process handle is
+still valid or has been released with
+.Xr Pfree 3PROC .
+.Pp
+If the process handle doesn't correspond to a core file or this note is
+not present in the core file, then the
+.Fn Pupanic
+function will fail.
+.Sh RETURN VALUES
+Upon successful completion, the
+.Fn Pupanic
+function returns
+.Sy 0
+and stores the allocated
+.Ft prupanic_t
+structure in
+.Fa prup .
+Otherwise
+.Sy -1
+is returned
+and
+.Vt errno
+is set to indicate the error.
+.Sh ERRORS
+The
+.Fn Pupanic
+function will fail if:
+.Bl -tag -width Er
+.It Er ENODATA
+The process handle
+.Fa P
+does not correspond to a core file.
+.It Er ENOENT
+The core file does not have a
+.Dv NT_UPANIC
+elf note.
+.It Er EAGAIN, Er ENOMEM
+An underlying memory allocation failed.
+.El
+.Sh INTERFACE STABILITY
+.Sy Uncommitted
+.Sh MT-LEVEL
+See
+.Sy LOCKING
+in
+.Xr libproc 3LIB .
+.Sh SEE ALSO
+.Xr upanic 3C ,
+.Xr libproc 3LIB ,
+.Xr core 4
diff --git a/usr/src/man/man4/core.4 b/usr/src/man/man4/core.4
index a718f93159..95c7fea692 100644
--- a/usr/src/man/man4/core.4
+++ b/usr/src/man/man4/core.4
@@ -1,482 +1,583 @@
-'\" te
+'\"
.\" Copyright (C) 2008, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 2012 DEY Storage Systems, Inc. All rights reserved.
.\" Copyright (c) 2013, Joyent, Inc. All rights reserved.
.\" Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
+.\" Copyright 2020 Oxide Computer Company
.\" Copyright 1989 AT&T
-.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
-.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
-.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH CORE 4 "Jan 6, 2020"
-.SH NAME
-core \- process core file
-.SH DESCRIPTION
+.\"
+.\" The contents of this file are subject to the terms of the
+.\" Common Development and Distribution License (the "License").
+.\" You may not use this file except in compliance with the License.
+.\"
+.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+.\" or http://www.opensolaris.org/os/licensing.
+.\" See the License for the specific language governing permissions
+.\" and limitations under the License.
+.\"
+.\" When distributing Covered Code, include this CDDL HEADER in each
+.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+.\" If applicable, add the following below this CDDL HEADER, with the
+.\" fields enclosed by brackets "[]" replaced with your own identifying
+.\" information: Portions Copyright [yyyy] [name of copyright owner]
+.\"
+.Dd October 31, 2020
+.Dt CORE 4
+.Os
+.Sh NAME
+.Nm core
+.Nd process core file
+.Sh DESCRIPTION
The operating system writes out a core file for a process when the process is
-terminated due to receiving certain signals. A core file is a disk copy of the
-contents of the process address space at the time the process received the
-signal, along with additional information about the state of the process. This
-information can be consumed by a debugger. Core files can also be generated by
-applying the \fBgcore\fR(1) utility to a running process.
-.sp
-.LP
+terminated due to receiving certain signals.
+A core file is a disk copy of the contents of the process address space at the
+time the process received the signal, along with additional information about
+the state of the process.
+This information can be consumed by a debugger.
+Core files can also be generated by applying the
+.Xr gcore 1
+utility to a running process.
+.Pp
Typically, core files are produced following abnormal termination of a process
-resulting from a bug in the corresponding application. Whatever the cause, the
-core file itself provides invaluable information to the programmer or support
-engineer to aid in diagnosing the problem. The core file can be inspected using
-a debugger such as \fBdbx\fR(1) or \fBmdb\fR(1) or by applying one of the
-\fBproc\fR(1) tools.
-.sp
-.LP
+resulting from a bug in the corresponding application.
+Whatever the cause, the core file itself provides invaluable information to the
+programmer or support engineer to aid in diagnosing the problem.
+The core file can be inspected using a debugger such as
+.Xr mdb 1 ,
+gdb, dbx, or or by applying one of the
+.Xr proc 1
+tools.
+.Pp
The operating system attempts to create up to two core files for each
abnormally terminating process, using a global core file name pattern and a
-per-process core file name pattern. These patterns are expanded to determine
-the pathname of the resulting core files, and can be configured by
-\fBcoreadm\fR(1M). By default, the global core file pattern is disabled and not
-used, and the per-process core file pattern is set to \fBcore\fR. Therefore, by
-default, the operating system attempts to create a core file named \fBcore\fR
+per-process core file name pattern.
+These patterns are expanded to determine the pathname of the resulting core
+files, and can be configured by
+.Xr coreadm 1M .
+By default, the global core file pattern is disabled and not used, and the
+per-process core file pattern is set to
+.Sy core .
+Therefore, by default, the operating system attempts to create a core file named
+.Pa core
in the process's current working directory.
-.sp
-.LP
+.Pp
A process terminates and produces a core file whenever it receives one of the
-signals whose default disposition is to cause a core dump. The list of signals
-that result in generating a core file is shown in \fBsignal.h\fR(3HEAD).
+signals whose default disposition is to cause a core dump or the
+.Xr upanic 2
+system call is used.
+The list of signals that result in generating a core file is shown in
+.Xr signal.h 3HEAD .
Therefore, a process might not produce a core file if it has blocked or
-modified the behavior of the corresponding signal. Additionally, no core dump
-can be created under the following conditions:
-.RS +4
-.TP
-.ie t \(bu
-.el o
+modified the behavior of the corresponding signal.
+Additionally, no core dump can be created under the following conditions:
+.Bl -bullet
+.It
If normal file and directory access permissions prevent the creation or
modification of the per-process core file pathname by the current process user
-and group ID. This test does not apply to the global core file pathname
-because, regardless of the UID of the process dumping core, the attempt to
-write the global core file is made as the superuser.
-.RE
-.RS +4
-.TP
-.ie t \(bu
-.el o
-Core files owned by the user \fBnobody\fR will not be produced. For example,
-core files generated for the superuser on an NFS directory are owned by
-\fBnobody\fR and are, therefore, not written.
-.RE
-.RS +4
-.TP
-.ie t \(bu
-.el o
+and group ID.
+This test does not apply to the global core file pathname because, regardless of
+the UID of the process dumping core, the attempt to write the global core file
+is made as the superuser.
+.It
+Core files owned by the user
+.Sy nobody
+will not be produced.
+For example, core files generated for the superuser on an NFS directory are
+owned by
+.Sy nobody
+and are, therefore, not written.
+.It
If the core file pattern expands to a pathname that contains intermediate
-directory components that do not exist. For example, if the global pattern is
-set to \fB/var/core/%n/core.%p\fR, and no directory \fB/var/core/`uname -n`\fR
+directory components that do not exist.
+For example, if the global pattern is set to
+.Pa /var/core/%n/core.%p ,
+and no directory
+.Pa /var/core/`uname -n`
has been created, no global core files are produced.
-.RE
-.RS +4
-.TP
-.ie t \(bu
-.el o
+.It
If the destination directory is part of a filesystem that is mounted read-only.
-.RE
-.RS +4
-.TP
-.ie t \(bu
-.el o
-If the resource limit \fBRLIMIT_CORE\fR has been set to \fB0\fR for the
-process, no per-process core file is produced. Refer to \fBsetrlimit\fR(2) and
-\fBulimit\fR(1) for more information on resource limits.
-.RE
-.RS +4
-.TP
-.ie t \(bu
-.el o
+.It
+If the resource limit
+.Dv RLIMIT_CORE
+has been set to
+.Sy 0
+for the
+process, no per-process core file is produced.
+Refer to
+.Xr setrlimit 2
+and
+.Xr ulimit 1
+for more information on resource limits.
+.It
If the core file name already exists in the destination directory and is not a
-regular file (that is, is a symlink, block or character special-file, and so
-forth).
-.RE
-.RS +4
-.TP
-.ie t \(bu
-.el o
-If the kernel cannot open the destination file \fBO_EXCL\fR, which can occur if
-same file is being created by another process simultaneously.
-.RE
-.RS +4
-.TP
-.ie t \(bu
-.el o
+regular file
+.Pq that is, is a symlink, block or character special-file, and so forth .
+.It
+If the kernel cannot open the destination file
+.Dv O_EXCL ,
+which can occur if same file is being created by another process simultaneously.
+.It
If the process's effective user ID is different from its real user ID or if its
-effective group ID is different from its real group ID. Similarly, set-user-ID
-and set-group-ID programs do not produce core files as this could potentially
-compromise system security. These processes can be explicitly granted
-permission to produce core files using \fBcoreadm\fR(1M), at the risk of
-exposing secure information.
-.RE
-.sp
-.LP
+effective group ID is different from its real group ID.
+Similarly, set-user-ID and set-group-ID programs do not produce core files as
+this could potentially compromise system security.
+These processes can be explicitly granted permission to produce core files using
+.Xr coreadm 1M ,
+at the risk of exposing secure information.
+.El
+.Pp
The core file contains all the process information pertinent to debugging:
-contents of hardware registers, process status, and process data. The format of
-a core file is object file specific.
-.sp
-.LP
-For ELF executable programs (see \fBa.out\fR(4)), the core file generated is
-also an ELF file, containing ELF program and file headers. The \fBe_type\fR
-field in the file header has type \fBET_CORE\fR. The program header contains an
-entry for every segment that was part of the process address space, including
-shared library segments. The contents of the mappings specified by
-\fBcoreadm\fR(1M) are also part of the core image. Each program header has its
-\fBp_memsz\fR field set to the size of the mapping. The program headers that
-represent mappings whose data is included in the core file have their
-\fBp_filesz\fR field set the same as \fBp_memsz\fR, otherwise \fBp_filesz\fR is
-\fBzero\fR.
-.sp
-.LP
-A mapping's data can be excluded due to the core file content settings (see
-\fBcoreadm\fR(1M)), due to a failure, or due to a signal received after
-core dump initiation but before its completion. If the data is excluded
-because of a failure, the program header entry will have the
-\fBPF_SUNW_FAILURE\fR flag
-set in its \fBp_flags\fR field; if the data is excluded because of a signal,
-the segment's \fBp_flags\fR field will have the \fBPF_SUNW_KILLED\fR
+contents of hardware registers, process status, and process data.
+The format of a core file is object file specific.
+.Pp
+For ELF executable programs
+.Po
+see
+.Xr a.out 4
+.Pc ,
+the core file generated is also an ELF file, containing ELF program and file
+headers.
+The
+.Fa e_type
+field in the file header has type
+.Dv ET_CORE .
+The program header contains an entry for every segment that was part of the
+process address space, including shared library segments.
+The contents of the mappings specified by
+.Xr coreadm 1M
+are also part of the core image.
+Each program header has its
+.Fa p_memsz
+field set to the size of the mapping.
+The program headers that represent mappings whose data is included in the core
+file have their
+.Fa p_filesz
+field set the same as
+.Fa p_memsz ,
+otherwise
+.Fa p_filesz
+is
+.Sy zero .
+.Pp
+A mapping's data can be excluded due to the core file content settings
+.Po
+see
+.Xr coreadm 1M
+.Pc ,
+due to a failure, or due to a signal received after core dump initiation but
+before its completion.
+If the data is excluded because of a failure, the program header entry will
+have the
+.Dv PF_SUNW_FAILURE
+flag set in its
+.Fa p_flags
+field; if the data is excluded because of a signal, the segment's
+.Fa p_flags
+field will have the
+.Dv PF_SUNW_KILLED
flag set.
-.sp
-.LP
-The program headers of an \fBELF\fR core file also contain entries for two
-\fBNOTE\fR segments, each containing several note entries as described below.
-The note entry header and core file note type (\fBn_type\fR) definitions are
-contained in <\fBsys/elf.h\fR>. The first \fBNOTE\fR segment exists for binary
-compatibility with old programs that deal with core files. It contains
-structures defined in <\fBsys/old_procfs.h\fR>. New programs should recognize
-and skip this \fBNOTE\fR segment, advancing instead to the new \fBNOTE\fR
-segment. The old \fBNOTE\fR segment is deleted from core files in a future
-release.
-.sp
-.LP
-The old \fBNOTE\fR segment contains the following entries. Each has entry name
-\fB"CORE"\fR and presents the contents of a system structure:
-.sp
-.ne 2
-.na
-\fB\fBprpsinfo_t\fR\fR
-.ad
-.RS 16n
-\fBn_type\fR: \fBNT_PRPSINFO\fR. This entry contains information of interest to
-the \fBps\fR(1) command, such as process status, \fBCPU\fR usage, \fBnice\fR
-value, controlling terminal, user-ID, process-ID, the name of the executable,
-and so forth. The \fBprpsinfo_t\fR structure is defined in
-<\fBsys/old_procfs.h\fR>.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBchar\fR array\fR
-.ad
-.RS 16n
-\fBn_type\fR: \fBNT_PLATFORM\fR. This entry contains a string describing the
-specific model of the hardware platform on which this core file was created.
-This information is the same as provided by \fBsysinfo\fR(2) when invoked with
-the command \fBSI_PLATFORM\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBauxv_t\fR array\fR
-.ad
-.RS 16n
-\fBn_type\fR: \fBNT_AUXV\fR. This entry contains the array of \fBauxv_t\fR
+.Pp
+The program headers of an
+.Sy ELF
+core file also contain entries for two
+.Sy NOTE
+segments, each containing several note entries as described below.
+The note entry header and core file note type
+.Pq Fa n_type
+definitions are contained in
+.In sys/elf.h .
+The first
+.Sy NOTE
+segment exists for binary compatibility with old programs that deal with core
+files.
+It contains structures defined in
+.In sys/old_procfs.h .
+New programs should recognize and skip this
+.Sy BNOTE
+segment, advancing instead to the new
+.Sy NOTE
+segment.
+The old
+.Sy NOTE
+segment is deleted from core files in a future release.
+.Pp
+The old
+.Sy NOTE
+segment contains the following entries.
+Each has entry name
+.Sy "CORE"
+and presents the contents of a system structure:
+.Bl -tag -width prpsinfo_t
+.It Vt prpsinfo_t
+.Fa n_type :
+.Dv NT_PRPSINFO .
+This entry contains information of interest to the
+.Xr ps 1
+command, such as process status, CPU usage, nice value, controlling terminal,
+user-ID, process-ID, the name of the executable, and so forth.
+The
+.Vt prpsinfo_t
+structure is defined in
+.In sys/old_procfs.h .
+.It Vt char[]
+.Fa n_type :
+.Dv NT_PLATFORM .
+This entry contains a string describing the specific model of the hardware
+platform on which this core file was created.
+This information is the same as provided by
+.Xr sysinfo 2
+when invoked with the command
+.Dv SI_PLATFORM .
+.It Vt auxv_t[]
+.Fa n_type :
+.Dv NT_AUXV .
+This entry contains the array of
+.Vt Bauxv_t
structures that was passed by the operating system as startup information to
-the dynamic linker. Auxiliary vector information is defined in
-<\fBsys/auxv.h\fR>.
-.RE
-
-.sp
-.LP
+the dynamic linker.
+Auxiliary vector information is defined in
+.In sys/auxv.h .
+.El
+.Pp
Following these entries, for each active (non-zombie) light-weight process
-(LWP) in the process, the old \fBNOTE\fR segment contains an entry with a
-\fBprstatus_t\fR structure, plus other optionally-present entries describing
-the LWP, as follows:
-.sp
-.ne 2
-.na
-\fB\fBprstatus_t\fR\fR
-.ad
-.RS 16n
-\fBn_type\fR: \fBNT_PRSTATUS\fR. This structure contains things of interest to
-a debugger from the operating system, such as the general registers, signal
-dispositions, state, reason for stopping, process-ID, and so forth. The
-\fBprstatus_t\fR structure is defined in <\fBsys/old_procfs.h\fR>.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBprfpregset_t\fR\fR
-.ad
-.RS 16n
-\fBn_type\fR: \fBNT_PRFPREG\fR. This entry is present only if the \fBLWP\fR
-used the floating-point hardware. It contains the floating-point registers. The
-\fBprfpregset_t\fR structure is defined in <\fBsys/procfs_isa.h\fR>.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBgwindows_t\fR\fR
-.ad
-.RS 16n
-\fBn_type\fR: \fBNT_GWINDOWS\fR. This entry is present only on a SPARC machine
-and only if the system was unable to flush all of the register windows to the
-stack. It contains all of the unspilled register windows. The \fBgwindows_t\fR
-structure is defined in <\fBsys/regset.h\fR>.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBprxregset_t\fR\fR
-.ad
-.RS 16n
-\fBn_type\fR: \fBNT_PRXREG\fR. This entry is present only if the machine has
-extra register state associated with it. It contains the extra register state.
-The \fBprxregset_t\fR structure is defined in <\fBsys/procfs_isa.h\fR>.
-.RE
-
-.sp
-.LP
-The new \fBNOTE\fR segment contains the following entries. Each has entry name
-"\fBCORE\fR" and presents the contents of a system structure:
-.sp
-.ne 2
-.na
-\fB\fBpsinfo_t\fR\fR
-.ad
-.RS 20n
-\fBn_type\fR: \fBNT_PSINFO\fR. This structure contains information of interest
-to the \fBps\fR(1) command, such as process status, \fBCPU\fR usage, \fBnice\fR
-value, controlling terminal, user-ID, process-ID, the name of the executable,
-and so forth. The \fBpsinfo_t\fR structure is defined in <\fBsys/procfs.h\fR>.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBpstatus_t\fR\fR
-.ad
-.RS 20n
-\fBn_type\fR: \fBNT_PSTATUS\fR. This structure contains things of interest to a
-debugger from the operating system, such as pending signals, state, process-ID,
-and so forth. The \fBpstatus_t\fR structure is defined in <\fBsys/procfs.h\fR>.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBchar\fR array\fR
-.ad
-.RS 20n
-\fBn_type\fR: \fBNT_PLATFORM\fR. This entry contains a string describing the
-specific model of the hardware platform on which this core file was created.
-This information is the same as provided by \fBsysinfo\fR(2) when invoked with
-the command \fBSI_PLATFORM\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBauxv_t\fR array\fR
-.ad
-.RS 20n
-\fBn_type\fR: \fBNT_AUXV\fR. This entry contains the array of \fBauxv_t\fR
+.Pq LWP
+in the process, the old
+.Sy NOTE
+segment contains an entry with a
+.Vt prstatus_t
+structure, plus other optionally-present entries describing the LWP, as follows:
+.Bl -tag -width "prfpregset_t"
+.It Vt prstatus_t
+.Fa n_type :
+.Dv NT_PRSTATUS .
+This structure contains things of interest to a debugger from the operating
+system, such as the general registers, signal dispositions, state, reason for
+stopping, process-ID, and so forth.
+The
+.Vt prstatus_t
+structure is defined in
+.In sys/old_procfs.h .
+.It Vt prfpregset_t
+.Fa n_type :
+.Dv NT_PRFPREG .
+This entry is present only if the
+.Sy BLWP
+used the floating-point hardware.
+It contains the floating-point registers.
+The
+.Vt prfpregset_t
+structure is defined in
+.In sys/procfs_isa.h .
+.It Vt gwindows_t
+.Fa n_type :
+.Dv NT_GWINDOWS .
+This entry is present only on a SPARC machine and only if the system was unable
+to flush all of the register windows to the stack.
+It contains all of the unspilled register windows.
+The
+.Vt gwindows_t
+structure is defined in
+.In sys/regset.h .
+.It Vt prxregset_t
+.Fa n_type :
+.Dv NT_PRXREG .
+This entry is present only if the machine has extra register state associated
+with it.
+It contains the extra register state.
+The
+.Vt prxregset_t
+structure is defined in
+.Vt sys/procfs_isa.h .
+.El
+.Pp
+The new
+.Sy NOTE
+segment contains the following entries.
+Each has entry name
+.Sy "CORE"
+and presents the contents of a system structure:
+.Bl -tag -width prxregset_t
+.It Vt psinfo_t
+.Fa n_type :
+.Dv NT_PSINFO .
+This structure contains information of interest to the
+.Xr ps 1
+command, such as process status, CPU usage, nice value, controlling terminal,
+user-ID, process-ID, the name of the executable, and so forth.
+The
+.Vt psinfo_t
+structure is defined in
+.In sys/procfs.h
+.It Vt pstatus_t
+.Fa n_type :
+.Dv NT_PSTATUS .
+This structure contains things of interest to a debugger from the operating
+system, such as pending signals, state, process-ID, and so forth.
+The
+.Vt pstatus_t
+structure is defined in
+.In sys/procfs.h .
+.It Vt char[]
+.Fa n_type :
+.Dv NT_PLATFORM .
+This entry contains a string describing the specific model of the hardware
+platform on which this core file was created.
+This information is the same as provided by
+.Xr sysinfo 2
+when invoked with the command
+.Dv SI_PLATFORM .
+.It auxv_t[]
+.Fa n_type :
+.Dv NT_AUXV .
+This entry contains the array of
+.Vt auxv_t
structures that was passed by the operating system as startup information to
-the dynamic linker. Auxiliary vector information is defined in
-<\fBsys/auxv.h\fR>.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBstruct utsname\fR\fR
-.ad
-.RS 20n
-\fBn_type\fR: \fBNT_UTSNAME\fR. This structure contains the system information
-that would have been returned to the process if it had performed a
-\fBuname\fR(2) system call prior to dumping core. The \fButsname\fR structure
-is defined in <\fBsys/utsname.h\fR>.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBprcred_t\fR\fR
-.ad
-.RS 20n
-\fBn_type\fR: \fBNT_PRCRED\fR. This structure contains the process credentials,
-including the real, saved, and effective user and group IDs. The \fBprcred_t\fR
-structure is defined in <\fBsys/procfs.h\fR>. Following the structure is an
-optional array of supplementary group IDs. The total number of supplementary
-group IDs is given by the \fBpr_ngroups\fR member of the \fBprcred_t\fR
-structure, and the structure includes space for one supplementary group. If
-\fBpr_ngroups\fR is greater than 1, there is \fBpr_ngroups - 1\fR \fBgid_t\fR
+the dynamic linker.
+Auxiliary vector information is defined in
+.In sys/auxv.h .
+.It Vt struct utsname
+.Fa n_type :
+.Dv NT_UTSNAME .
+This structure contains the system information that would have been returned
+to the process if it had performed a
+.Xr uname 2
+system call prior to dumping core.
+The
+.Vt utsname
+structure is defined in
+.In sys/utsname.h .
+.It pcred_t
+.Fa n_type :
+.Dv NT_PRCRED .
+This structure contains the process credentials, including the real, saved,
+and effective user and group IDs.
+The
+.Vt pcred_t
+structure is defined in
+.In sys/procfs.h .
+Following the structure is an optional array of supplementary group IDs.
+The total number of supplementary group IDs is given by the
+.Fa pr_ngroups
+member of the
+.Vt pcred_t
+structure, and the structure includes space for one supplementary group.
+If
+.Fa pr_ngroups
+is greater than 1, there is
+.So
+.Fa pr_ngroups
+- 1
+.Sc
+.Fa gid_t
items following the structure; otherwise, there is no additional data.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBchar array\fR\fR
-.ad
-.RS 20n
-\fBn_type\fR: \fBNT_ZONENAME\fR. This entry contains a string which describes
-the name of the zone in which the process was running. See \fBzones\fR(5). The
-information is the same as provided by \fBgetzonenamebyid\fR(3C) when invoked
-with the numerical ID returned by \fBgetzoneid\fR(3C).
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBprfdinfo_core_t\fR\fR
-.ad
-.RS 20n
-\fBn_type\fR: \fBNT_FDINFO\fR. This structure contains information about
-any open file descriptors, including the path, flags, and
-\fBstat\fR(2) information. The \fBprfdinfo_core_t\fR structure is defined in
-<\fBsys/procfs.h\fR>.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBstruct ssd\fR array\fR
-.ad
-.RS 20n
-\fBn_type\fR: \fBNT_LDT\fR. This entry is present only on an 32-bit x86 machine
-and only if the process has set up a Local Descriptor Table (LDT). It contains
-an array of structures of type \fBstruct ssd\fR, each of which was typically
-used to set up the \fB%gs\fR segment register to be used to fetch the address
-of the current thread information structure in a multithreaded process. The
-\fBssd\fR structure is defined in <\fBsys/sysi86.h\fR>.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBcore_content_t\fR\fR
-.ad
-.RS 20n
-\fBn_type\fR: \fBNT_CONTENT\fR. This optional entry indicates which parts of
-the process image are specified to be included in the core file. See
-\fBcoreadm\fR(1M).
-.RE
-
-.sp
-.LP
-Following these entries, for each active and zombie \fBLWP\fR in the process,
-the new \fBNOTE\fR segment contains an entry with an \fBlwpsinfo_t\fR structure
-plus, for a non-zombie LWP, an entry with an \fBlwpstatus_t\fR structure, plus
-other optionally-present entries describing the LWP, as follows. A zombie LWP
-is a non-detached LWP that has terminated but has not yet been reaped by
-another LWP in the same process.
-.sp
-.ne 2
-.na
-\fB\fBlwpsinfo_t\fR\fR
-.ad
-.RS 15n
-\fBn_type\fR: \fBNT_LWPSINFO\fR. This structure contains information of
-interest to the \fBps\fR(1) command, such as \fBLWP\fR status, \fBCPU\fR usage,
-\fBnice\fR value, \fBLWP-ID\fR, and so forth. The \fBlwpsinfo_t\fR structure is
-defined in <\fBsys/procfs.h\fR>. This is the only entry present for a zombie
-LWP.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBlwpstatus_t\fR\fR
-.ad
-.RS 15n
-\fBn_type\fR: \fBNT_LWPSTATUS\fR. This structure contains things of interest to
-a debugger from the operating system, such as the general registers, the
-floating point registers, state, reason for stopping, \fBLWP-ID\fR, and so
-forth. The \fBlwpstatus_t\fR structure is defined in <\fBsys/procfs.h>\fR>.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBgwindows_t\fR\fR
-.ad
-.RS 15n
-\fBn_type\fR: \fBNT_GWINDOWS\fR. This entry is present only on a SPARC machine
-and only if the system was unable to flush all of the register windows to the
-stack. It contains all of the unspilled register windows. The \fBgwindows_t\fR
-structure is defined in \fB<sys/regset.h>\fR\&.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBprxregset_t\fR\fR
-.ad
-.RS 15n
-\fBn_type\fR: \fBNT_PRXREG\fR. This entry is present only if the machine has
-extra register state associated with it. It contains the extra register state.
-The \fBprxregset_t\fR structure is defined in \fB<sys/procfs_isa.h>\fR\&.
-.RE
-
-.sp
-.ne 2
-.na
+.It Vt char[]
+.Fa n_type :
+.Dv NT_ZONENAME .
+This entry contains a string which describes the name of the zone in
+which the process was running.
+See
+.Xr zones 5 .
+The information is the same as provided by
+.Xr getzonenamebyid 3C
+when invoked with the numerical ID returned by
+.Xr getzoneid 3C .
+.It Vt prfdinfo_core_t
+.Fa n_type :
+.Dv NT_FDINFO .
+This structure contains information about any open file descriptors, including
+the path, flags, and
+.Xr stat 2
+information.
+The
+.Vt prfdinfo_core_t
+structure is defined in
+.In sys/procfs.h .
+.It Vt struct ssd[]
+.Fa n_type :
+.Dv NT_LDT .
+This entry is present only on an 32-bit x86 machine and only if the process has
+set up a Local Descriptor Table
+.Pq LDT .
+It contains an array of structures of type
+.Vt struct ssd ,
+each of which was typically used to set up the
+.Sy %gs
+segment register to be used to fetch the address of the current thread
+information structure in a multithreaded process.
+The
+.Vt ssd
+structure is defined in
+.In sys/sysi86.h .
+.It Vt core_content_t
+.Fa n_type :
+.Dv NT_CONTENT .
+This optional entry indicates which parts of the process image are specified
+to be included in the core file.
+See
+.Xr coreadm 1M .
+.It Vt prsecflags_t
+.Fa n_type :
+.Dv NT_SECFLAGS .
+This entry contains the process security-flags, see
+.Xr security-flags 5 ,
+.Xr proc 4 ,
+and
+.Xr psecflags 1
+for more information.
+.It Vt prupanic_t
+.Fa n_type :
+.Dv NT_UPANIC .
+This entry is included if a process terminated through the
+.Xr upanic 2
+system call.
+It is defined in
+.In sys/procfs.h .
+.Pp
+The
+.Fa pru_version
+member indicates the current revision of the structure, which is expected to be
+.Dv PRUPANIC_VERSION_1
+.Pq 1 .
+The
+.Fa pru_flags
+member will be set to the bitwise-inclusive-OR of the following fields:
+.Bl -tag -offset indent -width PRUPANIC_FLAG_MSG_TRUNC
+.It Dv PRUPANIC_FLAG_MSG_VALID
+Indicates that
+.Fa pru_data
+member has valid contents and that the process provided a message in the
+.Xr upanic 2
+call .
+.It Dv PRUPANIC_FLAG_MSG_ERROR
+Indicates that the calling process attempted to include a message; however, the
+provided address of the message did not point to valid memory.
+.It Dv PRUPANIC_FLAG_MSG_TRUNC
+Indicates that the calling process included a message; however, the message it
+wanted to provide was larger than the current message length.
+.El
+The
+.Fa pru_data
+array contains binary data that the terminating process used to indicate that
+the reason why it panicked.
+This member should be ignored if the
+.Dv PRUPANIC_FLAG_MSG_VALID
+flag is not set in
+.Fa pru_flags .
+While it is recommended that processes terminate with an ASCII string, consumers
+of this should not assume that the binary data is made of of printable
+characters.
+.El
+.Pp
+For each active and zombie
+.Sy LWP
+in the process,
+the new
+.Sy NOTE
+segment contains an entry with an
+.Vt lwpsinfo_t
+structure plus, for a non-zombie LWP, an entry with an
+.Vt lwpstatus_t
+structure, plus other optionally-present entries describing the LWP, as follows.
+A zombie LWP is a non-detached LWP that has terminated but has not yet been
+reaped by another LWP in the same process.
+.Bl -tag -width "prxregset_t"
+.It Vt lwpsinfo_t
+.Fa n_type :
+.Dv NT_LWPSINFO .
+This structure contains information of interest to the
+.Xr ps 1
+command, such as LWP status, CPU usage, nice value, LWP-ID, and so forth.
+The
+.Vt lwpsinfo_t
+structure is defined in
+.In sys/procfs.h .
+This is the only entry present for a zombie LWP.
+.It lwpstatus_t
+.Fa n_type :
+.Dv NT_LWPSTATUS .
+This structure contains things of interest to a debugger from the operating
+system, such as the general registers, the floating point registers, state,
+reason for stopping, LWP-ID, and so forth.
+The
+.Vt lwpstatus_t
+structure is defined in
+.In sys/procfs.h .
+.Vt gwindows_t
+.Fa n_type :
+.Dv NT_GWINDOWS .
+This entry is present only on a SPARC machine and only if the system was unable
+to flush all of the register windows to the stack.
+It contains all of the unspilled register windows.
+The
+.Vt gwindows_t
+structure is defined in
+.In sys/regset.h .
+.It Vt prxregset_t
+.Fa n_type :
+.Dv NT_PRXREG .
+This entry is present only if the machine has extra register state associated
+with it.
+It contains the extra register state.
+The
+.Vt prxregset_t
+structure is defined in
+.In sys/procfs_isa.h .
+.It Vt asrset_t
\fB\fBasrset_t\fR\fR
-.ad
-.RS 15n
-\fBn_type\fR: \fBNT_ASRS\fR. This entry is present only on a SPARC V9 machine
-and only if the process is a 64-bit process. It contains the ancillary state
-registers for the \fBLWP.\fR The \fBasrset_t\fR structure is defined in
-\fB<sys/regset.h>\fR\&.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBpsinfo_t\fR\fR
-.ad
-.RS 15n
-\fBn_type\fR: \fBNT_SPYMASTER\fR. This entry is present only for an agent
-LWP and contains the \fBpsinfo_t\fR of the process that created the agent
-LWP. See the \fBproc\fR(4) description of the \fBspymaster\fR entry for
-more details.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBprsecflags_t\fR\fR
-.ad
-.RS 15n
-\fBn_type\fR: \fBNT_SECFLAGS\fR. This entry contains the process
-security-flags, see \fBsecurity-flags\fR(5), \fBproc\fR(4), and
-\fBpsecflags\fR(1) for more information.
-.RE
-
-.sp
-.LP
-Depending on the \fBcoreadm\fR(1M) settings, the section header of an ELF core
-file can contain entries for CTF, symbol table, and string table sections. The
-\fBsh_addr\fR fields are set to the base address of the first mapping of the
-load object that they came from to. This can be used to match those sections
-with the corresponding load object.
-.sp
-.LP
+.Fa n_type :
+.Dv NT_ASRS .
+This entry is present only on a SPARC V9 machine and only if the process is a
+64-bit process.
+It contains the ancillary state registers for the LWP.
+The
+.Vt asrset_t asrset_t
+structure is defined in
+.In sys/regset.h .
+.It Vt psinfo_t
+.Fa n_type :
+.Dv NT_SPYMASTER .
+This entry is present only for an agent LWP and contains the
+.Vt psinfo_t
+of the process that created the agent LWP.
+See the
+.Xr proc 4 description of the
+.Sy spymaster
+entry for more details.
+.El
+.Pp
+Depending on the
+.Xr coreadm 1M
+settings, the section header of an ELF core file can contain entries for CTF,
+symbol table, and string table sections.
+The
+.Fa sh_addr
+fields are set to the base address of the first mapping of the load object that
+they came from to.
+This can be used to match those sections with the corresponding load object.
+.Pp
The size of the core file created by a process can be controlled by the user
-(see \fBgetrlimit\fR(2)).
-.SH SEE ALSO
-\fBelfdump\fR(1), \fBgcore\fR(1), \fBmdb\fR(1), \fBproc\fR(1), \fBps\fR(1),
-\fBcoreadm\fR(1M), \fBgetrlimit\fR(2), \fBsetrlimit\fR(2), \fBsetuid\fR(2),
-\fBsysinfo\fR(2), \fBuname\fR(2), \fBgetzonenamebyid\fR(3C),
-\fBgetzoneid\fR(3C), \fBelf\fR(3ELF), \fBsignal.h\fR(3HEAD), \fBa.out\fR(4),
-\fBproc\fR(4), \fBzones\fR(5), \fBsecurity-flags\fR(5)
-.sp
-.LP
-\fIANSI C Programmer's Guide\fR
+.Po
+see
+.Xr getrlimit 2
+.Pc
+.Sh SEE ALSO
+.Xr elfdump 1 ,
+.Xr gcore 1 ,
+.Xr mdb 1 ,
+.Xr proc 1 ,
+.Xr ps 1 ,
+.Xr coreadm 1M ,
+.Xr getrlimit 2 ,
+.Xr setrlimit 2 ,
+.Xr setuid 2 ,
+.Xr sysinfo 2 ,
+.Xr uname 2 ,
+.Xr upanic 2 ,
+.Xr getzoneid 3C ,
+.Xr getzonenamebyid 3C ,
+.Xr elf 3ELF ,
+.Xr signal.h 3HEAD ,
+.Xr a.out 4 ,
+.Xr proc 4 ,
+.Xr security-flags 5 ,
+.Xr zones 5
diff --git a/usr/src/pkg/manifests/system-header.mf b/usr/src/pkg/manifests/system-header.mf
index cd685c049e..c35efe456f 100644
--- a/usr/src/pkg/manifests/system-header.mf
+++ b/usr/src/pkg/manifests/system-header.mf
@@ -1615,6 +1615,7 @@ file path=usr/include/umem.h
file path=usr/include/umem_impl.h
file path=usr/include/unctrl.h
file path=usr/include/unistd.h
+file path=usr/include/upanic.h
file path=usr/include/user_attr.h
file path=usr/include/userdefs.h
file path=usr/include/ustat.h
@@ -1920,6 +1921,7 @@ file path=usr/share/man/man3head/uio.h.3head
file path=usr/share/man/man3head/ulimit.h.3head
file path=usr/share/man/man3head/un.h.3head
file path=usr/share/man/man3head/unistd.h.3head
+file path=usr/share/man/man3head/upanic.h.3head
file path=usr/share/man/man3head/utime.h.3head
file path=usr/share/man/man3head/utmpx.h.3head
file path=usr/share/man/man3head/utsname.h.3head
diff --git a/usr/src/pkg/manifests/system-kernel.man2.inc b/usr/src/pkg/manifests/system-kernel.man2.inc
index 6a45a39b55..493f86c642 100644
--- a/usr/src/pkg/manifests/system-kernel.man2.inc
+++ b/usr/src/pkg/manifests/system-kernel.man2.inc
@@ -151,6 +151,7 @@ file path=usr/share/man/man2/umask.2
file path=usr/share/man/man2/umount.2
file path=usr/share/man/man2/uname.2
file path=usr/share/man/man2/unlink.2
+file path=usr/share/man/man2/upanic.2
file path=usr/share/man/man2/ustat.2
file path=usr/share/man/man2/utime.2
file path=usr/share/man/man2/utimes.2
diff --git a/usr/src/pkg/manifests/system-library.man3proc.inc b/usr/src/pkg/manifests/system-library.man3proc.inc
index 66edc6e142..c3388bb920 100644
--- a/usr/src/pkg/manifests/system-library.man3proc.inc
+++ b/usr/src/pkg/manifests/system-library.man3proc.inc
@@ -97,6 +97,7 @@ file path=usr/share/man/man3proc/Psymbol_iter.3proc
file path=usr/share/man/man3proc/Psync.3proc
file path=usr/share/man/man3proc/Psysentry.3proc
file path=usr/share/man/man3proc/Puname.3proc
+file path=usr/share/man/man3proc/Pupanic.3proc
file path=usr/share/man/man3proc/Pupdate_maps.3proc
file path=usr/share/man/man3proc/Pupdate_syms.3proc
file path=usr/share/man/man3proc/Pwrite.3proc
@@ -227,6 +228,7 @@ link path=usr/share/man/man3proc/Psymbol_iter_by_name.3proc \
target=Psymbol_iter.3proc
link path=usr/share/man/man3proc/Psysexit.3proc target=Psysentry.3proc
link path=usr/share/man/man3proc/Punsetflags.3proc target=Psetflags.3proc
+link path=usr/share/man/man3proc/Pupanic_free.3proc target=Pupanic.3proc
link path=usr/share/man/man3proc/Pwait.3proc target=Pstopstatus.3proc
link path=usr/share/man/man3proc/Pxcreate.3proc target=Pcreate.3proc
link path=usr/share/man/man3proc/Pxecwapt.3proc target=Pxecbkpt.3proc
diff --git a/usr/src/uts/common/Makefile.files b/usr/src/uts/common/Makefile.files
index 5f38c6eb5f..a61a3b60df 100644
--- a/usr/src/uts/common/Makefile.files
+++ b/usr/src/uts/common/Makefile.files
@@ -385,6 +385,7 @@ GENUNIX_OBJS += \
uname.o \
unix_bb.o \
unlink.o \
+ upanic.o \
urw.o \
utime.o \
utssys.o \
diff --git a/usr/src/uts/common/exec/elf/elf_notes.c b/usr/src/uts/common/exec/elf/elf_notes.c
index eefc4450ec..1b6ba38dad 100644
--- a/usr/src/uts/common/exec/elf/elf_notes.c
+++ b/usr/src/uts/common/exec/elf/elf_notes.c
@@ -164,6 +164,13 @@ setup_note_header(Phdr *v, proc_t *p)
v[0].p_filesz += nlwp * sizeof (Note)
+ nlwp * roundup(sizeof (asrset_t), sizeof (Word));
#endif /* __sparc */
+
+ mutex_enter(&p->p_lock);
+ if ((p->p_upanicflag & P_UPF_PANICKED) != 0) {
+ v[0].p_filesz += sizeof (Note) +
+ roundup(sizeof (prupanic_t), sizeof (Word));
+ }
+ mutex_exit(&p->p_lock);
}
int
@@ -186,6 +193,7 @@ write_elfnotes(proc_t *p, int sig, vnode_t *vp, offset_t offset,
priv_impl_info_t prinfo;
struct utsname uts;
prsecflags_t psecflags;
+ prupanic_t upanic;
} *bigwad;
size_t xregsize = prhasx(p)? prgetprxregsize(p) : 0;
@@ -597,6 +605,36 @@ write_elfnotes(proc_t *p, int sig, vnode_t *vp, offset_t offset,
}
ASSERT(nlwp == 0);
+ /*
+ * If a upanic occurred, add a note for it.
+ */
+ mutex_enter(&p->p_lock);
+ if ((p->p_upanicflag & P_UPF_PANICKED) != 0) {
+ bzero(&bigwad->upanic, sizeof (prupanic_t));
+ bigwad->upanic.pru_version = PRUPANIC_VERSION_1;
+ if ((p->p_upanicflag & P_UPF_INVALMSG) != 0) {
+ bigwad->upanic.pru_flags |= PRUPANIC_FLAG_MSG_ERROR;
+ }
+
+ if ((p->p_upanicflag & P_UPF_TRUNCMSG) != 0) {
+ bigwad->upanic.pru_flags |= PRUPANIC_FLAG_MSG_TRUNC;
+ }
+
+ if ((p->p_upanicflag & P_UPF_HAVEMSG) != 0) {
+ bigwad->upanic.pru_flags |= PRUPANIC_FLAG_MSG_VALID;
+ bcopy(p->p_upanic, bigwad->upanic.pru_data,
+ PRUPANIC_BUFLEN);
+ }
+
+ error = elfnote(vp, &offset, NT_UPANIC, sizeof (prupanic_t),
+ &bigwad->upanic, rlimit, credp);
+ if (error != 0) {
+ mutex_exit(&p->p_lock);
+ goto done;
+ }
+ }
+ mutex_exit(&p->p_lock);
+
done:
kmem_free(bigwad, bigsize);
return (error);
diff --git a/usr/src/uts/common/os/exit.c b/usr/src/uts/common/os/exit.c
index 1b9359da47..2d571a73d0 100644
--- a/usr/src/uts/common/os/exit.c
+++ b/usr/src/uts/common/os/exit.c
@@ -22,6 +22,7 @@
/*
* Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ * Copyright 2020 Oxide Computer Company
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
@@ -71,6 +72,7 @@
#include <sys/pool.h>
#include <sys/sdt.h>
#include <sys/corectl.h>
+#include <sys/core.h>
#include <sys/brand.h>
#include <sys/libc_kernel.h>
@@ -473,6 +475,14 @@ proc_exit(int why, int what)
}
/*
+ * If we had generated any upanic(2) state, free that now.
+ */
+ if (p->p_upanic != NULL) {
+ kmem_free(p->p_upanic, PRUPANIC_BUFLEN);
+ p->p_upanic = NULL;
+ }
+
+ /*
* Remove any fpollinfo_t's for this (last) thread from our file
* descriptors so closeall() can ASSERT() that they're all gone.
*/
diff --git a/usr/src/uts/common/os/sysent.c b/usr/src/uts/common/os/sysent.c
index fb8bf07077..1858b5a693 100644
--- a/usr/src/uts/common/os/sysent.c
+++ b/usr/src/uts/common/os/sysent.c
@@ -24,6 +24,7 @@
* Copyright 2012 Milan Jurik. All rights reserved.
* Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
* Copyright (c) 2018, Joyent, Inc.
+ * Copyright 2020 Oxide Computer Company
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
@@ -330,6 +331,7 @@ int setsockopt(int, int, int, void *, socklen_t *, int);
int sockconfig(int, void *, void *, void *, void *);
ssize_t sendfilev(int, int, const struct sendfilevec *, int, size_t *);
ssize_t getrandom(void *, size_t, unsigned int);
+void upanic(void *, size_t);
typedef int64_t (*llfcn_t)(); /* for casting one-word returns */
@@ -583,7 +585,7 @@ struct sysent sysent[NSYSCALL] =
/* 122 */ SYSENT_CL("writev", writev, 3),
/* 123 */ SYSENT_CL("preadv", preadv, 5),
/* 124 */ SYSENT_CL("pwritev", pwritev, 5),
- /* 125 */ SYSENT_LOADABLE(), /* (was fxstat) */
+ /* 125 */ SYSENT_CI("upanic", upanic, 2),
/* 126 */ SYSENT_CL("getrandom", getrandom, 3),
/* 127 */ SYSENT_CI("mmapobj", mmapobjsys, 5),
/* 128 */ IF_LP64(
@@ -948,7 +950,7 @@ struct sysent sysent32[NSYSCALL] =
/* 122 */ SYSENT_CI("writev", writev32, 3),
/* 123 */ SYSENT_CI("preadv", preadv, 5),
/* 124 */ SYSENT_CI("pwritev", pwritev, 5),
- /* 125 */ SYSENT_LOADABLE32(), /* was fxstat32 */
+ /* 125 */ SYSENT_CI("upanic", upanic, 2),
/* 126 */ SYSENT_CI("getrandom", getrandom, 3),
/* 127 */ SYSENT_CI("mmapobj", mmapobjsys, 5),
/* 128 */ SYSENT_CI("setrlimit", setrlimit32, 2),
diff --git a/usr/src/uts/common/os/upanic.c b/usr/src/uts/common/os/upanic.c
new file mode 100644
index 0000000000..8acb9440f2
--- /dev/null
+++ b/usr/src/uts/common/os/upanic.c
@@ -0,0 +1,92 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright 2020 Oxide Computer Company
+ */
+
+#include <sys/proc.h>
+#include <c2/audit.h>
+#include <sys/procfs.h>
+#include <sys/core.h>
+
+/*
+ * This function is meant to be a guaranteed abort that generates a core file
+ * that allows up to 1k of data to enter into an elfnote in the process. This is
+ * meant to insure that even in the face of other problems, this can get out.
+ */
+
+void
+upanic(void *addr, size_t len)
+{
+ kthread_t *t = curthread;
+ proc_t *p = curproc;
+ klwp_t *lwp = ttolwp(t);
+ uint32_t auditing = AU_AUDITING();
+ uint32_t upflag = P_UPF_PANICKED;
+ void *buf;
+ int code;
+
+ /*
+ * Before we worry about the data that the user has as a message, go
+ * ahead and make sure we try and get all the other threads stopped.
+ * That'll help us make sure that nothing else is going on and we don't
+ * lose a race.
+ */
+ mutex_enter(&p->p_lock);
+ lwp->lwp_cursig = SIGABRT;
+ mutex_exit(&p->p_lock);
+
+ proc_is_exiting(p);
+ if (exitlwps(1) != 0) {
+ mutex_enter(&p->p_lock);
+ lwp_exit();
+ }
+
+ /*
+ * Copy in the user data. We truncate it to PRUPANIC_BUFLEN no matter
+ * what and ensure that the last data was set to zero.
+ */
+ if (addr != NULL && len > 0) {
+ size_t copylen;
+
+ upflag |= P_UPF_HAVEMSG;
+
+ if (len >= PRUPANIC_BUFLEN) {
+ copylen = PRUPANIC_BUFLEN;
+ upflag |= P_UPF_TRUNCMSG;
+ } else {
+ copylen = len;
+ }
+
+ buf = kmem_zalloc(PRUPANIC_BUFLEN, KM_SLEEP);
+ if (copyin(addr, buf, copylen) != 0) {
+ upflag |= P_UPF_INVALMSG;
+ upflag &= ~P_UPF_HAVEMSG;
+ } else {
+ mutex_enter(&p->p_lock);
+ ASSERT3P(p->p_upanic, ==, NULL);
+ p->p_upanic = buf;
+ mutex_exit(&p->p_lock);
+ }
+ }
+
+ mutex_enter(&p->p_lock);
+ p->p_upanicflag = upflag;
+ mutex_exit(&p->p_lock);
+
+ if (auditing) /* audit core dump */
+ audit_core_start(SIGABRT);
+ code = core(SIGABRT, B_FALSE);
+ if (auditing) /* audit core dump */
+ audit_core_finish(code ? CLD_KILLED : CLD_DUMPED);
+ exit(code ? CLD_KILLED : CLD_DUMPED, SIGABRT);
+}
diff --git a/usr/src/uts/common/sys/elf.h b/usr/src/uts/common/sys/elf.h
index 4bd884e9c2..82e7d82738 100644
--- a/usr/src/uts/common/sys/elf.h
+++ b/usr/src/uts/common/sys/elf.h
@@ -21,6 +21,7 @@
/*
* Copyright 2012 DEY Storage Systems, Inc. All rights reserved.
* Copyright (c) 2018, Joyent, Inc.
+ * Copyright 2020 Oxide Computer Company
*/
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
@@ -974,7 +975,8 @@ typedef Elf64_Word Elf64_Capchain;
#define NT_SPYMASTER 23 /* psinfo_t for agent LWP spymaster */
#define NT_SECFLAGS 24 /* process security-flags */
#define NT_LWPNAME 25 /* prlwpname_t */
-#define NT_NUM 25
+#define NT_UPANIC 26 /* prupanic_t */
+#define NT_NUM 26
#ifdef _KERNEL
diff --git a/usr/src/uts/common/sys/proc.h b/usr/src/uts/common/sys/proc.h
index 6fe6ba6c75..688fedbe80 100644
--- a/usr/src/uts/common/sys/proc.h
+++ b/usr/src/uts/common/sys/proc.h
@@ -22,6 +22,7 @@
/*
* Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2018 Joyent, Inc.
+ * Copyright 2020 Oxide Computer Company
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
@@ -355,6 +356,8 @@ typedef struct proc {
kcondvar_t p_poolcv; /* synchronization with pools */
uint_t p_poolcnt; /* # threads inside pool barrier */
uint_t p_poolflag; /* pool-related flags (see below) */
+ uint_t p_upanicflag; /* upanic-related flags (see below) */
+ void *p_upanic; /* optional upanic data */
uintptr_t p_portcnt; /* event ports counter */
struct zone *p_zone; /* zone in which process lives */
struct vnode *p_execdir; /* directory that p_exec came from */
@@ -524,6 +527,14 @@ extern struct pid pid0; /* p0's pid */
#define PBWAIT 0x0001 /* process should wait outside fork/exec/exit */
#define PEXITED 0x0002 /* process exited and about to become zombie */
+/*
+ * p_upanicflag codes
+ */
+#define P_UPF_PANICKED 0x0001
+#define P_UPF_HAVEMSG 0x0002
+#define P_UPF_TRUNCMSG 0x0004
+#define P_UPF_INVALMSG 0x0008
+
/* Macro to convert proc pointer to a user block pointer */
#define PTOU(p) (&(p)->p_user)
diff --git a/usr/src/uts/common/sys/procfs.h b/usr/src/uts/common/sys/procfs.h
index ea485c09fd..00ba23594e 100644
--- a/usr/src/uts/common/sys/procfs.h
+++ b/usr/src/uts/common/sys/procfs.h
@@ -675,6 +675,21 @@ typedef struct prheader {
(((unsigned)((flag)-1) < 32*sizeof (*(sp))/sizeof (uint32_t)) && \
(((uint32_t *)(sp))[((flag)-1)/32] & (1U<<(((flag)-1)%32))))
+/*
+ * Core file upanic NT_UPANIC structure.
+ */
+#define PRUPANIC_VERSION_1 1
+#define PRUPANIC_VERSION_CURRENT PRUPANIC_VERSION_1
+#define PRUPANIC_FLAG_MSG_VALID 0x01
+#define PRUPANIC_FLAG_MSG_ERROR 0x02
+#define PRUPANIC_FLAG_MSG_TRUNC 0x04
+#define PRUPANIC_BUFLEN 1024
+typedef struct prupanic {
+ uint32_t pru_version;
+ uint32_t pru_flags;
+ uint8_t pru_data[PRUPANIC_BUFLEN];
+} prupanic_t;
+
#if defined(_SYSCALL32)
/*
diff --git a/usr/src/uts/common/sys/syscall.h b/usr/src/uts/common/sys/syscall.h
index 8709f98c26..cd4f5445b0 100644
--- a/usr/src/uts/common/sys/syscall.h
+++ b/usr/src/uts/common/sys/syscall.h
@@ -24,6 +24,7 @@
* Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright (c) 2015, Joyent, Inc. All rights reserved.
+ * Copyright 2020 Oxide Computer Company
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
@@ -168,38 +169,38 @@ extern "C" {
#define SYS_tasksys 70
/*
* subcodes:
- * settaskid(...) :: tasksys(0, ...)
- * gettaskid(...) :: tasksys(1, ...)
- * getprojid(...) :: tasksys(2, ...)
+ * settaskid(...) :: tasksys(0, ...)
+ * gettaskid(...) :: tasksys(1, ...)
+ * getprojid(...) :: tasksys(2, ...)
*/
#define SYS_acctctl 71
#define SYS_exacctsys 72
/*
* subcodes:
- * getacct(...) :: exacct(0, ...)
- * putacct(...) :: exacct(1, ...)
- * wracct(...) :: exacct(2, ...)
+ * getacct(...) :: exacct(0, ...)
+ * putacct(...) :: exacct(1, ...)
+ * wracct(...) :: exacct(2, ...)
*/
#define SYS_getpagesizes 73
/*
* subcodes:
* getpagesizes2(...) :: getpagesizes(0, ...)
- * getpagesizes(...) :: getpagesizes(1, ...) legacy
+ * getpagesizes(...) :: getpagesizes(1, ...) legacy
*/
#define SYS_rctlsys 74
/*
* subcodes:
- * getrctl(...) :: rctlsys(0, ...)
- * setrctl(...) :: rctlsys(1, ...)
- * rctllist(...) :: rctlsys(2, ...)
- * rctlctl(...) :: rctlsys(3, ...)
+ * getrctl(...) :: rctlsys(0, ...)
+ * setrctl(...) :: rctlsys(1, ...)
+ * rctllist(...) :: rctlsys(2, ...)
+ * rctlctl(...) :: rctlsys(3, ...)
*/
#define SYS_sidsys 75
/*
* subcodes:
- * allocids(...) :: sidsys(0, ...)
- * idmap_reg(...) :: sidsys(1, ...)
- * idmap_unreg(...) :: sidsys(2, ...)
+ * allocids(...) :: sidsys(0, ...)
+ * idmap_reg(...) :: sidsys(1, ...)
+ * idmap_unreg(...) :: sidsys(2, ...)
*/
#define SYS_lwp_park 77
/*
@@ -213,8 +214,8 @@ extern "C" {
#define SYS_sendfilev 78
/*
* subcodes :
- * sendfilev() :: sendfilev(0, ...)
- * sendfilev64() :: sendfilev(1, ...)
+ * sendfilev() :: sendfilev(0, ...)
+ * sendfilev64() :: sendfilev(1, ...)
*/
#define SYS_rmdir 79
#define SYS_mkdir 80
@@ -222,11 +223,11 @@ extern "C" {
#define SYS_privsys 82
/*
* subcodes:
- * setppriv(...) :: privsys(0, ...)
- * getppriv(...) :: privsys(1, ...)
- * getimplinfo(...) :: privsys(2, ...)
- * setpflags(...) :: privsys(3, ...)
- * getpflags(...) :: privsys(4, ...)
+ * setppriv(...) :: privsys(0, ...)
+ * getppriv(...) :: privsys(1, ...)
+ * getimplinfo(...) :: privsys(2, ...)
+ * setpflags(...) :: privsys(3, ...)
+ * getpflags(...) :: privsys(4, ...)
* issetugid(); :: privsys(5)
*/
#define SYS_ucredsys 83
@@ -297,6 +298,7 @@ extern "C" {
#define SYS_writev 122
#define SYS_preadv 123
#define SYS_pwritev 124
+#define SYS_upanic 125
#define SYS_getrandom 126
#define SYS_mmapobj 127
#define SYS_setrlimit 128
@@ -368,7 +370,7 @@ extern "C" {
#define SYS_meminfosys SYS_lgrpsys
/*
* subcodes:
- * meminfo(...) :: meminfosys(MISYS_MEMINFO, ...)
+ * meminfo(...) :: meminfosys(MISYS_MEMINFO, ...)
*/
#define SYS_rusagesys 181
/*
diff --git a/usr/src/uts/intel/os/name_to_sysnum b/usr/src/uts/intel/os/name_to_sysnum
index 7fd73f512d..dd7b5ca3bb 100644
--- a/usr/src/uts/intel/os/name_to_sysnum
+++ b/usr/src/uts/intel/os/name_to_sysnum
@@ -118,6 +118,7 @@ readv 121
writev 122
preadv 123
pwritev 124
+upanic 125
getrandom 126
mmapobj 127
setrlimit 128
diff --git a/usr/src/uts/sparc/os/name_to_sysnum b/usr/src/uts/sparc/os/name_to_sysnum
index 2db2e10d3a..9455163907 100644
--- a/usr/src/uts/sparc/os/name_to_sysnum
+++ b/usr/src/uts/sparc/os/name_to_sysnum
@@ -116,6 +116,7 @@ readv 121
writev 122
preadv 123
pwritev 124
+upanic 125
getrandom 126
mmapobj 127
setrlimit 128