From nobody Thu Apr 23 03:49:57 2026 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 4g1MYL3vmRz6bThc for ; Thu, 23 Apr 2026 03:49: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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4g1MYK72cXz44TN for ; Thu, 23 Apr 2026 03:49:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776916198; 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=INEpm9lsWiO1R2erpUrWAYyVieVZ+/lFdIee6giVoXY=; b=VzdRlvgS62hQrg/8ZBy+bK1CoBXmSwweMB4FIfMMrcC8P2H1DIuv1RAB18/iBs3nF7sZBx p1+jM4HVk9SJZLfazvkViJz2AS2eXOtAoEFm804P88jo57JCST4dXEoHrGYDF00YLZcXr8 DKM/B4n2oqbb3Mqfy4cqDq5PVUrIyLbn9AHhk3cDN9BbRbrWEpsA0VwBBE0Go4axHbN/wr hFzrU1q3N2cOXI5A+eOdUdjtizYN935q+LOjHPpUTGop3Z9EQGs4AFzuwqMYw6wRmSNu23 nKTDJS1OK4qN+V1oRylDh064/jt2ZhW5uXpKrmiFJPEFt739lNU6ZX7plOyzAw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1776916198; a=rsa-sha256; cv=none; b=hlO7QFlK7bqjJUp+69vHSYNUdZExK+AhnIukjKeeTH+aoVU5BW4aIGctnO7SpbMwB2+XGl V4gtjQ2tCFYP1qM8ktD+WdcD9gCO9R2LonDN5qaJrH3KE4ocvdAnEA57zYZ63AXesQREV/ iRkltFrEt4/KKJIiy3mNoP3GfK45g1SsNS1nR2ixojK+cghux0N85TxWyIalkC0paaRnv+ FZUMujZeXngp7L3jKmC7+R5lcuOJbNctFsPeQmR6ek8/2nT0KOojgBPBG/cilX5jOCgaJu 1lGW9iFqwHE7A6FzBY2Fm/0qJ3ppgwcK4oEdm26we0uvRLiX7rkG9uBWc1TmlA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776916198; 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=INEpm9lsWiO1R2erpUrWAYyVieVZ+/lFdIee6giVoXY=; b=XewBymVq5DhzR+9Ca3HjtJ3caGdGve3U2EL4Ajz7qOsEbN4Wz/QGOvv6JPsdalstPFCF9i Ez1xm/V7fy/7LJ11lTJ+op+COeZ5GWRy/EBJv9Mi3xVrz3MF67HOaIbljnoUjR7aoXowla xPwcM99x58HZzX9mWIcer09SyKQh/lluRHBCt9QXEh2DNlvLCAdd8ePZUQImVzCwf0Vo+m Fn22vfZuxm6+YwZJ73jF8GJ0zig3dadRaFyR62Evgve2cOOM5P0J0U6QdcBeL2wyxCImCp uOhzoArWyg1ykeNmK7apsh4vIXuPMWQ1JsPoSqHf0VQTW98rptv5XQksa78LEw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4g1MYK6YMnz110r for ; Thu, 23 Apr 2026 03:49:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3a52e by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 23 Apr 2026 03:49:57 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 1a4e4e0d19f5 - stable/14 - jail: fix backfilling the "name" for jid-named jails 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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/stable/14 X-Git-Reftype: branch X-Git-Commit: 1a4e4e0d19f5e31b94f5772c33f1edcc3a91d146 Auto-Submitted: auto-generated Date: Thu, 23 Apr 2026 03:49:57 +0000 Message-Id: <69e996e5.3a52e.a99ae32@gitrepo.freebsd.org> The branch stable/14 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=1a4e4e0d19f5e31b94f5772c33f1edcc3a91d146 commit 1a4e4e0d19f5e31b94f5772c33f1edcc3a91d146 Author: Kyle Evans AuthorDate: 2025-08-16 17:39:47 +0000 Commit: Kyle Evans CommitDate: 2026-04-23 03:23:08 +0000 jail: fix backfilling the "name" for jid-named jails Using the cfparam variant of add_param() will actually copy the name and flags from the passed-in param, which I hadn't considered. We actually want the name/flags from the "name" param so that we can do variable expansion against it right after that -- otherwise it cannot be found, since variable expansion actually searches by name. While we're here, `jls -e` was the intermediate name for `jls -c` that never saw the light of the day. Fix our existence test. Reviewed by: jamie Fixes: 02944d8c49 ("jail: consistently populate the KP_JID [...]") (cherry picked from commit b81fd3fc8b20eaad64b5c41826432124fd92d6a7) --- usr.sbin/jail/config.c | 2 +- usr.sbin/jail/tests/jail_basic_test.sh | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/usr.sbin/jail/config.c b/usr.sbin/jail/config.c index 42498f01efd0..4465839cba0b 100644 --- a/usr.sbin/jail/config.c +++ b/usr.sbin/jail/config.c @@ -189,7 +189,7 @@ load_config(const char *cfname) * jail is created or found. */ if (j->intparams[KP_NAME] == NULL) - add_param(j, j->intparams[KP_JID], KP_NAME, NULL); + add_param(j, NULL, KP_NAME, j->name); /* Resolve any variable substitutions. */ pgen = 0; diff --git a/usr.sbin/jail/tests/jail_basic_test.sh b/usr.sbin/jail/tests/jail_basic_test.sh index a6859b4dc7f2..b0614a923dc9 100755 --- a/usr.sbin/jail/tests/jail_basic_test.sh +++ b/usr.sbin/jail/tests/jail_basic_test.sh @@ -170,7 +170,7 @@ clean_jails() fi while read jail; do - if jls -e -j "$jail"; then + if jls -c -j "$jail"; then jail -r "$jail" fi done < jails.lst @@ -183,10 +183,23 @@ jid_name_set_body() echo "basejail" >> jails.lst echo "$jid { name = basejail; persist; }" > jail.conf atf_check -o match:"$jid: created" jail -f jail.conf -c "$jid" + # Confirm that we didn't override the explicitly-set name with the jid + # as the name. + atf_check -o match:"basejail" jls -j "$jid" name + atf_check -o match:"$jid: removed" jail -f jail.conf -r "$jid" + + echo "$jid { host.hostname = \"\${name}\"; persist; }" > jail.conf + atf_check -o match:"$jid: created" jail -f jail.conf -c "$jid" + # Confirm that ${name} expanded and expanded correctly to the + # jid-implied name. + atf_check -o match:"$jid" jls -j "$jid" host.hostname atf_check -o match:"$jid: removed" jail -f jail.conf -r "$jid" echo "basejail { jid = $jid; persist; }" > jail.conf atf_check -o match:"basejail: created" jail -f jail.conf -c basejail + # Confirm that our jid assigment in the definition worked out and we + # did in-fact create the jail there. + atf_check -o match:"$jid" jls -j "basejail" jid atf_check -o match:"basejail: removed" jail -f jail.conf -r basejail }