Article View: linux.kernel.netdev
Article #6679Re: [PATCH net-next 09/15] net: skbuff: check csum_start against len in skb_copy_and_csum_dev()
From: netdev-bot+sashiko
Date: Fri, 23 Oct 2026 04:52
Date: Fri, 23 Oct 2026 04:52
63 lines
10679 bytes
10679 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 ยท High: 0 ยท Medium: 1 ยท 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).
- [Medium] net: skbuff: incomplete headlen underflow check in
skb_copy_and_csum_dev()
--
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -4103,7 +4103,11 @@ void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to)
> else
> csstart = skb_headlen(skb);
>
> + /* skb_headlen() underflows if data_len is bigger than len, so check
> + * csstart against len as well.
> + */
> if (unlikely(csstart < 0 || csstart > skb_headlen(skb) ||
> + csstart > skb->len ||
> (skb->ip_summed == CHECKSUM_PARTIAL &&
> csstart + skb->csum_offset + sizeof(__sum16) >
> skb->len))) {
>
[Severity: Medium]
This only closes the hole for the non-CHECKSUM_PARTIAL case. If
skb->data_len > skb->len and ip_summed is CHECKSUM_PARTIAL, csstart
comes from skb_checksum_start_offset() instead of skb_headlen(), so it
can be anywhere up to skb->len while skb_headlen() has wrapped to
about 4GB. Both the headlen comparison and the new skb->len comparison
then pass, the csum_offset check passes too, and we go straight on to
skb_copy_from_linear_data(skb, to, csstart) with nothing bounding
csstart by the real linear area.
skb_copy_and_csum_bits() then starts from int start =
skb_headlen(skb), which is either negative, so the linear part is
skipped and the frag reads are shifted by data_len - len bytes, or,
once the difference exceeds INT_MAX, a bogus positive value that lets
it copy from skb->data past the end of the linear data.
The fallback isn't safe either. skb_copy_bits() also begins with
int start = skb_headlen(skb), so sending such an skb down the existing
fallback, as the changelog describes, bounds the writes to @to by
skb->len but not the reads from the skb.
Since the condition you really want to catch is data_len > len,
would it be simpler to test that directly before computing csstart,
and memset() @to rather than calling skb_copy_bits() in that case? Or
should skb_copy_bits() and skb_copy_and_csum_bits() reject
data_len > len themselves?
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261019-b4-skbuff-bug-on-followups-v1-0-41dbef50b9f7%40toxicpanda.com
Technical Details
Message-ID:
<179273112823.3134.12241973533522574538@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350911-linux-kernel-netdev=dewy.ruReferences:
<20261019-b4-skbuff-bug-on-followups-v1-9-41dbef50b9f7@toxicpanda.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350911-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next 09/15] net: skbuff: check csum_start against len in skb_copy_and_csum_dev() Date: Fri, 23 Oct 2026 04:52:08 +0000 Organization: Usenet Network Message-ID: <179273112823.3134.12241973533522574538@kernel.org> References: <20261019-b4-skbuff-bug-on-followups-v1-9-41dbef50b9f7@toxicpanda.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="412578"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:22528I+ERCscadzg+8Na1qm4TsI= sha256:ByR28hc+WQfgMGn9g66bYyVT379TqnBGNLrSQPrTyGI= sha1:OjZoP6YSOp3q48E8FNH5s3MG3uQ= sha256:+OBS1vwa+Dc9e+LpxjNMyJT9ek3vyZliraaSzcfoas0= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id D2EC31113E4; Fri, 23 Oct 2026 07:55:02 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.738 X-Spam-Status: No, score=-3.738 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.339, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id J_7BVB_Q2Wrh; Fri, 23 Oct 2026 07:54:59 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-350911-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 92A121113DC; Fri, 23 Oct 2026 07:54:51 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 788B635BDC; Fri, 23 Oct 2026 04:52:15 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1792731131; b=usbr70sAQUapgsc8Yoo8As1fYcFqaUM7dCPvnrolOm1ZEiCppPV/tNhzTjcLNyPfcvaq CWaXeTmalFdk6Au6mpPFU/hiE9N512yUptIQ8KKQFAa03MeZATUBiGZXrelDUl6+ph7Ty Ep5+nbOfL+XnMBkwV3cK90ekmF17NCc+3FZ3nM+wLVlBiPavDAZEhg3vZE10Uufpr6Bui OcXutkZAypbA6Ol7XwIjCWniPKuVMNq2TCZLYnDTFHeRH78q/Ek+U6fbGLA61J0sUba6N 9pbKwYxwkvEtdK6xXZXb0AZg6LWhuNiZ2e3eQ14GdtxQGAzxIVs0YEF0bznYTRBaxqQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792731131; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=ALJG1SS2iy0WNzGYJ2ykwPhdXMhJmbb3CoA1YF8ffNc=; b=cmedgo8nrqWImWNXhRo6bQRH7udnYvyTOZyjOJxmE2Dvh2oTUVEBQ51ibxnAP0M+X6iE IFcyOKZWDGPThJ+qGrRj63E5Z4PGYFxSW80E/OGxLHgj1w6gwvP1ECnGNG1XARKV2FZwe NkSqfdbITOrXi0aSAVcEo6i7UdIrzbV0EDhNA59ODDXAsJfs57fKsgasGiO0NgxlSIyru 7QPc63kv/2+LphHaDDBJj9MwwgiRLWVcVV2RIAQZihCAIIAYsXZk6oEqQidI62JVXp9vL u7I6Sh3J/XtyVuAQZQP8x7kk9YDbdzTaVkBSM4d5J5NlP/ImE4sftpZpW6TgaZIoCrA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=LBiOMtrD; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7280D606A329; Fri, 23 Oct 2026 04:52:11 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=LBiOMtrD X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1792731130; b=T2yYLjrl2LC/SWrW4X2CFDOD3sdJOb1jmFqwGGDr+o8lrZfOu4Ox6Xz2TYuUGTWmmSqJ NzIH35yob8LvUCQkMxW/83NOrDrs9hhucOyikya9Y+PUmcf8s7glVgKEDyPJb+BqCcImZ JzXjCzMObiKjjm5/zhUqEa7qFNKzhlnJMCS9PFjBbRgBRa5ErRkTP06ITYEV50rPB5kqV JtUcDGTlKjfpEwh5MHgIpXYxQT/P0kvrrwgqyMJ/TZ7KEBY/wvS8q24vVxHhPWaHdKNDk NMoewS+w3b9Tg7lwF09mkJa2EUjivRArb9OpTJwOFUFOLs9jdtn1KeCHVH1pus4Sd6w== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792731130; 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=ALJG1SS2iy0WNzGYJ2ykwPhdXMhJmbb3CoA1YF8ffNc=; b=GRjSU3vOJU18ikg9b5nwekL/4DFoqMdNkMxmSoEgGdKsrT01kEM3c2z2FgZtcNXdbSf3 MauQYYPvsNHbYhX44O1tFwUuXl3Mz/U7HNEO3WLwuLG2y6jXD1Ae6It71OqVT8qEPdB5Q yYa/O9DdTEyBaH7mH55OFYkyIe+ZpkaRW4AOvkBhIofkS2tCcbWVJGnjpiGth7vCp4PCF wqPf0T3RrAOqoB5obvDCM23ITrSAO5VTcbfAS04/HOODyZRo0+6+7q3naxTNiUB1GJDt1 9HzlqBtYXjNGtWQs9QORI/8C3BIs8Soli3vWqXmBPX7Q7D+RUueQHbWCpPc72CAQgXw== X-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=LBiOMtrD; arc=none smtp.remote-ip=100.103.45.18 X-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 556D7606A319 for <netdev@vger.kernel.org>; Fri, 23 Oct 2026 04:52:09 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC8131F01825; Fri, 23 Oct 2026 04:52:08 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792731129; bh=ALJG1SS2iy0WNzGYJ2ykwPhdXMhJmbb3CoA1YF8ffNc=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=LBiOMtrDWCpmJO/ji86Cm00kxg5nINn6Ygjd5c3AQDkNrnU1kFrfmscNk06E3Pllm OOf4zfyBdEEeDqjVeUn8Q+eUF71szWkujD/7zYvOuUSd+DzyyeTym8udRVjUdDBmFn hkja5jzp7viOvPROAMFnWXTePG3v+VngBOu3XUHJSy6M7/nm3pxc5J0/sNgSM9wdhf i/qQl8vhcojaX76gM2RTVgRT/lL/bDsHtetipEb+ognTO7kEWTZxhxaYVyKZ+jmfJd K+wurkGehCZVpXLsNjKas5F7UkTKzAqORqvEBQEBKPNpOVLIDLwroUbGm+ZFiaVXHD FZpL/xAHtvnZg== X-Cc: davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, andrew+netdev@lunn.ch, jgross@suse.com, sstabellini@kernel.org, willemdebruijn.kernel@gmail.com, fmancera@suse.de, almasrymina@google.com, david.laight.linux@gmail.com, netdev@vger.kernel.org, xen-devel@lists.xenproject.org X-In-Reply-To: <20261019-b4-skbuff-bug-on-followups-v1-9-41dbef50b9f7@toxicpanda.com> X-sashiko-severity: Medium X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list