summaryrefslogtreecommitdiff
path: root/fs/proc
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2020-05-14 00:11:26 +0300
committerKees Cook <keescook@chromium.org>2020-07-11 02:01:51 +0300
commitc818c03b661cd769e035e41673d5543ba2ebda64 (patch)
treeceb9cf9666ce0e0e3964c1ff1a0a5949de471cf6 /fs/proc
parente4d05028a07f505a08802a6d1b11674c149df2b3 (diff)
downloadlinux-c818c03b661cd769e035e41673d5543ba2ebda64.tar.xz
seccomp: Report number of loaded filters in /proc/$pid/status
A common question asked when debugging seccomp filters is "how many filters are attached to your process?" Provide a way to easily answer this question through /proc/$pid/status with a "Seccomp_filters" line. Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'fs/proc')
-rw-r--r--fs/proc/array.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c
index 55ecbeb3a721..65ec2029fa80 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -341,6 +341,8 @@ static inline void task_seccomp(struct seq_file *m, struct task_struct *p)
seq_put_decimal_ull(m, "NoNewPrivs:\t", task_no_new_privs(p));
#ifdef CONFIG_SECCOMP
seq_put_decimal_ull(m, "\nSeccomp:\t", p->seccomp.mode);
+ seq_put_decimal_ull(m, "\nSeccomp_filters:\t",
+ atomic_read(&p->seccomp.filter_count));
#endif
seq_puts(m, "\nSpeculation_Store_Bypass:\t");
switch (arch_prctl_spec_ctrl_get(p, PR_SPEC_STORE_BYPASS)) {