Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2331305rdb; Wed, 21 Feb 2024 04:37:17 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXSmSOJQw1MMu6akwR/WMkyG/65vgWFifu8Z4I9d7xznmgpuSTSLoLWOUavmId5XlUKxuRDzEquAGx1Adz5WN+MdrRWKuLGGCJ/fMrsmA== X-Google-Smtp-Source: AGHT+IF+l+1c++gsmQPbOgwUqsIJ6HC8wmc2joaHeHerGnk+0MHsMtNfRvUIvpAmeg/FCJ/7OKXk X-Received: by 2002:a17:90a:7504:b0:299:466c:dc0b with SMTP id q4-20020a17090a750400b00299466cdc0bmr10196714pjk.4.1708519037383; Wed, 21 Feb 2024 04:37:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708519037; cv=pass; d=google.com; s=arc-20160816; b=Z88r6F4C9o4Rh4SXMzbhbZQeivFXrf3h0FRbSHKq773/2geduI4jyxh98rfb1duUr4 4yz1V9XWUfz2f4EzkyxE8vpzueupjmcmReGwSiqh7piQRaxLMm1Oq26c0kl3S8d3+EhE 6bZNXYys6522S3padgHiBzjpMXqwi+8/B+SpbT1AL9/aLxGjk4lOPQja1ru9y2S7Yu2r ykeNFb0Ca4XLW1P62Y87T2XUwXsENf8nFb0fLljIoLg3E5dIlujIvOzivoWuQ9Se/FJi NEzYO9tcD9W/P06hYsc0rrijsaBc7T8Rf0DkTzO22CXFO1vswOHWbQnlcE3ziH92nEJo CcRw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:user-agent:references:in-reply-to :date:cc:to:from:subject:message-id:dkim-signature:dkim-signature; bh=JtK62J80lR/5jww2egI3gbKnAcUpIG8MhJtmz7p4c+I=; fh=8ynXCpnCru8LOvpMYmrtjS2TgJPkRgl0KLtu/N2ZJaE=; b=mkYtVJCwv5j2XJMkpRXO98/dfmBIwmNx27LELN2I3nbiTjepwbqnrNmAnDZOmtkNqh gdfjShhP8Hmp9vMJPwWYBuWNYUll8ECjuA28r7MfiMreD/tPd7B1r+sLHRrS10zKI8wm 2bv9+Y3IYhylyO34ej3TWDydSPP4hNI4E/o8Z32sKoA2c8VJ51xQG7+h6nsjPTu0OUbj w9GhJFdhlMjNtyHQZ7OSJxGItO4xPtSk3rS0M/e5dbu2uZxpCrPOknuoWpi8gyEVgk/M FT722JzJk+ArnHbGXXmfMQXe4IcKLeZPrsYN2w/U8huPrTfoETdp6+ZKjWailb8mcDv4 zgZA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@hansenpartnership.com header.s=20151216 header.b=xuzzuTvm; dkim=pass header.i=@hansenpartnership.com header.s=20151216 header.b=ZQJ8zySG; arc=pass (i=1 spf=pass spfdomain=hansenpartnership.com dkim=pass dkdomain=hansenpartnership.com dkim=pass dkdomain=hansenpartnership.com dmarc=pass fromdomain=hansenpartnership.com); spf=pass (google.com: domain of linux-kernel+bounces-74701-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74701-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=hansenpartnership.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id y3-20020a17090a154300b00299945e4e76si1417759pja.43.2024.02.21.04.37.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 04:37:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-74701-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@hansenpartnership.com header.s=20151216 header.b=xuzzuTvm; dkim=pass header.i=@hansenpartnership.com header.s=20151216 header.b=ZQJ8zySG; arc=pass (i=1 spf=pass spfdomain=hansenpartnership.com dkim=pass dkdomain=hansenpartnership.com dkim=pass dkdomain=hansenpartnership.com dmarc=pass fromdomain=hansenpartnership.com); spf=pass (google.com: domain of linux-kernel+bounces-74701-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74701-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=hansenpartnership.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 1AE4628261C for ; Wed, 21 Feb 2024 12:37:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6160169318; Wed, 21 Feb 2024 12:37:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hansenpartnership.com header.i=@hansenpartnership.com header.b="xuzzuTvm"; dkim=pass (1024-bit key) header.d=hansenpartnership.com header.i=@hansenpartnership.com header.b="ZQJ8zySG" Received: from bedivere.hansenpartnership.com (bedivere.hansenpartnership.com [96.44.175.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD1A65231; Wed, 21 Feb 2024 12:37:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=96.44.175.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708519031; cv=none; b=lZm1LOLD0FR66B657L9o6KP/mw97QFGCPXvdfcZqKGvGr/sbZjdLB1fTlfw7ILtL+czUU4ZRseMqzvK2kGdcHcPJvmo1Q53AjVUSmj9Ft4OSVH8H12zOVS9yCKvsIBh1Xfliwg1Luuqh3D8lqxCDECmHSYdCZ1jMLPnql5tGn+A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708519031; c=relaxed/simple; bh=EV+8Kdakk6AUMifVeF8z7XA54mjPMAluhchCZOLm3/0=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=lisx/ECAEzKVRcHQT9xwtswNO3NdAWBid21lTOZuSMXSygsI6Aipv1PCXKeJcETjVLWA8Y6wcniGqMSlA0id+pAK8JaSYmJOfzjiwxwCTOddLO/O39mF2dqx8FGlrvfQRPxaG9BELjEpauEAdjbdxiYLkGcCiBSkGpVEVLtTAKA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=HansenPartnership.com; spf=pass smtp.mailfrom=HansenPartnership.com; dkim=pass (1024-bit key) header.d=hansenpartnership.com header.i=@hansenpartnership.com header.b=xuzzuTvm; dkim=pass (1024-bit key) header.d=hansenpartnership.com header.i=@hansenpartnership.com header.b=ZQJ8zySG; arc=none smtp.client-ip=96.44.175.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=HansenPartnership.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=HansenPartnership.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=hansenpartnership.com; s=20151216; t=1708519028; bh=EV+8Kdakk6AUMifVeF8z7XA54mjPMAluhchCZOLm3/0=; h=Message-ID:Subject:From:To:Date:In-Reply-To:References:From; b=xuzzuTvm6nF01WesnQGCDzKx1NS0plnC01JXB3KzQsul1SXVPJi9NZvClHTlSEbpU PK2BDttotg9F/cTYu57RLsNpiEPgLXQDfxzDyVopwL1s0QmVYC84KJPyQuamUPuV2G eJtIphQq//f936I6JCOH0ACIyI1lK/x3rZhD3lvA= Received: from localhost (localhost [127.0.0.1]) by bedivere.hansenpartnership.com (Postfix) with ESMTP id B0CAE1286FEF; Wed, 21 Feb 2024 07:37:08 -0500 (EST) Received: from bedivere.hansenpartnership.com ([127.0.0.1]) by localhost (bedivere.hansenpartnership.com [127.0.0.1]) (amavis, port 10024) with ESMTP id Vh-XjcP78zjU; Wed, 21 Feb 2024 07:37:06 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=hansenpartnership.com; s=20151216; t=1708519024; bh=EV+8Kdakk6AUMifVeF8z7XA54mjPMAluhchCZOLm3/0=; h=Message-ID:Subject:From:To:Date:In-Reply-To:References:From; b=ZQJ8zySGRzcl9/AjAaICWwBgktjf/1jS/VaDXjwb8czaHup+1YPaP3P9ITE3mpiBh D38BlCMMblK81NYGhciptL9QmyApl3JrTRukzhyBOjbNX0FF8POh0BOnH8U05EnOKU oK4mJRRMnRvNm9WrouTkGEpHPmbbxg0vVHhxwxZg= Received: from lingrow.int.hansenpartnership.com (unknown [IPv6:2601:5c4:4302:c21::a774]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by bedivere.hansenpartnership.com (Postfix) with ESMTPSA id C93151286F61; Wed, 21 Feb 2024 07:37:03 -0500 (EST) Message-ID: <7a7f8f0c1b9d124bfc01b66082abf2d8445564ce.camel@HansenPartnership.com> Subject: Re: [PATCH 1/3] tpm: protect against locality counter underflow From: James Bottomley To: Jarkko Sakkinen , Lino Sanfilippo , Alexander Steffen , "Daniel P. Smith" , Jason Gunthorpe , Sasha Levin , linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ross Philipson , Kanth Ghatraju , Peter Huewe Date: Wed, 21 Feb 2024 07:37:01 -0500 In-Reply-To: References: <20240131170824.6183-1-dpsmith@apertussolutions.com> <20240131170824.6183-2-dpsmith@apertussolutions.com> <2ba9a96e-f93b-48e2-9ca0-48318af7f9b1@kunbus.com> <91f600ef-867b-4523-89be-1c0ba34f8a4c@kunbus.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.4 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On Tue, 2024-02-20 at 22:31 +0000, Jarkko Sakkinen wrote: > > 2. Because localities are not too useful these days given TPM2's >    policy mechanism Localitites are useful to the TPM2 policy mechanism. When we get key policy in the kernel it will give us a way to create TPM wrapped keys that can only be unwrapped in the kernel if we run the kernel in a different locality from userspace (I already have demo patches doing this). > I cannot recall out of top of my head can >    you have two localities open at same time. I think there's a misunderstanding about what localities are: they're effectively an additional platform supplied tag to a command. Each command can therefore have one and only one locality. The TPM doesn't have a concept of which locality is open; if you look at the reference implementation, the simulator has a __plat__LocalitySet() function which places all commands in the just set locality until you change to a different one. However, since the way localities are implemented (i.e. what triggers _plat__LocalitySet()) is implementation defined, each physical TPM device has a different way of doing the set (for instance, for TIS TPM's locality is a function of the port set used to address the TPM; for CRB TPMs it can be an additional tag on the buffer for command submission). I think the locality request/relinquish was modelled after some other HW, but I don't know what. James