On Tue, Jan 06, 2026 at 07:49:18AM +0000, Enji Cooper wrote: > The branch main has been updated by ngie: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=f384784289dba13b90138a89d3df3a8ea063aff9 > > commit f384784289dba13b90138a89d3df3a8ea063aff9 > Author: Anagh Verma <[email protected]> > AuthorDate: 2026-01-06 07:42:56 +0000 > Commit: Enji Cooper <[email protected]> > CommitDate: 2026-01-06 07:48:54 +0000 > > kern_syscall_deregister: document syscall 0 no-op logic > > Document syscall #0 being handled specially in > `kern_syscall_deregister(..)`: it's a reserved syscall and not > dynamically registered, and hence does not need to be deregistered in > the function. > > Co-authored-by: ngie@ > MFC after: 2 weeks > Differential Revision: https://reviews.freebsd.org/D54326 > --- > sys/kern/kern_syscalls.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/sys/kern/kern_syscalls.c b/sys/kern/kern_syscalls.c > index a93d711e7597..7ddc28ed4e26 100644 > --- a/sys/kern/kern_syscalls.c > +++ b/sys/kern/kern_syscalls.c > @@ -161,8 +161,14 @@ kern_syscall_deregister(struct sysent *sysents, int > offset, > { > struct sysent *se; > > - if (offset == 0) > - return (0); /* XXX? */ > + if (offset == 0) { > + /* > + * Syscall #0 is reserved and is not dynamically registered. Syscall number zero is not reserved, it is the mux syscall. It is indeed not dynamic, it is marked with the SY_THR_STATIC flag.
> + * Treat deregistration as a no-op to simplify module unload > + * paths. > + */ > + return (0); > + } > > se = &sysents[offset]; > if ((se->sy_thrcnt & SY_THR_STATIC) != 0) This check for SY_THR_STATIC would catch it. That said, what is the use of silencing the error from an erronous attempt to deregister syscall handler not owned by caller?
