aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2017-05-13 07:51:47 -0400
committerJonathan Corbet <corbet@lwn.net>2017-05-18 12:33:04 -0400
commit90bb766440f2147486a2acc3e793d7b8348b0c22 (patch)
treed70d83fa1075ef5434f3e049ae2ffa3b5096fae4
parent5ea672c752d93ef3cfa9ce3ea1fbf204f7056a33 (diff)
doc: ReSTify Yama.txt
Adjusts for ReST markup and moves under LSM admin guide. Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
-rw-r--r--Documentation/admin-guide/LSM/Yama.rst (renamed from Documentation/security/Yama.txt)55
-rw-r--r--Documentation/admin-guide/LSM/index.rst1
-rw-r--r--Documentation/security/00-INDEX2
-rw-r--r--MAINTAINERS1
-rw-r--r--security/yama/Kconfig3
5 files changed, 33 insertions, 29 deletions
diff --git a/Documentation/security/Yama.txt b/Documentation/admin-guide/LSM/Yama.rst
index d9ee7d7a6c7f..13468ea696b7 100644
--- a/Documentation/security/Yama.txt
+++ b/Documentation/admin-guide/LSM/Yama.rst
@@ -1,13 +1,14 @@
1====
2Yama
3====
4
1Yama is a Linux Security Module that collects system-wide DAC security 5Yama is a Linux Security Module that collects system-wide DAC security
2protections that are not handled by the core kernel itself. This is 6protections that are not handled by the core kernel itself. This is
3selectable at build-time with CONFIG_SECURITY_YAMA, and can be controlled 7selectable at build-time with ``CONFIG_SECURITY_YAMA``, and can be controlled
4at run-time through sysctls in /proc/sys/kernel/yama: 8at run-time through sysctls in ``/proc/sys/kernel/yama``:
5
6- ptrace_scope
7 9
8============================================================== 10ptrace_scope
9 11============
10ptrace_scope:
11 12
12As Linux grows in popularity, it will become a larger target for 13As Linux grows in popularity, it will become a larger target for
13malware. One particularly troubling weakness of the Linux process 14malware. One particularly troubling weakness of the Linux process
@@ -25,47 +26,49 @@ exist and remain possible if ptrace is allowed to operate as before.
25Since ptrace is not commonly used by non-developers and non-admins, system 26Since ptrace is not commonly used by non-developers and non-admins, system
26builders should be allowed the option to disable this debugging system. 27builders should be allowed the option to disable this debugging system.
27 28
28For a solution, some applications use prctl(PR_SET_DUMPABLE, ...) to 29For a solution, some applications use ``prctl(PR_SET_DUMPABLE, ...)`` to
29specifically disallow such ptrace attachment (e.g. ssh-agent), but many 30specifically disallow such ptrace attachment (e.g. ssh-agent), but many
30do not. A more general solution is to only allow ptrace directly from a 31do not. A more general solution is to only allow ptrace directly from a
31parent to a child process (i.e. direct "gdb EXE" and "strace EXE" still 32parent to a child process (i.e. direct "gdb EXE" and "strace EXE" still
32work), or with CAP_SYS_PTRACE (i.e. "gdb --pid=PID", and "strace -p PID" 33work), or with ``CAP_SYS_PTRACE`` (i.e. "gdb --pid=PID", and "strace -p PID"
33still work as root). 34still work as root).
34 35
35In mode 1, software that has defined application-specific relationships 36In mode 1, software that has defined application-specific relationships
36between a debugging process and its inferior (crash handlers, etc), 37between a debugging process and its inferior (crash handlers, etc),
37prctl(PR_SET_PTRACER, pid, ...) can be used. An inferior can declare which 38``prctl(PR_SET_PTRACER, pid, ...)`` can be used. An inferior can declare which
38other process (and its descendants) are allowed to call PTRACE_ATTACH 39other process (and its descendants) are allowed to call ``PTRACE_ATTACH``
39against it. Only one such declared debugging process can exists for 40against it. Only one such declared debugging process can exists for
40each inferior at a time. For example, this is used by KDE, Chromium, and 41each inferior at a time. For example, this is used by KDE, Chromium, and
41Firefox's crash handlers, and by Wine for allowing only Wine processes 42Firefox's crash handlers, and by Wine for allowing only Wine processes
42to ptrace each other. If a process wishes to entirely disable these ptrace 43to ptrace each other. If a process wishes to entirely disable these ptrace
43restrictions, it can call prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY, ...) 44restrictions, it can call ``prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY, ...)``
44so that any otherwise allowed process (even those in external pid namespaces) 45so that any otherwise allowed process (even those in external pid namespaces)
45may attach. 46may attach.
46 47
47The sysctl settings (writable only with CAP_SYS_PTRACE) are: 48The sysctl settings (writable only with ``CAP_SYS_PTRACE``) are:
48 49
490 - classic ptrace permissions: a process can PTRACE_ATTACH to any other 500 - classic ptrace permissions:
51 a process can ``PTRACE_ATTACH`` to any other
50 process running under the same uid, as long as it is dumpable (i.e. 52 process running under the same uid, as long as it is dumpable (i.e.
51 did not transition uids, start privileged, or have called 53 did not transition uids, start privileged, or have called
52 prctl(PR_SET_DUMPABLE...) already). Similarly, PTRACE_TRACEME is 54 ``prctl(PR_SET_DUMPABLE...)`` already). Similarly, ``PTRACE_TRACEME`` is
53 unchanged. 55 unchanged.
54 56
551 - restricted ptrace: a process must have a predefined relationship 571 - restricted ptrace:
56 with the inferior it wants to call PTRACE_ATTACH on. By default, 58 a process must have a predefined relationship
59 with the inferior it wants to call ``PTRACE_ATTACH`` on. By default,
57 this relationship is that of only its descendants when the above 60 this relationship is that of only its descendants when the above
58 classic criteria is also met. To change the relationship, an 61 classic criteria is also met. To change the relationship, an
59 inferior can call prctl(PR_SET_PTRACER, debugger, ...) to declare 62 inferior can call ``prctl(PR_SET_PTRACER, debugger, ...)`` to declare
60 an allowed debugger PID to call PTRACE_ATTACH on the inferior. 63 an allowed debugger PID to call ``PTRACE_ATTACH`` on the inferior.
61 Using PTRACE_TRACEME is unchanged. 64 Using ``PTRACE_TRACEME`` is unchanged.
62 65
632 - admin-only attach: only processes with CAP_SYS_PTRACE may use ptrace 662 - admin-only attach:
64 with PTRACE_ATTACH, or through children calling PTRACE_TRACEME. 67 only processes with ``CAP_SYS_PTRACE`` may use ptrace
68 with ``PTRACE_ATTACH``, or through children calling ``PTRACE_TRACEME``.
65 69
663 - no attach: no processes may use ptrace with PTRACE_ATTACH nor via 703 - no attach:
67 PTRACE_TRACEME. Once set, this sysctl value cannot be changed. 71 no processes may use ptrace with ``PTRACE_ATTACH`` nor via
72 ``PTRACE_TRACEME``. Once set, this sysctl value cannot be changed.
68 73
69The original children-only logic was based on the restrictions in grsecurity. 74The original children-only logic was based on the restrictions in grsecurity.
70
71==============================================================
diff --git a/Documentation/admin-guide/LSM/index.rst b/Documentation/admin-guide/LSM/index.rst
index 6aa4e0dc588b..e5ba2c69b8ef 100644
--- a/Documentation/admin-guide/LSM/index.rst
+++ b/Documentation/admin-guide/LSM/index.rst
@@ -36,3 +36,4 @@ the one "major" module (e.g. SELinux) if there is one configured.
36 apparmor 36 apparmor
37 SELinux 37 SELinux
38 tomoyo 38 tomoyo
39 Yama
diff --git a/Documentation/security/00-INDEX b/Documentation/security/00-INDEX
index 04ef62511ea1..a55f781be0dd 100644
--- a/Documentation/security/00-INDEX
+++ b/Documentation/security/00-INDEX
@@ -2,8 +2,6 @@
2 - this file. 2 - this file.
3Smack.txt 3Smack.txt
4 - documentation on the Smack Linux Security Module. 4 - documentation on the Smack Linux Security Module.
5Yama.txt
6 - documentation on the Yama Linux Security Module.
7keys-ecryptfs.txt 5keys-ecryptfs.txt
8 - description of the encryption keys for the ecryptfs filesystem. 6 - description of the encryption keys for the ecryptfs filesystem.
9keys-request-key.txt 7keys-request-key.txt
diff --git a/MAINTAINERS b/MAINTAINERS
index 4d8914ad710a..816947653ea2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11573,6 +11573,7 @@ M: Kees Cook <keescook@chromium.org>
11573T: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git yama/tip 11573T: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git yama/tip
11574S: Supported 11574S: Supported
11575F: security/yama/ 11575F: security/yama/
11576F: Documentation/admin-guide/LSM/Yama.rst
11576 11577
11577SENSABLE PHANTOM 11578SENSABLE PHANTOM
11578M: Jiri Slaby <jirislaby@gmail.com> 11579M: Jiri Slaby <jirislaby@gmail.com>
diff --git a/security/yama/Kconfig b/security/yama/Kconfig
index 90c605eea892..96b27405558a 100644
--- a/security/yama/Kconfig
+++ b/security/yama/Kconfig
@@ -7,6 +7,7 @@ config SECURITY_YAMA
7 system-wide security settings beyond regular Linux discretionary 7 system-wide security settings beyond regular Linux discretionary
8 access controls. Currently available is ptrace scope restriction. 8 access controls. Currently available is ptrace scope restriction.
9 Like capabilities, this security module stacks with other LSMs. 9 Like capabilities, this security module stacks with other LSMs.
10 Further information can be found in Documentation/security/Yama.txt. 10 Further information can be found in
11 Documentation/admin-guide/LSM/Yama.rst.
11 12
12 If you are unsure how to answer this question, answer N. 13 If you are unsure how to answer this question, answer N.