Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider. Critical: 0 · High: 1 · Medium: 0 · Low: 0 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [High] The fix is incomplete because the new IHL length check assumes the IPv4 header always starts ETH_HLEN bytes into the frame. -- vrf: pull the full IPv4 header on xmit This patch adds a check to vrf_process_v4_outbound(). The check drops IPv4 frames sent on a VRF device if ihl < 5, or if fewer than ihl * 4 header bytes are present. The goal is to stop an skb->len underflow in xfrm4_transport_output() that makes ESP walk off the end of the scatterlist.
> diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c > index 79d433f49f803..d90b7e8fb158f 100644 > --- a/drivers/net/vrf.c > +++ b/drivers/net/vrf.c > @@ -499,6 +499,10 @@ static netdev_tx_t vrf_process_v4_outbound(struct sk_buff *skb, > if (!pskb_may_pull(skb, ETH_HLEN + sizeof(struct iphdr))) > goto err; > > + if (ip_hdr(skb)->ihl < 5 || > + !pskb_may_pull(skb, ETH_HLEN + ip_hdr(skb)->ihl * 4)) > + goto err; > +
[Severity: High] Is ETH_HLEN the right starting point for this length? ip_hdr() is read at skb->network_header, but the pull length here is counted from skb->data with a fixed ETH_HLEN. Later in the same function, the actual network offset is stripped: /* strip the ethernet header added for pass through VRF device */ __skb_pull(skb, skb_network_offset(skb)); Can vrf_xmit() get frames where skb_network_offset() is larger than ETH_HLEN? This path looks like it can produce one: 1. An NBMA ipgre device (no remote, so header_ops is &ipgre_header_ops) has hard_header_len = tunnel->hlen + sizeof(*iph), which is at least 24 bytes. 2. packet_snd() on a SOCK_RAW socket bound to that device sets reserve = hard_header_len. The network header therefore starts 24 or more bytes into the frame. 3. A tc clsact egress "mirred egress redirect dev vrf0" on the GRE device goes through tcf_mirred_to_dev(). The VRF device uses ether_setup(), so expects_nh is false. at_nh is also false, so the skb is passed on unchanged: expects_nh = want_ingress || !m_mac_header_xmit; at_nh = skb->data == skb_network_header(skb); if (at_nh != expects_nh) { The GRE ingress side looks similar. __ipgre_rcv() calls skb_pop_mac_header(), and mirred then pushes the outer IP + GRE mac_len before the skb reaches the VRF device. Take a network offset of 24, ihl = 15 and a frame length of 74 to 83: ETH_HLEN + ihl * 4 = 14 + 60 = 74, so the new check passes __skb_pull(skb, 24) leaves skb->len at 50..59, which is less than 60 If the route lookup returns a transport-mode ESP xfrm dst, xfrm4_transport_output() runs this without checking the length itself: __skb_pull(skb, ihl); Wouldn't skb->len then wrap the same way as in the oops in the commit message? If the skb is non-linear, could that __skb_pull() hit the skb->len < skb->data_len BUG() instead? The existing 20-byte check just above makes the same ETH_HLEN assumption. Would checks relative to the network header be more robust, for example: if (!pskb_network_may_pull(skb, sizeof(struct iphdr))) goto err; if (ip_hdr(skb)->ihl < 5 || !pskb_network_may_pull(skb, ip_hdr(skb)->ihl * 4)) goto err; Every step above (GRE link, tc clsact/mirred, VRF, xfrm SA and policy, AF_PACKET) can be set up inside an unprivileged user + net namespace. That is the same privilege the reproducer in the commit message needs.
> ip4h = ip_hdr(skb); > > memset(&fl4, 0, sizeof(fl4));
-- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40asu.edu