.\" Copyright (C) 1998 Andries Brouwer (aeb@cwi.nl)
.\" and Copyright (C) 2002, 2006, 2008, 2012, 2013 Michael Kerrisk <mtk.manpages@gmail.com>
.\" and Copyright Guillem Jover <guillem@hadrons.org>
+.\" and Copyright (C) 2014 Dave Hansen / Intel
.\"
.\" %%%LICENSE_START(VERBATIM)
.\" Permission is granted to make and distribute verbatim copies of this
.\" PR_GET_TIMERSLACK
.\" 2013-01-10 Kees Cook, document PR_SET_PTRACER
.\" 2012-02-04 Michael kerrisk, document PR_{SET,GET}_CHILD_SUBREAPER
+.\" 2014-11-10 Dave Hansen, document PR_MPX_{EN,DIS}ABLE_MANAGEMENT
.\"
.\"
.\"*******************************************************************
.\" See http://thread.gmane.org/gmane.linux.kernel/542632
.\" [PATCH 0 of 2] seccomp updates
.\" andrea@cpushare.com
-呼び出したスレッドのセキュアコンピューティング (seccomp) モードを設定する。 seccomp
-モードは利用できるシステムコールを制限するものである。 seccomp モードは \fIarg2\fP で指定できる (seccomp 定数は
-\fI<linux/seccomp.h>\fP で定義されている)。
+Set the secure computing (seccomp) mode for the calling thread, to limit the
+available system calls. The more recent \fBseccomp\fP(2) system call provides
+a superset of the functionality of \fBPR_SET_SECCOMP\fP.
-\fIarg2\fP を \fBSECCOMP_MODE_STRICT\fP に設定すると、 そのスレッドが呼び出しを許可されるシステムコールは
-\fBread\fP(2), \fBwrite\fP(2), \fB_exit\fP(2), \fBsigreturn\fP(2) だけになる。
-それ以外のシステムコールを呼び出すと、シグナル \fBSIGKILL\fP が配送される。 パイプやソケットから読み込んだ、
-信頼できないバイトコードを実行する必要がある大量の演算を行うアプリケーションにおいて、 strict secure computing モードは役立つ。
-この操作は利用できるのは、 カーネルが \fBCONFIG_SECCOMP\fP を有効にして作成されている場合だけである。
+The seccomp mode is selected via \fIarg2\fP. (The seccomp constants are
+defined in \fI<linux/seccomp.h>\fP.)
-\fIarg2\fP を \fBSECCOMP_MODE_FILTER\fP (Linux 3.5 以降) に設定すると、 許可されるシステムコールは
-\fIarg3\fP で渡された Berkeley Packet Filter へのポインターで定義される。 この引き数は \fIstruct
-sock_fprog\fP へのポインターである。 これは任意のシステムコールやシステムコール引き数をフィルタリングするために設計された。
-このモードはカーネルで \fBCONFIG_SECCOMP_FILTER\fP が有効になっている場合にのみ利用可能である。
+With \fIarg2\fP set to \fBSECCOMP_MODE_STRICT\fP, the only system calls that the
+thread is permitted to make are \fBread\fP(2), \fBwrite\fP(2), \fB_exit\fP(2), and
+\fBsigreturn\fP(2). Other system calls result in the delivery of a \fBSIGKILL\fP
+signal. Strict secure computing mode is useful for number\-crunching
+applications that may need to execute untrusted byte code, perhaps obtained
+by reading from a pipe or socket. This operation is available only if the
+kernel is configured with \fBCONFIG_SECCOMP\fP enabled.
+
+With \fIarg2\fP set to \fBSECCOMP_MODE_FILTER\fP (since Linux 3.5), the system
+calls allowed are defined by a pointer to a Berkeley Packet Filter passed in
+\fIarg3\fP. This argument is a pointer to \fIstruct sock_fprog\fP; it can be
+designed to filter arbitrary system calls and system call arguments. This
+mode is available only if the kernel is configured with
+\fBCONFIG_SECCOMP_FILTER\fP enabled.
\fBSECCOMP_MODE_FILTER\fP フィルターで \fBfork\fP(2) が許可されている場合、 seccomp モードは \fBfork\fP(2)
で作成された子プロセスに継承される。 \fBexecve\fP(2) が許可されている場合、 seccomp モードは \fBexecve\fP(2)
詳しい情報は、カーネルソースファイル \fIDocumentation/prctl/seccomp_filter.txt\fP を参照。
.TP
\fBPR_GET_SECCOMP\fP (Linux 2.6.23 以降)
-呼び出したスレッドの secure computing モードを (関数の結果として) 返す。 呼び出したスレッドが secure computing
-モードでなかった場合、 この操作は 0 を返す。 呼び出したスレッドが secure computing モードの場合、 \fBprctl\fP()
-を呼び出すとシグナル \fBSIGKILL\fP がそのプロセスに送信される。 呼び出したスレッドがフィルタモードで、 このシステムコールが seccomp
-フィルタにより許可されている場合、 2 を返す。 この操作が利用できるのは、カーネルが \fBCONFIG_SECCOMP\fP
-を有効にして作成されている場合だけである。
+Return (as the function result) the secure computing mode of the calling
+thread. If the caller is not in secure computing mode, this operation
+returns 0; if the caller is in strict secure computing mode, then the
+\fBprctl\fP() call will cause a \fBSIGKILL\fP signal to be sent to the process.
+If the caller is in filter mode, and this system call is allowed by the
+seccomp filters, it returns 2; otherwise, the process is killed with a
+\fBSIGKILL\fP signal. This operation is available only if the kernel is
+configured with \fBCONFIG_SECCOMP\fP enabled.
+
+Since Linux 3.8, the \fISeccomp\fP field of the \fI/proc/[pid]/status\fP file
+provides a method of obtaining the same information, without the risk that
+the process is killed; see \fBproc\fP(5).
.TP
\fBPR_SET_SECUREBITS\fP (Linux 2.6.26 以降)
呼び出したスレッドの "securebits" フラグを \fIarg2\fP で渡された値に設定する。 \fBcapabilities\fP(7) 参照。
二つ目の制限は、このような変更はプロセスの生存期間で一度だけ行うことができるという点である。 一度変更を行った後で変更を行おうとすると拒否される。
この動作は、 システム管理者が、 システムで動作するすべてのプロセスが行う、 普通でないシンボリックリンクの変更を監視するのを楽にする。
.RE
+.TP
+\fBPR_MPX_ENABLE_MANAGEMENT\fP, \fBPR_MPX_DISABLE_MANAGEMENT\fP (since Linux 3.19)
+.\" commit fe3d197f84319d3bce379a9c0dc17b1f48ad358c
+.\" See also http://lwn.net/Articles/582712/
+.\" See also https://gcc.gnu.org/wiki/Intel%20MPX%20support%20in%20the%20GCC%20compiler
+Enable or disable kernel management of Memory Protection eXtensions (MPX)
+bounds tables.
+
+MPX is a hardware\-assisted mechanism for performing bounds checking on
+pointers. It consists of a set of registers storing bounds information and
+a set of special instruction prefixes that tell the CPU on which
+instructions it should do bounds enforcement. There is a limited number of
+these registers and when there are more pointers than registers, their
+contents must be "spilled" into a set of tables. These tables are called
+"bounds tables" and the MPX \fBprctl\fP() operations control whether the
+kernel manages their allocation and freeing.
+
+When management is enabled, the kernel will take over allocation and freeing
+of the bounds tables. It does this by trapping the #BR exceptions that
+result at first use of missing bounds tables and instead of delivering the
+exception to user space, it allocates the table and populates the bounds
+directory with the location of the new table. For freeing, the kernel
+checks to see if bounds tables are present for memory which is not
+allocated, and frees them if so.
+
+Before enabling MPX management using \fBPR_MPX_ENABLE_MANAGEMENT\fP, the
+application must first have allocated a user\-space buffer for the bounds
+directory and placed the location of that directory in the \fIbndcfgu\fP
+register.
+
+These calls will fail if the CPU or kernel does not support MPX. Kernel
+support for MPX is enabled via the \fBCONFIG_X86_INTEL_MPX\fP configuration
+option. You can check whether the CPU supports MPX by looking for the 'mpx'
+CPUID bit, like with the following command:
+
+ cat /proc/cpuinfo | grep ' mpx '
+
+A thread may not switch in or out of long (64\-bit) mode while MPX is
+enabled.
+
+All threads in a process are affected by these calls.
+
+The child of a \fBfork\fP(2) inherits the state of MPX management. During
+\fBexecve\fP(2), MPX management is reset to a state as if
+\fBPR_MPX_DISABLE_MANAGEMENT\fP had been called.
+
.\"
+For further information on Intel MPX, see the kernel source file
+\fIDocumentation/x86/intel_mpx.txt\fP.
.SH 返り値
成功すると、 \fBPR_GET_DUMPABLE\fP, \fBPR_GET_KEEPCAPS\fP, \fBPR_GET_NO_NEW_PRIVS\fP,
\fBPR_GET_THP_DISABLE\fP, \fBPR_CAPBSET_READ\fP, \fBPR_GET_TIMING\fP,
\fBEFAULT\fP
\fIarg2\fP が不正なアドレスである。
.TP
+\fBEFAULT\fP
+\fIoption\fP is \fBPR_SET_SECCOMP\fP, \fIarg2\fP is \fBSECCOMP_MODE_FILTER\fP, the
+system was built with \fBCONFIG_SECCOMP_FILTER\fP, and \fIarg3\fP is an invalid
+address.
+.TP
\fBEINVAL\fP
\fIoption\fP の値が理解できない。
.TP
を有効にして作成されていなかった。
.TP
\fBEINVAL\fP
+\fIoption\fP is \fBPR_SET_SECCOMP\fP, \fIarg2\fP is \fBSECCOMP_MODE_FILTER\fP, and the
+kernel was not configured with \fBCONFIG_SECCOMP_FILTER\fP.
+.TP
+\fBEINVAL\fP
\fIoption\fP が \fBPR_SET_MM\fP で、以下のいずれかが真である。
.RS
.IP * 3
.\" and secure computing mode is already 1.
\fIoption\fP が \fBPR_SET_MM\fP で、 \fIarg3\fP が \fBPR_SET_MM_EXE_FILE\fP で、 \fIarg4\fP
で渡されたファイルディスクリプタが有効ではない。
+.TP
+\fBENXIO\fP
+\fIoption\fP was \fBPR_MPX_ENABLE_MANAGEMENT\fP or \fBPR_MPX_DISABLE_MANAGEMENT\fP
+and the kernel or the CPU does not support MPX management. Check that the
+kernel and processor have MPX support.
.SH バージョン
.\" The library interface was added in glibc 2.0.6
\fBprctl\fP() システムコールは Linux 2.1.57 で導入された。
.SH 関連項目
\fBsignal\fP(2), \fBcore\fP(5)
.SH この文書について
-この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.76 の一部である。
+この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.77 の一部である。
プロジェクトの説明とバグ報告に関する情報は \%http://www.kernel.org/doc/man\-pages/ に書かれている。