From nobody Mon Feb 6 19:36:57 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4P9c2x6gtKz3n5fx; Mon, 6 Feb 2023 19:36:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4P9c2x4wH5z3pTJ; Mon, 6 Feb 2023 19:36:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675712217; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ralxQB67FwWpnMSWmWS3lsPFoxgUCU4Ti1CO+9OoxiY=; b=Meu6JwiYfbLa09eMQcaHZ/CAXiHPuN7LkeKwO+ASPCvjd1+BodaGW3o5WS1cGg4IVXPnI+ RmzTUob8L/I9CyPtMyiBymhrY/Aw0+0blgtaNScEHUUTrdmt/YX5kK+jYAWgHTo85sPB+N r5CNo8ePThq7aZf43xiyruG9MgCxm5WYfPsZEKWdsXmC+B3STwFEuU5g+5MFXXLvfd9cPl 3MRUGmu4OHjDTuyGiRcK6UXlCnlXqrg0bbrS2tdBKUlh/xIonqGY/9R4a/boXODW1+5Ogc EsEPuvMv0zBSxNpllkO02xF7bduGIJbWNjffveWIxM2iMuAcKhECVVbdi2CqJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675712217; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ralxQB67FwWpnMSWmWS3lsPFoxgUCU4Ti1CO+9OoxiY=; b=QFskwoILg5OL50m2aumJtTrpFJx5q1ngI4eGw9Uu4gY4go0FBFIbVCLMAJNPiEgbfKdY/T 15VcskSDJ/l/3uQSnNav5WdjzgA7u1VzcL/SnYs8OdZto6xyqGojhXjfTda6ZD0s1v5fPR iU9BHXn1TGIFq0KNkcTp9fsn5Uq3pkTFMmtf0KMgODNK4H0ggOeAHLdJRbEFN+M5rDl9VB 73GoxiELbnU0XG0dlJ8BMVvW0ou5azherKJmucUvxNMPucPNQ/Ol69GFbycoAnTvLNv7t1 l3ZGBrgEt9e/V5ZSwRbJHHtTIYyvWa29ChTkdz4Zn2L0GP5teCQJwhpw87hPnw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675712217; a=rsa-sha256; cv=none; b=frpUqBn8wYJ0s3v7IIvzDsb9NjfZSaghgRqmE+oepYgQbHyCgcVMCkC/urBiAi6urfGgmN sGjK8ChWXGV+HQVf4sFC9Xrt0N1YJap58gzWoHqfk1k7/wOUb8atQ5/qKX1kS/qZJeuMY3 XaxFmKuODlnCDYaOgtfHSMfynt4HSwFJMnGDEV/KHtlbYdnopKVCPQBoujRVEOtc7cHlu9 vapu5Qay+fLR4fxIOwxMAonp4y+3JiUywL/io5kbhnwfTL/epNC3MbmedghYaDMrlVdSmA Ccbfjf/mg4cPW1PyLVOf0rBuZAZ8fUM305R6aIhHhRu8EZnx7Sztk3bkWc+zzQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4P9c2x40mYznCh; Mon, 6 Feb 2023 19:36:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 316JavNU020430; Mon, 6 Feb 2023 19:36:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 316JaveR020429; Mon, 6 Feb 2023 19:36:57 GMT (envelope-from git) Date: Mon, 6 Feb 2023 19:36:57 GMT Message-Id: <202302061936.316JaveR020429@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 2f12145a37be - stable/13 - kern_reboot: unconditionally call shutdown_reset() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2f12145a37befc2bae3db859699d394611e96e2d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=2f12145a37befc2bae3db859699d394611e96e2d commit 2f12145a37befc2bae3db859699d394611e96e2d Author: Mitchell Horne AuthorDate: 2023-01-23 18:47:11 +0000 Commit: Mitchell Horne CommitDate: 2023-02-06 19:34:36 +0000 kern_reboot: unconditionally call shutdown_reset() Currently shutdown_reset() is registered as the final entry of the shutdown_final event handler. However, if a panic occurs early in boot before the event is registered (SI_SUB_INTRINSIC), we may end up spinning in the subsequent infinite for loop and failing to reset altogether. Instead we can simply call this function unconditionally. Reviewed by: markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D37981 (cherry picked from commit 627ca221c311b5d9c4132e03664a96f390ff5c0d) --- sys/kern/kern_shutdown.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c index aaa5c5a0243f..ee6faa222206 100644 --- a/sys/kern/kern_shutdown.c +++ b/sys/kern/kern_shutdown.c @@ -265,8 +265,6 @@ shutdown_conf(void *unused) SHUTDOWN_PRI_LAST + 100); EVENTHANDLER_REGISTER(shutdown_final, shutdown_panic, NULL, SHUTDOWN_PRI_LAST + 100); - EVENTHANDLER_REGISTER(shutdown_final, shutdown_reset, NULL, - SHUTDOWN_PRI_LAST + 200); } SYSINIT(shutdown_conf, SI_SUB_INTRINSIC, SI_ORDER_ANY, shutdown_conf, NULL); @@ -499,6 +497,12 @@ kern_reboot(int howto) /* Now that we're going to really halt the system... */ EVENTHANDLER_INVOKE(shutdown_final, howto); + /* + * Call this directly so that reset is attempted even if shutdown + * handlers are not yet registered. + */ + shutdown_reset(NULL, howto); + for(;;) ; /* safety against shutdown_reset not working */ /* NOTREACHED */ }