From: Cong Wang <xiyou.wangcong@gmail.com>
To: Xiang Mei <xmei5@asu.edu>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>,
security@kernel.org,
Linux Kernel Network Developers <netdev@vger.kernel.org>
Subject: Re: sch_qfq: race conditon on qfq_aggregate (net/sched/sch_qfq.c)
Date: Thu, 3 Jul 2025 21:55:24 -0700 [thread overview]
Message-ID: <aGdevOopELhzlJvf@pop-os.localdomain> (raw)
In-Reply-To: <CAPpSM+QvO8LYVfSNDGesu4CUP0dBY+bumkxfbbuBQhYgddFaoQ@mail.gmail.com>
On Wed, Jul 02, 2025 at 12:41:36PM -0700, Xiang Mei wrote:
> On Mon, Jun 30, 2025 at 4:09 PM Cong Wang <xiyou.wangcong@gmail.com> wrote:
> >
> > Hi Xiang,
> >
> > On Mon, Jun 30, 2025 at 11:49:02AM -0700, Xiang Mei wrote:
> > > Thank you very much for your time. We've re-tested the PoC and
> > > confirmed it works on the latest kernels (6.12.35, 6.6.95, and
> > > 6.16-rc4).
> > >
> > > To help with reproduction, here are a few notes that might be useful:
> > > 1. The QFQ scheduler needs to be compiled into the kernel:
> > > $ scripts/config --enable CONFIG_NET_SCHED
> > > $ scripts/config --enable CONFIG_NET_SCH_QFQ
> > > 2. Since this is a race condition, the test environment should have at
> > > least two cores (e.g., -smp cores=2 for QEMU).
> > > 3. The PoC was compiled using: `gcc ./poc.c -o ./poc -w --static`
> > > 4. Before running the PoC, please check that the network interface
> > > "lo" is in the "up" state.
> > >
> > > Appreciate your feedback and patience.
> >
> > Thanks for your detailed report and efforts on reproducing it on the
> > latest kernel.
> >
> > I think we may have a bigger problem here, the sch_tree_lock() is to lock
> > the datapath, I doubt we really need to use sch_tree_lock() for
> > qfq->agg. _If_ it is only for control path, using RTNL lock + RCU lock
> > should be sufficient. We need a deeper review on the locking there.
>
> My experience focused on vulnerability exploitation, and I am very new
> to RCU. I have some questions about the possible RCU solution to this
> vulnerability:
>
> qfq->agg is used in both data path (qfq_change_agg was called in
> qfq_enqueue) and control path, which is not protected by RTNL lock.
> Does that mean we should use rcu_dereference_bh instead of
> rcu_dereference_rtnl or rcu_dereference?
Good finding! I think this is probably the reason why we are using
sch_tree_lock().
I have to say updating agg in enqueue() looks weird and anti-pattern,
but changing this requires more efforts, so we may have to defer it to
long term.
So, if we have to take sch_tree_lock(), what does your final patch look
like?
Thanks.
next prev parent reply other threads:[~2025-07-04 4:55 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAPpSM+SKOj9U8g_QsGp8M45dtEwvX4B_xdd7C0mP9pYu1b4mzA@mail.gmail.com>
2025-06-29 14:28 ` sch_qfq: race conditon on qfq_aggregate (net/sched/sch_qfq.c) Jamal Hadi Salim
2025-06-30 3:11 ` Xiang Mei
2025-06-30 11:36 ` Jamal Hadi Salim
2025-06-30 18:49 ` Xiang Mei
2025-06-30 23:09 ` Cong Wang
2025-07-01 2:52 ` Xiang Mei
2025-07-02 19:41 ` Xiang Mei
2025-07-04 4:55 ` Cong Wang [this message]
2025-07-05 22:39 ` [PATCH v1] net/sched: sch_qfq: Fix race condition on qfq_aggregate Xiang Mei
2025-07-05 22:49 ` Xiang Mei
2025-07-07 18:05 ` Cong Wang
2025-07-07 17:58 ` Jakub Kicinski
2025-07-07 23:42 ` Xiang Mei
2025-07-08 0:20 ` Jakub Kicinski
2025-07-07 18:03 ` Cong Wang
2025-07-08 0:05 ` Xiang Mei
2025-07-08 3:18 ` Willy Tarreau
2025-07-09 18:08 ` Xiang Mei
2025-07-09 18:06 ` [PATCH v2] " Xiang Mei
2025-07-09 20:19 ` Jakub Kicinski
2025-07-09 21:41 ` Xiang Mei
2025-07-09 21:54 ` Jakub Kicinski
2025-07-10 10:06 ` Xiang Mei
2025-07-10 21:18 ` Cong Wang
2025-07-10 22:45 ` Xiang Mei
2025-07-01 14:02 ` sch_qfq: race conditon on qfq_aggregate (net/sched/sch_qfq.c) Jamal Hadi Salim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aGdevOopELhzlJvf@pop-os.localdomain \
--to=xiyou.wangcong@gmail.com \
--cc=jhs@mojatatu.com \
--cc=netdev@vger.kernel.org \
--cc=security@kernel.org \
--cc=xmei5@asu.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox