Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp562663ybm; Wed, 27 May 2020 02:23:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/oyacCYb2E/kG+AFf+8mWv9Sy0TkSW0d4h1PjUnq2uDl8EEP+K+3ZXvxx2tKRtLb4CovW X-Received: by 2002:aa7:ce10:: with SMTP id d16mr4921010edv.116.1590571429067; Wed, 27 May 2020 02:23:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590571429; cv=none; d=google.com; s=arc-20160816; b=lwCBZ3IZdgAa/QekrdSzd/GRJ80GBUFXy6EAWigCWblKnmZgPIypyU7gfUivx/ldvs 5jUl8KP5YZtyXD+95hQBJKoMDTwYlONVsnQlvrYFl6OGAYU/UuuyoZ70Ebq6wylMdOlt 0aa4fayMsvocGDV06PN6NILzPjfzJ3rv25vO8oBPZO+hECOkQIQ74K03sLgnS4K4W3+R hL1soB2ZNaJyV5yEJNyG7XxMgEZAkZPxCp7qqGckmuZEF5DpQr8xNJDH9il7wQdGHW8H +EXVmFEwNrD6NiEHo6Aqo/XLjMTyHzyqrt65Kd0l3xf2sodbYt1bCKcH9fMS3XFBURNG R4VA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature:dkim-signature; bh=7KHXsU95iHU055Y/qbm7rgSV9NUXwO30g5e9XxWoVPo=; b=O8cDI8+smrP9Jyma4AJzJ7j3fYR/1NfAXHCtd0uDnHQmRd953hLiQt/CFMODsklLem Mni9W/IO3MHWGNoerS9u7vkVt1AogEX88E4oycfxpnrlpH32RaktjH3Z9KmwHUiTT5eI p6KDwWJ9tyYZKIov/6oxnEDkQjxRIfhLxmqZxbxxejdcDeCqZjnsH00f6inaDMykBH/u xjXoidSjucIpuu8wyze9CGeSSebEfm02WM94lyWYw12ST2yHxE+07h8404g5M9+Nk1ur asGTkxPR50PK8jBY5wqso72T9kDVviaMUxU+FnavGFvLFyu6VleSqWQe1DKg1OMaphjQ JjdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=DiLoaq8f; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=DiLoaq8f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hansenpartnership.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lz8si1675954ejb.721.2020.05.27.02.23.25; Wed, 27 May 2020 02:23:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=DiLoaq8f; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=DiLoaq8f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hansenpartnership.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392192AbgEZXGO (ORCPT + 99 others); Tue, 26 May 2020 19:06:14 -0400 Received: from bedivere.hansenpartnership.com ([66.63.167.143]:42266 "EHLO bedivere.hansenpartnership.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389802AbgEZXGN (ORCPT ); Tue, 26 May 2020 19:06:13 -0400 Received: from localhost (localhost [127.0.0.1]) by bedivere.hansenpartnership.com (Postfix) with ESMTP id E73BC8EE181; Tue, 26 May 2020 16:06:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=hansenpartnership.com; s=20151216; t=1590534372; bh=UIJxxdcolMNBV1F2tHlacd/GA5Gqhl4Il9Tm33AYAaQ=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=DiLoaq8fmnx68F+zW+NvPjpBkda+KC3ETTX4xGdOxk06zVmgscgPQCibtLWnUO0fI TrgPDUtYdszzo7Jzqvc1MyVusz629oB29QWSpsnIlVu6BiWsBV2g5ZFbOs16Q3qcQc +KFR+4/dX92dbBoqbQBi6OxEQQFaLODVUR4cB9N4= Received: from bedivere.hansenpartnership.com ([127.0.0.1]) by localhost (bedivere.hansenpartnership.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KLmpmuVFYzlj; Tue, 26 May 2020 16:06:12 -0700 (PDT) Received: from [153.66.254.194] (unknown [50.35.76.230]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bedivere.hansenpartnership.com (Postfix) with ESMTPSA id 8D8B18EE0D4; Tue, 26 May 2020 16:06:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=hansenpartnership.com; s=20151216; t=1590534372; bh=UIJxxdcolMNBV1F2tHlacd/GA5Gqhl4Il9Tm33AYAaQ=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=DiLoaq8fmnx68F+zW+NvPjpBkda+KC3ETTX4xGdOxk06zVmgscgPQCibtLWnUO0fI TrgPDUtYdszzo7Jzqvc1MyVusz629oB29QWSpsnIlVu6BiWsBV2g5ZFbOs16Q3qcQc +KFR+4/dX92dbBoqbQBi6OxEQQFaLODVUR4cB9N4= Message-ID: <1590534370.15108.17.camel@HansenPartnership.com> Subject: Re: [PATCH] tpm: Revert "tpm: fix invalid locking in NONBLOCKING mode" From: James Bottomley To: Alex Guzman , Mario.Limonciello@dell.com, peterhuewe@gmx.de, jarkko.sakkinen@linux.intel.com, jgg@ziepe.ca Cc: arnd@arndb.de, gregkh@linuxfoundation.org, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, jeffrin@rajagiritech.edu.in Date: Tue, 26 May 2020 16:06:10 -0700 In-Reply-To: References: <20200526183213.20720-1-mario.limonciello@dell.com> <1590520454.11810.40.camel@HansenPartnership.com> <1590521924.15108.1.camel@HansenPartnership.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.6 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2020-05-26 at 15:19 -0700, Alex Guzman wrote: [...] > When using your patch, I get a hang when trying to use tpm2_getcap, > and dmesg shows some info. Are you sure it's all applied? This > [ 570.913803] tpm_tcg_write_bytes+0x2f/0x40 > [ 570.913805] release_locality+0x49/0x220 > [ 570.913807] tpm_relinquish_locality+0x1f/0x40 > [ 570.913808] tpm_chip_stop+0x21/0x40 > [ 570.913810] tpm_put_ops+0x9/0x30 > [ 570.913811] tpm_common_write+0x179/0x190 > [ 570.913813] vfs_write+0xb1/0x1a0 Implies an unmatched tpm_put_ops() in the async write path, as though this hunk: > @@ -211,11 +202,19 @@ ssize_t tpm_common_write(struct file *file, > const char __user *buf, > if (file->f_flags & O_NONBLOCK) { > priv->command_enqueued = true; > queue_work(tpm_dev_wq, &priv->async_work); > - tpm_put_ops(priv->chip); > mutex_unlock(&priv->buffer_mutex); > return size; > } Is missing. I actually booted the patch in my TPM based VM and it all seems to work OK when I execute tpm2_getcap (I verified it's using O_NONBLOCK) and tssgetcapability in sync mode. James