From patchwork Mon Jun 22 21:20:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarkko Sakkinen X-Patchwork-Id: 11619151 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B3764618 for ; Mon, 22 Jun 2020 21:23:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A6CA3207DD for ; Mon, 22 Jun 2020 21:23:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730557AbgFVVXM (ORCPT ); Mon, 22 Jun 2020 17:23:12 -0400 Received: from mga12.intel.com ([192.55.52.136]:2435 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730460AbgFVVXL (ORCPT ); Mon, 22 Jun 2020 17:23:11 -0400 IronPort-SDR: k8dhMNyzdXZbSwDt1OmHO0XN7WDnceahm/RO+LcHcMYFC1tx4+49EOaw8xILN0i/3gDsYqrfab weug+k782/XA== X-IronPort-AV: E=McAfee;i="6000,8403,9660"; a="123548484" X-IronPort-AV: E=Sophos;i="5.75,268,1589266800"; d="scan'208";a="123548484" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 14:23:07 -0700 IronPort-SDR: HT28r4MFHIWnj1VKD2Ee6Sac8XbdwleMeRtuTIZ4ENl2/A9cbBVaAKyouMzUQhTskq6ulxETRU Ui8VzQS8/Zjw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,268,1589266800"; d="scan'208";a="278894224" Received: from scheller-mobl.ger.corp.intel.com (HELO localhost) ([10.252.33.117]) by orsmga006.jf.intel.com with ESMTP; 22 Jun 2020 14:23:03 -0700 From: Jarkko Sakkinen To: Shuah Khan Cc: pengfei.xu@intel.com, Jarkko Sakkinen , Tadeusz Struk , stable@vger.kernel.org, linux-integrity@vger.kernel.org, linux-kselftest@vger.kernel.org, Nikita Sobolev , Petr Vorel , linux-kernel@vger.kernel.org (open list) Subject: [PATCH 1/3] Revert "tpm: selftest: cleanup after unseal with wrong auth/policy test" Date: Tue, 23 Jun 2020 00:20:20 +0300 Message-Id: <20200622212034.20624-2-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200622212034.20624-1-jarkko.sakkinen@linux.intel.com> References: <20200622212034.20624-1-jarkko.sakkinen@linux.intel.com> MIME-Version: 1.0 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org The reverted commit illegitly uses tpm2-tools. External dependencies are absolutely forbidden from these tests. There is also the problem that clearing is not necessarily wanted behavior if the test/target computer is not used only solely for testing. Fixes: a9920d3bad40 ("tpm: selftest: cleanup after unseal with wrong auth/policy test") Cc: Tadeusz Struk Cc: stable@vger.kernel.org Cc: linux-integrity@vger.kernel.org Cc: linux-kselftest@vger.kernel.org Signed-off-by: Jarkko Sakkinen --- tools/testing/selftests/tpm2/test_smoke.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tools/testing/selftests/tpm2/test_smoke.sh b/tools/testing/selftests/tpm2/test_smoke.sh index 663062701d5a..79f8e9da5d21 100755 --- a/tools/testing/selftests/tpm2/test_smoke.sh +++ b/tools/testing/selftests/tpm2/test_smoke.sh @@ -8,8 +8,3 @@ ksft_skip=4 python -m unittest -v tpm2_tests.SmokeTest python -m unittest -v tpm2_tests.AsyncTest - -CLEAR_CMD=$(which tpm2_clear) -if [ -n $CLEAR_CMD ]; then - tpm2_clear -T device -fi From patchwork Mon Jun 22 21:20:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarkko Sakkinen X-Patchwork-Id: 11619153 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BD5DF618 for ; Mon, 22 Jun 2020 21:23:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A62542073E for ; Mon, 22 Jun 2020 21:23:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730581AbgFVVXT (ORCPT ); Mon, 22 Jun 2020 17:23:19 -0400 Received: from mga18.intel.com ([134.134.136.126]:20594 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730460AbgFVVXT (ORCPT ); Mon, 22 Jun 2020 17:23:19 -0400 IronPort-SDR: OvNfOnG76QU0OXK9nUGSUclbrYRVxvuDNmgGK/o0CXYbqUZ5rrxIy/3cVkM4UobxFiSz1h4BQr VoUlZ0ZHXjbw== X-IronPort-AV: E=McAfee;i="6000,8403,9660"; a="131284806" X-IronPort-AV: E=Sophos;i="5.75,268,1589266800"; d="scan'208";a="131284806" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 14:23:18 -0700 IronPort-SDR: 1qe1IqEQbX6OFoTJB/64GhFCnOlcqBqDRIHdYkPjPGp0lpD2vselbJo1xK1b/kyWyMRONNW+yI jLIFlQwcNFkQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,268,1589266800"; d="scan'208";a="278894253" Received: from scheller-mobl.ger.corp.intel.com (HELO localhost) ([10.252.33.117]) by orsmga006.jf.intel.com with ESMTP; 22 Jun 2020 14:23:14 -0700 From: Jarkko Sakkinen To: Shuah Khan Cc: pengfei.xu@intel.com, Jarkko Sakkinen , Nikita Sobolev , linux-integrity@vger.kernel.org, linux-kselftest@vger.kernel.org, Tadeusz Struk , Petr Vorel , linux-kernel@vger.kernel.org (open list) Subject: [PATCH 2/3] selftests: tpm: Use 'test -e' instead of 'test -f' Date: Tue, 23 Jun 2020 00:20:21 +0300 Message-Id: <20200622212034.20624-3-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200622212034.20624-1-jarkko.sakkinen@linux.intel.com> References: <20200622212034.20624-1-jarkko.sakkinen@linux.intel.com> MIME-Version: 1.0 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org 'test -f' is suitable only for *regular* files. Use 'test -e' instead. Cc: Nikita Sobolev Cc: linux-integrity@vger.kernel.org Cc: linux-kselftest@vger.kernel.org Fixes: 5627f9cffee7 ("Kernel selftests: Add check if TPM devices are supported") Signed-off-by: Jarkko Sakkinen --- tools/testing/selftests/tpm2/test_smoke.sh | 2 +- tools/testing/selftests/tpm2/test_space.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/tpm2/test_smoke.sh b/tools/testing/selftests/tpm2/test_smoke.sh index 79f8e9da5d21..338d6b0272dc 100755 --- a/tools/testing/selftests/tpm2/test_smoke.sh +++ b/tools/testing/selftests/tpm2/test_smoke.sh @@ -4,7 +4,7 @@ # Kselftest framework requirement - SKIP code is 4. ksft_skip=4 -[ -f /dev/tpm0 ] || exit $ksft_skip +[ -e /dev/tpm0 ] || exit $ksft_skip python -m unittest -v tpm2_tests.SmokeTest python -m unittest -v tpm2_tests.AsyncTest diff --git a/tools/testing/selftests/tpm2/test_space.sh b/tools/testing/selftests/tpm2/test_space.sh index 36c9d030a1c6..847cabb20a5f 100755 --- a/tools/testing/selftests/tpm2/test_space.sh +++ b/tools/testing/selftests/tpm2/test_space.sh @@ -4,6 +4,6 @@ # Kselftest framework requirement - SKIP code is 4. ksft_skip=4 -[ -f /dev/tpmrm0 ] || exit $ksft_skip +[ -e /dev/tpmrm0 ] || exit $ksft_skip python -m unittest -v tpm2_tests.SpaceTest From patchwork Mon Jun 22 21:20:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarkko Sakkinen X-Patchwork-Id: 11619157 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 291DF14B7 for ; Mon, 22 Jun 2020 21:23:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1161420732 for ; Mon, 22 Jun 2020 21:23:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730612AbgFVVXb (ORCPT ); Mon, 22 Jun 2020 17:23:31 -0400 Received: from mga12.intel.com ([192.55.52.136]:2469 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730460AbgFVVXa (ORCPT ); Mon, 22 Jun 2020 17:23:30 -0400 IronPort-SDR: dpFSCi1544XuAKCIGfSov51p5HubZ1RFSF97AyqncOx3jTg3Mhm3x0Mc1afnj6ftv87YqcasMo G96M1rx0B1Eg== X-IronPort-AV: E=McAfee;i="6000,8403,9660"; a="123548596" X-IronPort-AV: E=Sophos;i="5.75,268,1589266800"; d="scan'208";a="123548596" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 14:23:29 -0700 IronPort-SDR: YU7fP6RdkdXBthLv3FK4h2DNntPCXOCmcZe053PnGOAcQrgdaPS3xyaH4oySFH+lnqaZBSospj 70roBrLzBkVw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,268,1589266800"; d="scan'208";a="278894306" Received: from scheller-mobl.ger.corp.intel.com (HELO localhost) ([10.252.33.117]) by orsmga006.jf.intel.com with ESMTP; 22 Jun 2020 14:23:25 -0700 From: Jarkko Sakkinen To: Shuah Khan Cc: pengfei.xu@intel.com, Jarkko Sakkinen , stable@vger.kernel.org, linux-integrity@vger.kernel.org, linux-kselftest@vger.kernel.org, Tadeusz Struk , Nikita Sobolev , Petr Vorel , Joey Pabalinas , linux-kernel@vger.kernel.org (open list) Subject: [PATCH 3/3] selftests: tpm: Use /bin/sh instead of /bin/bash Date: Tue, 23 Jun 2020 00:20:22 +0300 Message-Id: <20200622212034.20624-4-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200622212034.20624-1-jarkko.sakkinen@linux.intel.com> References: <20200622212034.20624-1-jarkko.sakkinen@linux.intel.com> MIME-Version: 1.0 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org It's better to use /bin/sh instead of /bin/bash in order to run the tests in the BusyBox shell. Fixes: 6ea3dfe1e073 ("selftests: add TPM 2.0 tests") Cc: stable@vger.kernel.org Cc: linux-integrity@vger.kernel.org Cc: linux-kselftest@vger.kernel.org Signed-off-by: Jarkko Sakkinen --- tools/testing/selftests/tpm2/test_smoke.sh | 2 +- tools/testing/selftests/tpm2/test_space.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/tpm2/test_smoke.sh b/tools/testing/selftests/tpm2/test_smoke.sh index 338d6b0272dc..1334e301d2a0 100755 --- a/tools/testing/selftests/tpm2/test_smoke.sh +++ b/tools/testing/selftests/tpm2/test_smoke.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) # Kselftest framework requirement - SKIP code is 4. diff --git a/tools/testing/selftests/tpm2/test_space.sh b/tools/testing/selftests/tpm2/test_space.sh index 847cabb20a5f..00259cb746cf 100755 --- a/tools/testing/selftests/tpm2/test_space.sh +++ b/tools/testing/selftests/tpm2/test_space.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) # Kselftest framework requirement - SKIP code is 4.