public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Xiang Mei <xmei5@asu.edu>
To: Cong Wang <xiyou.wangcong@gmail.com>
Cc: netdev@vger.kernel.org, gregkh@linuxfoundation.org,
	jhs@mojatatu.com, jiri@resnulli.us, security@kernel.org
Subject: Re: [PATCH v1] net/sched: sch_qfq: Fix race condition on qfq_aggregate
Date: Mon, 7 Jul 2025 17:05:33 -0700	[thread overview]
Message-ID: <aGxgzS2dZo8fKUw5@xps> (raw)
In-Reply-To: <aGwMBj5BBRuITOlA@pop-os.localdomain>

On Mon, Jul 07, 2025 at 11:03:50AM -0700, Cong Wang wrote:
> On Sat, Jul 05, 2025 at 03:39:58PM -0700, Xiang Mei wrote:
> > A race condition can occur when 'agg' is modified in qfq_change_agg
> > (called during qfq_enqueue) while other threads access it
> > concurrently. For example, qfq_dump_class may trigger a NULL
> > dereference, and qfq_delete_class may cause a use-after-free.
> > 
> > This patch addresses the issue by:
> > 
> > 1. Moved qfq_destroy_class into the critical section.
> > 
> > 2. Added sch_tree_lock protection to qfq_dump_class and
> > qfq_dump_class_stats.
> > 
> > Signed-off-by: Xiang Mei <xmei5@asu.edu>
> 
> Although holding sch_tree_lock() for control path is generally not
> elegant, this is clearly not your fault, the current code is already so.
> Converting to RCU requires more efforts, so it should be deferred to
> long term (net-next).
> 
> So as a bug fix, this patch is okay.

Appreciate your code review and guides for the recent two qfq patches.
I'll try to provide a RCU implementation on RCU after I triage other found 
 bugs.

> 
> Reviewed-by: Cong Wang <xiyou.wangcong@gmail.com>
> 
> (I assume you tested it with all tdc selftests.)

The patched version passed the tc-testing and my pocs can't trigger the 
bug after patching.

> 
> Thanks!

I have two more questions:

1) Is the patch provider the person who usually adds the "Reported-by" tag?

2) Am I allowed to request a CVE number for this race condition bug?

Triggering this race condition requires "unprivileged user namespaces"
(net_admin) and the bug can lead to privilege escaping 
(refcnt issue -> UAF).

Thanks,
Xiang

  reply	other threads:[~2025-07-08  0:05 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
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 [this message]
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=aGxgzS2dZo8fKUw5@xps \
    --to=xmei5@asu.edu \
    --cc=gregkh@linuxfoundation.org \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=netdev@vger.kernel.org \
    --cc=security@kernel.org \
    --cc=xiyou.wangcong@gmail.com \
    /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