🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #6505

Re: [BUG] net/sched: malformed UFO GSO geometry can soft-lock DRR dequeue

#6505
From: Eric Dumazet
Date: Thu, 22 Oct 2026 15:26
131 lines
14567 bytes
Le jeu. 22 oct. 2026 à 16:57, Eric Dumazet <edumazet@kernel.org> a écrit :
>
> Le jeu. 22 oct. 2026 à 16:48, shaos <shawnq1@163.com> a écrit :
> >
> > Hello,
> >
> > A PACKET_VNET_HDR AF_PACKET send supplies UFO GSO with gso_size=1 and hdr_len=65532 for a 524275-byte frame. qdisc_pkt_len_segs_init() computes an accounted length of 4,294,574,091 bytes. With DRR quantum 256, the dequeue path needs about 16.8 million deficit refills before it can dequeue the skb, keeping the CPU in the qdisc path long enough to trigger the soft-lockup watchdog.
> >
> > HEAD commit:    c03c1a14507dfaf8b856c2608f9ac216021fc222
> > git tree:       30fd2ef82912c26cf3a58ad0ba6afc375fa851ac
> > source version: Linux 7.3.0, local master
> > compiler:       gcc 11.4.0, GNU ld 2.38
> >
> > console output:
> > https://gist.githubusercontent.com/shaos26/8a4f7f445aa23601bfe8e04f9c6a5202/raw/f4ca89881f7b8163ddea72fbc54b204385142bb8/console-output.txt
> > user-namespace positive output:
> > https://gist.githubusercontent.com/shaos26/8a4f7f445aa23601bfe8e04f9c6a5202/raw/14de8e3a06e7e73c540ebf408e73d301bae3922d/userns-positive.log
> > kernel config:
> > https://gist.githubusercontent.com/shaos26/8a4f7f445aa23601bfe8e04f9c6a5202/raw/6ea0e3da68f1e239d565c64f7906d0f9c73bf784/kernel-config.txt
> > reproducer sources:
> > https://gist.githubusercontent.com/shaos26/e2add470a38b7aab41f2b79ef021accf/raw/7153646b9233fa53aca81c9af879d48e8f95dd80/poc.c
> > https://gist.githubusercontent.com/shaos26/e2add470a38b7aab41f2b79ef021accf/raw/e8acddd986023c10a43b5106b4734a456a063deb/drop_priv.c
> >
> > Build the tested kernel with the attached configuration and boot a disposable QEMU guest. Compile the linked userspace reproducer and privilege-drop helper, then run the AF_PACKET/VNET_HDR test from a fresh user/network namespace.
> >
> > Impact and prerequisites:
> > A process with only namespace-scoped CAP_NET_ADMIN and CAP_NET_RAW can keep a CPU in the DRR dequeue path long enough to trigger a host soft-lockup. With softlockup_panic=1, as used in the test configuration, the watchdog panics the kernel. This is a local denial-of-service issue; no memory corruption or privilege escalation is demonstrated.
> >
> > Validation: Two fresh positives reproduced the soft lockup, including one run from an unprivileged UID mapped to namespace UID 0. The same-frame non-GSO control completed in milliseconds.
> >
> > Thanks,
> >
>
> Related recent work:
>
> commit 8f735d64382dcf162f4276d6699d03ad2f859c0b
> Author: Jamal Hadi Salim <jhs@mojatatu.com>
> Date:   Tue Aug 25 04:14:03 2026 -0400
>
>     net/sched: bound qdisc_pkt_len to prevent qdisc soft lockup

Something like:

commit b30c29ab2b07fa54bf9f3e73984f441f4151ba87
Author: Eric Dumazet <edumazet@kernel.org>
Date:   Thu Oct 22 17:19:07 2026 +0200

    net: harden qdisc_pkt_len_segs_init() against malicious GSO packets

    An SKB_GSO_DODGY packet can carry untrusted gso_size and headers.

    For instance, gso_size=1 and hdr_len=65532 for a 524275-byte frame
    makes qdisc_pkt_len_segs_init() compute an accounted length of
    about 4,294,574,091 bytes (after gso_segs silently wrapped in a u16).

    With DRR quantum 256, the dequeue path then needs ~16.8 million
    deficit refills before it can dequeue the skb, keeping the CPU in
    the qdisc path long enough to trigger the soft-lockup watchdog.

    Commit 8f735d64382d ("net/sched: bound qdisc_pkt_len to prevent
    qdisc soft lockup") added QDISC_PKT_LEN_MAX to bound size table
    amplification. Use the same bound for DODGY packets:

    - Make gso_segs a u32 and drop packets whose segment count does
      not fit GSO_MAX_SEGS, instead of silently truncating it.

    - Drop packets whose estimated qdisc_pkt_len() would exceed
      QDISC_PKT_LEN_MAX.

    Fixes: 15e5a0307164 ("net_sched: better precise estimation on
packet length for untrusted packets")
    Reported-by: shawnq1@163.com
    Closes: https://lore.kernel.org/netdev/20261022144755.65025-1-shawnq1@163.com/
    Signed-off-by: Eric Dumazet <edumazet@kernel.org>

diff --git a/net/core/dev.c b/net/core/dev.c
index e76762e29360ea87ade0846e4a4f9016dca587d6..573bcc9d67b1b1e21e844f054f0b51a172713a90
100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4175,7 +4175,7 @@ static enum skb_drop_reason
qdisc_pkt_len_segs_init(struct sk_buff *skb)
 {
        struct skb_shared_info *shinfo = skb_shinfo(skb);
        unsigned int hdr_len, tlen;
-       u16 gso_segs;
+       u32 gso_segs;

        qdisc_skb_cb(skb)->pkt_len = skb->len;
        if (!shinfo->gso_size) {
@@ -4226,6 +4226,15 @@ static enum skb_drop_reason
qdisc_pkt_len_segs_init(struct sk_buff *skb)
                if (payload <= 0)
                        return SKB_DROP_REASON_SKB_BAD_GSO;
                gso_segs = DIV_ROUND_UP(payload, shinfo->gso_size);
+               /* shinfo->gso_segs is a 16bit field.
+                * Also make sure untrusted gso_size/hdr_len can not inflate
+                * qdisc_pkt_len() beyond QDISC_PKT_LEN_MAX, or deficit
+                * schedulers could spin in their refill loops.
+                */
+               if (unlikely(gso_segs > GSO_MAX_SEGS ||
+                            skb->len + (u64)(gso_segs - 1) * hdr_len >
+                            QDISC_PKT_LEN_MAX))
+                       return SKB_DROP_REASON_SKB_BAD_GSO;
                shinfo->gso_segs = gso_segs;
                qdisc_skb_cb(skb)->pkt_segs = gso_segs;
        }
Technical Details
Message-ID: <CAL4WiiqAeS8p-UWhiZwAG9sDmsrqWT+yataW0QiomQ-63m0SVg@mail.gmail.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350660-linux-kernel-netdev=dewy.ru
References: <20261022144755.65025-1-shawnq1@163.com> <CAL4WiipjAy2M5kok3bkB1Ny=9ryJvrWkt1jz_awuSoPY3Nx_vQ@mail.gmail.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-350660-linux-kernel-netdev=dewy.ru
From: edumazet@kernel.org (Eric Dumazet)
Newsgroups: linux.kernel.netdev
Subject: Re: [BUG] net/sched: malformed UFO GSO geometry can soft-lock DRR dequeue
Date: Thu, 22 Oct 2026 17:26:37 +0200
Organization: Usenet Network
Message-ID: <CAL4WiiqAeS8p-UWhiZwAG9sDmsrqWT+yataW0QiomQ-63m0SVg@mail.gmail.com>
References: <20261022144755.65025-1-shawnq1@163.com> <CAL4WiipjAy2M5kok3bkB1Ny=9ryJvrWkt1jz_awuSoPY3Nx_vQ@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="244138"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:d39LRQzE0hs9uU/b4UYosC7TuYo= sha256:MaPrD33LINHW2ckJ1m5KKa8RhpUSRjHTyM+AQ42Xoog=
	sha1:tPHi7DiimOvGnaUIfXUcvOT3xi0= sha256:/dHTCsIklVgzWfAerkFD00iY6rhBjJiq3t8XT6suhAI=
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 A255E1112D9; Thu, 22 Oct 2026 18:27:21 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.838
X-Spam-Status: No, score=-3.838 tagged_above=-9999 required=6.31
	tests=[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 JxGQ05XSm0M2;
	Thu, 22 Oct 2026 18:27:18 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-350660-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 2127B1112D7; Thu, 22 Oct 2026 18:27:07 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id 7AEDB60923E; Thu, 22 Oct 2026 15:26:59 +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=1792682815;
	b=LW9FSlaPc4kVrfrcGNCE2MXHz3UEAhPguoy/k8iqZXOvWr+B/DXycDHWtz+hnyQDK3w2
	 p8dubfQ+NhqdKw/HcTD5I2VqLfE4udUICp+6zCRQKB57+dnBK83CxiaRiwRYJlWgcRPUU
	 70wIFeQl/KiLBvosngtY1cMEMKEG3N7FIX1oqTVVeE3zTe9WYieyydA2XKmYKMBGoNfvI
	 R0PVRGzUsHVdY+5vB/QmCKgoskERf3xWckCJIfGrV6Z5dzyJO8S5fdy8G+rgXzr6plVPC
	 RKl8eamgawRWscz+dgUtKYg/vuYHiVg6dZNAaNP8V19nGHT1qk292LubFDdgjeWgxwQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792682815;
	h=X-Original-To:Received:Received:DKIM-Signature:Received:
	 X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:X-Mailing-List:
	 List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
	 List-Owner:Precedence:MIME-Version:References:In-Reply-To:From:Date:
	 X-Gmail-Original-Message-ID:X-Gm-Features:Message-ID:Subject:To:Cc:
	 Content-Type:Content-Transfer-Encoding;
	bh=mnm90cT9fJ9yIzn1u2BOkgljm5HClP1epGLUsBPzh9w=;
	b=naH2AJyFdCv/eTXZHaqdad/8gaBZOaCfUmTFj1PDRZ04Wlxu6g3ag0/gYunaOgLivhMR
	 om16L73eIAA1R97MBb9t/Xh8jymDtvh3Dncjdl6dUXW/d28c1bDg72nAeA3uC+puoxDNq
	 D3cUUIFhLWWbn4bD69qkJFOvz4yh7wp3lUO1So3Oaa7T3fJcIIC89ovwcH7+cEE7X0Urg
	 5YVP7I600okUJtdqwtuFXbCEiPGOBzVj4nJJ2KetnWR21fvMeWnfYg2KI2gfIP9isBSME
	 lzb3/DXasjlLvWpfaFdXYFobUaGaZLwZDU5VzDJAhwelYcUN3/AVn9ZzWZWzOe0wXzQ==
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=g2SqXrhv;
	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 C0AD3606A335;
	Thu, 22 Oct 2026 15:26:55 +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=g2SqXrhv
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=1792682814;
	b=HGl8I9FS25fntqUGUIgQyY10JrOEK8NaumWN6ajZEZilAlNcEsga2J+eIgd/mFd7wup0
	 m7wq1rI35Y7xXvjIWFMraga3Cu1k2VQlEL7ZnRFrAdqaQnFI5pdH2tIVPy+xtxJIPyog1
	 /cI71rSsNfSb16jeCamL+byeZhh8JHjHfA2r6MYVhafjlBd9qxlMA8AIhYi0KVL8NEJsm
	 aKJN0MKraK/7aYLPFXVPz98CMmPHucbjeEr6t4qGYzeL+D8J/e/PXBBWOwcfkIbDp5R/p
	 ndJBYCe3YJagqzv+crqGjEcx8dj0BXWo8yUzpO8h2B484xxj83QPtEhzzub4Q0FcrkA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792682814;
	h=Received:DKIM-Signature:Received:X-Forwarded-Encrypted:
	 X-Gm-Message-State:X-Received:MIME-Version:References:In-Reply-To:
	 From:Date:X-Gmail-Original-Message-ID:X-Gm-Features:Message-ID:
	 Subject:To:Cc:Content-Type:Content-Transfer-Encoding;
	bh=mnm90cT9fJ9yIzn1u2BOkgljm5HClP1epGLUsBPzh9w=;
	b=JbaCWRZPHwvyzt3XzUnIRhqqRdklIgnEpP7iiR4I6AHqR3GIN7qLLf8h4jRcFp6Kuudy
	 29hwr9pztj5hyoIctM2DP2gLwT8trtdXemyQihMS2IIOXo7LkCOcFtK11yqVfUTF+ogVI
	 oT3VeDYY2f9z6A5yamZC79mFjSlHST4ZxcFo3kxiUBG7PCPCS8kZ+n/aL+cPiAF6+I90t
	 kLIN56jYxajP3C88yNW4IsBpHNKf4a9xexr2FrgEyR0eU2eGiDDCZXyKEESNVKi/WH2BH
	 1jT0ve9hIOL3bwaR4ycQysNSbatzUdEide9aBaWe8TSbBOo724Hw9p2a5M3NRQKn0Kg==
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=g2SqXrhv;
	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 91162606A31B
	for <netdev@vger.kernel.org>; Thu, 22 Oct 2026 15:26:53 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4162F1F031E5
	for <netdev@vger.kernel.org>; Thu, 22 Oct 2026 15:26:53 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1792682813;
	bh=mnm90cT9fJ9yIzn1u2BOkgljm5HClP1epGLUsBPzh9w=;
	h=References:In-Reply-To:From:Date:Subject:To:Cc;
	b=g2SqXrhvkHcTy1RGQkIhWO0tEkf3+v8Cz7qZVL1CVdFMmFt+Qh8jCchOmUHf8widV
	 fXKUPKDE1a4rKIHfH69ZmlctoApdZkVP3SMmzOr+GVBSNwHxGFB6FlbMO6jq/fkbUA
	 pRd4xSvQ+y26F9iwMdJsYbxS/AQUoHXeqj7e5/zH89hje1MXiTda+bs7OCWy06rxqc
	 Is2+m0V0AQRDbtAV/E0aCtuY4/Do8I3ufGdIo+N6ChVqs0Gb6hOvE3sKfeiUUlk0Za
	 NT6A91HBB8kHPlf++rrCJXx6IF2oA+zLWy9Jm8nJxm39xDgGMR+oetAiuRT4XbRYde
	 p0KopnEwxPujw==
X-Received: by mail-lj1-f177.google.com with SMTP id 38308e7fff4ca-3a5a26c8412so20642701fa.3
        for <netdev@vger.kernel.org>; Thu, 22 Oct 2026 08:26:53 -0700 (PDT)
X-Forwarded-Encrypted: i=1; AKwUvBySa4zGD9QwqcM3yZDKqvJytupiBsBxcC8hWOdZtFpp0UeoRRXpWsPDkBqQDNoS/8FGZoh4C4s=@vger.kernel.org
X-Gm-Message-State: AFq9FYLlqA4iP1+Q6kcH+V9dE2QZ04VO+t8tDgb/PcjGPhw1rLxupz96
	tf7LI+TjEEYmLJOPsTG/jzLzMwdvL9aQypw1UmTfaxHMJ1LqYJSKB4fIH+2Vo44tJ2Mc9He+s7h
	MczV/QXaQ6R5MhwtWKMwcSM0mw44Rne8=
X-Received: by 2002:a2e:b889:0:b0:3a5:e792:2dc8 with SMTP id
 38308e7fff4ca-3ac4418feb1mr16883001fa.16.1792682811916; Thu, 22 Oct 2026
 08:26:51 -0700 (PDT)
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
X-In-Reply-To: <CAL4WiipjAy2M5kok3bkB1Ny=9ryJvrWkt1jz_awuSoPY3Nx_vQ@mail.gmail.com>
X-Gmail-Original-Message-ID: <CAL4WiiqAeS8p-UWhiZwAG9sDmsrqWT+yataW0QiomQ-63m0SVg@mail.gmail.com>
X-Gm-Features: AclHuK-atW4cgN6Ufa7vK0c8jno8uTekEFo8Aretgm_gWVP5hjCdSvfweoV_oPI
X-Cc: Jiri Pirko <jiri@resnulli.us>, "David S . Miller" <davem@davemloft.net>, 
	Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, 
	Simon Horman <horms@kernel.org>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org