Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp2009242rwo; Thu, 3 Aug 2023 03:26:49 -0700 (PDT) X-Google-Smtp-Source: APBJJlHVDZYtkGMHklyB5sHqmBXV9pGGm4cxg3a48BRx3+xAh+xVSdnCKywBlRTTI3K7yW8Xwyyh X-Received: by 2002:a17:907:760d:b0:99b:cdfd:fb44 with SMTP id jx13-20020a170907760d00b0099bcdfdfb44mr9927828ejc.9.1691058409419; Thu, 03 Aug 2023 03:26:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691058409; cv=none; d=google.com; s=arc-20160816; b=LBa8wbIPDdYpwP1KygSFa61M0/4czg3PERMnhwdnxyRGGGZSEaovfmFAiXB64ustR0 vBT5+wNpay1r8GHclRvZWlYTrfDf05ypkdEI/dZzaNye2cfS7ekVSFOyFtnGNt1OwWa6 5AAR6C4zFCx9KY8TnkUajJqhtj8v3sIZo6UMAWS/xAb8XDBfcBwLUM9gp/LMoQSMFHAu z4evTwMgE6YV/3OekYUDdrPMmtswsx5FYxiNoWKWdkjNLaZLUxEpQcxyIyQiVUDFZchQ t1+NHUOZA4VaCLc2lk0SNdIxsjKIguYS4PbGUNBjXGRgvI6ME+Hy2uS1boBf3bR4iRw0 0rrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-signature; bh=0JKh0YoT5EtMkmw+6bQ4IAlmA0cKqBisDvoowqXZlsY=; fh=FJXhAE3rDMGi9sqYYHpsRIZaooQ+Ag4OseMA+qEjYE0=; b=TrrTtYoj2palVs2QNGCXALVp++P0Vfnwq7jNKpmgQd5BoNxK2RvOm/GD4OqQEJ0e5p O1zUcL3ReJARyJtsUNTiYiG+yiFBEArRY/ebgxcK38Qe4ejXeV429AEqiEFBHT1aZgY2 Zqi91HiLkjVS4cvFuFHxWZQYPV2UCVbcNqZSHjWbww7dB7F8P8uAEKWDko+1JFW2Gjvt tHptzhu93i08Mac648XCNZjLR73VhOFigReqXSN52xAIxHYnIZIVEW6kQ9dy5EFXokvy kfXfwwddeuKDoHYPF4LkfJDfVDPNcn6ZL8mGg/C8QlGFIIxbL+wmdKq+SBDZGggBdjyE 23wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=QTwbY7td; dkim=neutral (no key) header.i=@suse.cz; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u21-20020a1709060b1500b00993cdec0182si1843207ejg.143.2023.08.03.03.26.25; Thu, 03 Aug 2023 03:26:49 -0700 (PDT) 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=@suse.cz header.s=susede2_rsa header.b=QTwbY7td; dkim=neutral (no key) header.i=@suse.cz; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232996AbjHCIbx (ORCPT + 99 others); Thu, 3 Aug 2023 04:31:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231823AbjHCIbK (ORCPT ); Thu, 3 Aug 2023 04:31:10 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 368C35597; Thu, 3 Aug 2023 01:27:44 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 8718521990; Thu, 3 Aug 2023 08:27:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1691051262; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0JKh0YoT5EtMkmw+6bQ4IAlmA0cKqBisDvoowqXZlsY=; b=QTwbY7tdSYtBbOr6bU3TIjPc48JFY0p1VEQ5UnC2EHaxwrykAGZGvKzQRdVgJSsKL/m+yM fJuEpmMtc+P5sgSlDFeiqXxqxaeXH3fz3fl5asZhjGqs41c7L3FfI7JED49+jtjEXd++iP tdAxoHZWGrv1GShKFMJxGJ048j17dSc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1691051262; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0JKh0YoT5EtMkmw+6bQ4IAlmA0cKqBisDvoowqXZlsY=; b=SceAnaI/ZBi3nu/BhzdVcO/Exau4SNI7QBc/3iF9kI37OtrKOf3KYrOX0bS4DyIdl5GlUj 1GPytqRNhMzqXLDw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 45FCC134B0; Thu, 3 Aug 2023 08:27:42 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id oHFOEP5ky2SfUgAAMHmgww (envelope-from ); Thu, 03 Aug 2023 08:27:42 +0000 Message-ID: <2cfa5f55-1d68-8a4f-d049-13f42e0d1484@suse.cz> Date: Thu, 3 Aug 2023 10:27:41 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.1 Subject: Re: [PATCH 04/24] PM: hibernate: move finding the resume device out of software_resume To: Christoph Hellwig , Jens Axboe Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Mike Snitzer , Joern Engel , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Pavel Machek , Loic Poulain , dm-devel@redhat.com, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-mtd@lists.infradead.org, linux-pm@vger.kernel.org, Linux regressions mailing list References: <20230531125535.676098-1-hch@lst.de> <20230531125535.676098-5-hch@lst.de> Content-Language: en-US From: Vlastimil Babka In-Reply-To: <20230531125535.676098-5-hch@lst.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE 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 5/31/23 14:55, Christoph Hellwig wrote: > software_resume can be called either from an init call in the boot code, > or from sysfs once the system has finished booting, and the two > invocation methods this can't race with each other. > > For the latter case we did just parse the suspend device manually, while > the former might not have one. Split software_resume so that the search > only happens for the boot case, which also means the special lockdep > nesting annotation can go away as the system transition mutex can be > taken a little later and doesn't have the sysfs locking nest inside it. > > Signed-off-by: Christoph Hellwig > Acked-by: Rafael J. Wysocki This caused a regression for me in 6.5-rc1+, fix below. ----8<---- From 95a310ae6cfae9b3cab61e54a1bce488c3ab93a1 Mon Sep 17 00:00:00 2001 From: Vlastimil Babka Date: Wed, 2 Aug 2023 15:46:18 +0200 Subject: [PATCH] PM: hibernate: fix resume_store() return value when hibernation not available On a laptop with hibernation set up but not actively used, and with secure boot and lockdown enabled kernel, 6.5-rc1 gets stuck on boot with the following repeated messages: A start job is running for Resume from hibernation using device /dev/system/swap (24s / no limit) lockdown_is_locked_down: 25311154 callbacks suppressed Lockdown: systemd-hiberna: hibernation is restricted; see man kernel_lockdown.7 ... Checking the resume code leads to commit cc89c63e2fe3 ("PM: hibernate: move finding the resume device out of software_resume") which inadvertently changed the return value from resume_store() to 0 when !hibernation_available(). This apparently translates to userspace write() returning 0 as in number of bytes written, and userspace looping indefinitely in the attempt to write the intended value. Fix this by returning the full number of bytes that were to be written, as that's what was done before the commit. Fixes: cc89c63e2fe3 ("PM: hibernate: move finding the resume device out of software_resume") Signed-off-by: Vlastimil Babka --- kernel/power/hibernate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c index e1b4bfa938dd..2b4a946a6ff5 100644 --- a/kernel/power/hibernate.c +++ b/kernel/power/hibernate.c @@ -1166,7 +1166,7 @@ static ssize_t resume_store(struct kobject *kobj, struct kobj_attribute *attr, int error; if (!hibernation_available()) - return 0; + return n; if (len && buf[len-1] == '\n') len--; -- 2.41.0