* [PATCH net v4 0/4] {net,bpf}: nd_tbl fixes for when ipv6.disable=1
@ 2026-03-07 20:50 Ricardo B. Marlière
2026-03-07 20:50 ` [PATCH net v4 1/4] ipv6: move the disable_ipv6_mod knob to core code Ricardo B. Marlière
` (5 more replies)
0 siblings, 6 replies; 12+ messages in thread
From: Ricardo B. Marlière @ 2026-03-07 20:50 UTC (permalink / raw)
To: Martin KaFai Lau, Daniel Borkmann, John Fastabend,
Stanislav Fomichev, Alexei Starovoitov, Andrii Nakryiko,
Eduard Zingerman, Song Liu, Yonghong Song, KP Singh, Hao Luo,
Jiri Olsa, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Toke Høiland-Jørgensen,
David Ahern, Jay Vosburgh, Andrew Lunn, Hangbin Liu
Cc: Fernando Fernandez Mancera, bpf, netdev, linux-kernel,
Ricardo B. Marlière
Hi,
Please consider merging these four patches to fix three crashes that were
found after this report:
https://lore.kernel.org/all/CAHXs0ORzd62QOG-Fttqa2Cx_A_VFp=utE2H2VTX5nqfgs7LDxQ@mail.gmail.com
The first patch from Jakub Kicinski is a preparation in order to enable
the use ipv6_mod_enabled() even when CONFIG_IPV6=n.
Thank you,
- Ricardo.
Signed-off-by: Ricardo B. Marlière <rbm@suse.com>
---
Changes in v4:
- Use preparatory patch from Jakub (thx!)
- Use ipv6_mod_enabled() helper in all three patches
- bonding: Move check to an earlier point - bond_rcv_validate() instead of bond_na_rcv()
- Link to v3: https://lore.kernel.org/r/20260305-net-nd_tbl_fixes-v3-0-fde28b30a744@suse.com
Changes in v3:
- Don't use ipv6_mod_enabled() in net/core/filter.c.
- Link to v2: https://lore.kernel.org/r/20260305-net-nd_tbl_fixes-v2-0-b7177db1a9f3@suse.com
Changes in v2:
- Used ipv6_mod_enabled() helper, guarded by unlikely().
- Link to v1: https://lore.kernel.org/r/20260228-net-nd_tbl_fixes-v1-0-2b2a274df9bb@suse.com
---
Jakub Kicinski (1):
ipv6: move the disable_ipv6_mod knob to core code
Ricardo B. Marlière (3):
net: bonding: Fix nd_tbl NULL dereference when IPv6 is disabled
bpf: bpf_out_neigh_v4: Fix nd_tbl NULL dereference when IPv6 is disabled
bpf: bpf_out_neigh_v6: Fix nd_tbl NULL dereference when IPv6 is disabled
drivers/net/bonding/bond_main.c | 2 +-
include/linux/ipv6.h | 7 ++++++-
net/core/filter.c | 7 +++++++
net/ipv4/af_inet.c | 6 ++++++
net/ipv6/af_inet6.c | 8 --------
5 files changed, 20 insertions(+), 10 deletions(-)
---
base-commit: b824c3e16c1904bf80df489e293d1e3cbf98896d
change-id: 20260228-net-nd_tbl_fixes-ce81ca1e0bf2
Best regards,
--
Ricardo B. Marlière <rbm@suse.com>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH net v4 1/4] ipv6: move the disable_ipv6_mod knob to core code
2026-03-07 20:50 [PATCH net v4 0/4] {net,bpf}: nd_tbl fixes for when ipv6.disable=1 Ricardo B. Marlière
@ 2026-03-07 20:50 ` Ricardo B. Marlière
2026-03-07 20:50 ` [PATCH net v4 2/4] net: bonding: Fix nd_tbl NULL dereference when IPv6 is disabled Ricardo B. Marlière
` (4 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: Ricardo B. Marlière @ 2026-03-07 20:50 UTC (permalink / raw)
To: Martin KaFai Lau, Daniel Borkmann, John Fastabend,
Stanislav Fomichev, Alexei Starovoitov, Andrii Nakryiko,
Eduard Zingerman, Song Liu, Yonghong Song, KP Singh, Hao Luo,
Jiri Olsa, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Toke Høiland-Jørgensen,
David Ahern, Jay Vosburgh, Andrew Lunn, Hangbin Liu
Cc: Fernando Fernandez Mancera, bpf, netdev, linux-kernel,
Ricardo B. Marlière
From: Jakub Kicinski <kuba@kernel.org>
From: Jakub Kicinski <kuba@kernel.org>
Make sure disable_ipv6_mod itself is not part of the IPv6 module,
in case core code wants to refer to it. We will remove support
for IPv6=m soon, this change helps make fixes we commit before
that less messy.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
include/linux/ipv6.h | 7 ++++++-
net/ipv4/af_inet.c | 6 ++++++
net/ipv6/af_inet6.c | 8 --------
3 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 443053a76dcf..a7421382a916 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -333,7 +333,12 @@ struct tcp6_timewait_sock {
};
#if IS_ENABLED(CONFIG_IPV6)
-bool ipv6_mod_enabled(void);
+extern int disable_ipv6_mod;
+
+static inline bool ipv6_mod_enabled(void)
+{
+ return disable_ipv6_mod == 0;
+}
static inline struct ipv6_pinfo *inet6_sk(const struct sock *__sk)
{
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 8036e76aa1e4..c7731e300a44 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -124,6 +124,12 @@
#include <trace/events/sock.h>
+/* Keep the definition of IPv6 disable here for now, to avoid annoying linker
+ * issues in case IPv6=m
+ */
+int disable_ipv6_mod;
+EXPORT_SYMBOL(disable_ipv6_mod);
+
/* The inetsw table contains everything that inet_create needs to
* build a new socket.
*/
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 23cc9b4cb2f1..4cbd45b68088 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -86,8 +86,6 @@ struct ipv6_params ipv6_defaults = {
.autoconf = 1,
};
-static int disable_ipv6_mod;
-
module_param_named(disable, disable_ipv6_mod, int, 0444);
MODULE_PARM_DESC(disable, "Disable IPv6 module such that it is non-functional");
@@ -97,12 +95,6 @@ MODULE_PARM_DESC(disable_ipv6, "Disable IPv6 on all interfaces");
module_param_named(autoconf, ipv6_defaults.autoconf, int, 0444);
MODULE_PARM_DESC(autoconf, "Enable IPv6 address autoconfiguration on all interfaces");
-bool ipv6_mod_enabled(void)
-{
- return disable_ipv6_mod == 0;
-}
-EXPORT_SYMBOL_GPL(ipv6_mod_enabled);
-
static struct ipv6_pinfo *inet6_sk_generic(struct sock *sk)
{
const int offset = sk->sk_prot->ipv6_pinfo_offset;
--
2.53.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH net v4 2/4] net: bonding: Fix nd_tbl NULL dereference when IPv6 is disabled
2026-03-07 20:50 [PATCH net v4 0/4] {net,bpf}: nd_tbl fixes for when ipv6.disable=1 Ricardo B. Marlière
2026-03-07 20:50 ` [PATCH net v4 1/4] ipv6: move the disable_ipv6_mod knob to core code Ricardo B. Marlière
@ 2026-03-07 20:50 ` Ricardo B. Marlière
2026-03-09 0:50 ` Hangbin Liu
2026-03-07 20:50 ` [PATCH net v4 3/4] bpf: bpf_out_neigh_v4: " Ricardo B. Marlière
` (3 subsequent siblings)
5 siblings, 1 reply; 12+ messages in thread
From: Ricardo B. Marlière @ 2026-03-07 20:50 UTC (permalink / raw)
To: Martin KaFai Lau, Daniel Borkmann, John Fastabend,
Stanislav Fomichev, Alexei Starovoitov, Andrii Nakryiko,
Eduard Zingerman, Song Liu, Yonghong Song, KP Singh, Hao Luo,
Jiri Olsa, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Toke Høiland-Jørgensen,
David Ahern, Jay Vosburgh, Andrew Lunn, Hangbin Liu
Cc: Fernando Fernandez Mancera, bpf, netdev, linux-kernel,
Ricardo B. Marlière
When booting with the 'ipv6.disable=1' parameter, the nd_tbl is never
initialized because inet6_init() exits before ndisc_init() is called
which initializes it. If bonding ARP/NS validation is enabled, an IPv6
NS/NA packet received on a slave can reach bond_validate_na(), which
calls bond_has_this_ip6(). That path calls ipv6_chk_addr() and can
crash in __ipv6_chk_addr_and_flags().
BUG: kernel NULL pointer dereference, address: 00000000000005d8
Oops: Oops: 0000 [#1] SMP NOPTI
RIP: 0010:__ipv6_chk_addr_and_flags+0x69/0x170
Call Trace:
<IRQ>
ipv6_chk_addr+0x1f/0x30
bond_validate_na+0x12e/0x1d0 [bonding]
? __pfx_bond_handle_frame+0x10/0x10 [bonding]
bond_rcv_validate+0x1a0/0x450 [bonding]
bond_handle_frame+0x5e/0x290 [bonding]
? srso_alias_return_thunk+0x5/0xfbef5
__netif_receive_skb_core.constprop.0+0x3e8/0xe50
? srso_alias_return_thunk+0x5/0xfbef5
? update_cfs_rq_load_avg+0x1a/0x240
? srso_alias_return_thunk+0x5/0xfbef5
? __enqueue_entity+0x5e/0x240
__netif_receive_skb_one_core+0x39/0xa0
process_backlog+0x9c/0x150
__napi_poll+0x30/0x200
? srso_alias_return_thunk+0x5/0xfbef5
net_rx_action+0x338/0x3b0
handle_softirqs+0xc9/0x2a0
do_softirq+0x42/0x60
</IRQ>
<TASK>
__local_bh_enable_ip+0x62/0x70
__dev_queue_xmit+0x2d3/0x1000
? srso_alias_return_thunk+0x5/0xfbef5
? srso_alias_return_thunk+0x5/0xfbef5
? packet_parse_headers+0x10a/0x1a0
packet_sendmsg+0x10da/0x1700
? kick_pool+0x5f/0x140
? srso_alias_return_thunk+0x5/0xfbef5
? __queue_work+0x12d/0x4f0
__sys_sendto+0x1f3/0x220
__x64_sys_sendto+0x24/0x30
do_syscall_64+0x101/0xf80
? exc_page_fault+0x6e/0x170
? srso_alias_return_thunk+0x5/0xfbef5
entry_SYSCALL_64_after_hwframe+0x77/0x7f
</TASK>
Fix this by checking ipv6_mod_enabled() before dispatching IPv6 packets to
bond_na_rcv(). If IPv6 is disabled, return early from bond_rcv_validate()
and avoid the path to ipv6_chk_addr().
Suggested-by: Fernando Fernandez Mancera <fmancera@suse.de>
Fixes: 4e24be018eb9 ("bonding: add new parameter ns_targets")
Signed-off-by: Ricardo B. Marlière <rbm@suse.com>
---
drivers/net/bonding/bond_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 14ed91391fcc..33fb5f168cef 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3377,7 +3377,7 @@ int bond_rcv_validate(const struct sk_buff *skb, struct bonding *bond,
} else if (is_arp) {
return bond_arp_rcv(skb, bond, slave);
#if IS_ENABLED(CONFIG_IPV6)
- } else if (is_ipv6) {
+ } else if (is_ipv6 && likely(ipv6_mod_enabled())) {
return bond_na_rcv(skb, bond, slave);
#endif
} else {
--
2.53.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH net v4 3/4] bpf: bpf_out_neigh_v4: Fix nd_tbl NULL dereference when IPv6 is disabled
2026-03-07 20:50 [PATCH net v4 0/4] {net,bpf}: nd_tbl fixes for when ipv6.disable=1 Ricardo B. Marlière
2026-03-07 20:50 ` [PATCH net v4 1/4] ipv6: move the disable_ipv6_mod knob to core code Ricardo B. Marlière
2026-03-07 20:50 ` [PATCH net v4 2/4] net: bonding: Fix nd_tbl NULL dereference when IPv6 is disabled Ricardo B. Marlière
@ 2026-03-07 20:50 ` Ricardo B. Marlière
2026-03-11 5:47 ` Daniel Borkmann
2026-03-07 20:50 ` [PATCH net v4 4/4] bpf: bpf_out_neigh_v6: " Ricardo B. Marlière
` (2 subsequent siblings)
5 siblings, 1 reply; 12+ messages in thread
From: Ricardo B. Marlière @ 2026-03-07 20:50 UTC (permalink / raw)
To: Martin KaFai Lau, Daniel Borkmann, John Fastabend,
Stanislav Fomichev, Alexei Starovoitov, Andrii Nakryiko,
Eduard Zingerman, Song Liu, Yonghong Song, KP Singh, Hao Luo,
Jiri Olsa, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Toke Høiland-Jørgensen,
David Ahern, Jay Vosburgh, Andrew Lunn, Hangbin Liu
Cc: Fernando Fernandez Mancera, bpf, netdev, linux-kernel,
Ricardo B. Marlière
When booting with the 'ipv6.disable=1' parameter, the nd_tbl is never
initialized because inet6_init() exits before ndisc_init() is called which
initializes it. If bpf_redirect_neigh() is called from tc with an explicit
nexthop of nh_family == AF_INET6, bpf_out_neigh_v4() takes the AF_INET6
branch and calls ip_neigh_gw6(), which relies on ipv6_stub->nd_tbl.
BUG: kernel NULL pointer dereference, address: 0000000000000248
Oops: Oops: 0000 [#1] SMP NOPTI
RIP: 0010:skb_do_redirect+0xb93/0xf00
Call Trace:
<TASK>
? srso_alias_return_thunk+0x5/0xfbef5
? __tcf_classify.constprop.0+0x83/0x160
? srso_alias_return_thunk+0x5/0xfbef5
? tcf_classify+0x2b/0x50
? srso_alias_return_thunk+0x5/0xfbef5
? tc_run+0xb8/0x120
? srso_alias_return_thunk+0x5/0xfbef5
__dev_queue_xmit+0x6fa/0x1000
? srso_alias_return_thunk+0x5/0xfbef5
? srso_alias_return_thunk+0x5/0xfbef5
? alloc_skb_with_frags+0x58/0x200
packet_sendmsg+0x10da/0x1700
? srso_alias_return_thunk+0x5/0xfbef5
__sys_sendto+0x1f3/0x220
__x64_sys_sendto+0x24/0x30
do_syscall_64+0x101/0xf80
? exc_page_fault+0x6e/0x170
? srso_alias_return_thunk+0x5/0xfbef5
entry_SYSCALL_64_after_hwframe+0x77/0x7f
</TASK>
Fix this by adding an early check in the AF_INET6 branch of
bpf_out_neigh_v4(). If IPv6 is disabled, unlock RCU and drop the packet.
Suggested-by: Fernando Fernandez Mancera <fmancera@suse.de>
Fixes: ba452c9e996d ("bpf: Fix bpf_redirect_neigh helper api to support supplying nexthop")
Signed-off-by: Ricardo B. Marlière <rbm@suse.com>
---
net/core/filter.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/core/filter.c b/net/core/filter.c
index 0d5d5a17acb2..ff02dbe4c94f 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -2335,6 +2335,10 @@ static int bpf_out_neigh_v4(struct net *net, struct sk_buff *skb,
neigh = ip_neigh_for_gw(rt, skb, &is_v6gw);
} else if (nh->nh_family == AF_INET6) {
+ if (unlikely(!ipv6_mod_enabled())) {
+ rcu_read_unlock();
+ goto out_drop;
+ }
neigh = ip_neigh_gw6(dev, &nh->ipv6_nh);
is_v6gw = true;
} else if (nh->nh_family == AF_INET) {
--
2.53.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH net v4 4/4] bpf: bpf_out_neigh_v6: Fix nd_tbl NULL dereference when IPv6 is disabled
2026-03-07 20:50 [PATCH net v4 0/4] {net,bpf}: nd_tbl fixes for when ipv6.disable=1 Ricardo B. Marlière
` (2 preceding siblings ...)
2026-03-07 20:50 ` [PATCH net v4 3/4] bpf: bpf_out_neigh_v4: " Ricardo B. Marlière
@ 2026-03-07 20:50 ` Ricardo B. Marlière
2026-03-11 5:49 ` Daniel Borkmann
2026-03-11 0:58 ` [PATCH net v4 0/4] {net,bpf}: nd_tbl fixes for when ipv6.disable=1 Jakub Kicinski
2026-03-12 1:10 ` patchwork-bot+netdevbpf
5 siblings, 1 reply; 12+ messages in thread
From: Ricardo B. Marlière @ 2026-03-07 20:50 UTC (permalink / raw)
To: Martin KaFai Lau, Daniel Borkmann, John Fastabend,
Stanislav Fomichev, Alexei Starovoitov, Andrii Nakryiko,
Eduard Zingerman, Song Liu, Yonghong Song, KP Singh, Hao Luo,
Jiri Olsa, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Toke Høiland-Jørgensen,
David Ahern, Jay Vosburgh, Andrew Lunn, Hangbin Liu
Cc: Fernando Fernandez Mancera, bpf, netdev, linux-kernel,
Ricardo B. Marlière
When booting with the 'ipv6.disable=1' parameter, the nd_tbl is never
initialized because inet6_init() exits before ndisc_init() is called which
initializes it. If bpf_redirect_neigh() is called with explicit AF_INET6
nexthop parameters, __bpf_redirect_neigh_v6() can skip the IPv6 FIB lookup
and call bpf_out_neigh_v6() directly. bpf_out_neigh_v6() then calls
ip_neigh_gw6(), which uses ipv6_stub->nd_tbl.
BUG: kernel NULL pointer dereference, address: 0000000000000248
Oops: Oops: 0000 [#1] SMP NOPTI
RIP: 0010:skb_do_redirect+0x44f/0xf40
Call Trace:
<TASK>
? srso_alias_return_thunk+0x5/0xfbef5
? __tcf_classify.constprop.0+0x83/0x160
? srso_alias_return_thunk+0x5/0xfbef5
? tcf_classify+0x2b/0x50
? srso_alias_return_thunk+0x5/0xfbef5
? tc_run+0xb8/0x120
? srso_alias_return_thunk+0x5/0xfbef5
__dev_queue_xmit+0x6fa/0x1000
? srso_alias_return_thunk+0x5/0xfbef5
packet_sendmsg+0x10da/0x1700
? srso_alias_return_thunk+0x5/0xfbef5
__sys_sendto+0x1f3/0x220
__x64_sys_sendto+0x24/0x30
do_syscall_64+0x101/0xf80
? exc_page_fault+0x6e/0x170
? srso_alias_return_thunk+0x5/0xfbef5
entry_SYSCALL_64_after_hwframe+0x77/0x7f
</TASK>
Fix this by adding an early check in bpf_out_neigh_v6(). If IPv6 is
disabled, drop the packet before neighbor lookup.
Suggested-by: Fernando Fernandez Mancera <fmancera@suse.de>
Fixes: ba452c9e996d ("bpf: Fix bpf_redirect_neigh helper api to support supplying nexthop")
Signed-off-by: Ricardo B. Marlière <rbm@suse.com>
---
net/core/filter.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/core/filter.c b/net/core/filter.c
index ff02dbe4c94f..3344fa0789f0 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -2228,6 +2228,9 @@ static int bpf_out_neigh_v6(struct net *net, struct sk_buff *skb,
return -ENOMEM;
}
+ if (unlikely(!ipv6_mod_enabled()))
+ goto out_drop;
+
rcu_read_lock();
if (!nh) {
dst = skb_dst(skb);
--
2.53.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH net v4 2/4] net: bonding: Fix nd_tbl NULL dereference when IPv6 is disabled
2026-03-07 20:50 ` [PATCH net v4 2/4] net: bonding: Fix nd_tbl NULL dereference when IPv6 is disabled Ricardo B. Marlière
@ 2026-03-09 0:50 ` Hangbin Liu
0 siblings, 0 replies; 12+ messages in thread
From: Hangbin Liu @ 2026-03-09 0:50 UTC (permalink / raw)
To: Ricardo B. Marlière
Cc: Martin KaFai Lau, Daniel Borkmann, John Fastabend,
Stanislav Fomichev, Alexei Starovoitov, Andrii Nakryiko,
Eduard Zingerman, Song Liu, Yonghong Song, KP Singh, Hao Luo,
Jiri Olsa, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Toke Høiland-Jørgensen,
David Ahern, Jay Vosburgh, Andrew Lunn,
Fernando Fernandez Mancera, bpf, netdev, linux-kernel
On Sat, Mar 07, 2026 at 05:50:54PM -0300, Ricardo B. Marlière wrote:
> When booting with the 'ipv6.disable=1' parameter, the nd_tbl is never
> initialized because inet6_init() exits before ndisc_init() is called
> which initializes it. If bonding ARP/NS validation is enabled, an IPv6
> NS/NA packet received on a slave can reach bond_validate_na(), which
> calls bond_has_this_ip6(). That path calls ipv6_chk_addr() and can
> crash in __ipv6_chk_addr_and_flags().
>
> BUG: kernel NULL pointer dereference, address: 00000000000005d8
> Oops: Oops: 0000 [#1] SMP NOPTI
> RIP: 0010:__ipv6_chk_addr_and_flags+0x69/0x170
> Call Trace:
> <IRQ>
> ipv6_chk_addr+0x1f/0x30
> bond_validate_na+0x12e/0x1d0 [bonding]
> ? __pfx_bond_handle_frame+0x10/0x10 [bonding]
> bond_rcv_validate+0x1a0/0x450 [bonding]
> bond_handle_frame+0x5e/0x290 [bonding]
> ? srso_alias_return_thunk+0x5/0xfbef5
> __netif_receive_skb_core.constprop.0+0x3e8/0xe50
> ? srso_alias_return_thunk+0x5/0xfbef5
> ? update_cfs_rq_load_avg+0x1a/0x240
> ? srso_alias_return_thunk+0x5/0xfbef5
> ? __enqueue_entity+0x5e/0x240
> __netif_receive_skb_one_core+0x39/0xa0
> process_backlog+0x9c/0x150
> __napi_poll+0x30/0x200
> ? srso_alias_return_thunk+0x5/0xfbef5
> net_rx_action+0x338/0x3b0
> handle_softirqs+0xc9/0x2a0
> do_softirq+0x42/0x60
> </IRQ>
> <TASK>
> __local_bh_enable_ip+0x62/0x70
> __dev_queue_xmit+0x2d3/0x1000
> ? srso_alias_return_thunk+0x5/0xfbef5
> ? srso_alias_return_thunk+0x5/0xfbef5
> ? packet_parse_headers+0x10a/0x1a0
> packet_sendmsg+0x10da/0x1700
> ? kick_pool+0x5f/0x140
> ? srso_alias_return_thunk+0x5/0xfbef5
> ? __queue_work+0x12d/0x4f0
> __sys_sendto+0x1f3/0x220
> __x64_sys_sendto+0x24/0x30
> do_syscall_64+0x101/0xf80
> ? exc_page_fault+0x6e/0x170
> ? srso_alias_return_thunk+0x5/0xfbef5
> entry_SYSCALL_64_after_hwframe+0x77/0x7f
> </TASK>
>
> Fix this by checking ipv6_mod_enabled() before dispatching IPv6 packets to
> bond_na_rcv(). If IPv6 is disabled, return early from bond_rcv_validate()
> and avoid the path to ipv6_chk_addr().
>
> Suggested-by: Fernando Fernandez Mancera <fmancera@suse.de>
> Fixes: 4e24be018eb9 ("bonding: add new parameter ns_targets")
> Signed-off-by: Ricardo B. Marlière <rbm@suse.com>
> ---
> drivers/net/bonding/bond_main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 14ed91391fcc..33fb5f168cef 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -3377,7 +3377,7 @@ int bond_rcv_validate(const struct sk_buff *skb, struct bonding *bond,
> } else if (is_arp) {
> return bond_arp_rcv(skb, bond, slave);
> #if IS_ENABLED(CONFIG_IPV6)
> - } else if (is_ipv6) {
> + } else if (is_ipv6 && likely(ipv6_mod_enabled())) {
> return bond_na_rcv(skb, bond, slave);
> #endif
> } else {
>
> --
> 2.53.0
>
Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net v4 0/4] {net,bpf}: nd_tbl fixes for when ipv6.disable=1
2026-03-07 20:50 [PATCH net v4 0/4] {net,bpf}: nd_tbl fixes for when ipv6.disable=1 Ricardo B. Marlière
` (3 preceding siblings ...)
2026-03-07 20:50 ` [PATCH net v4 4/4] bpf: bpf_out_neigh_v6: " Ricardo B. Marlière
@ 2026-03-11 0:58 ` Jakub Kicinski
2026-03-11 5:50 ` Daniel Borkmann
2026-03-12 1:10 ` patchwork-bot+netdevbpf
5 siblings, 1 reply; 12+ messages in thread
From: Jakub Kicinski @ 2026-03-11 0:58 UTC (permalink / raw)
To: Daniel Borkmann
Cc: Ricardo B. Marlière, Martin KaFai Lau, John Fastabend,
Stanislav Fomichev, Alexei Starovoitov, Andrii Nakryiko,
Eduard Zingerman, Song Liu, Yonghong Song, KP Singh, Hao Luo,
Jiri Olsa, David S. Miller, Eric Dumazet, Paolo Abeni,
Simon Horman, Toke Høiland-Jørgensen, David Ahern,
Jay Vosburgh, Andrew Lunn, Hangbin Liu,
Fernando Fernandez Mancera, bpf, netdev, linux-kernel
On Sat, 07 Mar 2026 17:50:52 -0300 Ricardo B. Marlière wrote:
> bpf: bpf_out_neigh_v4: Fix nd_tbl NULL dereference when IPv6 is disabled
> bpf: bpf_out_neigh_v6: Fix nd_tbl NULL dereference when IPv6 is disabled
Hi Daniel, are you okay with these for net?
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net v4 3/4] bpf: bpf_out_neigh_v4: Fix nd_tbl NULL dereference when IPv6 is disabled
2026-03-07 20:50 ` [PATCH net v4 3/4] bpf: bpf_out_neigh_v4: " Ricardo B. Marlière
@ 2026-03-11 5:47 ` Daniel Borkmann
0 siblings, 0 replies; 12+ messages in thread
From: Daniel Borkmann @ 2026-03-11 5:47 UTC (permalink / raw)
To: Ricardo B. Marlière, Martin KaFai Lau, John Fastabend,
Stanislav Fomichev, Alexei Starovoitov, Andrii Nakryiko,
Eduard Zingerman, Song Liu, Yonghong Song, KP Singh, Hao Luo,
Jiri Olsa, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Toke Høiland-Jørgensen,
David Ahern, Jay Vosburgh, Andrew Lunn, Hangbin Liu
Cc: Fernando Fernandez Mancera, bpf, netdev, linux-kernel
On 3/7/26 9:50 PM, Ricardo B. Marlière wrote:
> When booting with the 'ipv6.disable=1' parameter, the nd_tbl is never
> initialized because inet6_init() exits before ndisc_init() is called which
> initializes it. If bpf_redirect_neigh() is called from tc with an explicit
> nexthop of nh_family == AF_INET6, bpf_out_neigh_v4() takes the AF_INET6
> branch and calls ip_neigh_gw6(), which relies on ipv6_stub->nd_tbl.
>
> BUG: kernel NULL pointer dereference, address: 0000000000000248
> Oops: Oops: 0000 [#1] SMP NOPTI
> RIP: 0010:skb_do_redirect+0xb93/0xf00
> Call Trace:
> <TASK>
> ? srso_alias_return_thunk+0x5/0xfbef5
> ? __tcf_classify.constprop.0+0x83/0x160
> ? srso_alias_return_thunk+0x5/0xfbef5
> ? tcf_classify+0x2b/0x50
> ? srso_alias_return_thunk+0x5/0xfbef5
> ? tc_run+0xb8/0x120
> ? srso_alias_return_thunk+0x5/0xfbef5
> __dev_queue_xmit+0x6fa/0x1000
> ? srso_alias_return_thunk+0x5/0xfbef5
> ? srso_alias_return_thunk+0x5/0xfbef5
> ? alloc_skb_with_frags+0x58/0x200
> packet_sendmsg+0x10da/0x1700
> ? srso_alias_return_thunk+0x5/0xfbef5
> __sys_sendto+0x1f3/0x220
> __x64_sys_sendto+0x24/0x30
> do_syscall_64+0x101/0xf80
> ? exc_page_fault+0x6e/0x170
> ? srso_alias_return_thunk+0x5/0xfbef5
> entry_SYSCALL_64_after_hwframe+0x77/0x7f
> </TASK>
>
> Fix this by adding an early check in the AF_INET6 branch of
> bpf_out_neigh_v4(). If IPv6 is disabled, unlock RCU and drop the packet.
>
> Suggested-by: Fernando Fernandez Mancera <fmancera@suse.de>
> Fixes: ba452c9e996d ("bpf: Fix bpf_redirect_neigh helper api to support supplying nexthop")
> Signed-off-by: Ricardo B. Marlière <rbm@suse.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net v4 4/4] bpf: bpf_out_neigh_v6: Fix nd_tbl NULL dereference when IPv6 is disabled
2026-03-07 20:50 ` [PATCH net v4 4/4] bpf: bpf_out_neigh_v6: " Ricardo B. Marlière
@ 2026-03-11 5:49 ` Daniel Borkmann
0 siblings, 0 replies; 12+ messages in thread
From: Daniel Borkmann @ 2026-03-11 5:49 UTC (permalink / raw)
To: Ricardo B. Marlière, Martin KaFai Lau, John Fastabend,
Stanislav Fomichev, Alexei Starovoitov, Andrii Nakryiko,
Eduard Zingerman, Song Liu, Yonghong Song, KP Singh, Hao Luo,
Jiri Olsa, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Toke Høiland-Jørgensen,
David Ahern, Jay Vosburgh, Andrew Lunn, Hangbin Liu
Cc: Fernando Fernandez Mancera, bpf, netdev, linux-kernel
On 3/7/26 9:50 PM, Ricardo B. Marlière wrote:
> When booting with the 'ipv6.disable=1' parameter, the nd_tbl is never
> initialized because inet6_init() exits before ndisc_init() is called which
> initializes it. If bpf_redirect_neigh() is called with explicit AF_INET6
> nexthop parameters, __bpf_redirect_neigh_v6() can skip the IPv6 FIB lookup
> and call bpf_out_neigh_v6() directly. bpf_out_neigh_v6() then calls
> ip_neigh_gw6(), which uses ipv6_stub->nd_tbl.
>
> BUG: kernel NULL pointer dereference, address: 0000000000000248
> Oops: Oops: 0000 [#1] SMP NOPTI
> RIP: 0010:skb_do_redirect+0x44f/0xf40
> Call Trace:
> <TASK>
> ? srso_alias_return_thunk+0x5/0xfbef5
> ? __tcf_classify.constprop.0+0x83/0x160
> ? srso_alias_return_thunk+0x5/0xfbef5
> ? tcf_classify+0x2b/0x50
> ? srso_alias_return_thunk+0x5/0xfbef5
> ? tc_run+0xb8/0x120
> ? srso_alias_return_thunk+0x5/0xfbef5
> __dev_queue_xmit+0x6fa/0x1000
> ? srso_alias_return_thunk+0x5/0xfbef5
> packet_sendmsg+0x10da/0x1700
> ? srso_alias_return_thunk+0x5/0xfbef5
> __sys_sendto+0x1f3/0x220
> __x64_sys_sendto+0x24/0x30
> do_syscall_64+0x101/0xf80
> ? exc_page_fault+0x6e/0x170
> ? srso_alias_return_thunk+0x5/0xfbef5
> entry_SYSCALL_64_after_hwframe+0x77/0x7f
> </TASK>
>
> Fix this by adding an early check in bpf_out_neigh_v6(). If IPv6 is
> disabled, drop the packet before neighbor lookup.
>
> Suggested-by: Fernando Fernandez Mancera <fmancera@suse.de>
> Fixes: ba452c9e996d ("bpf: Fix bpf_redirect_neigh helper api to support supplying nexthop")
> Signed-off-by: Ricardo B. Marlière <rbm@suse.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net v4 0/4] {net,bpf}: nd_tbl fixes for when ipv6.disable=1
2026-03-11 0:58 ` [PATCH net v4 0/4] {net,bpf}: nd_tbl fixes for when ipv6.disable=1 Jakub Kicinski
@ 2026-03-11 5:50 ` Daniel Borkmann
2026-03-12 0:53 ` Jakub Kicinski
0 siblings, 1 reply; 12+ messages in thread
From: Daniel Borkmann @ 2026-03-11 5:50 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Ricardo B. Marlière, Martin KaFai Lau, John Fastabend,
Stanislav Fomichev, Alexei Starovoitov, Andrii Nakryiko,
Eduard Zingerman, Song Liu, Yonghong Song, KP Singh, Hao Luo,
Jiri Olsa, David S. Miller, Eric Dumazet, Paolo Abeni,
Simon Horman, Toke Høiland-Jørgensen, David Ahern,
Jay Vosburgh, Andrew Lunn, Hangbin Liu,
Fernando Fernandez Mancera, bpf, netdev, linux-kernel
On 3/11/26 1:58 AM, Jakub Kicinski wrote:
> On Sat, 07 Mar 2026 17:50:52 -0300 Ricardo B. Marlière wrote:
>> bpf: bpf_out_neigh_v4: Fix nd_tbl NULL dereference when IPv6 is disabled
>> bpf: bpf_out_neigh_v6: Fix nd_tbl NULL dereference when IPv6 is disabled
>
> Hi Daniel, are you okay with these for net?
Yes, these look good to me. Go for it via net!
Thanks,
Daniel
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net v4 0/4] {net,bpf}: nd_tbl fixes for when ipv6.disable=1
2026-03-11 5:50 ` Daniel Borkmann
@ 2026-03-12 0:53 ` Jakub Kicinski
0 siblings, 0 replies; 12+ messages in thread
From: Jakub Kicinski @ 2026-03-12 0:53 UTC (permalink / raw)
To: Daniel Borkmann
Cc: Ricardo B. Marlière, Martin KaFai Lau, John Fastabend,
Stanislav Fomichev, Alexei Starovoitov, Andrii Nakryiko,
Eduard Zingerman, Song Liu, Yonghong Song, KP Singh, Hao Luo,
Jiri Olsa, David S. Miller, Eric Dumazet, Paolo Abeni,
Simon Horman, Toke Høiland-Jørgensen, David Ahern,
Jay Vosburgh, Andrew Lunn, Hangbin Liu,
Fernando Fernandez Mancera, bpf, netdev, linux-kernel
On Wed, 11 Mar 2026 06:50:18 +0100 Daniel Borkmann wrote:
> On 3/11/26 1:58 AM, Jakub Kicinski wrote:
> > On Sat, 07 Mar 2026 17:50:52 -0300 Ricardo B. Marlière wrote:
> >> bpf: bpf_out_neigh_v4: Fix nd_tbl NULL dereference when IPv6 is disabled
> >> bpf: bpf_out_neigh_v6: Fix nd_tbl NULL dereference when IPv6 is disabled
> >
> > Hi Daniel, are you okay with these for net?
> Yes, these look good to me. Go for it via net!
Thanks!
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net v4 0/4] {net,bpf}: nd_tbl fixes for when ipv6.disable=1
2026-03-07 20:50 [PATCH net v4 0/4] {net,bpf}: nd_tbl fixes for when ipv6.disable=1 Ricardo B. Marlière
` (4 preceding siblings ...)
2026-03-11 0:58 ` [PATCH net v4 0/4] {net,bpf}: nd_tbl fixes for when ipv6.disable=1 Jakub Kicinski
@ 2026-03-12 1:10 ` patchwork-bot+netdevbpf
5 siblings, 0 replies; 12+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-03-12 1:10 UTC (permalink / raw)
To: =?utf-8?b?UmljYXJkbyBCLiBNYXJsacOocmUgPHJibUBzdXNlLmNvbT4=?=
Cc: martin.lau, daniel, john.fastabend, sdf, ast, andrii, eddyz87,
song, yonghong.song, kpsingh, haoluo, jolsa, davem, edumazet,
kuba, pabeni, horms, toke, dsahern, jv, andrew+netdev, liuhangbin,
fmancera, bpf, netdev, linux-kernel
Hello:
This series was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Sat, 07 Mar 2026 17:50:52 -0300 you wrote:
> Hi,
>
> Please consider merging these four patches to fix three crashes that were
> found after this report:
>
> https://lore.kernel.org/all/CAHXs0ORzd62QOG-Fttqa2Cx_A_VFp=utE2H2VTX5nqfgs7LDxQ@mail.gmail.com
>
> [...]
Here is the summary with links:
- [net,v4,1/4] ipv6: move the disable_ipv6_mod knob to core code
https://git.kernel.org/netdev/net/c/94a4b1f95998
- [net,v4,2/4] net: bonding: Fix nd_tbl NULL dereference when IPv6 is disabled
https://git.kernel.org/netdev/net/c/30021e969d48
- [net,v4,3/4] bpf: bpf_out_neigh_v4: Fix nd_tbl NULL dereference when IPv6 is disabled
https://git.kernel.org/netdev/net/c/dcb4e2231469
- [net,v4,4/4] bpf: bpf_out_neigh_v6: Fix nd_tbl NULL dereference when IPv6 is disabled
https://git.kernel.org/netdev/net/c/d56b5d163458
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2026-03-12 1:10 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-07 20:50 [PATCH net v4 0/4] {net,bpf}: nd_tbl fixes for when ipv6.disable=1 Ricardo B. Marlière
2026-03-07 20:50 ` [PATCH net v4 1/4] ipv6: move the disable_ipv6_mod knob to core code Ricardo B. Marlière
2026-03-07 20:50 ` [PATCH net v4 2/4] net: bonding: Fix nd_tbl NULL dereference when IPv6 is disabled Ricardo B. Marlière
2026-03-09 0:50 ` Hangbin Liu
2026-03-07 20:50 ` [PATCH net v4 3/4] bpf: bpf_out_neigh_v4: " Ricardo B. Marlière
2026-03-11 5:47 ` Daniel Borkmann
2026-03-07 20:50 ` [PATCH net v4 4/4] bpf: bpf_out_neigh_v6: " Ricardo B. Marlière
2026-03-11 5:49 ` Daniel Borkmann
2026-03-11 0:58 ` [PATCH net v4 0/4] {net,bpf}: nd_tbl fixes for when ipv6.disable=1 Jakub Kicinski
2026-03-11 5:50 ` Daniel Borkmann
2026-03-12 0:53 ` Jakub Kicinski
2026-03-12 1:10 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox