From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796157924; b=M4E52rC/rwqJnL5NZK8wehegYDx6g8FIHrQrsP8YVz9kYcWHwZXggckNwLvQLQjA2KIy cZJgPnBbfRBn76ksVs1A/yO17IKsrosr+DxePkjDyn6lAXfoBVdsjKRwZ75s5TyJwGxp8 5acvbkshBZvyl+zngeHWfEB49HzTqzFrdDuLXlhquHnCfdKthm9iu0lFPMz1ftqyHl6FL ZBZkCTPb7O3S3Q05wow31ZVsV+ROCRPwWckaXDJ3+p9Bi4g1L7ggZZI3e+SpZfiyQKyQ4 pujzF6uUG3HgCYtesSWItBHhPy1nCMSTxId0lhZ2V4fEYNNHdQNNVUKehj7nJ/uMgGQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796157924; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=0AaJduEZ7wfJaY5Vq7wb6cI/XnyhI/Ovesz8EZooNYA=; b=oTE1bWWrMMKjYHytkubMQDUUgdd0h86tG4uZ+HG71xeHWcrVX1ckTrkWrMwMNsmZx7Xx Am8L/UUX0IcOCxM9lfP8diJAbPz5fqWytDe8xuE8srO/r8rv5LedJp2dVPAdQ0aSS1LhR 3UVHku3yGlNBgaUIpERwIEi7PksUH3I5BdP4jcZtNq2uss1oEnggoXkPfz2eRg59twrNx 5JK/70TPl/GNyuW0pjGOoQgDftmRn+gaI6BWoUB5GiOfL4QFeo98hLNVHtVunvDXOdmSq CyNbypeY/G+aBYBAYoCKuv/qQqMjUWLUCWfNUaZrLdLQyx43Z3eLITzF/82fi2CaT0A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=YzzOt8hL; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 466DF606A320; Tue, 1 Dec 2026 20:45:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=YzzOt8hL Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6B211F0089A; Tue, 1 Dec 2026 20:45:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796157923; bh=0AaJduEZ7wfJaY5Vq7wb6cI/XnyhI/Ovesz8EZooNYA=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=YzzOt8hLv5/7r+SIVL6HtgRe/x+Ofxh0P3RlxjrKIEDxxsm+PRJ1HLOJd6PuatEuj wM1ONXw2i7BSuGmavo9Ifwjknq31K8YX3VT4uTWcQzrN5Mr92uvYhXf54IaccZdezd EtU23R/CZ/deN7B+cYTkSIKUDEVkQLRcsIBeHllztpbTsMYVE6Jh6H93WFaZ2Jvl71 FxDh+171rmOOmQejfKwvj1sCTSCGsK9zzCVYw0joMKLlhW86QPoHgm2snKH02BGcsy eizxpq2tS6GBDwIorrBo6NoGvY7Pz3XRNOcU4Ugi29FBA+ZvR+0bZrdtP4m4Ib/KL1 2q6HhRgeko+pA== Subject: Re: [PATCH net v2] vrf: pull the full IPv4 header on xmit From: netdev-bot+sashiko@kernel.org To: xmei5@asu.edu Cc: dsahern@kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, co+bfd69dd4e073f1e9@bugs.sh Date: Tue, 01 Dec 2026 20:45:22 +0000 Message-ID: <179615792219.3146.18277936289940113941@kernel.org> In-Reply-To: <20261130204412.632027-1-xmei5@asu.edu> References: <20261130204412.632027-1-xmei5@asu.edu> X-sashiko-severity: High Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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/20261130204412.632027-1-xmei5%40asu.edu