git: 9bccb454ae96 - stable/13 - kern_jail.c: Remove #ifdefs for VNET_NFSD

From: Rick Macklem <rmacklem_at_FreeBSD.org>
Date: Sun, 21 May 2023 20:09:10 UTC
The branch stable/13 has been updated by rmacklem:

URL: https://cgit.FreeBSD.org/src/commit/?id=9bccb454ae9653105469568dda57b5ff9064f7d1

commit 9bccb454ae9653105469568dda57b5ff9064f7d1
Author:     Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2023-03-02 21:13:24 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2023-05-21 20:07:14 +0000

    kern_jail.c: Remove #ifdefs for VNET_NFSD
    
    The consensus was that VNET_NFSD was not needed.
    This patch removes it from kern_jail.c.
    
    With this patch, support for the "allow.nfsd"
    jail parameter is enabled in the kernel for
    kernels built with "options VIMAGE".
    
    (cherry picked from commit cbbb22031f9b957967c03dc8e685392f7d7e7fb8)
---
 sys/kern/kern_jail.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c
index 0203dcd0faf1..d43d2326cfec 100644
--- a/sys/kern/kern_jail.c
+++ b/sys/kern/kern_jail.c
@@ -216,7 +216,7 @@ static struct bool_flags pr_flag_allow[NBBY * NBPW] = {
 	{"allow.unprivileged_proc_debug", "allow.nounprivileged_proc_debug",
 	 PR_ALLOW_UNPRIV_DEBUG},
 	{"allow.suser", "allow.nosuser", PR_ALLOW_SUSER},
-#if defined(VNET_NFSD) && defined(VIMAGE) && defined(NFSD)
+#ifdef VIMAGE
 	{"allow.nfsd", "allow.nonfsd", PR_ALLOW_NFSD},
 #endif
 };
@@ -1888,12 +1888,10 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags)
 	}
 #endif
 
-#ifdef VNET_NFSD
 	if (born && pr != &prison0 && (pr->pr_allow & PR_ALLOW_NFSD) != 0 &&
 	    (pr->pr_root->v_vflag & VV_ROOT) == 0)
 		printf("Warning jail jid=%d: mountd/nfsd requires a separate"
 		   " file system\n", pr->pr_id);
-#endif
 
 	drflags &= ~PD_KILL;
 	td->td_retval[0] = pr->pr_id;
@@ -3473,12 +3471,7 @@ prison_priv_check(struct ucred *cred, int priv)
 	case PRIV_NFS_DAEMON:
 	case PRIV_VFS_GETFH:
 	case PRIV_VFS_MOUNT_EXPORTED:
-#ifdef VNET_NFSD
 		if (!prison_check_nfsd(cred))
-#else
-		printf("running nfsd in a prison requires a kernel "
-		    "built with ''options VNET_NFSD''\n");
-#endif
 			return (EPERM);
 #ifdef notyet
 	case PRIV_NFS_LOCKD:
@@ -4230,7 +4223,7 @@ SYSCTL_JAIL_PARAM(_allow, unprivileged_proc_debug, CTLTYPE_INT | CTLFLAG_RW,
     "B", "Unprivileged processes may use process debugging facilities");
 SYSCTL_JAIL_PARAM(_allow, suser, CTLTYPE_INT | CTLFLAG_RW,
     "B", "Processes in jail with uid 0 have privilege");
-#if defined(VNET_NFSD) && defined(VIMAGE) && defined(NFSD)
+#ifdef VIMAGE
 SYSCTL_JAIL_PARAM(_allow, nfsd, CTLTYPE_INT | CTLFLAG_RW,
     "B", "Mountd/nfsd may run in the jail");
 #endif