Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Feb 2025 09:02:11 GMT
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 59f9d8c4bf64 - main - nlm: set vnet(9) context in the NLM syscall
Message-ID:  <202502010902.51192BEv047988@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=59f9d8c4bf6485a1143e2df514dea5060551a3ee

commit 59f9d8c4bf6485a1143e2df514dea5060551a3ee
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2025-02-01 01:02:17 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2025-02-01 09:00:26 +0000

    nlm: set vnet(9) context in the NLM syscall
    
    With the kernel RPC binding moving to Netlink transport all clients need
    to have proper vnet(9) context set.  This change will unlikely make NLM
    properly virtualized, but at least it will not panic on the default VNET
    when kernel is compiled with VIMAGE.
    
    Reviewed by:            rmacklem
    Differential Revision:  https://reviews.freebsd.org/D48555
---
 sys/nlm/nlm_prot_impl.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/sys/nlm/nlm_prot_impl.c b/sys/nlm/nlm_prot_impl.c
index 5275f4362a71..02b7383cd640 100644
--- a/sys/nlm/nlm_prot_impl.c
+++ b/sys/nlm/nlm_prot_impl.c
@@ -39,6 +39,7 @@
 #include <sys/mount.h>
 #include <sys/priv.h>
 #include <sys/proc.h>
+#include <sys/jail.h>
 #include <sys/socket.h>
 #include <sys/socketvar.h>
 #include <sys/syscall.h>
@@ -1711,7 +1712,11 @@ sys_nlm_syscall(struct thread *td, struct nlm_syscall_args *uap)
 	nlm_grace_threshold = time_uptime + uap->grace_period;
 	nlm_next_idle_check = time_uptime + NLM_IDLE_PERIOD;
 
-	return nlm_server_main(uap->addr_count, uap->addrs);
+	CURVNET_SET(TD_TO_VNET(td));
+	error = nlm_server_main(uap->addr_count, uap->addrs);
+	CURVNET_RESTORE();
+
+	return (error);
 }
 
 /**********************************************************************/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202502010902.51192BEv047988>