diff options
author | Kees Cook <keescook@chromium.org> | 2017-05-13 07:51:47 -0400 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2017-05-18 12:33:04 -0400 |
commit | 90bb766440f2147486a2acc3e793d7b8348b0c22 (patch) | |
tree | d70d83fa1075ef5434f3e049ae2ffa3b5096fae4 | |
parent | 5ea672c752d93ef3cfa9ce3ea1fbf204f7056a33 (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.rst | 1 | ||||
-rw-r--r-- | Documentation/security/00-INDEX | 2 | ||||
-rw-r--r-- | MAINTAINERS | 1 | ||||
-rw-r--r-- | security/yama/Kconfig | 3 |
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 | ==== | ||
2 | Yama | ||
3 | ==== | ||
4 | |||
1 | Yama is a Linux Security Module that collects system-wide DAC security | 5 | Yama is a Linux Security Module that collects system-wide DAC security |
2 | protections that are not handled by the core kernel itself. This is | 6 | protections that are not handled by the core kernel itself. This is |
3 | selectable at build-time with CONFIG_SECURITY_YAMA, and can be controlled | 7 | selectable at build-time with ``CONFIG_SECURITY_YAMA``, and can be controlled |
4 | at run-time through sysctls in /proc/sys/kernel/yama: | 8 | at run-time through sysctls in ``/proc/sys/kernel/yama``: |
5 | |||
6 | - ptrace_scope | ||
7 | 9 | ||
8 | ============================================================== | 10 | ptrace_scope |
9 | 11 | ============ | |
10 | ptrace_scope: | ||
11 | 12 | ||
12 | As Linux grows in popularity, it will become a larger target for | 13 | As Linux grows in popularity, it will become a larger target for |
13 | malware. One particularly troubling weakness of the Linux process | 14 | malware. One particularly troubling weakness of the Linux process |
@@ -25,47 +26,49 @@ exist and remain possible if ptrace is allowed to operate as before. | |||
25 | Since ptrace is not commonly used by non-developers and non-admins, system | 26 | Since ptrace is not commonly used by non-developers and non-admins, system |
26 | builders should be allowed the option to disable this debugging system. | 27 | builders should be allowed the option to disable this debugging system. |
27 | 28 | ||
28 | For a solution, some applications use prctl(PR_SET_DUMPABLE, ...) to | 29 | For a solution, some applications use ``prctl(PR_SET_DUMPABLE, ...)`` to |
29 | specifically disallow such ptrace attachment (e.g. ssh-agent), but many | 30 | specifically disallow such ptrace attachment (e.g. ssh-agent), but many |
30 | do not. A more general solution is to only allow ptrace directly from a | 31 | do not. A more general solution is to only allow ptrace directly from a |
31 | parent to a child process (i.e. direct "gdb EXE" and "strace EXE" still | 32 | parent to a child process (i.e. direct "gdb EXE" and "strace EXE" still |
32 | work), or with CAP_SYS_PTRACE (i.e. "gdb --pid=PID", and "strace -p PID" | 33 | work), or with ``CAP_SYS_PTRACE`` (i.e. "gdb --pid=PID", and "strace -p PID" |
33 | still work as root). | 34 | still work as root). |
34 | 35 | ||
35 | In mode 1, software that has defined application-specific relationships | 36 | In mode 1, software that has defined application-specific relationships |
36 | between a debugging process and its inferior (crash handlers, etc), | 37 | between a debugging process and its inferior (crash handlers, etc), |
37 | prctl(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 |
38 | other process (and its descendants) are allowed to call PTRACE_ATTACH | 39 | other process (and its descendants) are allowed to call ``PTRACE_ATTACH`` |
39 | against it. Only one such declared debugging process can exists for | 40 | against it. Only one such declared debugging process can exists for |
40 | each inferior at a time. For example, this is used by KDE, Chromium, and | 41 | each inferior at a time. For example, this is used by KDE, Chromium, and |
41 | Firefox's crash handlers, and by Wine for allowing only Wine processes | 42 | Firefox's crash handlers, and by Wine for allowing only Wine processes |
42 | to ptrace each other. If a process wishes to entirely disable these ptrace | 43 | to ptrace each other. If a process wishes to entirely disable these ptrace |
43 | restrictions, it can call prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY, ...) | 44 | restrictions, it can call ``prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY, ...)`` |
44 | so that any otherwise allowed process (even those in external pid namespaces) | 45 | so that any otherwise allowed process (even those in external pid namespaces) |
45 | may attach. | 46 | may attach. |
46 | 47 | ||
47 | The sysctl settings (writable only with CAP_SYS_PTRACE) are: | 48 | The sysctl settings (writable only with ``CAP_SYS_PTRACE``) are: |
48 | 49 | ||
49 | 0 - classic ptrace permissions: a process can PTRACE_ATTACH to any other | 50 | 0 - 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 | ||
55 | 1 - restricted ptrace: a process must have a predefined relationship | 57 | 1 - 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 | ||
63 | 2 - admin-only attach: only processes with CAP_SYS_PTRACE may use ptrace | 66 | 2 - 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 | ||
66 | 3 - no attach: no processes may use ptrace with PTRACE_ATTACH nor via | 70 | 3 - 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 | ||
69 | The original children-only logic was based on the restrictions in grsecurity. | 74 | The 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. |
3 | Smack.txt | 3 | Smack.txt |
4 | - documentation on the Smack Linux Security Module. | 4 | - documentation on the Smack Linux Security Module. |
5 | Yama.txt | ||
6 | - documentation on the Yama Linux Security Module. | ||
7 | keys-ecryptfs.txt | 5 | keys-ecryptfs.txt |
8 | - description of the encryption keys for the ecryptfs filesystem. | 6 | - description of the encryption keys for the ecryptfs filesystem. |
9 | keys-request-key.txt | 7 | keys-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> | |||
11573 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git yama/tip | 11573 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git yama/tip |
11574 | S: Supported | 11574 | S: Supported |
11575 | F: security/yama/ | 11575 | F: security/yama/ |
11576 | F: Documentation/admin-guide/LSM/Yama.rst | ||
11576 | 11577 | ||
11577 | SENSABLE PHANTOM | 11578 | SENSABLE PHANTOM |
11578 | M: Jiri Slaby <jirislaby@gmail.com> | 11579 | M: 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. |