Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp413322ybm; Tue, 26 May 2020 21:26:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvHVv/BCFkDQfREOZVuVM2unyR3LlkykK+m+IaRNGISDo22lGRMyIs7cDdrNkQbPftCwdB X-Received: by 2002:a17:906:e112:: with SMTP id gj18mr4050111ejb.352.1590553578763; Tue, 26 May 2020 21:26:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590553578; cv=none; d=google.com; s=arc-20160816; b=N+OKCSiju1bARko4+yCeo+a822WTM3OGydEghyE44MG+/BTd4XFp5KMefkF71Fwx4o UC2yfGmZjPEGtkdI9VY/8UCqdMxj38NLqI0EgoscGjyYT63Pq9jn3gUgVM8KKdCRQ1eM R1bkYfsbXPqoIfbzyGUR7iZ13WCCj7Upd/ZNk4ylsjRcVJwfCEo2wEc8iwGOEd3RpyuH sw6E5odgleml4f7/EVxDI7Dw/YUj4lie2jef3dXlOOQMSy6SMR7w6Ei5cH2PEBmO9pi1 wiTvvwynKVl28O493Skxb+eJ3GFdP7tymhPOf0zmUtxxb7qY53MfYbBN7Qe/P1fTCigc lNyQ== 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=VCQDPiR3HLLpWY9fXOL46d7G87Is2VRE85VEcRXrzNk=; b=Scf/oPJLbNC1oHukhPjH2DBpQVdKKEPBTDjaolSzFFFHc32u/3abn/4rY21MfWE6UC 8JEKSL95LQDzX8VLVEUqGC7+IQhm9C7PFgmyauwqRGbGbndoHhp5kwa3Z/grZgcbOD0Z scyHtr7ZiAfzge85sd+P7Xay8bjS4Pk/NU6RKs2SQjaIWJaqgbCIlwEj6L+0iACztvcq N74i5rnk3IWfx/dze+8GKaP92voOxDxBQTmb0t2k/MZ2xGrznP2eX9ES+NYDLfmV/RuE FjX8qiarVxn8hs/8SM2WsSUo1ZT9LoR8HfnsFpiaRMbabnUcw7sVk+dPbZmirkd7/ZJv h17g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=nn+hxfT7; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b="T1Y/cKeW"; 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 m16si1085421edq.126.2020.05.26.21.25.56; Tue, 26 May 2020 21:26:18 -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=nn+hxfT7; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b="T1Y/cKeW"; 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 S1726868AbgE0ASZ (ORCPT + 99 others); Tue, 26 May 2020 20:18:25 -0400 Received: from bedivere.hansenpartnership.com ([66.63.167.143]:42866 "EHLO bedivere.hansenpartnership.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726857AbgE0ASZ (ORCPT ); Tue, 26 May 2020 20:18:25 -0400 Received: from localhost (localhost [127.0.0.1]) by bedivere.hansenpartnership.com (Postfix) with ESMTP id 3E16E8EE181; Tue, 26 May 2020 17:18:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=hansenpartnership.com; s=20151216; t=1590538704; bh=qID++NqcCImhZsa5jpMl2xI3bNrObdcyNtPXj6J7vTA=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=nn+hxfT7PV/m8JO5KlzADc5duM37fIGlQITTf2WsHd2ZlK9ywTrkidZpOegr4aovL f5DQCl2MH4e3UrZjKbQ3Ho5T83bGFI0meV/QpToT0SKIcpnV+aCpjLTa19QPw88r/b uYRAXGTNlGfSWP1kvUOH2xt6e5PpCqDi8xHlHUG4= 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 nz4t2lLbttbW; Tue, 26 May 2020 17:18:24 -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 7C57E8EE0D4; Tue, 26 May 2020 17:18:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=hansenpartnership.com; s=20151216; t=1590538703; bh=qID++NqcCImhZsa5jpMl2xI3bNrObdcyNtPXj6J7vTA=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=T1Y/cKeWxtbmbBUOm78QeCdLFUqn+xmpk6E3IRjgulQEmYpeh4x2z39psGk5tKD57 7KFJXTEEZ85zCawULY6iCjn4ZYT/RLCVybG9psE5iOdT6OKB2bZmmf3BqSDrwjr1U/ I8kAPCXNq7e9nWqSSgenBsf+5vP/vKzwqfUp3vs0= Message-ID: <1590538702.3576.2.camel@HansenPartnership.com> Subject: Re: [PATCH] tpm: Revert "tpm: fix invalid locking in NONBLOCKING mode" From: James Bottomley To: Alex Guzman Cc: Mario Limonciello , Peter Huewe , Jarkko Sakkinen , Jason Gunthorpe , Arnd Bergmann , Greg Kroah-Hartman , linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, Jeffrin Jose T Date: Tue, 26 May 2020 17:18:22 -0700 In-Reply-To: References: <20200526183213.20720-1-mario.limonciello@dell.com> <1590520454.11810.40.camel@HansenPartnership.com> <1590521924.15108.1.camel@HansenPartnership.com> <1590534370.15108.17.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 16:31 -0700, Alex Guzman wrote: > On Tue, May 26, 2020 at 4:06 PM James Bottomley > wrote: > > > > 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 > > > > Oh, I did miss that bit. The patch had issues applying for some > reason and I missed the single-line removal when I was looking at the > diff. Sorry, that's likely my fault: I did it on top of my current TPM tree. I'll prepare a version against the vanilla kernel with a real changelog. > I gave it a spin on my machine again. getcap seems to work correctly > with and without having the async config flag set for tpm2-tss. The > pkcs11 plugin seems to work correctly again too. :) Great, thanks! I'll add your tested-by to the above. James