Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp1511968rwl; Thu, 5 Jan 2023 14:56:58 -0800 (PST) X-Google-Smtp-Source: AMrXdXuhh/BJyIWtYkxtJy1tEJ/8Dq48fCf7qmi+mAuh1Z3sqTFuzxgRJfjV37UXDhAdQsnuA3IS X-Received: by 2002:a17:907:6f18:b0:837:3ed3:9c2b with SMTP id sy24-20020a1709076f1800b008373ed39c2bmr50520338ejc.5.1672959418504; Thu, 05 Jan 2023 14:56:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672959418; cv=none; d=google.com; s=arc-20160816; b=QNnPkmz4uF/JbiZjpju/0mFIj9IbuP8FWmKU9T+Mq9/416fkbr4U4em9UpSZ3hJu3r 03iZIFu8S3Lgu6/B/pab4tFCTmLSkuA+G7bvXiPgE1Wzii8rYgDCZU697HWdaOvLP6aE PMwHsoqgmZJl4W61pImJe0dXIHcP39Q1SJszTt2UU/anRQ8fbq53KsjGsjfMdjCDPG1b pedCyYI8wKajpfZLlBaFFH09LznkMAeTKfxXKl3UyalA+EqMmvkEDN9vk1v2Aw3PC0sV oeMH+5bQ5DIX5z2HYSo2IBl4FvMyPpCmkL1rjd1vEvq//7RkuJDxo10d/4i3sMWUX8rb j49Q== 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=mMldSeIA7qWoDB1sx6P/v3uvnTNOCNV9Im/Ue9FmzFU=; b=a5llpvZkypBFFZkrBxCMt7bQ+2FGbS82ATbX8ojcPd2BxLWDfV6ugow6ggH9608nhw 0hwi8VtHQXGDtPBNQF3iyc1R6K+U+j+faH3u5aV2DvgYtW/kP8e1Bk7lIz9xSUzNUJt6 50B7RlzaYq9cp15flAO1V6Ip0dQnjDXehIlGd/KJr0sJ3dSxEhXHQNSOd2a1osvFYuAm 4H7dyZuqq9ry2nWp3dUxSAN6kP0zTcbI4M/Rc7cWxyLYCFxgIWK429qaKChCPIZlVvtp B07TF4yDe+mpb03Xc8P1hyywCqlP4RMBghkp7WLPT6e1/nB4iVb2CEwVDkk5lw7FL7lP ZOZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=QpBB4pwU; 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 sc37-20020a1709078a2500b007c19a5b7697si35133585ejc.233.2023.01.05.14.56.45; Thu, 05 Jan 2023 14:56:58 -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=QpBB4pwU; 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 S235967AbjAEWa3 (ORCPT + 55 others); Thu, 5 Jan 2023 17:30:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236046AbjAEWaD (ORCPT ); Thu, 5 Jan 2023 17:30:03 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D57910D6; Thu, 5 Jan 2023 14:29:54 -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 ams.source.kernel.org (Postfix) with ESMTPS id E4976B81C0A; Thu, 5 Jan 2023 22:29:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B0FDC433EF; Thu, 5 Jan 2023 22:29:50 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="QpBB4pwU" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1672957786; 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=mMldSeIA7qWoDB1sx6P/v3uvnTNOCNV9Im/Ue9FmzFU=; b=QpBB4pwU2wEZ2yl5XVSF8mYLnd3NmfAVe/m2DxszOjivDyR1t+oAmAjfXb9/LnZft8M8Sm tfyMpwX8w1ub8ByD/S+prDNIPhgnJLkTf3MoS+QWRKds0cASzWvEhSX/Bk+RZunpaPP8+3 zaDdmKSp9EPrhaXg2F5QU1PKN05ae+s= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 843725ac (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 5 Jan 2023 22:29:46 +0000 (UTC) Date: Thu, 5 Jan 2023 23:29:43 +0100 From: "Jason A. Donenfeld" To: Linus Torvalds Cc: Thorsten Leemhuis , James Bottomley , Peter Huewe , Jarkko Sakkinen , Jason Gunthorpe , Jan Dabros , regressions@lists.linux.dev, LKML , linux-integrity@vger.kernel.org, Dominik Brodowski , Herbert Xu , Johannes Altmanninger , stable@vger.kernel.org Subject: Re: [PATCH] tpm: Disable hwrng for TPM 1 if PM_SLEEP is enabled Message-ID: References: <370a2808-a19b-b512-4cd3-72dc69dfe8b0@suse.cz> <20230105144742.3219571-1-Jason@zx2c4.com> 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, Jan 05, 2023 at 01:58:48PM -0800, Linus Torvalds wrote: > On Thu, Jan 5, 2023 at 6:48 AM Jason A. Donenfeld wrote: > > > > TPM 1's support for its hardware RNG is broken across system suspends, > > due to races or locking issues or something else that haven't been > > diagnosed or fixed yet. These issues prevent the system from actually > > suspending. So disable the driver in this case. Later, when this is > > fixed properly, we can remove this. > > How about just keeping it enabled, but not making it a fatal error if > the TPM saving doesn't work? IOW, just print the warning, and then > "return 0" from the suspend function. You're right that returning 0 from the pm notifier would make the problem that users actually care about -- laptop doesn't sleep when you close the lid -- go away. From a random.c perspective, the RNG is already initialized when the driver loads, which will be before suspend bricks the driver. So even if the behavior afterwards is a buggy driver handing all zeros to random.c, it won't really matter much; random.c can deal with that cryptographically. I have no idea if this is actually the case with the driver's error condition. But if it is, it's good that it doesn't matter. So okay, I'll roll a patch to do that when I get home. I'm writing on my phone now, but from memory it's just changing a 'return rc;' into 'return 0;'. Then the TPM folks can fix the underlying issue at their leisure whenever. Jason