From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753766AbdJSWsl convert rfc822-to-8bit (ORCPT ); Thu, 19 Oct 2017 18:48:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53020 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752140AbdJSWsi (ORCPT ); Thu, 19 Oct 2017 18:48:38 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C2806641C0 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=dhowells@redhat.com Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <20171019221829.7m5nczg3ltqmhzom@ast-mbp> References: <20171019221829.7m5nczg3ltqmhzom@ast-mbp> <150842463163.7923.11081723749106843698.stgit@warthog.procyon.org.uk> <150842476953.7923.18174368926573855810.stgit@warthog.procyon.org.uk> To: Alexei Starovoitov Cc: jlee@suse.com, dhowells@redhat.com, linux-security-module@vger.kernel.org, gnomes@lxorguk.ukuu.org.uk, linux-efi@vger.kernel.org, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, jforbes@redhat.com, Daniel Borkmann , "David S. Miller" , netdev@vger.kernel.org Subject: Re: [PATCH 18/27] bpf: Restrict kernel image access functions when the kernel is locked down MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <481.1508453314.1@warthog.procyon.org.uk> Content-Transfer-Encoding: 8BIT Date: Thu, 19 Oct 2017 23:48:34 +0100 Message-ID: <482.1508453314@warthog.procyon.org.uk> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 19 Oct 2017 22:48:38 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Alexei Starovoitov wrote: > > @@ -65,6 +65,11 @@ BPF_CALL_3(bpf_probe_read, void *, dst, u32, size, const void *, unsafe_ptr) > > { > > int ret; > > > > + if (kernel_is_locked_down("BPF")) { > > + memset(dst, 0, size); > > + return -EPERM; > > + } > > That doesn't help the lockdown purpose. > If you don't trust the root the only way to prevent bpf read > memory is to disable the whole thing. > Have a single check in sys_bpf() to disallow everything if kernel_is_locked_down() > and don't add overhead to critical path like bpf_probe_read(). TBH, I've no idea how bpf does anything, so I can't say whether this is better, overkill or insufficient. David From mboxrd@z Thu Jan 1 00:00:00 1970 From: dhowells@redhat.com (David Howells) Date: Thu, 19 Oct 2017 23:48:34 +0100 Subject: [PATCH 18/27] bpf: Restrict kernel image access functions when the kernel is locked down In-Reply-To: <20171019221829.7m5nczg3ltqmhzom@ast-mbp> References: <20171019221829.7m5nczg3ltqmhzom@ast-mbp> <150842463163.7923.11081723749106843698.stgit@warthog.procyon.org.uk> <150842476953.7923.18174368926573855810.stgit@warthog.procyon.org.uk> Message-ID: <482.1508453314@warthog.procyon.org.uk> To: linux-security-module@vger.kernel.org List-Id: linux-security-module.vger.kernel.org Alexei Starovoitov wrote: > > @@ -65,6 +65,11 @@ BPF_CALL_3(bpf_probe_read, void *, dst, u32, size, const void *, unsafe_ptr) > > { > > int ret; > > > > + if (kernel_is_locked_down("BPF")) { > > + memset(dst, 0, size); > > + return -EPERM; > > + } > > That doesn't help the lockdown purpose. > If you don't trust the root the only way to prevent bpf read > memory is to disable the whole thing. > Have a single check in sys_bpf() to disallow everything if kernel_is_locked_down() > and don't add overhead to critical path like bpf_probe_read(). TBH, I've no idea how bpf does anything, so I can't say whether this is better, overkill or insufficient. David -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html