OSDN Git Service

Update README
[linuxjm/LDP_man-pages.git] / original / man2 / sigaction.2
index a9a0741..74ef301 100644 (file)
 .\"    out of this page into separate pages.
 .\" 2010-06-11 Andi Kleen, add hwpoison signal extensions
 .\" 2010-06-11 mtk, improvements to discussion of various siginfo_t fields.
+.\" 2015-01-17, Kees Cook <keescook@chromium.org>
+.\"    Added notes on ptrace SIGTRAP and SYS_SECCOMP.
 .\"
-.TH SIGACTION 2 2014-12-31 "Linux" "Linux Programmer's Manual"
+.TH SIGACTION 2 2015-01-22 "Linux" "Linux Programmer's Manual"
 .SH NAME
 sigaction \- examine and change a signal action
 .SH SYNOPSIS
@@ -416,10 +418,6 @@ and
 fill in
 .I si_addr
 with the address of the fault.
-.\" FIXME . SIGTRAP also sets the following for ptrace_notify() ?
-.\"     info.si_code = exit_code;
-.\"     info.si_pid = task_pid_vnr(current);
-.\"     info.si_uid = current_uid();  /* Real UID */
 On some architectures,
 these signals also fill in the
 .I si_trapno
@@ -438,7 +436,22 @@ For example, if a full page was corrupted,
 .I si_addr_lsb
 contains
 .IR log2(sysconf(_SC_PAGESIZE)) .
-.B BUS_MCERR_*
+When
+.BR SIGTRAP
+is delivered in response to a
+.BR ptrace (2)
+event (PTRACE_EVENT_foo),
+.I si_addr
+is not populated, but
+.I si_pid
+and
+.I si_uid
+are populated with the respective process ID and user ID responsible for
+delivering the trap.
+In the case of
+.BR seccomp (2),
+the tracee will be shown as delivering the event.
+.B BUS_MCEERR_*
 and
 .I si_addr_lsb
 are Linux-specific extensions.
@@ -457,45 +470,57 @@ The
 .I si_fd
 field indicates the file descriptor for which the I/O event occurred.
 .IP *
-The
-.B SIGSYS
-signal that is (since Linux 3.5)
+.BR SIGSYS ,
+generated (since Linux 3.5)
 .\" commit a0727e8ce513fe6890416da960181ceb10fbfae6
-generated when a seccomp filter returns
-.B SECCOMP_RET_TRAP
+when a seccomp filter returns
+.BR SECCOMP_RET_TRAP ,
 fills in
 .IR si_call_addr ,
 .IR si_syscall ,
 .IR si_arch ,
-and various other fields as described in
+.IR si_errno ,
+and other fields as described in
 .BR seccomp (2).
 .PP
 .I si_code
-is a value (not a bit mask)
-indicating why this signal was sent.
-The following list shows the values which can be placed in
+is a value (not a bit mask) indicating why this signal was sent.
+For a
+.BR ptrace (2)
+event,
+.I si_code
+will contain
+.BR SIGTRAP
+and have the ptrace event in the high byte:
+
+.nf
+    (SIGTRAP | PTRACE_EVENT_foo << 8).
+.fi
+
+For a regular signal, the following list shows the values which can be
+placed in
 .I si_code
 for any signal, along with reason that the signal was generated.
 .RS 4
-.TP 15
+.TP
 .B SI_USER
-.BR kill (2)
+.BR kill (2).
 .TP
 .B SI_KERNEL
 Sent by the kernel.
 .TP
 .B SI_QUEUE
-.BR sigqueue (3)
+.BR sigqueue (3).
 .TP
 .B SI_TIMER
-POSIX timer expired
+POSIX timer expired.
 .TP
-.B SI_MESGQ
-POSIX message queue state changed (since Linux 2.6.6); see
-.BR mq_notify (3)
+.BR SI_MESGQ " (since Linux 2.6.6)"
+POSIX message queue state changed; see
+.BR mq_notify (3).
 .TP
 .B SI_ASYNCIO
-AIO completed
+AIO completed.
 .TP
 .B SI_SIGIO
 Queued
@@ -506,17 +531,13 @@ fills in
 .I si_code
 as described below).
 .TP
-.B SI_TKILL
+.BR SI_TKILL " (since Linux 2.4.19)"
 .BR tkill (2)
 or
-.BR tgkill (2)
-(since Linux 2.4.19)
+.BR tgkill (2).
 .\" SI_DETHREAD is defined in 2.6.9 sources, but isn't implemented
 .\" It appears to have been an idea that was tried during 2.5.6
 .\" through to 2.5.24 and then was backed out.
-.\"
-.\" FIXME .
-.\" Eventually need to add the SYS_SECCOMP code here (see seccomp(2))
 .RE
 .PP
 The following values can be placed in
@@ -525,30 +546,30 @@ for a
 .B SIGILL
 signal:
 .RS 4
-.TP 15
+.TP
 .B ILL_ILLOPC
-illegal opcode
+Illegal opcode.
 .TP
 .B ILL_ILLOPN
-illegal operand
+Illegal operand.
 .TP
 .B ILL_ILLADR
-illegal addressing mode
+Illegal addressing mode.
 .TP
 .B ILL_ILLTRP
-illegal trap
+Illegal trap.
 .TP
 .B ILL_PRVOPC
-privileged opcode
+Privileged opcode.
 .TP
 .B ILL_PRVREG
-privileged register
+Privileged register.
 .TP
 .B ILL_COPROC
-coprocessor error
+Coprocessor error.
 .TP
 .B ILL_BADSTK
-internal stack error
+Internal stack error.
 .RE
 .PP
 The following values can be placed in
@@ -557,30 +578,30 @@ for a
 .B SIGFPE
 signal:
 .RS 4
-.TP 15
+.TP
 .B FPE_INTDIV
-integer divide by zero
+Integer divide by zero.
 .TP
 .B FPE_INTOVF
-integer overflow
+Integer overflow.
 .TP
 .B FPE_FLTDIV
-floating-point divide by zero
+Floating-point divide by zero.
 .TP
 .B FPE_FLTOVF
-floating-point overflow
+Floating-point overflow.
 .TP
 .B FPE_FLTUND
-floating-point underflow
+Floating-point underflow.
 .TP
 .B FPE_FLTRES
-floating-point inexact result
+Floating-point inexact result.
 .TP
 .B FPE_FLTINV
-floating-point invalid operation
+Floating-point invalid operation.
 .TP
 .B FPE_FLTSUB
-subscript out of range
+Subscript out of range.
 .RE
 .PP
 The following values can be placed in
@@ -589,12 +610,12 @@ for a
 .B SIGSEGV
 signal:
 .RS 4
-.TP 15
+.TP
 .B SEGV_MAPERR
-address not mapped to object
+Address not mapped to object.
 .TP
 .B SEGV_ACCERR
-invalid permissions for mapped object
+Invalid permissions for mapped object.
 .RE
 .PP
 The following values can be placed in
@@ -603,15 +624,15 @@ for a
 .B SIGBUS
 signal:
 .RS 4
-.TP 15
+.TP
 .B BUS_ADRALN
-invalid address alignment
+Invalid address alignment.
 .TP
 .B BUS_ADRERR
-nonexistent physical address
+Nonexistent physical address.
 .TP
 .B BUS_OBJERR
-object-specific hardware error
+Object-specific hardware error.
 .TP
 .BR BUS_MCEERR_AR " (since Linux 2.6.32)"
 Hardware memory error consumed on a machine check; action required.
@@ -626,18 +647,18 @@ for a
 .B SIGTRAP
 signal:
 .RS 4
-.TP 15
+.TP
 .B TRAP_BRKPT
-process breakpoint
+Process breakpoint.
 .TP
 .B TRAP_TRACE
-process trace trap
+Process trace trap.
 .TP
 .BR TRAP_BRANCH " (since Linux 2.4)"
-process taken branch trap
+Process taken branch trap.
 .TP
 .BR TRAP_HWBKPT " (since Linux 2.4)"
-hardware breakpoint/watchpoint
+Hardware breakpoint/watchpoint.
 .RE
 .PP
 The following values can be placed in
@@ -646,24 +667,24 @@ for a
 .B SIGCHLD
 signal:
 .RS 4
-.TP 15
+.TP
 .B CLD_EXITED
-child has exited
+Child has exited.
 .TP
 .B CLD_KILLED
-child was killed
+Child was killed.
 .TP
 .B CLD_DUMPED
-child terminated abnormally
+Child terminated abnormally.
 .TP
 .B CLD_TRAPPED
-traced child has trapped
+Traced child has trapped.
 .TP
 .B CLD_STOPPED
-child has stopped
+Child has stopped.
 .TP
-.B CLD_CONTINUED
-stopped child has continued (since Linux 2.6.9)
+.BR CLD_CONTINUED " (since Linux 2.6.9)"
+Stopped child has continued.
 .RE
 .PP
 The following values can be placed in
@@ -672,24 +693,37 @@ for a
 .BR SIGIO / SIGPOLL
 signal:
 .RS 4
-.TP 15
+.TP
 .B POLL_IN
-data input available
+Data input available.
 .TP
 .B POLL_OUT
-output buffers available
+Output buffers available.
 .TP
 .B POLL_MSG
-input message available
+Input message available.
 .TP
 .B POLL_ERR
-I/O error
+I/O error.
 .TP
 .B POLL_PRI
-high priority input available
+High priority input available.
 .TP
 .B POLL_HUP
-device disconnected
+Device disconnected.
+.RE
+.PP
+The following value can be placed in
+.I si_code
+for a
+.BR SIGSYS
+signal:
+.RS 4
+.TP
+.BR SYS_SECCOMP " (since Linux 3.5)"
+Triggered by a
+.BR seccomp (2)
+filter rule.
 .RE
 .SH RETURN VALUE
 .BR sigaction ()
@@ -830,6 +864,7 @@ See
 .BR killpg (2),
 .BR pause (2),
 .BR restart_syscall (2),
+.BR seccomp (2)
 .BR sigaltstack (2),
 .BR signal (2),
 .BR signalfd (2),
@@ -846,7 +881,7 @@ See
 .BR core (5),
 .BR signal (7)
 .SH COLOPHON
-This page is part of release 3.77 of the Linux
+This page is part of release 3.79 of the Linux
 .I man-pages
 project.
 A description of the project,