Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 51ef9af2 authored by Kees Cook's avatar Kees Cook Committed by Greg Kroah-Hartman
Browse files

proc: Provide details on speculation flaw mitigations



commit fae1fa0fc6cca8beee3ab8ed71d54f9a78fa3f64 upstream

As done with seccomp and no_new_privs, also show speculation flaw
mitigation state in /proc/$pid/status.

Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarDavid Woodhouse <dwmw@amazon.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4272f528
Loading
Loading
Loading
Loading
+23 −1
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@
#include <linux/delayacct.h>
#include <linux/seq_file.h>
#include <linux/pid_namespace.h>
#include <linux/prctl.h>
#include <linux/ptrace.h>
#include <linux/tracehook.h>
#include <linux/string_helpers.h>
@@ -345,8 +346,29 @@ static inline void task_seccomp(struct seq_file *m, struct task_struct *p)
{
#ifdef CONFIG_SECCOMP
	seq_put_decimal_ull(m, "Seccomp:\t", p->seccomp.mode);
	seq_putc(m, '\n');
#endif
	seq_printf(m, "\nSpeculation Store Bypass:\t");
	switch (arch_prctl_spec_ctrl_get(p, PR_SPEC_STORE_BYPASS)) {
	case -EINVAL:
		seq_printf(m, "unknown");
		break;
	case PR_SPEC_NOT_AFFECTED:
		seq_printf(m, "not vulnerable");
		break;
	case PR_SPEC_PRCTL | PR_SPEC_DISABLE:
		seq_printf(m, "thread mitigated");
		break;
	case PR_SPEC_PRCTL | PR_SPEC_ENABLE:
		seq_printf(m, "thread vulnerable");
		break;
	case PR_SPEC_DISABLE:
		seq_printf(m, "globally mitigated");
		break;
	default:
		seq_printf(m, "vulnerable");
		break;
	}
	seq_putc(m, '\n');
}

static inline void task_context_switch_counts(struct seq_file *m,