Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp5497819rwl; Wed, 28 Dec 2022 20:52:02 -0800 (PST) X-Google-Smtp-Source: AMrXdXvn/1N2XM0bkacXsrmLzBt4sg4+jwxGVbycNxhJrrlsxAumCNYvuttpLm9Pp0ORlbLlLuRx X-Received: by 2002:a17:906:22d2:b0:7fc:3787:243d with SMTP id q18-20020a17090622d200b007fc3787243dmr26021845eja.53.1672289521814; Wed, 28 Dec 2022 20:52:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672289521; cv=none; d=google.com; s=arc-20160816; b=a968fJ77sOBLrgZTBoj79ZP6/15aafeMOBcCXk7+HXdKa8KmxAxK0QzkUUJ4OHzrEV FOuVPq68OjXXLcHJBXzLB/BNL0InwwuG4c5yr6ob3cC0cTGRzefstFcSx2lNXCzowN4q YTAaL7z/Df6aJlyiTyjgRWeztAd2lQLyXlfxDiWW4HpWwpqUSOXC10ODfzEekPI5LFdl Kq6WFN+LJFReIVW/5LN7nkX1ChsozEku0IuqrDC8IPSCn1OdJdoiXouBzkJEM+5UTf9i +l8wit2ItYSgBgJd+H6S/XOjhcXUgkfm77MXS1EMFILbDPkO5hgZU9LONhLaLtr6Ka2c 3NSg== 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=mryHCuwKL4ka0P8BgAVspE8IMbN7LJc0YktowyLFPBU=; b=T15myzsNYqy3SfpArHTTBB6ByvbN+sAsgGWnN8o+g4eoSiBJQJa7BG4RD/BxeCwlK/ qagI1yNWZu6NNyosPdYpXSFcW1u8XHpf8oPaO2LO5hPE9RMkzuVr/CSyzEccQ+txbNtM Ys2fRApCejR6av/Yf4vJ43SPqvZ586qQjSjEZi1mOZn1RTVIiafdl3lCZr4DTkZbenJQ naJquBPNx7tVblQet2gLBUDEz0ktChtVsoSs/Lx7Qiw4METqY0lh/JqnZ6m1IuqvnV/n o8g4siCkQRPSMFfHA+0OePwUVCZQSMkjffb6kAWdc/g48zdZJX8aiBxTtAwv4GEqnWxA NVsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=HIwmwkOQ; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=zx2c4.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t18-20020a1709063e5200b007c17d93ca62si12147867eji.971.2022.12.28.20.51.40; Wed, 28 Dec 2022 20:52:01 -0800 (PST) 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=@zx2c4.com header.s=20210105 header.b=HIwmwkOQ; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=zx2c4.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232749AbiL2ERL (ORCPT + 62 others); Wed, 28 Dec 2022 23:17:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230006AbiL2ERI (ORCPT ); Wed, 28 Dec 2022 23:17:08 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A2C912087; Wed, 28 Dec 2022 20:17:07 -0800 (PST) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 8404C61701; Thu, 29 Dec 2022 04:17:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85084C433D2; Thu, 29 Dec 2022 04:17:04 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="HIwmwkOQ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1672287423; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=mryHCuwKL4ka0P8BgAVspE8IMbN7LJc0YktowyLFPBU=; b=HIwmwkOQ33WeQbwrhkbvP9jwvW6KhesTh1A1e6UMyWZYf1mH5qGJFqk8/M/bmzvSeU9hg+ 8HBWjdLAUMVbiSicxFUbBsJkY8IxvC4XFd926K1MZGUMUfIliLoFqDq3aYWUwAdQH2U6Ar PpsmuM0TbZxiqtOWTUtqmvk8Mv6aHe8= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 18782bdc (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 29 Dec 2022 04:17:02 +0000 (UTC) Date: Thu, 29 Dec 2022 05:16:59 +0100 From: "Jason A. Donenfeld" To: James Bottomley Cc: Vlastimil Babka , Peter Huewe , Jarkko Sakkinen , Jason Gunthorpe , Jan Dabros , regressions@lists.linux.dev, LKML , linux-integrity@vger.kernel.org, Dominik Brodowski , Herbert Xu , Linus Torvalds Subject: Re: [REGRESSION] suspend to ram fails in 6.2-rc1 due to tpm errors Message-ID: References: <7cbe96cf-e0b5-ba63-d1b4-f63d2e826efa@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, 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 On Thu, Dec 29, 2022 at 05:03:44AM +0100, Jason A. Donenfeld wrote: > I recall seeing something pretty similar to this report with the > selftest as well. Basically, the call to tpm1_do_selftest can race with > the call to tpm1_get_random, presumably because tpm1_get_random doesn't > do any locking on its own. So it might be a good idea to make sure that > tpm1_get_random() isn't running before tpm1_do_selftest() or any other > TPM commands run. The other locking angle is that tpm1_pm_suspend() should wait for tpm1_get_random() to finish or cancel tpm1_get_random(), if that's not already happening. IIRC, the selftest gets tripped up when it's triggered on resume due to an already in-flight tpm1_get_random() from prior to sleep, that never completed.