UPSTREAM: /proc/pid/status: add "Seccomp" field
authorKees Cook <keescook@chromium.org>
Tue, 18 Dec 2012 00:03:14 +0000 (16:03 -0800)
committerChromeBot <chrome-bot@google.com>
Fri, 25 Jan 2013 00:47:02 +0000 (16:47 -0800)
commit9283927e50378bb8bb2fbfc53b615b02d546f090
treeb59d15f347cac8b427be7f834c4d2b81f87426ce
parent91b3c57827b73826448a15cad47881b50ee253f3
UPSTREAM: /proc/pid/status: add "Seccomp" field

It is currently impossible to examine the state of seccomp for a given
process.  While attaching with gdb and attempting "call
prctl(PR_GET_SECCOMP,...)" will work with some situations, it is not
reliable.  If the process is in seccomp mode 1, this query will kill the
process (prctl not allowed), if the process is in mode 2 with prctl not
allowed, it will similarly be killed, and in weird cases, if prctl is
filtered to return errno 0, it can look like seccomp is disabled.

When reviewing the state of running processes, there should be a way to
externally examine the seccomp mode.  ("Did this build of Chrome end up
using seccomp?" "Did my distro ship ssh with seccomp enabled?")

This adds the "Seccomp" line to /proc/$pid/status.

Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: James Morris <jmorris@namei.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
BUG=None
TEST=stout build, "Seccomp" field visible in "status" file

(cherry picked from commit 2f4b3bf6b2318cfaa177ec5a802f4d8d6afbd816)
Change-Id: I9200bf8e7535055e5a849548eb6199812d69b6d8
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/41959
Reviewed-by: Mandeep Singh Baines <msb@chromium.org>
Documentation/filesystems/proc.txt
fs/proc/array.c