Re: git: 89eddfb4b9f5 - main - linux: fix panic on kldunload
- In reply to: Gleb Smirnoff : "git: 89eddfb4b9f5 - main - linux: fix panic on kldunload"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 10 Dec 2025 20:24:00 UTC
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