net/sched: act_skbmod: require an Ethernet header for MAC rewrites
Subsystems (3)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/2 net/sched: act_skbmod: require an Ethernet header for MAC rewrites
From: Wyatt Feng <[email protected]>
tcf_skbmod_act() derives its writable length from skb_mac_header_len(skb), but the DMAC, SMAC, ETYPE and SWAPMAC modes always write through eth_hdr(skb).
After a prior action strips the L2 header, skb_mac_header_len(skb) can drop below ETH_HLEN while skbmod still attempts to rewrite a full Ethernet header. This is a buffer-size length miscalculation and can corrupt packet data on short or non-linear skbs.
Reject Ethernet rewrite requests unless a full MAC header is still present, and use ETH_HLEN as the writable length for those rewrites. That matches the bytes skbmod actually modifies and leaves the ECN path unchanged.
--- net/sched/act_skbmod.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
net/sched/act_skbmod.c +7 -2
@@ -38,7 +38,6 @@ TC_INDIRECT_SCOPE int tcf_skbmod_act(struct sk_buff *skb,if (unlikely (p->action ==TC_ACT_SHOT )) goto drop; - max_edit_len =skb_mac_header_len (skb); flags = p->flags;/* tcf_skbmod_init() guarantees "flags" to be one of the following:
@@ -49,6 +48,8 @@ TC_INDIRECT_SCOPE int tcf_skbmod_act(struct sk_buff *skb,* packets. */ if (flags ==SKBMOD_F_ECN ) { + max_edit_len =skb_mac_header_len (skb); +switch (skb_protocol (skb, true)) {case cpu_to_be16 (ETH_P_IP ):case cpu_to_be16 (ETH_P_IPV6 ):
@@ -57,8 +58,12 @@ TC_INDIRECT_SCOPE int tcf_skbmod_act(struct sk_buff *skb,default : goto out; } - }else if (!skb->dev || skb->dev->type !=ARPHRD_ETHER ) { + }else if (!skb->dev || skb->dev->type !=ARPHRD_ETHER || + !skb_mac_header_was_set (skb) || +skb_mac_header_len (skb) <ETH_HLEN ) { goto out; + }else { + max_edit_len =ETH_HLEN ; } err =skb_ensure_writable (skb, max_edit_len);
Signature · 1 line
2.47.3
Jakub Kicinski
maintainerQuoted 9 lines · On Mon, 29 Jun 2026 10:46:03 +0800 Ren Wei wrote:
Reported-by Yuan Tan <[email protected]>Reported-by Yifan Wu <[email protected]>Reported-by Juefei Pu <[email protected]>Reported-by Zhengchuan Liang <[email protected]>Reported-by Xin Liu <[email protected]>Assisted-by Codex:GPT-5.4Signed-off-by Wyatt Feng <[email protected]>Signed-off-by Ren Wei <[email protected]>
Let's do away with the 5 reported-by tags? You can use a tag for your tool or your team, it doesn't have to be a person. Look at sashiko or syzbot reported-by tags.
Signature · 1 line
pw-bot: cr
Jakub Kicinski
maintainerQuoted 11 lines · On Tue, 30 Jun 2026 17:10:16 -0700 Jakub Kicinski wrote:
Quoted 9 lines · On Mon, 29 Jun 2026 10:46:03 +0800 Ren Wei wrote:
Reported-by Yuan Tan <[email protected]>Reported-by Yifan Wu <[email protected]>Reported-by Juefei Pu <[email protected]>Reported-by Zhengchuan Liang <[email protected]>Reported-by Xin Liu <[email protected]>Assisted-by Codex:GPT-5.4Signed-off-by Wyatt Feng <[email protected]>Signed-off-by Ren Wei <[email protected]>
Quoted 3 lines
Let's do away with the 5 reported-by tags? You can use a tag for your tool or your team, it doesn't have to be a person. Look at sashiko or syzbot reported-by tags.
On second thought, if y'all work together maybe there should be no reported-by tag at all? Can you explain the situation?
Quoted 13 lines · Jakub Kicinski
Quoted 11 lines · On Tue, 30 Jun 2026 17:10:16 -0700 Jakub Kicinski wrote:
Quoted 9 lines · On Mon, 29 Jun 2026 10:46:03 +0800 Ren Wei wrote:
Reported-by Yuan Tan <[email protected]>Reported-by Yifan Wu <[email protected]>Reported-by Juefei Pu <[email protected]>Reported-by Zhengchuan Liang <[email protected]>Reported-by Xin Liu <[email protected]>Assisted-by Codex:GPT-5.4Signed-off-by Wyatt Feng <[email protected]>Signed-off-by Ren Wei <[email protected]>
Quoted 6 lines
Quoted 3 lines
Let's do away with the 5 reported-by tags? You can use a tag for your tool or your team, it doesn't have to be a person. Look at sashiko or syzbot reported-by tags.
On second thought, if y'all work together maybe there should be no reported-by tag at all? Can you explain the situation?
Hi Jakub,
Since February, our team's bug-finding tool has found hundreds of bugs and vulnerabilities. Several people have helped improve the tool to discover more bugs, and verify that they are real. I did not want their credit to be lost, so I added Reported-by tags based on whether they contributed to finding a particular bug.
I agree, though, that having five Reported-by tags may not look ideal. Maybe using the tool name instead would be better. I will discuss this with the others.
We also found many external volunteers to submit patches, instead of simply dumping bug reports on the community and leaving it at that. We were worried that too many reports might annoy maintainers. That said, it may be easier in some cases for maintainers to fix the issues themselves rather than review our patches, since we are not experts in every subsystem.
Jakub Kicinski
maintainerQuoted 22 lines · On Tue, 30 Jun 2026 23:46:46 -0700 Yuan Tan wrote:
Quoted 8 lines · Jakub Kicinski
Quoted 4 lines · On Tue, 30 Jun 2026 17:10:16 -0700 Jakub Kicinski wrote:
On Mon, 29 Jun 2026 10:46:03 +0800 Ren Wei wrote:
Let's do away with the 5 reported-by tags? You can use a tag for your tool or your team, it doesn't have to be a person. Look at sashiko or syzbot reported-by tags.On second thought, if y'all work together maybe there should be no reported-by tag at all? Can you explain the situation?
Hi Jakub,
Since February, our team's bug-finding tool has found hundreds of bugs and vulnerabilities. Several people have helped improve the tool to discover more bugs, and verify that they are real. I did not want their credit to be lost, so I added Reported-by tags based on whether they contributed to finding a particular bug.
I agree, though, that having five Reported-by tags may not look ideal. Maybe using the tool name instead would be better. I will discuss this with the others.
Quoted 6 lines
We also found many external volunteers to submit patches, instead of simply dumping bug reports on the community and leaving it at that. We were worried that too many reports might annoy maintainers. That said, it may be easier in some cases for maintainers to fix the issues themselves rather than review our patches, since we are not experts in every subsystem.
Sorry, I was AFK for the last 2.5 weeks.
I expect you to make the changes I asked for. There are multiple teams doing the same thing as you are, and nobody else has so many tags.
Quoted 31 lines · Jakub Kicinski
Quoted 22 lines · On Tue, 30 Jun 2026 23:46:46 -0700 Yuan Tan wrote:
Quoted 8 lines · Jakub Kicinski
Quoted 4 lines · On Tue, 30 Jun 2026 17:10:16 -0700 Jakub Kicinski wrote:
On Mon, 29 Jun 2026 10:46:03 +0800 Ren Wei wrote:
Let's do away with the 5 reported-by tags? You can use a tag for your tool or your team, it doesn't have to be a person. Look at sashiko or syzbot reported-by tags.On second thought, if y'all work together maybe there should be no reported-by tag at all? Can you explain the situation?
Hi Jakub,
Since February, our team's bug-finding tool has found hundreds of bugs and vulnerabilities. Several people have helped improve the tool to discover more bugs, and verify that they are real. I did not want their credit to be lost, so I added Reported-by tags based on whether they contributed to finding a particular bug.
I agree, though, that having five Reported-by tags may not look ideal. Maybe using the tool name instead would be better. I will discuss this with the others.
Quoted 6 lines
We also found many external volunteers to submit patches, instead of simply dumping bug reports on the community and leaving it at that. We were worried that too many reports might annoy maintainers. That said, it may be easier in some cases for maintainers to fix the issues themselves rather than review our patches, since we are not experts in every subsystem.
Quoted 4 lines
Sorry, I was AFK for the last 2.5 weeks.
I expect you to make the changes I asked for. There are multiple teams doing the same thing as you are, and nobody else has so many tags.
Hi Jakub,
I would like to sincerely apologize for the problems with our patch submission process.
Because of some communication issues on our side, we did not handle the submission process correctly. One particularly embarrassing mistake is that I only recently realized that when you wrote last month, “Can you not post these to the public list?”, you meant that we should post cover to the public list. I had understood it as asking us not to post them publicly. This was entirely my misunderstanding of the English phrasing, and I am very sorry.
Going forward, we will send the cover letters, including the PoCs and bug details, to the public mailing list. We will also use Reported-by:
[email protected] instead of using individual volunteer names.
Besides, we will also be more careful about prioritizing fixes. We understand that some very minor or highly theoretical bugs may not be worth the maintainers’ review time. It is sometimes difficult for us to make this judgment correctly, and we are still trying to improve this part of our process. We will do our best to be more selective in the future.
I am sorry for the confusion and frustration caused by our previous submissions. Thank you for your patience and for all the feedback you have given us.
Best,
Yuan
PATCH 2/2 net/sched: act_vlan: skip pop_eth on non-Ethernet devices
In reply to a message not in the archiveFrom: Wyatt Feng <[email protected]>
TCA_VLAN_ACT_POP_ETH removes a base Ethernet header, but tcf_vlan_act() currently runs it on any device type.
On non-Ethernet devices such as loopback, this can strip the linear ETH_HLEN bytes from an skb that later reaches code paths which still expect an Ethernet header, leading to a BUG in __skb_pull(). This is a short-packet handling bug caused by applying an Ethernet-only transform to a non-Ethernet skb.
Treat POP_ETH as an Ethernet-only action and leave non-Ethernet packets unchanged.
--- net/sched/act_vlan.c | 4 ++++ 1 file changed, 4 insertions(+)
net/sched/act_vlan.c +4 -0
@@ -4,6 +4,7 @@*/ #include <linux/module.h> +#include <linux/if_arp.h> #include <linux/init.h> #include <linux/kernel.h> #include <linux/skbuff.h>
@@ -76,6 +77,9 @@ TC_INDIRECT_SCOPE int tcf_vlan_act(struct sk_buff *skb,__vlan_hwaccel_put_tag (skb, p->tcfv_push_proto, tci);break ;case TCA_VLAN_ACT_POP_ETH : +if (!skb->dev || skb->dev->type !=ARPHRD_ETHER ) + goto out; + err =skb_eth_pop (skb);if (err) goto drop;
Signature · 1 line
2.47.3