Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2580126rdb; Wed, 21 Feb 2024 12:07:48 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWaO8VSemFUxzL2mY3dMLvN/GaGyimnnPrqbREn29lOPtUmUPxSnJMjIcMZXaLHnLe6m1eRhcNDpJi8sf+kwBZE3qrTSEpDF0arIPz+Zw== X-Google-Smtp-Source: AGHT+IFrtAaFT4NETTDJewpWlkwJq01csGKOzOTCQ56HIxCSc/NiROkbK10xyFfNZErB/pFB46KI X-Received: by 2002:a05:6512:49d:b0:512:98d1:d5e1 with SMTP id v29-20020a056512049d00b0051298d1d5e1mr9701980lfq.21.1708546068179; Wed, 21 Feb 2024 12:07:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708546068; cv=pass; d=google.com; s=arc-20160816; b=VYdStArFSby83jV4NDLS8Zd/I5fH5SWy67V7jOwYqUfB0XsTgQX678y4wUyRoU1DIc PxHdUJ3CocQBDZ+rW9twyGulqPrJNGOpx/VLL9kIpA3qnDUv5ITaSocTvOCi9Arw9HVR 4wXg+6d4kywf1Yq1ld+3HO1oFVb91oCCu7WSODUYA6T0snhsaIPmxkNYDPL2a2SMeT12 BXYh+PlHJoRcQk7FZ/5t1bEiHY9R/QjrXhKIbOEul1T3A9Yb1vNb+uznl8eFFexVXPpg lDFaU84uwTUQwkXYODAjR2jS/8dOrHyRc9wedIa+XBXkCv/JmlrGK+6Nv2TJGJgP3NKP ob3w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:references:cc:to:from:subject:message-id:date :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=E2oIepkxk0t2t0JieQRbmEejZcHddIK9i/nSyq6+ZMk=; fh=iq+N9Ao9KBEnKr4C5e9dXKyISgXHzrlBVdejyfJzkuQ=; b=jXDQveRDDizNloTuVFxU+yj15AhUJLXiyZsSElYPsH1cMHkX5H9EZJsG62OuGWdIF6 iWbFlXc3Qskom/jlqvXyvdLjH21joijPk+hdoo0mmQ6/E7OidJ63mIGbyZqZinSw1f/J EDWJmEadoLk0qJsstU08+dwMSi7Sw3fgXjY+0xKfGNgLZ2V6ITuWqBt7xFW8KibyyUqU twAEvUDnQDcSLO7P4cC6HewYVbspLK308IpTabnmf4ldg8HX0ZnHNsy/Jz0NFYYPrLUe iXMAfy3AoNyNmmjYysBZQKnHJCaTXKmyoDI4YFatElh6WA4n3vNtULgvCBY8CqQkKes7 YPew==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=n5a73uOl; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-75418-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75418-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id ec16-20020a170906b6d000b00a3da4bf91b3si4681834ejb.494.2024.02.21.12.07.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 12:07:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75418-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=n5a73uOl; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-75418-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75418-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 2FB351F2799D for ; Wed, 21 Feb 2024 19:56:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 60559127B6C; Wed, 21 Feb 2024 19:45:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="n5a73uOl" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 7ABDC85923; Wed, 21 Feb 2024 19:45:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708544715; cv=none; b=Lb2SWnS1BC3YrRTxo0/U6U1ggwF68HEQcyjPcHAULzLydEbBEX2N15MfAPteki6iwbrHgfjFtDwx5cpCqM0QZYZamDdf6GwMg6e1edz1Z/1BGXObX6yjzkEGiXif87U6hBAj6Yt+RItKRn0F6Sv3j0kf4xs5bqr8TTxKesNnVSE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708544715; c=relaxed/simple; bh=k05KXlMbnmI+laCXj6HRVtiY8TJLU/7JY5PZjol1VlE=; h=Mime-Version:Content-Type:Date:Message-Id:Subject:From:To:Cc: References:In-Reply-To; b=pkvi7Q8k3YZRJmN7UpTRYr46di3jJPr161OnB9Il66rthA+wo0eOKcqCNdx1uBixEL9w9d4HMmco7UdF5U5s6IIsBMU83hYwaTs8tCSmDXgLYTfMJtYy2n9RP2GamtWWcJUZ5s7nIDipa42rsM/Eb8mgv48N8LHl+O+4cDuYv/E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=n5a73uOl; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66A47C433F1; Wed, 21 Feb 2024 19:45:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708544715; bh=k05KXlMbnmI+laCXj6HRVtiY8TJLU/7JY5PZjol1VlE=; h=Date:Subject:From:To:Cc:References:In-Reply-To:From; b=n5a73uOlk8UvhfXlPtlBTswiTVyaiUkaE5eSHBu3gDjGAmcM8me1YEa89O9MsY9yd EsjINJmcsHF4j/VVKs82e3dymbotED8p2aOWPWfaA/Gbtl2ZlmMyqlJUvFpnbuQ19R SoY4b8uKbyHqHfFGeQl956wO4xaN8qNZy4TNOVL3YdsUMDyKyG+0av0ZltSj3Brr5w jbTwBNERhlB5/QUdu1i3hOLLqaBkAMZUUiELvI5ggyk5iFTIsQgqyr/1n7Nf3+6qAL 0y4aRCchnh5IGO+GlkbfR1Eqb9xx5XzHp+ar5QT0S+R70d77KdlLAEztrYjVrnqhvv 1unSa4iY1jHRw== Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 21 Feb 2024 19:45:10 +0000 Message-Id: Subject: Re: [PATCH 1/3] tpm: protect against locality counter underflow From: "Jarkko Sakkinen" To: "Jarkko Sakkinen" , "James Bottomley" , "Lino Sanfilippo" , "Alexander Steffen" , "Daniel P. Smith" , "Jason Gunthorpe" , "Sasha Levin" , , Cc: "Ross Philipson" , "Kanth Ghatraju" , "Peter Huewe" X-Mailer: aerc 0.15.2 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> <7a7f8f0c1b9d124bfc01b66082abf2d8445564ce.camel@HansenPartnership.com> In-Reply-To: On Wed Feb 21, 2024 at 7:43 PM UTC, Jarkko Sakkinen wrote: > On Wed Feb 21, 2024 at 12:37 PM UTC, James Bottomley wrote: > > On Tue, 2024-02-20 at 22:31 +0000, Jarkko Sakkinen wrote: > > >=20 > > > 2. Because localities are not too useful these days given TPM2's > > > =C2=A0=C2=A0 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). > > Let's keep this discussion in scope, please. > > Removing useless code using registers that you might have some actually > useful use is not wrong thing to do. It is better to look at things from > clean slate when the time comes. > > > > I cannot recall out of top of my head can > > > =C2=A0=C2=A0 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 > > Actually this was not unclear at all. I even read the chapters from > Ariel Segall's yesterday as a refresher. Refering to https://www.amazon.com/Trusted-Platform-Modules-Computing-Netwo= rks/dp/1849198934 SBR, Jarkko