Hi,

Kyuwon Cho <[email protected]> writes:

> Hi Aaron, Eelco, Ilya,
>
> While testing v7.4-rc3 with an LLM-guided test generator that we are
> developing as a research prototype, we found that OVS_PACKET_CMD_EXECUTE
> can trigger the WARN_ONCE() at the end of ovs_fragment(). An unprivileged
> user can do this from its own user and network namespace:
>
>   Failed fragment ->ovs0: eth=8847, MRU=500, MTU=1500.
>   WARNING: net/openvswitch/actions.c:831 at ovs_fragment+0x239/0x840, CPU#1: 
> test/106
>   CPU: 1 UID: 65534 PID: 106 Comm: test Not tainted 7.4.0-rc3 #1 
> PREEMPT(lazy) 
>   RIP: 0010:ovs_fragment+0x24e/0x840
>   Call Trace:
>    <TASK>
>    do_execute_actions+0x580e/0x7380
>    ovs_execute_actions+0xd3/0x3e0
>    ovs_packet_cmd_execute+0xc21/0x13c0
>    genl_family_rcv_msg_doit+0x1e0/0x2c0
>    genl_rcv_msg+0x42d/0x6f0
>    netlink_rcv_skb+0x11f/0x350
>    genl_rcv+0x23/0x30
>    netlink_unicast+0x518/0x870
>    netlink_sendmsg+0x849/0xe20
>    __sys_sendto+0x36a/0x3c0
>
> OVS_PACKET_ATTR_MRU is taken from the request as is. In do_output(), a
> packet longer than mru + hard_header_len goes to ovs_fragment() when mru
> is not larger than the port's MTU. ovs_fragment() only handles IPv4 and
> IPv6, and treats any other ethertype as a case that should not happen:
>
>       } else {
>               WARN_ONCE(1, "Failed fragment ->%s: eth=%04x, MRU=%d, MTU=%d.",
>                         ovs_vport_name(vport), ntohs(key->eth.type), mru,
>                         vport->dev->mtu);
>               reason = OVS_DROP_FRAG_INVALID_PROTO;
>               goto err;
>       }
>
> With an MRU in the request, any ethertype reaches it; we used MPLS
> (0x8847). The packet is dropped either way, so the effect is the
> warning, which panics a machine with panic_on_warn.
>
> Dropping the packet with a rate-limited message instead of the WARN, as
> fd954cc1919e ("openvswitch: switch from WARN to pr_warn") did for
> ovs_dp_reset_user_features(), or checking the ethertype in do_output()
> before calling ovs_fragment(), should avoid it. We have not tested either
> change.
>
> The reproducer runs as an unprivileged user (uid 65534) that creates a
> user and network namespace, creates a datapath with an internal port,
> and executes one 1434-byte Ethernet frame with ethertype 0x8847,
> OVS_PACKET_ATTR_MRU 500 and an output action to that port. On an x86_64
> QEMU guest with 2 vCPUs and KASAN (gcc 13.3, config attached), it warns
> in every run (7 of 7).
>
> Checked against v7.4-rc3 (aebb72744764); actions.c is the same in
> net-next (6ff4c5942a30). We found no earlier report on syzbot or in a
> web search.
>
> The reproducer (repro.c) and the kernel config are attached.

We can change it, and I think it makes sense.  A ratelimited warn seems
appropriate.

Did the LLM already generate a patch for the issue?  That would helpful.

> Thanks,
> Kyuwon Cho

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to