Received: by 10.213.65.68 with SMTP id h4csp305243imn; Tue, 3 Apr 2018 21:31:56 -0700 (PDT) X-Google-Smtp-Source: AIpwx49pjYdW3naP05Hh2aB5haec4c/dARo1sgnhABCLTS0/doVbmoFGHKkshYvH/C9xmcakaIZw X-Received: by 2002:a17:902:848e:: with SMTP id c14-v6mr1243559plo.57.1522816316037; Tue, 03 Apr 2018 21:31:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522816316; cv=none; d=google.com; s=arc-20160816; b=i6JBGECTw2ccFTIUsTVhZRY7IONOhRET4Ir0nmQuEfty1o6tP69Qg9lRtsueKsFEb5 SWN7cERzyRFP98SR6o0MuPRnBa05D8pXddbSL/Gy85m79D09RNeF468TFaTDaBBiMMia Icve4R7dCz01gOdv/SQeHhlcQNzMvEuM0+mA8XxSWkjKmHVe51kGpckB86u4xrOe/PM8 ebgL/26853wJ1BzK2nCM8AqP37wuS78UxibqOAR/zcyIaSn2TiyorxAd6oDIorR0alzB KndJ0nVOYCMoKeWfmzembW3bTE6QPLgOI0CMm+fEzd26AfDsJyaPfpCstbeVNSVylXe6 z8RA== 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 :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=BtvbebkftuwnJlJEqPviNoY7ZkpejZQ98dd8T5GMRWM=; b=0R4SyzDMdOwE5F+cDNXl/lZgUYUpwG/w3LBtA9FyOJz0/ADD7bKHCu6ACMLNB5hp5v dE6oXgOhnWk/IPz1kl5/8VixLEZukWlyMKaLW/PQHxqZ8qswjlLvPJwR6R9L+SFsXqRh N5/Q+h74PbY8uKq/EomwwhmEpJG9naCk6oNHHjkMMuIZEM2C7veyxOk/Zt75tktVXmu5 KZ6hc+n/ubxdvb+8d/3gjIasm53ZaZUQzkOhn/1LaBOyJ4TvKNVu2fGlEU25meOOcnJM pR3lIFLnWBfYqKk3IO2vkJ/gQB5afu4B5CIMO7PdbPU9itGisULlakniT91f1mC7I7gY imXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Bch9yDqh; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p61-v6si2169339plb.633.2018.04.03.21.31.40; Tue, 03 Apr 2018 21:31:56 -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=@google.com header.s=20161025 header.b=Bch9yDqh; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750853AbeDDEad (ORCPT + 99 others); Wed, 4 Apr 2018 00:30:33 -0400 Received: from mail-it0-f42.google.com ([209.85.214.42]:53626 "EHLO mail-it0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750770AbeDDEab (ORCPT ); Wed, 4 Apr 2018 00:30:31 -0400 Received: by mail-it0-f42.google.com with SMTP id m134-v6so26255992itb.3 for ; Tue, 03 Apr 2018 21:30:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BtvbebkftuwnJlJEqPviNoY7ZkpejZQ98dd8T5GMRWM=; b=Bch9yDqhOlkMP3jAzzmkiXyDYZc9u+3j47nMfX7GLly/eLX/frxUaqZgQ7SyZCNwVk 1zd4zfysg1YYzS0/obWoDTzMzbwtLpchk/prf1/nY4hItUxg1bC2S0xtNhYjx3uSCXjv hHLCpVKnmSTDaIXympY31acqHkE8RJ73cbhNUU0KKxeVs7YF+caFzEweEZ7i0fwYU1jR uq1XH2KW4FAHlw2e8OZSyjC4NQpILTbgd+/5UYU7OwhNyaJGq6LawXDopWMKHad1XqDF eTrU0f3tW/LhpbX0Il/BZzUT0Ry8ydeVcxALLne2vwgGWEyNLerUF3L810TiV73pLTZr rx0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=BtvbebkftuwnJlJEqPviNoY7ZkpejZQ98dd8T5GMRWM=; b=OaroIgd75p8jVuUVujqm3N+VR0Hc8JcF4gXV8KCzhDpy5z9Dyvyo6YKo7rvTxsINqp OVEcM7IakkZ8geadvu1lZ/qjhF8yNwGek0FPzGGXrASORidFK5POl//EdonKWPvXE3eq Dgh9ju5VvjfbtUr7QDo5zzSK28fYOFLgOIh8GQZkoxPuE8w1gvpVw2FdgmpKSC8BHzRs hr1m2Vga9YjsSg5DQ/r13BZrnpR1yWXwpWkCm2+Uu6Qkaqd/qBfDMGav03ySyvTAlx8H yPjUS7o63imntZsmfdeI9DdtJd2soMowxFINH3g1CSEZ7AK2Ps3e5YP3+icsaaummPeU 9H6A== X-Gm-Message-State: ALQs6tDLery1JrMitkyCH2U6hwOr47Ysj74V1clOpUjCCHbhQ/mj64bW 3eZ2e+Kjv3mfg9ERrfqbl2UzpxI+BTmh8ep8BdjaFA== X-Received: by 2002:a24:6881:: with SMTP id v123-v6mr8212636itb.32.1522816229718; Tue, 03 Apr 2018 21:30:29 -0700 (PDT) MIME-Version: 1.0 References: <4136.1522452584@warthog.procyon.org.uk> <186aeb7e-1225-4bb8-3ff5-863a1cde86de@kernel.org> <30459.1522739219@warthog.procyon.org.uk> <9758.1522775763@warthog.procyon.org.uk> <13189.1522784944@warthog.procyon.org.uk> <9349.1522794769@warthog.procyon.org.uk> In-Reply-To: From: Matthew Garrett Date: Wed, 04 Apr 2018 04:30:18 +0000 Message-ID: Subject: Re: [GIT PULL] Kernel lockdown for secure boot To: Linus Torvalds Cc: luto@kernel.org, David Howells , Ard Biesheuvel , jmorris@namei.org, Alan Cox , Greg Kroah-Hartman , Linux Kernel Mailing List , jforbes@redhat.com, linux-man@vger.kernel.org, jlee@suse.com, LSM List , linux-api@vger.kernel.org, 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 6:43 PM Linus Torvalds wrote: > On Tue, Apr 3, 2018 at 6:13 PM, Matthew Garrett wrote: > > > > There are four cases: > No. > Matthew., stop with the agenda already. > This shit is what I'm talking about: > > Verified Boot off, lockdown on: Perception of security improvement that's > > trivially circumvented (and so bad) > You're doing some serious value judgement that is simply bogus. > If lockdown actually helps avoid CPL0 execution attacks, then it helps > even if secure more is off. Bear in mind that I'm talking about defaults here - in more constrained configurations the answers may change. But the kernel has no way of knowing whether it's in one of those configurations, and as a result there's an argument for not overpromising on the security that you're providing users. If a user has a configuration where you're able to verify that userspace has some degree of protection (eg, disk encryption keys are in the TPM and won't unseal if someone's switched out the kernel) then it's reasonable for userland (or a kernel command line option) to enable the functionality. What I'm afraid of is this turning into a "security" feature that ends up being circumvented in most scenarios where it's currently deployed - eg, module signatures are mostly worthless in the non-lockdown case because you can just grab the sig_enforce symbol address and then kexec a preamble that flips it back to N regardless of the kernel config. This is the sort of thing that's not obvious to most users, and it potentially causes them to make worse security decisions as a result. The goal for this part of the patchset isn't to cover every single conceivable case, it's to provide reasonable defaults in a way that makes life easier for distributions. > Or think of virtual machines - which people often use on purpose for > security things. Again, they very much are _not_ going to have secure > boot, but it's not necessarily even possible to "replace the kernel > and reboot" at all, because the kernel came from outside the virtual > machine entirely, and rebooting might just kill the VM rather than > restart anything. And where you have a trustworthy external thing providing your kernel, yeah, that's also an argument - and having a kernel command line argument that enables it in this case also seems entirely reasonable. > This is what I mean by having an agenda. We all know you are a big > proponent of secure boot. But it seems to cloud your arguments, by > turning your assumptions and your agenda into an "argument" that is > simply not even TRUE. I'm making this argument from the perspective of "What should the kernel do when it has no additional information". Having the kernel automatically enable lockdown without the user being aware of which guarantees their environment is providing risks giving users the impression of security that they may not have - in that case it makes more sense to have the user make an explicit decision to enable it. > See what I'm unhappy about? > > Verified Boot on, lockdown off: Perception of security improvement that's > > trivially circumvented (and so bad), status quo in mainline kernels > I think this is entirely false too. Again, the "trivial circumvention" > shows a bias and agenda that isn't really all that true. > > Of these four options, only two make sense. > No. > You say that, because you have that bias and that agenda. Ok. Only two make sense *in the absence of additional information about local configuration*. Distributions have to make reasonable choices here, and where a configuration choice decreases functionality and provides what may only be a marginal increase in security it's not a good configuration choice to make by default. > That said, wouldn't it be equally good to just make the whole thing be > a protected EFI variable instead? Once you have physical access to the > EFI shell (to turn off secure boot) you have access to that too. That's pretty much exactly what mokutil does, without you needing to find a copy of the UEFI shell to install first. If you think there's a strong enough need for it, we could definitely add an additional variable that allowed you to disable lockdown without disabling signature validation.