Date: Wed, 10 Dec 2025 15:24:00 -0500 From: John Baldwin <jhb@FreeBSD.org> To: Gleb Smirnoff <glebius@FreeBSD.org>, src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 89eddfb4b9f5 - main - linux: fix panic on kldunload Message-ID: <2fb326df-cbe6-4551-b2f0-03ae846ce0bd@FreeBSD.org> In-Reply-To: <6939c865.26fbe.36b38dfe@gitrepo.freebsd.org> References: <6939c865.26fbe.36b38dfe@gitrepo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 12/10/25 14:22, Gleb Smirnoff wrote: > The branch main has been updated by glebius: > > URL: https://cgit.FreeBSD.org/src/commit/?id=89eddfb4b9f5d744623ce0ee8ea966b0d33456e5 > > commit 89eddfb4b9f5d744623ce0ee8ea966b0d33456e5 > Author: Gleb Smirnoff <glebius@FreeBSD.org> > AuthorDate: 2025-12-10 19:20:14 +0000 > Commit: Gleb Smirnoff <glebius@FreeBSD.org> > CommitDate: 2025-12-10 19:20:14 +0000 > > linux: fix panic on kldunload > > The vnet_deregister_sysuninit() that is called by linker unload sequence also > calls every registered destructor before unregistering it. IMHO, this is > not correct in principle, but for now plug the regression right in the code > that introduced the panic. > > Fixes: 607f11055d2d421770963162a4d9a99cdd136152 > --- > sys/compat/linux/linux_if.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/sys/compat/linux/linux_if.c b/sys/compat/linux/linux_if.c > index 1281207c1c84..b342b07a6722 100644 > --- a/sys/compat/linux/linux_if.c > +++ b/sys/compat/linux/linux_if.c > @@ -105,6 +105,13 @@ VNET_SYSINIT(linux_ifnet_vnet_init, SI_SUB_PROTO_IF, SI_ORDER_ANY, > static void > linux_ifnet_vnet_uninit(void *arg __unused) > { > + /* > + * At a normal vnet shutdown all interfaces are gone at this point. > + * But when we kldunload linux.ko, the vnet_deregister_sysuninit() > + * would call this function for the default vnet. > + */ > + if (IS_DEFAULT_VNET(curvnet)) > + clear_unrhdr(V_linux_eth_unr); > delete_unrhdr(V_linux_eth_unr); > } > VNET_SYSUNINIT(linux_ifnet_vnet_uninit, SI_SUB_PROTO_IF, SI_ORDER_ANY, Don't you also want to make this SYSUNINIT enabled for the !VIMAGE case so you don't leak this on unload for the !VIMAGE case? -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2fb326df-cbe6-4551-b2f0-03ae846ce0bd>
