From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42599C4332F for ; Wed, 1 Dec 2021 10:19:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348608AbhLAKWh (ORCPT ); Wed, 1 Dec 2021 05:22:37 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:59530 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232177AbhLAKWe (ORCPT ); Wed, 1 Dec 2021 05:22:34 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1B08AB81E17; Wed, 1 Dec 2021 10:19:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 387F8C53FCC; Wed, 1 Dec 2021 10:19:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638353951; bh=1DD6yb8AndnxLz2+3Nk3lf/qwuXp3fDEiH6kGOpOszU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Tlzh7bhavcuJL1JqvmDk1Pm+IxQe6SWnZS0YSsrgT245Kv02NKGibqzXW+dF0KFef EroXPB0P923FZ4+JNasEbAzQV8X3YHuNN1Bse4uKZiylQlDC/krndQMHr8N+nF4yHf SWEmU24CovYm7TBosS6Fl9pXUR4FeXRvg2IPbrwhaKl3MW5Z2IMTa6ONG0HsdTRImU T+f5GcwZ/FZ2Itdc9JhMSYPhnRIEYWnsNfTPU3NPY7yMR6M1LOhI5Jl7PyU7jvZdH9 tPetaLPCgDyhV8wkvirXtXDRx/fWpEgMlAK0Vmt2QxS1t0H3bgWSXLbJvCIM21K065 cgBC+oTl0H+zw== Date: Wed, 1 Dec 2021 12:19:09 +0200 From: Jarkko Sakkinen To: Stefan Berger Cc: Stefan Berger , linux-integrity@vger.kernel.org, peterhuewe@gmx.de, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, skhan@linuxfoundation.org Subject: Re: [PATCH v4 2/2] selftests: tpm2: Reset the dictionary attack lock Message-ID: References: <20211128041052.1395504-1-stefanb@linux.vnet.ibm.com> <20211128041052.1395504-3-stefanb@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 01, 2021 at 12:16:11PM +0200, Jarkko Sakkinen wrote: > On Mon, Nov 29, 2021 at 07:26:12PM -0500, Stefan Berger wrote: > > > > On 11/29/21 18:43, Jarkko Sakkinen wrote: > > > On Sat, Nov 27, 2021 at 11:10:52PM -0500, Stefan Berger wrote: > > > > From: Stefan Berger > > > > > > > > Reset the dictionary attack lock to avoid the following types of test > > > > failures after running the test 2 times: > > > > > > > > ====================================================================== > > > > ERROR: test_unseal_with_wrong_policy (tpm2_tests.SmokeTest) > > > > ---------------------------------------------------------------------- > > > > Traceback (most recent call last): > > > > File "/root/linux-ima-namespaces/tools/testing/selftests/tpm2/tpm2_tests.py", line 105, in test_unseal_with_wrong_policy > > > > blob = self.client.seal(self.root_key, data, auth, policy_dig) > > > > File "/root/linux-ima-namespaces/tools/testing/selftests/tpm2/tpm2.py", line 620, in seal > > > > rsp = self.send_cmd(cmd) > > > > File "/root/linux-ima-namespaces/tools/testing/selftests/tpm2/tpm2.py", line 397, in send_cmd > > > > raise ProtocolError(cc, rc) > > > > tpm2.ProtocolError: TPM_RC_LOCKOUT: cc=0x00000153, rc=0x00000921 > > > > > > > > Signed-off-by: Stefan Berger > > > > --- > > > > tools/testing/selftests/tpm2/tpm2_tests.py | 2 ++ > > > > 1 file changed, 2 insertions(+) > > > > > > > > diff --git a/tools/testing/selftests/tpm2/tpm2_tests.py b/tools/testing/selftests/tpm2/tpm2_tests.py > > > > index e63a37819978..ad6f54c01adf 100644 > > > > --- a/tools/testing/selftests/tpm2/tpm2_tests.py > > > > +++ b/tools/testing/selftests/tpm2/tpm2_tests.py > > > > @@ -139,6 +139,8 @@ class SmokeTest(unittest.TestCase): > > > > except: > > > > self.client.flush_context(handle) > > > > raise > > > > + finally: > > > > + self.client.reset_da_lock() > > > > self.assertEqual(rc, tpm2.TPM2_RC_POLICY_FAIL) > > > > -- > > > > 2.31.1 > > > > > > > I don't agree with this as a DA lock has legit use. This would be adequate > > > for systems dedicated for kernel testing only. > > > > The problem is this particular test case I am patching here causes the above > > test failures upon rerun. We are testing the driver here presumably and not > > the TPM2, so I think we should leave the TPM2 as cleaned up as possible, > > thus my suggestion is to reset the DA lock and we won't hear any complaints > > after that. > > Ok. > > > > We could make this available in the folder where TPM2 tests are: > > > > > > https://git.kernel.org/pub/scm/linux/kernel/git/jarkko/tpm2-scripts.git/tree/tpm2-reset-da-lock > > > > > > The tss packages also have command line tools to reset the DA lock, but it > > shouldn't be necessary to use them after running a **driver** test case. > > If you speak about TSS, please alway say which one :-) > > Adding non-volatile state changes explicitly is to a test case is both A typo, should be: "Adding non-volatile state changes explicitly to a test case is both" /Jarkko