@@ -51,6 +51,8 @@ fixes/update part 1.1 Stefani Seibold <stefani@seibold.net> June 9 2009
5151 4 Configuring procfs
5252 4.1 Mount options
5353
54+ 5 Filesystem behavior
55+
5456 Preface
5557=======
5658
@@ -2142,6 +2144,7 @@ The following mount options are supported:
21422144 ========= ========================================================
21432145 hidepid= Set /proc/<pid>/ access mode.
21442146 gid= Set the group authorized to learn processes information.
2147+ subset= Show only the specified subset of procfs.
21452148 ========= ========================================================
21462149
21472150hidepid=0 means classic mode - everybody may access all /proc/<pid>/ directories
@@ -2164,6 +2167,57 @@ information about running processes, whether some daemon runs with elevated
21642167privileges, whether other user runs some sensitive program, whether other users
21652168run any program at all, etc.
21662169
2170+ hidepid=4 means that procfs should only contain /proc/<pid>/ directories
2171+ that the caller can ptrace.
2172+
21672173gid= defines a group authorized to learn processes information otherwise
21682174prohibited by hidepid=. If you use some daemon like identd which needs to learn
21692175information about processes information, just add identd to this group.
2176+
2177+ subset=pid hides all top level files and directories in the procfs that
2178+ are not related to tasks.
2179+
2180+ 5 Filesystem behavior
2181+ ----------------------------
2182+
2183+ Originally, before the advent of pid namepsace, procfs was a global file
2184+ system. It means that there was only one procfs instance in the system.
2185+
2186+ When pid namespace was added, a separate procfs instance was mounted in
2187+ each pid namespace. So, procfs mount options are global among all
2188+ mountpoints within the same namespace.
2189+
2190+ ::
2191+
2192+ # grep ^proc /proc/mounts
2193+ proc /proc proc rw,relatime,hidepid=2 0 0
2194+
2195+ # strace -e mount mount -o hidepid=1 -t proc proc /tmp/proc
2196+ mount("proc", "/tmp/proc", "proc", 0, "hidepid=1") = 0
2197+ +++ exited with 0 +++
2198+
2199+ # grep ^proc /proc/mounts
2200+ proc /proc proc rw,relatime,hidepid=2 0 0
2201+ proc /tmp/proc proc rw,relatime,hidepid=2 0 0
2202+
2203+ and only after remounting procfs mount options will change at all
2204+ mountpoints.
2205+
2206+ # mount -o remount,hidepid=1 -t proc proc /tmp/proc
2207+
2208+ # grep ^proc /proc/mounts
2209+ proc /proc proc rw,relatime,hidepid=1 0 0
2210+ proc /tmp/proc proc rw,relatime,hidepid=1 0 0
2211+
2212+ This behavior is different from the behavior of other filesystems.
2213+
2214+ The new procfs behavior is more like other filesystems. Each procfs mount
2215+ creates a new procfs instance. Mount options affect own procfs instance.
2216+ It means that it became possible to have several procfs instances
2217+ displaying tasks with different filtering options in one pid namespace.
2218+
2219+ # mount -o hidepid=2 -t proc proc /proc
2220+ # mount -o hidepid=1 -t proc proc /tmp/proc
2221+ # grep ^proc /proc/mounts
2222+ proc /proc proc rw,relatime,hidepid=2 0 0
2223+ proc /tmp/proc proc rw,relatime,hidepid=1 0 0
0 commit comments