Re: [PATCH] rtnetlink: fix NULL pointer dereference in rtnl_get_link()
From: Eric Dumazet
Date: Mon Nov 23 2026 - 13:02:07 EST
Le lun. 23 nov. 2026 à 17:02, <mdshahid03@xxxxxxxxx> a écrit :
>
> Thanks Paolo.
>
> I think,I may have misunderstood this part from NET documentation guidelines:
>
> "The commit message must disclose whether reproducing the issue required
> modifying the kernel (e.g. inserting a delay to widen a race, or[[**writing
> a loadable module to issue the right sequence of calls)**]] or using error injection."
>
> I interpreted this as allowing a out-of-tree test module to produce
> an issue,provided that it uses legitimate kernel APIs.
>
> 1.am i intrepretting incorrectly ?
Yes.
This sentence is a disclosure requirement, so that reviewers know how
much weight to give to the reproducer. It does not say that any crash
obtained this way is a bug.
A test module (or an added delay) is fine when it only makes it easier
to reach a state that the unmodified kernel can reach by itself, for
instance to widen a race window, or to exercise an in-tree code path
that is hard to trigger from user space.
Your module does something different: it creates a state that no
in-tree code can create.
rtnl_msg_handlers[PF_UNSPEC] is populated from rtnetlink_init(), which
is built-in and panics if the registration fails. Nothing in the tree
calls rtnl_unregister_all(PF_UNSPEC), the only callers are for
PF_PHONET, PF_INET6, PF_MPLS and PF_CAN.
So the PF_UNSPEC table is never NULL once the kernel has booted, and
rtnl_get_link() relies on this.
This is what Jakub asked in his first reply ("How can this happen?"),
and the changelog should have answered it.
>
> 2.This is general question ,i mean ,we can litrally crash the kernel
> just with loadable module ? How do we distinguish a legitimate kernel
> bug exposed through a test module from a crash caused by an artificial
> or unsupported sequence of operations? is this not vulnerablity in a
> way or design issue ?
Of course a module can crash the kernel. A module runs with full
kernel privileges, it can call panic(), or overwrite any memory.
Loading one requires CAP_SYS_MODULE. There is no security boundary
between a module and the rest of the kernel, so this is not a
vulnerability.
Exported functions are not hardened against callers misusing them.
We do not add checks for conditions that can not happen, they add
code, and they hide the invariants from people reading the code.
The question to ask is: can the unmodified kernel reach this state,
from user space, from the network, or from a device?
If yes, you should be able to describe the in-tree call chain in the
changelog, and in most cases to trigger it without a module.
If the only way is to add new kernel code calling an API in a way no
in-tree user does, there is nothing to fix.
Note that clang-analyzer does not know about this kind of invariant.
Its reports are a starting point for an analysis, they are not a proof
that a bug exists.
>
> 3.Don't you see a gap in documentation w.r.t testing with loadable module
> in details.
Not really. The documentation asks how the bug was confirmed to be
real. A module unregistering the PF_UNSPEC handlers does not confirm
anything about the upstream kernel.
>
> I am asking because, like to understand the correct approach and apply
> it to my future kernel contributions.
>
> Have a nice day !!!
>
> Thanks
> Shahid.
>
> On 2026-11-23 11:56 +0100, Paolo Abeni wrote:
> > On 11/21/26 12:10, mdshahid03@xxxxxxxxx wrote:
> > > I tested this issue on both original and patched kernels in qemu.
> > >
> > > First, I used a test module to unregister all PF_UNSPEC handlers.
> >
> > Just in case the are any doubts on the poic: if you need a custom
> > OoO kernel module to trigger a 'bug', it's not a bug.
> >
> > /P
> >
> >
> >
>
>