From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.44 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796145680; b=P0V2BIIllLEloVihuIX96TydeqG0u4UQTZmfIiWeQOCXI5Kj1qQI5YV2YzrhhZL9LXxU wEq0ye9n0XCuGuguh35/6/kthPeLYvG3TgU4T1Mz4mIQcXW1OjzCo/OH09yMV+FZjTqmL srZWrYYo+EOEZHjw3eqiqFknp7oylro8AeHAEmWnitvg7iorJ17ua21YbZlFHN8sN0VoQ FS6ksI9F85Af6ZKqRe1zmU5XaQRhSFV41V63XEp5j+2Od+J60ATGGEY2zsNNhsBuWMFIw O5y0lPRGdUfmEeFuhI/v+jSut69SmOsg5m45qsIGp2NY31iKctiw4/EJj1GwTLrFCHQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796145680; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Message-ID:Date: MIME-Version:User-Agent:Reply-To:Subject:To:References:From: Content-Language:Organization:In-Reply-To:Content-Type: Content-Transfer-Encoding; bh=vWAxngyEbJrWe1VcSRUUPcYiU8Ha5oP3szagwEUnKT0=; b=kgJrmpIouVpTSGavFuLYKnUUU+5KbEkwhol8AGABwmMkC6hKoGTvnyzrjTWzEQZbvS6w zSmIVdyp/n2eQmK7D/PEY2b3l+iECb0oNeyGofmT70aRoAzS3pencj0Gf9h5tOje7f9f9 7jvG8qVTR36VKdqSeQrY6zyYvOU8CFNBtJknr3o55WqDBPca+NGrlvrjqVoY5Rt718fdL h+N4dBtcCJpt0eqnOb4eVDaNUAmTO7RpJOq799uQfD9oRzIhY42nkNfck7lSnHbFQ4OIJ MwUJBjoPHWVh77Hx1nhtYI94lBT0C6nnSYrqMxDTk3XpJqajwgwxdMY/W6LRQwEgpnQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=6wind.com; spf=pass smtp.mailfrom=6wind.com; dkim=pass header.d=6wind.com header.i=@6wind.com header.a=rsa-sha256 header.s=google header.b=bsG50iVS; arc=none smtp.remote-ip=209.85.128.44 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A7D52606A334 for ; Tue, 1 Dec 2026 17:21:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A7D52606A334 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=6wind.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=6wind.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=6wind.com header.i=@6wind.com header.a=rsa-sha256 header.s=google header.b=bsG50iVS Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-4bb5e3cbf45so11274595e9.1 for ; Tue, 01 Dec 2026 09:21:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; t=1796145678; x=1796750478; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:organization :content-language:from:references:to:subject:reply-to:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to:content-type; bh=vWAxngyEbJrWe1VcSRUUPcYiU8Ha5oP3szagwEUnKT0=; b=bsG50iVSEg2cfDn98/oxo9I2zVhbgt1B3LUHJlrRtE8Kp/HnsItJHKacRGyJ16JhDt teVINUZxhorC9gvKqVnErrmhpC2VjdxF2xlDGpye1xD+WXMcTPOZwrkPgSHo5SOw10eG Qa5hYmcO1uAseKQbBiZF/hx2iCBpmPDzi7GlCihbk0eYE6yhgZAvI4qeKNVHsX7KwI5r TMtvHpF1ERB9nSp7u6q0lZyamQtAsOaxiYNJfu6wSeQLznZpUBbgCkfHhoFvSyaYiuPP 2A4J2c4caaA0YxSyg/GPLIDCYMAEcJKH4yZk8/jtxCl91/z3Brsqi4yN3NPz/GUJgzya QYtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796145678; x=1796750478; h=content-transfer-encoding:content-type:in-reply-to:organization :content-language:from:references:to:subject:reply-to:user-agent :mime-version:date:message-id:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to:content-type; bh=vWAxngyEbJrWe1VcSRUUPcYiU8Ha5oP3szagwEUnKT0=; b=ydKrLTh1H+R83KLuaDac5OK804lUdUcAN/HsdZdZ0t4yPsEhdoYIQVSDT0eCWN0sDf TI1JYczmmbh+q5SBtHIwrZ7RXXxjBHaht1D9fTDleDi610mN/kO3UEjDtHT4ncQ5i9UO snThuSMWFRPbpChth2fznJdWt98zhTYXLmTV0fE8ef1jCYhQbYjUTfsE6aE5cMku0qXn mhjhZTPCQ3ZsZV1MAUT5eNI3ocQVLfUhr7uK0JcpX8U2etc8gAJwFxtDZIflaYVoxOtu VSJI+BHrON0xf/3TaHWdEeIjtz+C0EYrm5O651nJz6vMzAPq5hLQU0XpTXYzR5LH862g O23Q== X-Gm-Message-State: APuU4Z9iSWTpaSHBb4t0vAw5TnbYlXE3UqfIr0tZYhljdlntUINgT9fS RuDQeEPDpMZuxrbs95xSnsNwY/VsOxAPKqHeyg7UW3SFQPHXUPuolZc53CoT7lMZPpk7345nbpw xMcKGnBo= X-Gm-Gg: AZFdTZdDnBThMzoRhy5Dls/uPTaEzdhN4gNp1MxnWv2xABAPjZUTN81Jk7vCM4W4FfD DgwWidrkn5fgbAVs71QkMniceIVmIjPeLdmf47a5gT98bDFu0N+K93kZECUaWgmBql3P8bpcFS/ niC/MfWZN66iSV0BxTS7u84kQVNiAU5IvJ0qiJ1dWv6F48s8c3Bj995s0Pxf/yhsIAD7USmTCaR eeZrwba5z6smdqynxXVP+HigoSKb7mcJsAu5bSbj6ljrRdJiV4yJQjf9fW6Z/g6a19AnvnwpkJ0 2YBVx6CDrk368sKO0vDFAntZ0p+ma8MH2L/5XYXAFq3sOt5ekLDW/RIXsxSXxa09K9qnECiDWjV MFojFO8ZeIvRbi94RSEtos+wgpsmhOF/kpxm4yTJKS5zcMQ3YtZ7avAIOkD+CUzeDykvTT+Buu7 jo3gfyAl6+gIRJKQ974quiUIorYyZVknPokA9KAEBqlXypT6GntoeOgOptqmxMU7CatITaepX4y 9G1O53qk9YMYPlnRdvJTNo+hsSZLRaBDpFC2Ahuk/DFzTtIt/GnabXwza3ygfND6sz6od8Uhhrt ZfgVaY3aw9ObGrCuzSpxaaQAWHeq4/I53IqjmWElcktQICZXyTNCuIh6xzqmhWhF/gGVKnAZGVh vvn4n X-Received: by 2002:a05:600c:8210:b0:4bb:7ad8:99f2 with SMTP id 5b1f17b1804b1-4bb88785da4mr694844145e9.0.1796145678056; Tue, 01 Dec 2026 09:21:18 -0800 (PST) Received: from ?IPV6:2a01:e0a:ab7:2110:6a1d:efff:fe52:1959? ([2a01:e0a:ab7:2110:6a1d:efff:fe52:1959]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb884b8429sm1618474625e9.14.2026.12.01.09.21.16 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Dec 2026 09:21:16 -0800 (PST) Message-ID: Date: Tue, 1 Dec 2026 18:21:16 +0100 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 User-Agent: Mozilla Thunderbird Reply-To: nicolas.dichtel@6wind.com Subject: Re: [PATCH net v2] vrf: pull the full IPv4 header on xmit To: netdev@vger.kernel.org References: <20261130204412.632027-1-xmei5@asu.edu> From: Nicolas Dichtel Content-Language: en-US Organization: 6WIND In-Reply-To: <20261130204412.632027-1-xmei5@asu.edu> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Le 30/11/2026 à 21:44, Xiang Mei a écrit :> A frame sent on a VRF device with AF_PACKET carries an IPv4 header > written by the user. vrf_process_v4_outbound() makes sure the first 20 > bytes are there, but never checks that the packet is as long as the > header says it is (ihl * 4). > > With a transport-mode ESP SA, xfrm4_transport_output() strips ihl * 4 > bytes from the front of the packet. If the packet is shorter than that, > skb->len wraps around to ~4G and ESP walks off the end of the > scatterlist. An unprivileged user can do this inside a user + net > namespace: > > Oops: general protection fault, probably for non-canonical address ... > KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f] > RIP: 0010:scatterwalk_ffwd (crypto/scatterwalk.c:191) > Call Trace: > crypto_authenc_encrypt (crypto/authenc.c:201) > crypto_aead_encrypt (crypto/aead.c:91) > esp_output_tail (net/ipv4/esp4.c:600) > esp_output (net/ipv4/esp4.c:675) > xfrm_output_resume (net/xfrm/xfrm_output.c:562 net/xfrm/xfrm_output.c:597) > xfrm_output (net/xfrm/xfrm_output.c:656 net/xfrm/xfrm_output.c:837) > __xfrm4_output (net/ipv4/xfrm4_output.c:28) > xfrm4_output (./include/linux/netfilter.h:314 net/ipv4/xfrm4_output.c:33) > vrf_ip_local_out (./include/net/dst.h:471 drivers/net/vrf.c:485) > vrf_xmit (drivers/net/vrf.c:537 ... drivers/net/vrf.c:568) > dev_hard_start_xmit (net/core/dev.c:4084) > __dev_queue_xmit (net/core/dev.c:5101) > packet_xmit (net/packet/af_packet.c:274) > packet_sendmsg (net/packet/af_packet.c:3209) > __sock_sendmsg (net/socket.c:818) > __sys_sendto (net/socket.c:2283) > __x64_sys_sendto (net/socket.c:2286) > do_syscall_64 (arch/x86/entry/syscall_64.c:89) > entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130) > Kernel panic - not syncing: Fatal exception in interrupt > > Drop the frame if ihl < 5 or not all ihl * 4 header bytes are present, > the same checks ip_rcv_core() does for received packets. Nit: ip_rcv_core() also checks version != 4 > > Cc: stable@vger.kernel.org > Fixes: 193125dbd8eb ("net: Introduce VRF device driver") > Reported-by: co+bfd69dd4e073f1e9@bugs.sh I did not found the report on netdev. checkpatch complains that Reported-by: should be immediately followed by a Closes: or Link: tag pointing to the report. The commit log should state how the issue was discovered, please see: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/maintainer-netdev.rst#n286 > Signed-off-by: Xiang Mei Please also add a changelog below the "---" line, with a link to the previous postings: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/maintainer-netdev.rst#n235 > --- > drivers/net/vrf.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c > index 79d433f49f80..d90b7e8fb158 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; > + nit: one if would do the job: if (!pskb_may_pull(skb, ETH_HLEN + sizeof(struct iphdr)) || ip_hdr(skb)->ihl < 5 || !pskb_may_pull(skb, ETH_HLEN + ip_hdr(skb)->ihl * 4)) goto err; > ip4h = ip_hdr(skb); > > memset(&fl4, 0, sizeof(fl4));