On Mon, May 29, 2023 at 3:08 AM Huang, Ying <ying.huang@xxxxxxxxx> wrote: > > Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx> writes: > > > syzbot is reporting lockdep warning in __stack_depot_save(), for > > the caller of __stack_depot_save() (i.e. __kasan_record_aux_stack() in > > this report) is responsible for masking __GFP_KSWAPD_RECLAIM flag in > > order not to wake kswapd which in turn wakes kcompactd. > > > > Since kasan/kmsan functions might be called with arbitrary locks held, > > mask __GFP_KSWAPD_RECLAIM flag from all GFP_NOWAIT/GFP_ATOMIC allocations > > in kasan/kmsan. > > > > Note that kmsan_save_stack_with_flags() is changed to mask both > > __GFP_DIRECT_RECLAIM flag and __GFP_KSWAPD_RECLAIM flag, for > > wakeup_kswapd() from wake_all_kswapds() from __alloc_pages_slowpath() > > calls wakeup_kcompactd() if __GFP_KSWAPD_RECLAIM flag is set and > > __GFP_DIRECT_RECLAIM flag is not set. > > > > Reported-by: syzbot <syzbot+ece2915262061d6e0ac1@xxxxxxxxxxxxxxxxxxxxxxxxx> > > Closes: https://syzkaller.appspot.com/bug?extid=ece2915262061d6e0ac1 > > Signed-off-by: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx> > > This looks good to me. Thanks! > > Reviewed-by: "Huang, Ying" <ying.huang@xxxxxxxxx> Sorry for the late reply, but maybe it would be better to mask this flag in __stack_depot_save() (lib/stackdepot.c) instead? We are already masking out a number of flags there, and the problem seems quite generic.