Skip to content

Commit fae1fa0

Browse files
keesKAGA-KOKO
authored andcommitted
proc: Provide details on speculation flaw mitigations
As done with seccomp and no_new_privs, also show speculation flaw mitigation state in /proc/$pid/status. Signed-off-by: Kees Cook <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]>
1 parent 7bbf137 commit fae1fa0

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

fs/proc/array.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
#include <linux/delayacct.h>
8686
#include <linux/seq_file.h>
8787
#include <linux/pid_namespace.h>
88+
#include <linux/prctl.h>
8889
#include <linux/ptrace.h>
8990
#include <linux/tracehook.h>
9091
#include <linux/string_helpers.h>
@@ -335,6 +336,27 @@ static inline void task_seccomp(struct seq_file *m, struct task_struct *p)
335336
#ifdef CONFIG_SECCOMP
336337
seq_put_decimal_ull(m, "\nSeccomp:\t", p->seccomp.mode);
337338
#endif
339+
seq_printf(m, "\nSpeculation Store Bypass:\t");
340+
switch (arch_prctl_spec_ctrl_get(p, PR_SPEC_STORE_BYPASS)) {
341+
case -EINVAL:
342+
seq_printf(m, "unknown");
343+
break;
344+
case PR_SPEC_NOT_AFFECTED:
345+
seq_printf(m, "not vulnerable");
346+
break;
347+
case PR_SPEC_PRCTL | PR_SPEC_DISABLE:
348+
seq_printf(m, "thread mitigated");
349+
break;
350+
case PR_SPEC_PRCTL | PR_SPEC_ENABLE:
351+
seq_printf(m, "thread vulnerable");
352+
break;
353+
case PR_SPEC_DISABLE:
354+
seq_printf(m, "globally mitigated");
355+
break;
356+
default:
357+
seq_printf(m, "vulnerable");
358+
break;
359+
}
338360
seq_putc(m, '\n');
339361
}
340362

0 commit comments

Comments
 (0)