diff options
author | Dan McDonald <danmcd@joyent.com> | 2020-11-17 14:48:44 -0500 |
---|---|---|
committer | Dan McDonald <danmcd@joyent.com> | 2020-11-17 14:48:44 -0500 |
commit | 2d6415143e9c1044d04ebf846f72f232883413cb (patch) | |
tree | 555fae9f2f89b0c9a4d8c4bbd66b02b70ded9fc7 /usr/src/man | |
parent | 5a1b3228538dfeb09e05cc2bdfad707ee4d698d7 (diff) | |
parent | 5a0af8165ce9590e7a18f1ef4f9badc4dd72c6e6 (diff) | |
download | illumos-joyent-release-20201119.tar.gz |
[illumos-gate merge]release-20201119
commit 5a0af8165ce9590e7a18f1ef4f9badc4dd72c6e6
13274 enable -fstack-protector-strong by default in user land
commit 6a817834d81cc75ce12d0d393320837b1fec1e85
5788 Want support for GCC's stack protector in libc
commit 350ffdd54baf880f440ddf9697666e283894ded1
13273 want upanic(2)
commit 7fdea60d55a95f0e46066fd021c4ef1b1321bafc
13300 mlxcx_cq_setup() doesn't take required locks for ASSERTs
Merge notes:
- Manifest changes to match package changes (including shipping libssp_ns.a)
- Modified lx_vdso tools to not include SSP, to match other build-only tools.
Diffstat (limited to 'usr/src/man')
-rw-r--r-- | usr/src/man/man2/Makefile | 1 | ||||
-rw-r--r-- | usr/src/man/man2/upanic.2 | 95 | ||||
-rw-r--r-- | usr/src/man/man3head/Makefile | 1 | ||||
-rw-r--r-- | usr/src/man/man3head/upanic.h.3head | 41 | ||||
-rw-r--r-- | usr/src/man/man3lib/libproc.3lib | 7 | ||||
-rw-r--r-- | usr/src/man/man3proc/Makefile | 4 | ||||
-rw-r--r-- | usr/src/man/man3proc/Pupanic.3proc | 103 | ||||
-rw-r--r-- | usr/src/man/man4/core.4 | 1011 |
8 files changed, 806 insertions, 457 deletions
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 |