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
This commit is contained in:
Gleb Smirnoff 2025-01-31 17:02:17 -08:00
parent 030c028255
commit 59f9d8c4bf

View file

@ -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);
}
/**********************************************************************/