From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796059332; b=ED5UIAsyla73xYZkMCm+N8wOv3Jy3HQg0cvlhaYKQ/om3TNn9ajzGUdg2ioL1rTOhSQE eSswOYRBQFB/KqxwH48KUNjSldWE/kgqIIgpmPAIR9O7ZGOTpII7+GwymrsjWG5W01H8s xZBl3+2atPTpjmnstQRUUmHRWz3OSFnYjtnYh5rTEpvjR+/jVHlQb/5yZ0wwaXIF0snX9 KcPIvb3k4MZMebR8pYiLotKDKN1qC/xtfEP8jxfPFGnZ0kebIPIEK0IU901s/Is50+VnE r2SWDALf+bTZpoZYvHnXgFb/AoUyDl1C8TU7iTTjQnd5YIKHF7DSn78PaCEzDPwMLhQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796059332; h=DMARC-Filter:DKIM-Signature:Received:X-MC-Unique: X-Mimecast-MFC-AGG-ID:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received: X-Received:Received:Message-ID:Date:MIME-Version:User-Agent:Subject: To:Cc:References:Content-Language:From:In-Reply-To:Content-Type: Content-Transfer-Encoding; bh=AhsYTqRyEmlddsWfPrVeZsDXeRnCsktKeN5GfFh1H5o=; b=MDVHewoykwgoytNAPXSGvOFjDc8Sft10vQft/kHeJijiJhrRiIBZ9tZ/RjQ68yf08x/R ZJuZ+nqDrOOpRonC03VONY62p+sQWd5Xpr73ZMfwQDorFPtEF9x8pRBGiopxsYKH0SSky fQvSUZ1NfCYcCd8vd01PuS0YT6TvAcHkP+4TPMym9WEDscI5w2XlXoxz9FU8UjY/C1eFb ZZ0lf9SVFNTmn4OCY6F0HHth0blN5/1O8/pGRIjHBX/UvJ7bQdscZqzMe/wYqC3TxaAXZ DsJDtxBEFsupGFBRJViB3fiwLjL5GZzlQH6QNEhvYBmRxwb3tI0zL0qUZluZci6w8kw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=dxqAUm4P; dkim=pass header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=google header.b=F3B0LGql; arc=none smtp.remote-ip=170.10.133.124 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 47CC2606A6AC for ; Mon, 30 Nov 2026 17:22:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 47CC2606A6AC Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=dxqAUm4P; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=google header.b=F3B0LGql DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1796059331; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AhsYTqRyEmlddsWfPrVeZsDXeRnCsktKeN5GfFh1H5o=; b=dxqAUm4P0kgawBimQlaaiZPFABZdeKVXrVwtHCH2/2wTAHL6gNTumrfNwzrvpmmOeX3G6r cA88VxSArbHRPiCQ3g8T9YxOqw9qXJ1BFLz7O+6au2IEkN6zdsJoetSJh+uoaLgJoFbX4d mD2UojJgv2U0kuycqZ2dV1lCV+ewSYU= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-696-9Qi4VpYQP9m7NmUQVjvXww-1; Mon, 30 Nov 2026 17:22:09 +0000 X-MC-Unique: 9Qi4VpYQP9m7NmUQVjvXww-1 X-Mimecast-MFC-AGG-ID: 9Qi4VpYQP9m7NmUQVjvXww_1796059328 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4bb8da397aaso71530945e9.0 for ; Mon, 30 Nov 2026 09:22:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1796059328; x=1796664128; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=AhsYTqRyEmlddsWfPrVeZsDXeRnCsktKeN5GfFh1H5o=; b=F3B0LGqlcP+avttesoB9Dq1JGKMhCqTRLBx2/cS4i6oI3wcm8Q/AwD12D878KV4qHh pCibRELjRopuU5qqlpiRCSktvbND+LDBSpx5qQZIzgNEmESqj9fzATmLBo5vfasytf14 IKYv2WRkVwH9kMHHjbDW4wVCaJAIVPrH+Fh0tI58ZH+SpVSg+FhhcEYwi7HxQxceGQyr 8rbyedZ5Dz6n6tzP21RsN5KzeUTIpexZK8qrZW6Y/EBtR+NO2BIMQ4F1UwgDsJIGHDu1 pT0KpeJr1qSr6DmVkmaDw3ICZXEwtGNZxG9ZuAxPZNotucP8zm85rOTiiUmmyTDCncRO siuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796059328; x=1796664128; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject: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=AhsYTqRyEmlddsWfPrVeZsDXeRnCsktKeN5GfFh1H5o=; b=uvYzEMsBoLt+nhznEdA0XH/LFB5HiN+R1VZcA4lAKzn0sxNmWbb/PkOGvrCN+QGKEL oB6fjuLJ/zEwk9WfSeXFb6VG64mWGKCjUAdmUYRT+XWB+OPYnhGIV6pd61LUBDk2tDlB OmvXVYJiK8fSpPGNKQafCvK2xHDyuduUx1y96aLRZcMMqXcxtvOzNlW2RZWOm56Fg18G qDBhS1AXL8c8Q4Gx3TSek91XYxgPXYenU4lNsj6DeSQAHm5mqAPDPv3J9qtT0QcX4sX5 DaGxwwXm8CAuYCe5KtTe0oNDQOkvVz9WBgB5MHv0BZ8JzMwmFUY9ShX6e0abLjcuUI9h wTKg== X-Forwarded-Encrypted: i=1; AL+hErGhBq/2j9cJJhHI6+00ecBLo8xJPWp9nOgVU+z5J7+BdGAH05OW0auF0eV6H77p39mjH/tdW2uCg4ueGWU=@vger.kernel.org X-Gm-Message-State: APuU4Z9wh8Vji15/gc37DunyVZH/+6M7oGik8YKdGEVIEqrBE3WCN0XQ PCn7AYhQXEHSz+GmbKHLV/5K8XcsSGKG5xP8YcR5swDs72pEDpkTIYnSaYNxYD8+RZt9FMCfv34 bvxX3b0NaWd+8fJa8WJuVdQXRxaxAW973SsqU0m+e0vFgvgbdqv/F+xTtLpqd/hiWXg== X-Gm-Gg: AZFdTZdSOFPp4Z+bNbFoUxqqrrz18Z+wRLTKQGxa3cpF2oOdRa+ohiTn/+/JleilsdD 9slAR+1rV6mjz52F1uTdo8C2P7KFIXzfu6Ht/AeWkOrYrNW1qpCYbpxpu+A3flHkEp5VYDRCG1D m2IPNdbVjG8TRR5a5GixuaxjUzUZJBdZJPmoQd4UD3+kaVQU0m45Zx+/LcWFlB41b/B4oABSfTN Oa3e66zrGqM2P0Q13dKpLtUoOhPufinkPdc69ModvDIQXgpd0IdL5VYiBlzMWkRdDE9iCjyaRbf z+2VFEassiRWp9RGDisWVPIgpHPipu0u6fDCB8AZN5mQ2N6cknvJefZMBwP1TRo1nKhPqs7vA/s KexKR7O9E44VMVR9uyC69JOUg1D7mHCx4s/Je8tp3UMwhIFHmpAbbhuSO1szhk8QbiAf6aO5zHl uyhTKwz+bXIlI49aE35y3EQK9WahX3jd3zosLq1Bn1sXU9 X-Received: by 2002:a05:600c:8b6b:b0:4bb:5e8c:13bc with SMTP id 5b1f17b1804b1-4bbba61a187mr184162765e9.7.1796059328252; Mon, 30 Nov 2026 09:22:08 -0800 (PST) X-Received: by 2002:a05:600c:8b6b:b0:4bb:5e8c:13bc with SMTP id 5b1f17b1804b1-4bbba61a187mr184162215e9.7.1796059327890; Mon, 30 Nov 2026 09:22:07 -0800 (PST) Received: from [192.168.88.30] (ip231-128-192-82.pool-bba.aruba.it. [82.192.128.231]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb853a1e8bsm771075905e9.9.2026.11.30.09.22.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 30 Nov 2026 09:22:07 -0800 (PST) Message-ID: <7ecbb59e-d985-4b75-9240-ce83bcd87175@redhat.com> Date: Mon, 30 Nov 2026 18:22:06 +0100 X-Mailing-List: linux-kernel@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 Subject: Re: [PATCH v2 net] net/sched: sch_qfq: bound backward slot rotation To: jhs@mojatatu.com, jiri@resnulli.us, netdev@vger.kernel.org, Lin Jiapeng Cc: Lin Jiapeng , TencentOS Corvus AI , kuba@kernel.org, davem@davemloft.net, edumazet@kernel.org, paolo.valente@unimore.it, linux-kernel@vger.kernel.org, horms@kernel.org References: <20261124040208.13282-1-ljp1205831794@gmail.com> Content-Language: en-US From: Paolo Abeni In-Reply-To: <20261124040208.13282-1-ljp1205831794@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 11/24/26 05:01, Lin Jiapeng wrote: > From: Lin Jiapeng > > QFQ+ keeps aggregates in timestamp-ordered slots and rotates the > occupied-slot bitmap when a group's start time decreases, avoiding the > need to move the aggregates themselves. Insertions are capped so that > occupied slots leave room for a later backward adjustment. > > A stale aggregate can make the decrease larger than the slots can > represent. Rotation can then drop occupied bits or alias distinct logical > slots onto one physical hlist, and a later removal can clear bits in the > following slot-list pointers or leave stale bits. KASAN reports a > slab-use-after-free read of size 8 in qfq_choose_next_agg+0xd04/0xd90 by > task repro/92 after the corrupted group is selected, followed by a panic. > > Limit backward rotation using the highest occupied bit so every occupied > offset remains below QFQ_MAX_SLOTS. If the decrease exceeds that limit, > move the activating aggregate's S/F and rounded start time forward by the > same slot-aligned delta before rotating. This preserves its service > interval and the logical-to-physical slot mapping, including repeated > rotations, while leaving representable rotations unchanged. > > Fixes: 462dbc9101ac ("pkt_sched: QFQ Plus: fair-queueing service at DRR cost") > Reported-by: TencentOS Corvus AI > Link: https://lore.kernel.org/all/20261116121710.77403-1-ljp1205831794@gmail.com/ > Signed-off-by: Lin Jiapeng @Jamal: could you please have a look? It's totally unclear to me how the aggregates become state and if the issue could/should be addressed flushing such stale entries earlier. /P