git: deaa609d065d - stable/15 - jaildesc: remove desc from the sysctl parameter list
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 15 Sep 2025 04:04:19 UTC
The branch stable/15 has been updated by jamie:
URL: https://cgit.FreeBSD.org/src/commit/?id=deaa609d065d525a13392d09057afa237fbe4d68
commit deaa609d065d525a13392d09057afa237fbe4d68
Author: Jamie Gritton <jamie@FreeBSD.org>
AuthorDate: 2025-09-13 22:30:14 +0000
Commit: Jamie Gritton <jamie@FreeBSD.org>
CommitDate: 2025-09-15 03:34:00 +0000
jaildesc: remove desc from the sysctl parameter list
Like lastjid, desc should count as a pseudo-parameter. The difference
lies entirely in the security.jail.param sysctls, which list all of
the jail parameters. Since desc opens and returns a file descriptor,
it has no place in such uses as "jls all." Like lastjid, it's still
recognized by the kernel if passed in/out, and hard-coded into libjail
so it can be recognized there.
(cherry picked from commit e75dda31c1eead9ad40580bd8fec17f2bbf55a21)
---
lib/libjail/jail.c | 10 +++++++++-
sys/kern/kern_jail.c | 1 -
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/lib/libjail/jail.c b/lib/libjail/jail.c
index f761bc6993e5..ad3348af0d2d 100644
--- a/lib/libjail/jail.c
+++ b/lib/libjail/jail.c
@@ -920,13 +920,21 @@ jailparam_type(struct jailparam *jp)
} desc;
int mib[CTL_MAXNAME];
- /* The "lastjid" parameter isn't real. */
+ /*
+ * Some pseudo-parameters don't show up in the sysctl
+ * parameter list.
+ */
name = jp->jp_name;
if (!strcmp(name, "lastjid")) {
jp->jp_valuelen = sizeof(int);
jp->jp_ctltype = CTLTYPE_INT | CTLFLAG_WR;
return (0);
}
+ if (!strcmp(name, "desc")) {
+ jp->jp_valuelen = sizeof(int);
+ jp->jp_ctltype = CTLTYPE_INT | CTLFLAG_RW;
+ return (0);
+ }
/* Find the sysctl that describes the parameter. */
mib[0] = 0;
diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c
index 43035dc009b3..a75ba89d2a7e 100644
--- a/sys/kern/kern_jail.c
+++ b/sys/kern/kern_jail.c
@@ -4935,7 +4935,6 @@ sysctl_jail_param(SYSCTL_HANDLER_ARGS)
* jail creation time but cannot be changed in an existing jail.
*/
SYSCTL_JAIL_PARAM(, jid, CTLTYPE_INT | CTLFLAG_RDTUN, "I", "Jail ID");
-SYSCTL_JAIL_PARAM(, desc, CTLTYPE_INT | CTLFLAG_RW, "I", "Jail descriptor");
SYSCTL_JAIL_PARAM(, parent, CTLTYPE_INT | CTLFLAG_RD, "I", "Jail parent ID");
SYSCTL_JAIL_PARAM_STRING(, name, CTLFLAG_RW, MAXHOSTNAMELEN, "Jail name");
SYSCTL_JAIL_PARAM_STRING(, path, CTLFLAG_RDTUN, MAXPATHLEN, "Jail root path");