Re: [Kernel Bug] KASAN: slab-use-after-free Read in __blkcg_rstat_flush

From: Michal Koutný

Date: Tue Feb 03 2026 - 07:58:37 EST


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.)

> 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())?

Regards,
Michal

Attachment: signature.asc
Description: PGP signature