Re: [Kernel Bug] KASAN: slab-use-after-free Read in __blkcg_rstat_flush
From: Ming Lei
Date: Tue Feb 03 2026 - 09:11:44 EST
On Tue, Feb 03, 2026 at 01:53:40PM +0100, Michal Koutný wrote:
> On Tue, Feb 03, 2026 at 07:11:11PM +0800, Ming Lei <ming.lei@xxxxxxxxxx> wrote:
> > RCU supports this way, here is just 2-stage RCU chain, and everything
> > is deterministic.
>
> The time when RCU callback runs is noisy, moreover when chained after
> each other.
> (I don't mean it doesn't work but it's debugging/testing nuisance. And
> it also looks awkward.)
IMO it is one correct & simple fix for this complicated race.
>
> > I thought about this way, but ->lqueued is lockless, and in theory the `blkg_iostat_set`
> > can be added again after WRITE_ONCE(bisc->lqueued, false) happens, so this way looks
> > fragile.
>
> Right, I brushed up on the cycles from the commit 20cb1c2fb7568
> ("blk-cgroup: Flush stats before releasing blkcg_gq") and it'd be a step
> back.
>
> Does anything prevent doing the each-cpu flush in blkg_release() (before
> __blkg_release())?
I can't parse your question, here blkg_release() simply needs to flush
all stats. Why do you talk about preventing new flush? why is it related
with this UAF?
Thanks,
Ming