Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp412034ybm; Tue, 26 May 2020 21:23:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxh4ozeA+2uopTy3lXQwxO1mSFpBFnW8CMnNVa2sWXT1kRwSFs0v1aLqYudvbyB7TdsPCjx X-Received: by 2002:a17:907:40f1:: with SMTP id no1mr4050584ejb.178.1590553411675; Tue, 26 May 2020 21:23:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590553411; cv=none; d=google.com; s=arc-20160816; b=aS0eL8nx4gcLaBmstvtkxiO8p5OKLEWNcy+436bmW08eR2WhNqOSTkBoJyY4nUJH1s tkvcwX09IllZxlTEYWKews4MWaoNGWO1bTN5eIBOZ1brU7sf6hW8375qX+KDN+gmqRbP 4ftYuqttZbHeC0yBvAH7IKoQP62EyW8MWIYC954D8Vt+x5l+u7/p8LUaOaaMELzooga8 lYWEyNWb1xKvQwBS394MtWri7czLKx+jEpdA875IiIOpvVwz3+8hnY95WGD49++qZ0+x cBhSRzS222Yw0SZkyk5OhB/FGUDBqMXUfqWHyNk4kSV8uMzBUrI/fSJoZwEFd3y/QuKR ffLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=NUHQ87HXBhNLKdg5M4S8WpnQd9u0DanCJ6FWlFhn50g=; b=eyd6qA9/eaaeoHhe+uzs8PGfxj4NrS8aXUQGjysGo6zJ/bGR5kcYK1q1Uhr993R2Ky 6GTxSVk0600lOMHFxhwZ1RSsf+yjyauN0NMNCDlAB8WdJl2I4LizHiLczz60hOho7KX8 Cjt/8IpDs7oIWH4VJz9t65uts6g0tSLDPuXlU/Urb1TR50Nc8UU6WYBPWo6ekNnrldIR DLeYELRLMDjMQAWXn7AkdoUq75t23O3RRAuccVfL1QgP0lgesaFl40SHnwAUSqHZozNm 1ObC4GU6Vff/LP+5A/WuRnkZd6UpURo63g+UpD/3cyVk/c4HFbiggcvVuLihuKuVPDBA xCAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@guzman.io header.s=google header.b=kMBEkytO; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e9si1104057edl.560.2020.05.26.21.23.08; Tue, 26 May 2020 21:23:31 -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=pass header.i=@guzman.io header.s=google header.b=kMBEkytO; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726130AbgEZXbP (ORCPT + 99 others); Tue, 26 May 2020 19:31:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725896AbgEZXbO (ORCPT ); Tue, 26 May 2020 19:31:14 -0400 Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CB3AC061A0F for ; Tue, 26 May 2020 16:31:14 -0700 (PDT) Received: by mail-lj1-x243.google.com with SMTP id b6so26697356ljj.1 for ; Tue, 26 May 2020 16:31:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=guzman.io; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=NUHQ87HXBhNLKdg5M4S8WpnQd9u0DanCJ6FWlFhn50g=; b=kMBEkytO421Sme01FUYPg/RhFeCsWxOBXVi7dHrRMP/yX14dsQeccuifaus5xaz/9e wjjpnmeM9D+ccEq+VUAB48plmUqyKLQSBCKqiLDJ28D9pzenSdcyuoNl08yWm5uNOqIg AR2sai4gvUcXNsVVu12PJ6aQYJhyLkKAXuNqY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=NUHQ87HXBhNLKdg5M4S8WpnQd9u0DanCJ6FWlFhn50g=; b=EFPma9yCXNzUJzZ3aS39JYzgB6C4IHTLxnwQswyGyGyu0XVSSsmDwHKlnqwwMEg4ik 26NoPMXxRvWfv4MBYJwd+fl35jwYQJuFaa00IbgXrCMiY+MOUCRUywUU79b/3A8WYoT9 MVUGfXrTXh0CSRLLl1rcGFteg9m89hbflV78q7uKVfVOYAJoDnreMEaTkF9Udy+TVWUx YQfrwqEr0+KWMzoTpiY6dxx23IfmSFfh86GRl9p5QHYQFaw9XJ7F7vDSZ/Ck+1VVFlhp tdfMgC2s3qkirI/TsnvWn1AO/Ct5zp8gPbH0d7OD+zBoUHqymW9B6AoLzuViOiPoaDn1 iG6g== X-Gm-Message-State: AOAM533GZCd7Gky5y1BcCz0qbL0t4zDgqWtu1X5DMlW2xIRnPY2RBOE7 HLJ7ZqnBYQJtOUgXC0cK1JFyeA7kcEznsPPU2U4HYQ== X-Received: by 2002:a2e:8654:: with SMTP id i20mr1474327ljj.79.1590535872825; Tue, 26 May 2020 16:31:12 -0700 (PDT) MIME-Version: 1.0 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> In-Reply-To: <1590534370.15108.17.camel@HansenPartnership.com> From: Alex Guzman Date: Tue, 26 May 2020 16:31:01 -0700 Message-ID: Subject: Re: [PATCH] tpm: Revert "tpm: fix invalid locking in NONBLOCKING mode" To: James Bottomley 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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. :)