From nobody Sat Dec 14 04:31:58 2024 X-Original-To: dev-commits-src-main@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 4Y9CwG3l9jz5gfhq; Sat, 14 Dec 2024 04:31:58 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y9CwG30Dyz3xZ4; Sat, 14 Dec 2024 04:31:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734150718; 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=UqI8995+XPCGGJvdTYjADY2GSzs/rPTt4a5MZ/f71Rg=; b=Tmkn62zGeAhSbUXaEupPOlF36TGCwJmt+VyCWJJ/0+ErhNX5dSexPTMHWj7+qZWIhaRgWr 43kA3ipm2pl9TCgUemoc9zraMfRjHh9QFYVrden4wNgasKZMBPFyMoqvzIRCm3yZqwJQi+ LOe+qWkb1X5BkLlRYkFADjrZwM7vttoweo0oNu4nT8a1CQgSCD4wNxYhvbCinLHsx6jGM6 JUeqpgTpnq8mdQqTMJbHjg9PSo4ltAPWKtrnIeus/EYaFGzc/ZGOxiqw6ycgLuG82vK+iZ wzBw9HbpTSFNafSoMjlFPLG2CgxZ6bayz4lE0ROW0uFcDXYGf1AC4SmtDmXrjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734150718; 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=UqI8995+XPCGGJvdTYjADY2GSzs/rPTt4a5MZ/f71Rg=; b=WzFrnusnz7kqNMlffSQpW6IwpIfnQsle0xJ/1+/FVR+7Sjizm+dOQ7aTRJe03n0u31wMy4 ipmeUV1GJZW4Q12M2EtUEutLlzzfPVQkVTuCYkFuTj7NC+PN2pz0or47059xM6ibaU4uns nNCYlVWlmuYRGuvmtH7WzL47h6lOsCXv9XI4XMfx3OOXvemo+oGB5vg+3ZTcEmYK3TUW0b KpJcRbA49e9c20TuUKgDOAZNP8QYkDq0rNmMysUkSMhWSpzPmA+NRndiOl9WP3IyU8Au4f Tz+FdVbnhAjkyLv05t9IaYCA1G8spNDzTte+OOKrB6sEzbhvlLWUx3xMK/XeBQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1734150718; a=rsa-sha256; cv=none; b=U1givtDT0Tq+MJphlZVA+QcNndA80JdPR7AU2nNS0E5Ai+q5wUqN636jS6PJj5EWWlz58E xl5HR2oHKFZCUUkDTD+m0oXkDXP8F8BwsbkaNw3nkkDjMKyNLCBLTv4jZlzXyJ1/Yz34LU EZ68CNaj2QhkoOdhkS3HKRNyWAlbow0wqcVeXvCf79K90mr4pRAckqSlixs60QctkgeiC5 ueF9Mr5aIAxXtyQ6o/NJgtEMMfdFGKSqnXnId4gY1X2dVF7LnMjZVG56MPMfZlzySH7Igu iyX4URf89ffcwR4JFnHvnQPcWE98Vw538thj4oeQvtqNy7ASg2JQhoR+tF9N3Q== 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 4Y9CwG2bHvz17HD; Sat, 14 Dec 2024 04:31:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4BE4VwAC046908; Sat, 14 Dec 2024 04:31:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4BE4Vw1s046891; Sat, 14 Dec 2024 04:31:58 GMT (envelope-from git) Date: Sat, 14 Dec 2024 04:31:58 GMT Message-Id: <202412140431.4BE4Vw1s046891@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 48b05b8fc248 - main - loader: set boot_safe when safe mode is selected List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 48b05b8fc2485ba5cc7ba7b52c62965feea101a8 Auto-Submitted: auto-generated The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=48b05b8fc2485ba5cc7ba7b52c62965feea101a8 commit 48b05b8fc2485ba5cc7ba7b52c62965feea101a8 Author: Kyle Evans AuthorDate: 2024-12-14 04:31:22 +0000 Commit: Kyle Evans CommitDate: 2024-12-14 04:31:28 +0000 loader: set boot_safe when safe mode is selected This may be used to disable or limit functionality of some services when safe mode is selected. The particular value of boot_safe should not be considered significant, only its presence in the environment. Reviewed by: imp, tsoome Differential Revision: https://reviews.freebsd.org/D32172 --- stand/forth/menu-commands.4th | 2 ++ stand/lua/core.lua | 2 ++ stand/man/loader_simp.8 | 17 ++++++++++++++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/stand/forth/menu-commands.4th b/stand/forth/menu-commands.4th index 2c3d787c65e1..13bbcf73201c 100644 --- a/stand/forth/menu-commands.4th +++ b/stand/forth/menu-commands.4th @@ -128,6 +128,7 @@ also menu-namespace also menu-command-helpers s" set hw.ata.atapi_dma=0" evaluate s" set kern.eventtimer.periodic=1" evaluate s" set kern.geom.part.check_integrity=0" evaluate + s" set boot_safe=YES" evaluate ; : safemode_disable ( -- ) @@ -136,6 +137,7 @@ also menu-namespace also menu-command-helpers s" hw.ata.atapi_dma" unsetenv s" kern.eventtimer.periodic" unsetenv s" kern.geom.part.check_integrity" unsetenv + s" boot_safe" unsetenv ; : init_safemode ( N -- N ) diff --git a/stand/lua/core.lua b/stand/lua/core.lua index 3582720f2a81..5976cc65156d 100644 --- a/stand/lua/core.lua +++ b/stand/lua/core.lua @@ -179,12 +179,14 @@ function core.setSafeMode(safe_mode) loader.setenv("hw.ata.atapi_dma", "0") loader.setenv("kern.eventtimer.periodic", "1") loader.setenv("kern.geom.part.check_integrity", "0") + loader.setenv("boot_safe", "YES") else loader.unsetenv("kern.smp.disabled") loader.unsetenv("hw.ata.ata_dma") loader.unsetenv("hw.ata.atapi_dma") loader.unsetenv("kern.eventtimer.periodic") loader.unsetenv("kern.geom.part.check_integrity") + loader.unsetenv("boot_safe") end core.sm = safe_mode end diff --git a/stand/man/loader_simp.8 b/stand/man/loader_simp.8 index 49214e78b494..cdacd823b1a5 100644 --- a/stand/man/loader_simp.8 +++ b/stand/man/loader_simp.8 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd September 29, 2021 +.Dd September 30, 2021 .Dt LOADER_SIMP 8 .Os .Sh NAME @@ -339,6 +339,21 @@ In a running system, the state of console muting can be manipulated by the utility. .It Va boot_pause During the device probe, pause after each line is printed. +.It Va boot_safe +Force userland to boot in +.Dq safe mode , +which may disable or limit the functionality of some services that may not be +desired in safe mode. +This is typically set by selecting +.Dq safe mode +in the loader menu, which also sets some other hints for the kernel. +Applications wishing to respect safe mode should +.Sy only +test for the presence of +.Va boot_safe +in +.Xr kenv 1 , +not for any particular value. .It Va boot_serial Force the use of a serial console even when an internal console is present.