Re: [PATCH] gfs2: fix uaf in glock shrinker
From: Andreas Gruenbacher
Date: Thu May 20 2021 - 07:50:22 EST
On Wed, May 19, 2021 at 8:08 AM Hillf Danton <hdanton@xxxxxxxx> wrote:
> The GLF_LRU flag is checked under lru_lock in gfs2_glock_remove_from_lru() to
> remove glock from the lru list in __gfs2_glock_put().
>
> On the shrink scan path, the same flag is cleared under lru_lock but because
> of cond_resched_lock(&lru_lock) in gfs2_dispose_glock_lru() progress on the
> put side can be made without deleting glock from lru.
>
> Keep GLF_LRU across the race window opened by cond_resched_lock(&lru_lock) to
> ensure correct behaviors on both sides - clear GLF_LRU after list_del under
> lru_lock. That is the fix to uaf reported by the smart syzbot.
Thanks, I've added this to for-next.
Andreas