* [PATCH net v2 1/2] netfilter: nfnetlink_queue: only adjust bridged skbs that have a mac header
2026-11-17 17:58 [PATCH net v2 0/2] net: do not point a pskb copy's mac header into uninitialised headroom Theodor Arsenij Larionov Trichkine
@ 2026-11-17 17:58 ` Theodor Arsenij Larionov Trichkine
2026-11-17 17:58 ` [PATCH net v2 2/2] net: unset the mac header of a pskb copy that points into headroom Theodor Arsenij Larionov Trichkine
2026-11-17 18:03 ` [PATCH net v2 0/2] net: do not point a pskb copy's mac header into uninitialised headroom netdev-bot+sinfo
2 siblings, 0 replies; 4+ messages in thread
From: Theodor Arsenij Larionov Trichkine @ 2026-11-17 17:58 UTC (permalink / raw)
To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: Simon Horman, Pablo Neira Ayuso, Florian Westphal, Phil Sutter,
netdev, netfilter-devel, coreteam,
Theodor Arsenij Larionov Trichkine
nf_bridge_adjust_skb_data() and nf_bridge_adjust_segmented_data() push
and pull skb_mac_header_len() bytes for any skb with bridge netfilter
info. A pskb copy of a bridged packet, such as one made by nft dup,
keeps that info, and the next patch unsets its mac header. With the mac
header unset, skb_mac_header_len() underflows and the push moves
skb->data out of the buffer before skb_gso_segment():
BUG: KASAN: slab-out-of-bounds in inet_gso_segment+0xd5f/0x1370
Only adjust skbs that have a mac header.
Fixes: a5fedd43d5f6 ("netfilter: move skb_gso_segment into nfnetlink_queue module")
Cc: stable@vger.kernel.org
Signed-off-by: Theodor Arsenij Larionov Trichkine <theodorlarionov@gmail.com>
---
net/netfilter/nfnetlink_queue.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
index a8aa7ad832c3..fafadd9057cf 100644
--- a/net/netfilter/nfnetlink_queue.c
+++ b/net/netfilter/nfnetlink_queue.c
@@ -1084,13 +1084,13 @@ nf_queue_entry_dup(struct nf_queue_entry *e)
*/
static void nf_bridge_adjust_skb_data(struct sk_buff *skb)
{
- if (nf_bridge_info_get(skb))
+ if (nf_bridge_info_get(skb) && skb_mac_header_was_set(skb))
__skb_push(skb, skb_mac_header_len(skb));
}
static void nf_bridge_adjust_segmented_data(struct sk_buff *skb)
{
- if (nf_bridge_info_get(skb))
+ if (nf_bridge_info_get(skb) && skb_mac_header_was_set(skb))
__skb_pull(skb, skb_mac_header_len(skb));
}
#else
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH net v2 2/2] net: unset the mac header of a pskb copy that points into headroom
2026-11-17 17:58 [PATCH net v2 0/2] net: do not point a pskb copy's mac header into uninitialised headroom Theodor Arsenij Larionov Trichkine
2026-11-17 17:58 ` [PATCH net v2 1/2] netfilter: nfnetlink_queue: only adjust bridged skbs that have a mac header Theodor Arsenij Larionov Trichkine
@ 2026-11-17 17:58 ` Theodor Arsenij Larionov Trichkine
2026-11-17 18:03 ` [PATCH net v2 0/2] net: do not point a pskb copy's mac header into uninitialised headroom netdev-bot+sinfo
2 siblings, 0 replies; 4+ messages in thread
From: Theodor Arsenij Larionov Trichkine @ 2026-11-17 17:58 UTC (permalink / raw)
To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: Simon Horman, Pablo Neira Ayuso, Florian Westphal, Phil Sutter,
netdev, netfilter-devel, coreteam,
Theodor Arsenij Larionov Trichkine
__pskb_copy_fclone() copies the data from skb->data onwards, while
skb_copy_header() keeps the mac_header offset. When the link-layer
header was pulled, the copy's mac header points into uninitialised
headroom. nft dup is one such caller: a link-layer payload read of the
duplicated packet on LOCAL_OUT or POST_ROUTING loads those bytes, and a
set element returns them to userspace:
BUG: KMSAN: kernel-infoleak in _copy_to_iter
Unset the mac header of the copy in that case. Callers that need it,
such as the bridge, push the link-layer header before copying.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Suggested-by: Florian Westphal <fw@strlen.de>
Cc: stable@vger.kernel.org
Signed-off-by: Theodor Arsenij Larionov Trichkine <theodorlarionov@gmail.com>
---
net/core/skbuff.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 1ac1e327ac4c..7f6d0344efa6 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -2278,6 +2278,8 @@ struct sk_buff *__pskb_copy_fclone(struct sk_buff *skb, int headroom,
}
skb_copy_header(n, skb);
+ if (skb_mac_header_was_set(n) && skb_mac_offset(n) < 0)
+ skb_unset_mac_header(n);
out:
return n;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH net v2 0/2] net: do not point a pskb copy's mac header into uninitialised headroom
2026-11-17 17:58 [PATCH net v2 0/2] net: do not point a pskb copy's mac header into uninitialised headroom Theodor Arsenij Larionov Trichkine
2026-11-17 17:58 ` [PATCH net v2 1/2] netfilter: nfnetlink_queue: only adjust bridged skbs that have a mac header Theodor Arsenij Larionov Trichkine
2026-11-17 17:58 ` [PATCH net v2 2/2] net: unset the mac header of a pskb copy that points into headroom Theodor Arsenij Larionov Trichkine
@ 2026-11-17 18:03 ` netdev-bot+sinfo
2 siblings, 0 replies; 4+ messages in thread
From: netdev-bot+sinfo @ 2026-11-17 18:03 UTC (permalink / raw)
To: Theodor Arsenij Larionov Trichkine
Cc: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Pablo Neira Ayuso, Florian Westphal, Phil Sutter,
netdev, netfilter-devel, coreteam
Hi!
This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:
- How the issue was discovered, e.g. hit in production, hit during
development, syzbot report, manual code inspection, LLM or static
analysis tool scan.
Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account.
*IMPORTANT*: If you do repost (for other reasons) - please include
the relevant info in the cover letter or commit messages.
--
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
^ permalink raw reply [flat|nested] 4+ messages in thread