Received: by 10.213.65.68 with SMTP id h4csp1369297imn; Sun, 8 Apr 2018 01:47:58 -0700 (PDT) X-Google-Smtp-Source: AIpwx483RNFrU0z9e3FhoBUu+XGjF8dE/8y2Mq0THOzZOOMWFypjG0u5f++FHHV9qVTizF0RL+BE X-Received: by 2002:a17:902:20cb:: with SMTP id v11-v6mr35101521plg.82.1523177278603; Sun, 08 Apr 2018 01:47:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523177278; cv=none; d=google.com; s=arc-20160816; b=QCkvjGe4d71g1VFjcXd+bZ53bhbYg2aalVRazcM2EhepDRkIT1mf6aRMbaLTV5FOE2 RuWQw0soMlNyvuQ/TMFJdKaP5cdIwDVUyqQ9ze3ZueXxSAvzUtHH37qjIeJRBWsHUvWE 6LVvA86eFMqARf1GqVR4CI4rP0NXzrSNe3gAcwaBF/xiwUXNndGjYOgFpN4Smz4lBW7P jjchTtQkIML5z+INRT0nIaaHeunA9vX0l0/8uJ/Y7rC2pkdcso9tFiLPEMH3EjPzDR06 Lndo+hdmjTekzS5ZeMQI3Hz4C8oVkPTS8JcLuHejhsl5BVBvRuDDLuE0jx9JJDqK3pTK O0lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=abtfDDcMmhJ4/PoKmvzqYVgshqU+2JHnOCzUu4Nakh0=; b=PaYvDssEp2gxHJ7ltfnhetMbIE0C61A9eNfkyoYRqUO9EzNW8gC82aAX5+WJw/WKiC NXAVUFmmRsSijC97RtKClcpvOAAAjrSoptu+StP6J23zUoz7i3kk58ZnvvCGz9/VSIFB UN1Phnk1cXvfDCFZDfMuVRJu6Y7Acc+9T3qNOhxQHe0YMBpYBrZdY/+Ykg+n15zzJ4sG P06jopbTPh7U4/6YjOikDrVYQWYFLB4tRc9SwQGal0NEZjXST4P5HDU49h5vxPRAPR2C eIdFSCsHtDhOTHCU0LLntWWpxgIA7NjMH2IBGHG4+rFw14MKi1KjJmdJnNNEEBZMtohT VSsQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z22-v6si12212278plo.270.2018.04.08.01.47.22; Sun, 08 Apr 2018 01:47:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751663AbeDHIIE (ORCPT + 99 others); Sun, 8 Apr 2018 04:08:04 -0400 Received: from smtp.nue.novell.com ([195.135.221.5]:46642 "EHLO smtp.nue.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750891AbeDHIIC (ORCPT ); Sun, 8 Apr 2018 04:08:02 -0400 Received: from linux-l9pv.suse (124-11-22-254.static.tfn.net.tw [124.11.22.254]) by smtp.nue.novell.com with ESMTP (TLS encrypted); Sun, 08 Apr 2018 10:07:54 +0200 Date: Sun, 8 Apr 2018 16:07:42 +0800 From: joeyli To: Alexei Starovoitov Cc: Andy Lutomirski , David Howells , Ard Biesheuvel , James Morris , One Thousand Gnomes , Linus Torvalds , Matthew Garrett , Greg KH , LKML , Justin Forbes , linux-man , LSM List , Linux API , Kees Cook , linux-efi Subject: Re: [GIT PULL] Kernel lockdown for secure boot Message-ID: <20180408080742.GE7362@linux-l9pv.suse> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 03, 2018 at 07:34:25PM -0700, Alexei Starovoitov wrote: > On Tue, Apr 3, 2018 at 9:26 AM, Andy Lutomirski wrote: > > On Tue, Apr 3, 2018 at 8:41 AM, Alexei Starovoitov > > wrote: > >> On Tue, Apr 03, 2018 at 08:11:07AM -0700, Andy Lutomirski wrote: > >>> > > >>> >> "bpf: Restrict kernel image access functions when the kernel is locked down": > >>> >> This patch just sucks in general. > >>> > > >>> > Yes - but that's what Alexei Starovoitov specified. bpf kind of sucks since > >>> > it gives you unrestricted access to the kernel. > >>> > >>> bpf, in certain contexts, gives you unrestricted access to *reading* > >>> kernel memory. bpf should, under no circumstances, let you write to > >>> the kernel unless you're using fault injection or similar. > >>> > >>> I'm surprised that Alexei acked this patch. If something like XDP or > >>> bpfilter starts becoming widely used, this patch will require a lot of > >>> reworking to avoid breaking standard distros. > >> > >> my understanding was that this lockdown set attemps to disallow _reads_ > >> of kernel memory from anything, so first version of patch was adding > >> run-time checks for bpf_probe_read() which is no-go > >> and without this helper the bpf for tracing is losing a lot of its power, > >> so the easiest is to disable it all. > > > > Fair enough. > > Actually looking at the patch again: > https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/commit/?h=efi-lock-down&id=78bb0059c3b8304a8d124b55feebc780fb3e0500 > The bpf is totally disabled in this patch. > If the only thing that folks are paranoid about is reading > arbitrary kernel memory with bpf_probe_read() helper > then preferred patch would be to disable it during verification > when in lockdown mode Sorry for I didn't fully understand your idea... Do you mean that using bpf verifier to filter out bpf program that uses bpf_probe_read()? . > No run-time overhead and android folks will be happy > that lockdown doesn't break their work. > They converted out-of-tree networking accounting > module and corresponding user daemon to use bpf: > https://www.linuxplumbersconf.org/2017/ocw/system/presentations/4791/original/eBPF%20cgroup%20filters%20for%20data%20usage%20accounting%20on%20Android.pdf Thanks Joey Lee