From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 119213909AC for ; Mon, 6 Apr 2026 17:12:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775495571; cv=none; b=eFtiU6pZNXyva7N1XxPzOikmyDrkucwOsWtglUdkUC3UtwwR/2mVT08jdjX/uxKfmDVkDn1MWYVEoIDLqkslet7RM+L204NAAS6ewGk59rYo9LQf8V0TemlWsL3GIl2PqTvfgxOFQRFruoZlNJtFNb92MdUQ31CV7Yy39Yuo9sE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775495571; c=relaxed/simple; bh=d42IIw+weYRwQ5HRi/h21uuLi5FFAQnCGKhreEp4H7w=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JlaKY3dQe8DXo/raEFD6QGZyUj6FfXEwm4B3RKLmvOeOzo1rVPd3tLMCw7NtOzSrRh/p1OisSGyq7RI8Qjr79+IlmuAJAgWS0fqYYUmP4hx9s9Ux7VZmy6sqCxLDuxqdIwP0CSINpXxCihRo5YAI6w9rOSNlVAS6UUumJA9x070= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=networkplumber.org; spf=pass smtp.mailfrom=networkplumber.org; dkim=pass (2048-bit key) header.d=networkplumber-org.20251104.gappssmtp.com header.i=@networkplumber-org.20251104.gappssmtp.com header.b=ZnXFG4Fp; arc=none smtp.client-ip=209.85.210.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=networkplumber.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=networkplumber.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=networkplumber-org.20251104.gappssmtp.com header.i=@networkplumber-org.20251104.gappssmtp.com header.b="ZnXFG4Fp" Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-8296dabef74so3981060b3a.1 for ; Mon, 06 Apr 2026 10:12:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20251104.gappssmtp.com; s=20251104; t=1775495567; x=1776100367; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=TSRY3MffZOgkoF8pneWM3oCokuMI5pTYVXcqEQr21cI=; b=ZnXFG4Fpz7uaNkM8Tph9oHHFcn2beygIBDweG31W+n2EMbSHIHVmpOhFdm59vQNp22 koFJh9gFNRd01Vv32At8T1s4IDT8L55v/lZI6OXEQ7wXBExuF/YoAl7NkOazUjFnHMVk bMdcPB3gz6JGD1Dg5UE6PCVzwZBK2FdGP+nigC/BB1k7MtqW5lLl1MvmeLfd2Av/SFgu vWH0MKXXdXuQzABQ3rMiD3r4emFVpHxvVvVxhCDL/A5mK5KC5NfAj37zbBvixqEMFtDi 8ql9zI3uT144f4mtIVY4MlOr2UZTLC6+qKRjTlWAtVpuGwEqKfr3z4TLEPtkJI/V7YAK BuaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775495567; x=1776100367; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=TSRY3MffZOgkoF8pneWM3oCokuMI5pTYVXcqEQr21cI=; b=OMGx/ryUrp+lCJik5N5UtPPDBQYipLUgJqjihm8MhSZn9/+QsqB1VNVqCtEDzOQb2h iploP6uUVEXiiXY6vaGpt+Kwd15Nw44+LdN59A+1beh0rsrZH8JoNY1oJRweEghTXdb1 gaHtvbAg9aSC+U5xLmEwdrQJVbmWb9o3GMGc1VmHpxD2zRVSaYTon04EqZvCAxwcxRq7 D34UA6jF10K/EYdkbiJ9AZYqzu/oXm5SG+ebR8WmA4EzifG/Hv9z0P2BorvZnzobOwDA g3RE/tjX1WgiFMpJqq5PyGajWUEBzQKoMp0Sgr5p5wOu0PfrzlnCAYShIh+jkgthTQlh CQfw== X-Forwarded-Encrypted: i=1; AJvYcCU9roKxeweigeZcaslX5DPnF2g4/Pyio6oehOOJhph45YWWjlw/3zDYOibVH/CeVcXvOSccvPOW3jBnPL8=@vger.kernel.org X-Gm-Message-State: AOJu0Yxwe5pealzcDz0NjOqB1gUCZsOp1YY8CtAh2MT4bxguuLZyCuey UMbKb83yn7lH++2Nf7Rcc430qJsSddMveFGG0f1KqcRqYs6cPpIDvn7+vFbzdODnxxs= X-Gm-Gg: AeBDieuq6C70k1Ik7urYuStuGris8O00Z6ov4axYUbC4IWhJkWKF9ZOoThXx+ScI6yb 2N+jqhg3UP5D6rTrH8aMazXjtqUA6or6yE+fPDaDdG8N3nXb1Opuf3Pr7UJnDdyOXjcifOTfztm aRMRPhQsDKviYaDFcSXQTd+vHDREiYPG+QWEsVBvUQfw57ZO7Td0nUiqgxnkhFrNsHBAXmGzb5R IYdf/voSZ+DSzO8M00r4kHGBcF0fcGZJd6JjFLw4W2JoUwJtuVoklejFnDoy3P3rQ1/OdApGKLc CGhlEhnoRaOHjXUIhhawE4mJOnLnwhDPWjMTlt15eu8/O91fL1wQJ80aYax1o3PghPavkSCYTPF +bhVLJFYnWS0q2uipWOQwZHEsdmZObjOoWXTBYev8YbUlFlLprfp0AuyJt2kY2WwIpbxzo5WSid sSlHbsyWJnl1OJ7mXSVM9AKPOxNRjohEwxnaw= X-Received: by 2002:a05:6a00:18a3:b0:81f:31c3:2e34 with SMTP id d2e1a72fcca58-82d0da90bc1mr13231550b3a.25.1775495567223; Mon, 06 Apr 2026 10:12:47 -0700 (PDT) Received: from phoenix.local ([104.202.41.210]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-82cf9b261b6sm17721564b3a.3.2026.04.06.10.12.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Apr 2026 10:12:46 -0700 (PDT) Date: Mon, 6 Apr 2026 10:12:38 -0700 From: Stephen Hemminger To: Jakub Kicinski Cc: Simon Horman , netdev@vger.kernel.org, Jamal Hadi Salim , Jiri Pirko , "David S. Miller" , Eric Dumazet , Paolo Abeni , open list Subject: Re: [PATCH net v3 4/7] net/sched: netem: restructure dequeue to avoid re-entrancy with child qdisc Message-ID: <20260406101238.2d106bfd@phoenix.local> In-Reply-To: <20260406084133.47bcfc8f@kernel.org> References: <20260402202037.176299-1-stephen@networkplumber.org> <20260402202037.176299-5-stephen@networkplumber.org> <20260404094946.GU113102@horms.kernel.org> <20260406084133.47bcfc8f@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Mon, 6 Apr 2026 08:41:33 -0700 Jakub Kicinski wrote: > On Sat, 4 Apr 2026 10:49:46 +0100 Simon Horman wrote: > > On Thu, Apr 02, 2026 at 01:19:32PM -0700, Stephen Hemminger wrote: > > > netem_dequeue() enqueues packets into its child qdisc while being > > > called from the parent's dequeue path. This causes two problems: > > > > > > - HFSC tracks class active/inactive state on qlen transitions. > > > A child enqueue during dequeue causes double-insertion into > > > the eltree (CVE-2025-37890, CVE-2025-38001). > > > > > > - Non-work-conserving children like TBF may refuse to dequeue > > > packets just enqueued, causing netem to return NULL despite > > > having backlog. Parents like DRR then incorrectly deactivate > > > the class. > > > > > > Split the dequeue into helpers: > > > > > > netem_pull_tfifo() - remove head packet from tfifo > > > netem_slot_account() - update slot pacing counters > > > netem_dequeue_child() - batch-transfer ready packets to the > > > child, then dequeue from the child > > > netem_dequeue_direct()- dequeue from tfifo when no child > > > > > > When a child qdisc is present, all time-ready packets are moved > > > into the child before calling its dequeue. This separates the > > > enqueue and dequeue phases so the parent sees consistent qlen > > > transitions. > > > > > > Fixes: 50612537e9ab ("netem: fix classful handling") > > > Signed-off-by: Stephen Hemminger > > > --- > > > net/sched/sch_netem.c | 201 +++++++++++++++++++++++++++--------------- > > > 1 file changed, 128 insertions(+), 73 deletions(-) > > > > Hi Stephen, > > > > As a fix this is a large and complex patch. > > Could it be split up somehow to aid review? > > +1, FWIW it's perfectly fine to have refactoring patch in a net series > (without a Fixes tag) if it makes the fix a lot easier to review. I split it into refactoring followed by fix for next version The fix alone just gets really confusing to look at; I got more confused the pre-existing spaghetti code here..