Return-path: Received: from mga07.intel.com ([134.134.136.100]) by Galois.linutronix.de with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1fFpUD-0000KE-0U for speck@linutronix.de; Tue, 08 May 2018 01:24:06 +0200 From: Dave Hansen Subject: [MODERATED] [PATCH 1/5] SSB extra v2 1 Date: Mon, 7 May 2018 16:18:42 -0700 Message-Id: =?utf-8?q?=3C8de240e7d1e070bf12e1614443782815d514a6c5=2E152573?= =?utf-8?q?4796=2Egit=2Edave=2Ehansen=40intel=2Ecom=3E?= In-Reply-To: References: In-Reply-To: References: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 To: speck@linutronix.de Cc: Dave Hansen List-ID: From: Thomas Gleixner Signed-off-by: Thomas Gleixner --- include/linux/nospec.h | 4 ++++ kernel/bpf/core.c | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/include/linux/nospec.h b/include/linux/nospec.h index a908c95..d04ca98 100644 --- a/include/linux/nospec.h +++ b/include/linux/nospec.h @@ -63,4 +63,8 @@ int arch_prctl_spec_ctrl_get(struct task_struct *task, unsigned long which); int arch_prctl_spec_ctrl_set(struct task_struct *task, unsigned long which, unsigned long ctrl); +/* Speculation control for BPF enforced mitigation */ +void arch_bpf_spec_ctrl_disable(void); +void arch_bpf_spec_ctrl_enable(void); + #endif /* _LINUX_NOSPEC_H */ diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index ba03ec3..dd7caa1 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c @@ -31,6 +31,7 @@ #include #include #include +#include #include @@ -1805,6 +1806,10 @@ const struct bpf_func_proto bpf_tail_call_proto = { .arg3_type = ARG_ANYTHING, }; +/* Stubs for architectures which do not implement BPF speculation control */ +void __weak arch_bpf_spec_ctrl_disable(void) { } +void __weak arch_bpf_spec_ctrl_enable(void) { } + /* Stub for JITs that only support cBPF. eBPF programs are interpreted. * It is encouraged to implement bpf_int_jit_compile() instead, so that * eBPF and implicitly also cBPF can get JITed! -- 2.9.5