From: Lin Jiapeng <ljp1205831794@gmail.com>
To: Jiri Benc <jbenc@redhat.com>
Cc: aconole@redhat.com, echaudro@redhat.com, i.maximets@ovn.org,
davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
pabeni@redhat.com, horms@kernel.org, netdev@vger.kernel.org,
dev@openvswitch.org, Lin Jiapeng <jiapenglin@tencent.com>,
stable@vger.kernel.org, TencentOS Corvus AI <corvus@tencent.com>
Subject: Re: [PATCH net] openvswitch: reject negative L2 length in ovs_fragment()
Date: Thu, 26 Nov 2026 17:34:19 +0800 [thread overview]
Message-ID: <5d1f3ff8-b995-4496-a59f-2a01f38603b1@gmail.com> (raw)
In-Reply-To: <20261126101410.4a310394@jbenc-thinkpadp1gen4i.rmtcz.csb>
On 2026-11-26 5:14 p.m., Jiri Benc wrote:
> On Thu, 26 Nov 2026 16:31:41 +0800, Lin Jiapeng wrote:
>> From: Lin Jiapeng <jiapenglin@tencent.com>
>> ...
>> Reject a negative offset together with an oversized one and drop the
>> packet through OVS_DROP_FRAG_L2_TOO_LONG. Valid offsets are unchanged.
>
> This was supposed to be fixed by
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=78a86d75a70e1e227711c72865c59b1422d0a5ae
>
> What kernel did you reproduce this on?
>
> Jiri
Thank you for pointing me to that fix. I reproduced the issue on the
then-current mainline, commit
4dce97c6c265544342e716e62fd24bbb232590c5, fetched on 2026-11-25.
I also verified that 78a86d75a70e1e227711c72865c59b1422d0a5ae is
already an ancestor of this commit.
You are right that 78a86d75 addresses the original issue. However, it
does not cover this particular variant.
The existing fix is reached through the following POP path:
do_execute_actions()
-> pop_mpls()
-> skb_mpls_pop()
-> if (!eth_p_mpls(next_proto))
skb->inner_protocol = 0;
Thus, when the last POP specifies a non-MPLS next_proto, the stale
inner_protocol state is cleared as intended.
My reproducer instead installs the following action list:
PUSH_MPLS,
POP_MPLS(ETH_P_MPLS_UC),
POP_MPLS(ETH_P_MPLS_UC),
OUTPUT
This takes a different path:
PUSH_MPLS
-> skb_mpls_push()
-> record inner_network_header and inner_protocol
POP_MPLS(0x8847) x 2
-> pop_mpls()
-> skb_mpls_pop()
-> advance skb->data by four bytes per POP
-> !eth_p_mpls(next_proto) is false for both POPs
-> inner_protocol is not cleared
OUTPUT
-> do_output()
-> ovs_fragment()
-> skb->network_header = skb->inner_network_header
-> skb_network_offset(skb) becomes -4
-> the signed "> MAX_L2_LEN" check does not reject it
-> prepare_frag()
-> unsigned int hlen = skb_network_offset(skb)
-> hlen becomes 0xfffffffc
-> memcpy(&data->l2_data, skb->data, hlen)
After PUSH_MPLS followed by the two POP_MPLS actions, skb->data is four
bytes past the saved inner_network_header. Because both POP actions
still declare next_proto as MPLS, the clearing condition added by
78a86d75 is never satisfied, even though the label stack has already
been emptied.
This produces the reported KASAN signature:
BUG: KASAN: slab-out-of-bounds in prepare_frag
Read of size 4294967292
So this is not a case of the fix being absent from the tested kernel;
rather, the all-MPLS POP sequence described above is not covered by its
clearing condition.
next prev parent reply other threads:[~2026-11-26 9:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 8:31 [PATCH net] openvswitch: reject negative L2 length in ovs_fragment() Lin Jiapeng
2026-11-26 9:14 ` Jiri Benc
2026-11-26 9:34 ` Lin Jiapeng [this message]
2026-11-26 10:08 ` Jiri Benc
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5d1f3ff8-b995-4496-a59f-2a01f38603b1@gmail.com \
--to=ljp1205831794@gmail.com \
--cc=aconole@redhat.com \
--cc=corvus@tencent.com \
--cc=davem@davemloft.net \
--cc=dev@openvswitch.org \
--cc=echaudro@redhat.com \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=i.maximets@ovn.org \
--cc=jbenc@redhat.com \
--cc=jiapenglin@tencent.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox