Skip to content

Commit 31f00f2

Browse files
keeskonradwilk
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]> (cherry picked from commit fae1fa0) Orabug: 28034177 CVE: CVE-2018-3639 Signed-off-by: Konrad Rzeszutek Wilk <[email protected]> Tested-by: Mihai Carabas <[email protected]> Reviewed-by: Mihai Carabas <[email protected]> Reviewed-by: John Haxby <[email protected]>
1 parent 5765ec2 commit 31f00f2

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>
@@ -347,6 +348,27 @@ static inline void task_seccomp(struct seq_file *m, struct task_struct *p)
347348
#ifdef CONFIG_SECCOMP
348349
seq_put_decimal_ull(m, "\nSeccomp:\t", p->seccomp.mode);
349350
#endif
351+
seq_printf(m, "\nSpeculation Store Bypass:\t");
352+
switch (arch_prctl_spec_ctrl_get(p, PR_SPEC_STORE_BYPASS)) {
353+
case -EINVAL:
354+
seq_printf(m, "unknown");
355+
break;
356+
case PR_SPEC_NOT_AFFECTED:
357+
seq_printf(m, "not vulnerable");
358+
break;
359+
case PR_SPEC_PRCTL | PR_SPEC_DISABLE:
360+
seq_printf(m, "thread mitigated");
361+
break;
362+
case PR_SPEC_PRCTL | PR_SPEC_ENABLE:
363+
seq_printf(m, "thread vulnerable");
364+
break;
365+
case PR_SPEC_DISABLE:
366+
seq_printf(m, "globally mitigated");
367+
break;
368+
default:
369+
seq_printf(m, "vulnerable");
370+
break;
371+
}
350372
seq_putc(m, '\n');
351373
}
352374

0 commit comments

Comments
 (0)