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 1fFpUH-0000KO-Lm for speck@linutronix.de; Tue, 08 May 2018 01:24:10 +0200 From: Dave Hansen Subject: [MODERATED] [PATCH 4/5] SSB extra v2 4 Date: Mon, 7 May 2018 16:18:45 -0700 Message-Id: =?utf-8?q?=3C29955dc00f7cf9c506acb7da9e84db76f81eae73=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: Dave Hansen For now, assume that all programs loaded by unpriviliged users are untrusted and need mitigation. Again, there are lots of optimizations we can do here, but this is obviously a conservative place to start. Signed-off-by: Dave Hansen --- kernel/bpf/syscall.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index 4ca46df..fa4d9e3 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -1292,6 +1292,8 @@ static int bpf_prog_load(union bpf_attr *attr) bpf_prog_insn_size(prog)) != 0) goto free_prog; + /* Mitigate all programs loaded without CAP_SYS_ADMIN: */ + prog->need_mitigation = !capable(CAP_SYS_ADMIN); prog->orig_prog = NULL; prog->jited = 0; -- 2.9.5