aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/filesystems/proc.txt
diff options
context:
space:
mode:
authorVasiliy Kulikov <segooon@gmail.com>2012-01-10 18:11:31 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-01-10 19:30:54 -0500
commit0499680a42141d86417a8fbaa8c8db806bea1201 (patch)
treeeb2aeb559bf5418476319aa81fa4f6ed3659bbc0 /Documentation/filesystems/proc.txt
parent97412950b10e64f347aec4a9b759395c2465adf6 (diff)
procfs: add hidepid= and gid= mount options
Add support for mount options to restrict access to /proc/PID/ directories. The default backward-compatible "relaxed" behaviour is left untouched. The first mount option is called "hidepid" and its value defines how much info about processes we want to be available for non-owners: hidepid=0 (default) means the old behavior - anybody may read all world-readable /proc/PID/* files. hidepid=1 means users may not access any /proc/<pid>/ directories, but their own. Sensitive files like cmdline, sched*, status are now protected against other users. As permission checking done in proc_pid_permission() and files' permissions are left untouched, programs expecting specific files' modes are not confused. hidepid=2 means hidepid=1 plus all /proc/PID/ will be invisible to other users. It doesn't mean that it hides whether a process exists (it can be learned by other means, e.g. by kill -0 $PID), but it hides process' euid and egid. It compicates intruder's task of gathering info about running processes, whether some daemon runs with elevated privileges, whether another user runs some sensitive program, whether other users run any program at all, etc. gid=XXX defines a group that will be able to gather all processes' info (as in hidepid=0 mode). This group should be used instead of putting nonroot user in sudoers file or something. However, untrusted users (like daemons, etc.) which are not supposed to monitor the tasks in the whole system should not be added to the group. hidepid=1 or higher is designed to restrict access to procfs files, which might reveal some sensitive private information like precise keystrokes timings: http://www.openwall.com/lists/oss-security/2011/11/05/3 hidepid=1/2 doesn't break monitoring userspace tools. ps, top, pgrep, and conky gracefully handle EPERM/ENOENT and behave as if the current user is the only user running processes. pstree shows the process subtree which contains "pstree" process. Note: the patch doesn't deal with setuid/setgid issues of keeping preopened descriptors of procfs files (like https://lkml.org/lkml/2011/2/7/368). We rely on that the leaked information like the scheduling counters of setuid apps doesn't threaten anybody's privacy - only the user started the setuid program may read the counters. Signed-off-by: Vasiliy Kulikov <segoon@openwall.com> Cc: Alexey Dobriyan <adobriyan@gmail.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Randy Dunlap <rdunlap@xenotime.net> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Greg KH <greg@kroah.com> Cc: Theodore Tso <tytso@MIT.EDU> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Cc: James Morris <jmorris@namei.org> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Hugh Dickins <hughd@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation/filesystems/proc.txt')
-rw-r--r--Documentation/filesystems/proc.txt39
1 files changed, 39 insertions, 0 deletions
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
index 0ec91f03422e..12fee132fbe2 100644
--- a/Documentation/filesystems/proc.txt
+++ b/Documentation/filesystems/proc.txt
@@ -41,6 +41,8 @@ Table of Contents
41 3.5 /proc/<pid>/mountinfo - Information about mounts 41 3.5 /proc/<pid>/mountinfo - Information about mounts
42 3.6 /proc/<pid>/comm & /proc/<pid>/task/<tid>/comm 42 3.6 /proc/<pid>/comm & /proc/<pid>/task/<tid>/comm
43 43
44 4 Configuring procfs
45 4.1 Mount options
44 46
45------------------------------------------------------------------------------ 47------------------------------------------------------------------------------
46Preface 48Preface
@@ -1542,3 +1544,40 @@ a task to set its own or one of its thread siblings comm value. The comm value
1542is limited in size compared to the cmdline value, so writing anything longer 1544is limited in size compared to the cmdline value, so writing anything longer
1543then the kernel's TASK_COMM_LEN (currently 16 chars) will result in a truncated 1545then the kernel's TASK_COMM_LEN (currently 16 chars) will result in a truncated
1544comm value. 1546comm value.
1547
1548
1549------------------------------------------------------------------------------
1550Configuring procfs
1551------------------------------------------------------------------------------
1552
15534.1 Mount options
1554---------------------
1555
1556The following mount options are supported:
1557
1558 hidepid= Set /proc/<pid>/ access mode.
1559 gid= Set the group authorized to learn processes information.
1560
1561hidepid=0 means classic mode - everybody may access all /proc/<pid>/ directories
1562(default).
1563
1564hidepid=1 means users may not access any /proc/<pid>/ directories but their
1565own. Sensitive files like cmdline, sched*, status are now protected against
1566other users. This makes it impossible to learn whether any user runs
1567specific program (given the program doesn't reveal itself by its behaviour).
1568As an additional bonus, as /proc/<pid>/cmdline is unaccessible for other users,
1569poorly written programs passing sensitive information via program arguments are
1570now protected against local eavesdroppers.
1571
1572hidepid=2 means hidepid=1 plus all /proc/<pid>/ will be fully invisible to other
1573users. It doesn't mean that it hides a fact whether a process with a specific
1574pid value exists (it can be learned by other means, e.g. by "kill -0 $PID"),
1575but it hides process' uid and gid, which may be learned by stat()'ing
1576/proc/<pid>/ otherwise. It greatly complicates an intruder's task of gathering
1577information about running processes, whether some daemon runs with elevated
1578privileges, whether other user runs some sensitive program, whether other users
1579run any program at all, etc.
1580
1581gid= defines a group authorized to learn processes information otherwise
1582prohibited by hidepid=. If you use some daemon like identd which needs to learn
1583information about processes information, just add identd to this group.