Received: by 2002:a05:6358:16cd:b0:dc:6189:e246 with SMTP id r13csp1274976rwl; Fri, 4 Nov 2022 11:54:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4vVWbaMVJly7dsNLjVX+U6DPdqKFb3b+qmY3rp+JS1VlOmklyG+HwSGN6ohqkRx8jMIlpZ X-Received: by 2002:a63:fa17:0:b0:43c:3f26:48e3 with SMTP id y23-20020a63fa17000000b0043c3f2648e3mr31576937pgh.66.1667588051714; Fri, 04 Nov 2022 11:54:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667588051; cv=none; d=google.com; s=arc-20160816; b=hUsEjE52VjilzNF7su+Mv2zE8l/jY/QjyxMh2kJiV1ZBOmV2VANGsT7NsH0TjnH3qI cw6apNvDMNGznAErJun2tfOMB05yfdp8eyH4jakBhZFXXGMBvl37QovoLxRla0YaO/pz x9Pb8eYj2xeIYYp+Qipz13tOlwHMRBxqts1GQZmB6g4K823PIzLOd12Q89nX9XowCPV0 tq7Ewu9zUIAT+Fjr8yjnv1oPVjvIwT9QUAnrSffGtK/9Mj2z3d5V1Yy59dMtbupM7aYH BAr6qKGW2oVXWIFEPaXIIcnXv7jxX1VzAhAAXigrbZay6J3nl4fo16bNUC3IQ1/RUh9s EJPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=pUqszso6Ws0bgIO+Fn99YX+rUGif2Q1cUmfl0WM0vmw=; b=jpMFNeJ98l8DPCgKU7bLo2NVXrV8MmUApWRnCYf0OOQs0gnmqx+0h0u+JQihqYnajQ rlyUnsEjeqlANjxnti1zPIqjinyb8+VNXrdCfq1JkjwUCyzEgYNDFibj3nailCZUHfYa a1DM1TbXe8+XTO3uhmoW3e0m/f9fAlwLpMcFpJsIbGBMj4mhe8OaqVaxzp0MybxfnDed eq4fp9e1SYHYa13Ea/z0lbs8LjCcDjqf9QtH3kk5Jete0l3ZgPIJawHtc6By2o2v2Qty +l7eH+mHPYicsY7o1HXYcdyFfAl9fgXnQCJKhY1PznJ8psfk/Ekx2qkJOryLa2feIFiz V4rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=odecLGRh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u25-20020a62ed19000000b0056238741ba7si4774987pfh.174.2022.11.04.11.53.59; Fri, 04 Nov 2022 11:54:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=odecLGRh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232012AbiKDS2A (ORCPT + 96 others); Fri, 4 Nov 2022 14:28:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231431AbiKDS1z (ORCPT ); Fri, 4 Nov 2022 14:27:55 -0400 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0147431FB5 for ; Fri, 4 Nov 2022 11:27:54 -0700 (PDT) Received: by mail-pl1-x62f.google.com with SMTP id io19so5644738plb.8 for ; Fri, 04 Nov 2022 11:27:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=pUqszso6Ws0bgIO+Fn99YX+rUGif2Q1cUmfl0WM0vmw=; b=odecLGRhxOwhsXd0tqsJnLvySgK1wwL5EuKjfVW2c3GzswA2SuTOPOMGHpRE8Oo5jF L45owvgVsVwiX3yrJTEPO3I5oqc25pHMej0OGi+/D3BFS/EyoVBztE7WTQMpAaqf+Rgg AknDcr7HTObIsDEivNuvIS1OvsxZeWIyfLnAc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=pUqszso6Ws0bgIO+Fn99YX+rUGif2Q1cUmfl0WM0vmw=; b=zdGaaXXC4x4XcPg+EfrM8DJU0lFYv+UdF/Xw7F28ZeJcxS745nasXL05JAqhttE25b HpjCn+wUCYax5WxFTJOVoUlqWpTo+nphmiA/cWOnGgyQvcvdUj/49iv2SD5Xcvn48NG7 h+YP9k4gKtnbn0OSup3l8i82Ysjmc/A2SOC0llXtFcfzcO1p09FsXKbZ2lB3zedhRpXq NXJ4CeknwcjIC2rC8vcf1gc0H2V8fW9p43vgTevkuQWW3DTejuai1ewEfQeNElgDfi1g MP9WGzQQCoU9HgGtneMelG5Q/KF/9U2imTQuM/1YHqB/FjUH1gJhYy6QHvYEx/Swvrs0 LOIg== X-Gm-Message-State: ACrzQf2NgsPCQua7hedKjOiCzGh+sd2ksN51T/a5hDOSK/qpIsODWtvP cG82Lwr8Uehkn63HJkc4tgsTVg== X-Received: by 2002:a17:90b:3a81:b0:213:ff6a:aa0d with SMTP id om1-20020a17090b3a8100b00213ff6aaa0dmr23344938pjb.86.1667586474491; Fri, 04 Nov 2022 11:27:54 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id 101-20020a17090a0fee00b0020669c8bd87sm45503pjz.36.2022.11.04.11.27.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Nov 2022 11:27:54 -0700 (PDT) Date: Fri, 4 Nov 2022 11:27:53 -0700 From: Kees Cook To: Evan Green Cc: linux-kernel@vger.kernel.org, corbet@lwn.net, linux-pm@vger.kernel.org, rjw@rjwysocki.net, gwendal@chromium.org, apronin@chromium.org, Pavel Machek , Matthew Garrett , linux-integrity@vger.kernel.org, jejb@linux.ibm.com, zohar@linux.ibm.com, dlunev@google.com, Eric Biggers , Ben Boeckel , jarkko@kernel.org, Matthew Garrett , Matthew Garrett , Jason Gunthorpe , Peter Huewe Subject: Re: [PATCH v4 03/11] tpm: Allow PCR 23 to be restricted to kernel-only use Message-ID: <202211041127.55ED2921E5@keescook> References: <20221103180120.752659-1-evgreen@chromium.org> <20221103105558.v4.3.I9ded8c8caad27403e9284dfc78ad6cbd845bc98d@changeid> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221103105558.v4.3.I9ded8c8caad27403e9284dfc78ad6cbd845bc98d@changeid> X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 03, 2022 at 11:01:11AM -0700, Evan Green wrote: > From: Matthew Garrett > > Introduce a new Kconfig, TCG_TPM_RESTRICT_PCR, which if enabled > restricts usermode's ability to extend or reset PCR 23. > > Under certain circumstances it might be desirable to enable the creation > of TPM-backed secrets that are only accessible to the kernel. In an > ideal world this could be achieved by using TPM localities, but these > don't appear to be available on consumer systems. An alternative is to > simply block userland from modifying one of the resettable PCRs, leaving > it available to the kernel. If the kernel ensures that no userland can > access the TPM while it is carrying out work, it can reset PCR 23, > extend it to an arbitrary value, create or load a secret, and then reset > the PCR again. Even if userland somehow obtains the sealed material, it > will be unable to unseal it since PCR 23 will never be in the > appropriate state. > > This Kconfig is only properly supported for systems with TPM2 devices. > For systems with TPM1 devices, having this Kconfig enabled completely > restricts usermode's access to the TPM. TPM1 contains support for > tunnelled transports, which usermode could use to smuggle commands > through that this Kconfig is attempting to restrict. > > Link: https://lore.kernel.org/lkml/20210220013255.1083202-3-matthewgarrett@google.com/ > Signed-off-by: Matthew Garrett > Signed-off-by: Evan Green > --- > > Changes in v4: > - Augment the commit message (Jarkko) > > Changes in v3: > - Fix up commit message (Jarkko) > - tpm2_find_and_validate_cc() was split (Jarkko) > - Simply fully restrict TPM1 since v2 failed to account for tunnelled > transport sessions (Stefan and Jarkko). > > Changes in v2: > - Fixed sparse warnings Since you've changed this patch from the original, I would follow the same advice I gave here: https://lore.kernel.org/lkml/202209201620.A886373@keescook/ > -- Kees Cook