Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3408259rwb; Mon, 19 Sep 2022 21:52:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5qkv4pH5zdlAE9XVr9LncXAt53QZAs7zymd1TIjbpULYbbrA0eoR++lZmmcn63VCMuz68G X-Received: by 2002:a17:907:9620:b0:77d:4f86:2e66 with SMTP id gb32-20020a170907962000b0077d4f862e66mr15291987ejc.751.1663649560254; Mon, 19 Sep 2022 21:52:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663649560; cv=none; d=google.com; s=arc-20160816; b=z/RlbJQYe3ps13ykGBRpXlT1i4V9Xahih6DADWtkVpG+N90yGJXK+3PR8OVylmsx7P LZ/C95AYVo/hrQGxKp/YomedQZm2EU+YUIyCerhUZKwP45Ge0P8czhkPJ2l3j3aonx8U SPOTq2EXV9zVefZFb4+VRATwymTNgy6hPFieSBTYcXlvuvAx+Pz7J/8V8R6UZXCPH3PL /1Ww8+W5ApnNUwrsm9A5CoWs7ARqwqu0GhRBpXYlEnal8ubxazUUKQmFRbTGImrRH2zw 67irDpkKkv2bF6t2YdFX+rCKCPC8Y+8SlbpAVkSaMnF7d6gcIaM2H91or/TAyQXQ2n3T vGpA== 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=ZHyM7vH+TciZvTbubWGFfKvWsbpQw28+mNZ3T62abUI=; b=nu9TPdj5DSEl6S/iDJnACvI53XvTEeIfA4BOxGNB8zsxFZzEdzB6s7qiUksUlXxoN6 aWNT/5y9gNdJYCL6giRxZsLsssYVPE09Kx/k0Q7iyuTueoUPH5+CG/rEwpjquxR9LCvy wShjBD8Fnx71esDZnzFAZ8p++A9vzQR8E9dy2rcTBGON3/dWr/6GA5A8HKFRUf28CaPU CgSOuKAJS9Wj3IKAo0Er/dXbqDZHyd173RZ3QruP2XgVc9nExZEqYn5OKh/yRPr8ZkRV GHMsyx6AEEfeCh6PzL/e9xKX7geAZRdU6rOODhQXtcYlrGwDOpkg05yBRyJ0aegEQZUx i3Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iBsUr0Sy; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y6-20020a056402270600b004472b35d7a5si595876edd.309.2022.09.19.21.52.14; Mon, 19 Sep 2022 21:52:40 -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=@kernel.org header.s=k20201202 header.b=iBsUr0Sy; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229833AbiITEcI (ORCPT + 99 others); Tue, 20 Sep 2022 00:32:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229792AbiITEcE (ORCPT ); Tue, 20 Sep 2022 00:32:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D6504F688; Mon, 19 Sep 2022 21:32:03 -0700 (PDT) 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 7B8D6B82460; Tue, 20 Sep 2022 04:32:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65C39C433C1; Tue, 20 Sep 2022 04:31:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663648320; bh=G4YYpJnTxquXyhq/5s9yFVygBQrSnN4g3Clkw1kfHYM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=iBsUr0SyKHXeh6IQNo5NEP3SbQbzlbh85z7FniPDcwJAnD0n0bYtMyeYJ43GOxDEF ZSU7jvZ16xwkf+UMnutERd/UDWmFByJ1OvnlTWWq1w2Yiz1G0FJYpaHjR0f7fYpKSQ RxZ8VR5w8tNilGrZeYa8262CnUnaizN/bT9gLGRPbSmWJUWzrAw1+XR78JBqpzVXn2 vpmEhJVtC/q7cBXZWsMNRHoGC4Z3s21a4Xvzk8D5+xIAGpmXbrldkhmknLhb42GBAM o7pFhtlECcqWsvSSTc228e7DysnTA1VGkDUmycUNxnZ3sRbyML6q2x3pGAmHjJgfIp cER6eQTENZEJQ== Date: Tue, 20 Sep 2022 07:31:56 +0300 From: Jarkko Sakkinen To: Stefan Berger Cc: linux-integrity@vger.kernel.org, peterhuewe@gmx.de, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, skhan@linuxfoundation.org, Stefan Berger , Shuah Khan Subject: Re: [PATCH] selftests: tpm2: Implement class desstructor to close file descriptor Message-ID: References: <20220909152056.1335261-1-stefanb@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220909152056.1335261-1-stefanb@linux.vnet.ibm.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 s/desstructor/destructor/ I'd change it to "selftest: tpm2: Add Client.__del__() to close /dev/tpm* handle" On Fri, Sep 09, 2022 at 11:20:56AM -0400, Stefan Berger wrote: > From: Stefan Berger > > Implement a class destructor to close the open TPM file descriptor > and avoid the following error message: > > test_flush_context (tpm2_tests.SpaceTest) ... \ > /usr/lib64/python3.6/unittest/case.py:605: ResourceWarning: \ > unclosed file <_io.FileIO name='/dev/tpmrm0' mode='rb+' closefd=True> I don't recall seeing this. Does this happen on every test case? Should better describe what is going on, e.g. " The following output can bee seen when the test is executed: test_flush_context (tpm2_tests.SpaceTest) ... \ /usr/lib64/python3.6/unittest/case.py:605: ResourceWarning: \ unclosed file <_io.FileIO name='/dev/tpmrm0' mode='rb+' closefd=True> An instance of Client does not implicitly close /dev/tpm* handle, once it gets destroyed. Close the file handle in the class destructor Client.__del__(). " > > Fixes: 6ea3dfe1e0732 ("selftests: add TPM 2.0 tests") > Cc: Shuah Khan > Cc: linux-kselftest@vger.kernel.org > Cc: Jarkko Sakkinen > Signed-off-by: Stefan Berger BR, Jarkko