Received: by 10.213.65.68 with SMTP id h4csp231629imn; Tue, 3 Apr 2018 19:36:11 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/FBs16EYou6/78yFyxy4BZn5mJxZUxNEzjBwPHjmQPd0jdEn4KYA/izW8XD9vtE7xyPtvQ X-Received: by 10.99.43.70 with SMTP id r67mr10970392pgr.422.1522809371385; Tue, 03 Apr 2018 19:36:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522809371; cv=none; d=google.com; s=arc-20160816; b=bJj53jQsBftigZ+CsIcQSuB/xCJJJqs02DrnU9+wM4yQIz20daWzaZWcpZoyaRpGuz 6LyLLVdTeC2R6cx5ZbYxlsSt8kT9Zd6q05F4YLkh4QxCuItpqOgxJ18vtIfXpe2fOHbc WtjOaPzSym6z4Z8MFzPiFujlQfC4l4+iZm+ExGZay57JfEEasYCgZaArviFH2XU4Rctv n3nPc1C49jD3g4M0yP2BWYMBpfSOIGHVcG0N54qzCFLNFP9OsN9IcSV9rUw7cZIPF4ns T3yVduPvp6M/b7Xub6SfL09OY00bueudjwa+WUD1oqHVNaFUdDRCLdnbc1FdBUNFRBxS vHZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :mime-version:dkim-signature:arc-authentication-results; bh=8be7W7IwU15e/iHp86gGh97okrwT2hUF6siHmn5ZXeU=; b=awdAWRzuGzdBL3LeX6CT0jgrK9cexV5x3316JHNfa3Rte0YN85Ddfa/5ZHAc4uUO4D mzuY6vNt1Cwpbe6EJRX+gQMkVKzWRm4IuA+DPqoBgu/h6hlWCEC4ODznvzdBr7oB1n8N 66Zv5g0BTnBKGXCh6eYkJ+lrXgjIPKEINn5Ijfa//0Sg2/hfZRAft0nCaaPs7IAXfVlM cFLcDZR5eQzItFBhk7a9wShyWP8SCWdyZiqiW4f3BNooViA7mO9ZuSqGQ5OTszw24HsH wzZb48wAKla6W/SUW0xj8hxIhhNofwQKS/DK0z5xu9Q+hPRFTctvPD7YzGmpAP9hPstw wY7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BVgM36g5; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j3si2853141pga.364.2018.04.03.19.35.56; Tue, 03 Apr 2018 19:36:11 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BVgM36g5; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754850AbeDDCeu (ORCPT + 99 others); Tue, 3 Apr 2018 22:34:50 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:37063 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752750AbeDDCer (ORCPT ); Tue, 3 Apr 2018 22:34:47 -0400 Received: by mail-wr0-f193.google.com with SMTP id l49so20495998wrl.4; Tue, 03 Apr 2018 19:34:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=8be7W7IwU15e/iHp86gGh97okrwT2hUF6siHmn5ZXeU=; b=BVgM36g5o94bxUjn3Mg7ayXRaXOwiH6vrn+5EmOD/d66gX0PTzjYId4Wtm5maazcwa AlMJ/CUJmHP49pvfzlwTJhEOod+XpVC4h1CN88cQVznUQ7W7jbvaBIXEZvEixk1wUoVm 4zeuISdR7XUqfuCYOxVgra/DT4ikd9sBYz9zern/qhGMh7NubkiNJuLx01yFyFyN1ZGM ZzF8o3J+FNZi91HsAZNsqGASj+fKHygHV5oAxZ0G+/cnwQtezPeZ6LU/R66pJT3nQ5t9 9E1tfxgStYhjLsvftr7voyklt8QuEQXTF5XpyJ5/VVpRSt8LR/J9MetRpgqcBnys0Jrv itjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=8be7W7IwU15e/iHp86gGh97okrwT2hUF6siHmn5ZXeU=; b=OB9H6768RLr5j0hsiKMFCxniVBvB7czBQIGiiO8UvLQB+p8W9TUP8OEHcW0fO+3ThV tyPNfUi33tFunHhcXKKs/GeAC82W8ZcEwBmoUEG3EwM+pute45xQyWc06JECo1pQ5rmj eAoDA4Mn04WkIed725YzzWfNZkVOQgWOVWcwsnfj940y/kfQgmtj9ScmuOW/HwPhHftn oNTBska3C2rfYd1saW+sSzNuak1Qv7QeIPn5SAmlhTvxQdrWiBPlwPWkwfN2HhNurbj7 r9HKYZ/HpVXrXtSQUdk7sL8oDudSCDwTftAFB5pisPxnfH6ej06H+F5a2SSRAaTjaQBt XDeQ== X-Gm-Message-State: AElRT7EwfmmNaEJKsbU7I2NYNGdZprQiRUK3XxOfdnPOyHRj6LBOohwy PvHR+PD1Oz4vvxSsCyRKs3DNf/0q+ZzbCxkRYOo= X-Received: by 10.223.176.119 with SMTP id g52mr12342016wra.21.1522809286098; Tue, 03 Apr 2018 19:34:46 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.155.148 with HTTP; Tue, 3 Apr 2018 19:34:25 -0700 (PDT) From: Alexei Starovoitov Date: Tue, 3 Apr 2018 19:34:25 -0700 Message-ID: Subject: Re: [GIT PULL] Kernel lockdown for secure boot To: Andy Lutomirski Cc: David Howells , Ard Biesheuvel , James Morris , One Thousand Gnomes , Linus Torvalds , Matthew Garrett , Greg KH , LKML , Justin Forbes , linux-man , joeyli , LSM List , Linux API , Kees Cook , linux-efi Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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. 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