Re: [syzbot] KASAN: use-after-free Read in register_shrinker

From: Andrew Morton
Date: Wed Oct 12 2022 - 17:07:31 EST


On Wed, 12 Oct 2022 05:46:49 -0700 syzbot <syzbot+12320e263831dd4ddb91@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 2e30960097f6 bpf, x64: Remove unnecessary check on existen..
> git tree: bpf-next
> console output: https://syzkaller.appspot.com/x/log.txt?x=15934fbc880000
> kernel config: https://syzkaller.appspot.com/x/.config?x=796b7c2847a6866a
> dashboard link: https://syzkaller.appspot.com/bug?extid=12320e263831dd4ddb91
> compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1055b15c880000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1018112a880000
>
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/f0f073bdb6eb/disk-2e309600.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/6062312f63fe/vmlinux-2e309600.xz
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+12320e263831dd4ddb91@xxxxxxxxxxxxxxxxxxxxxxxxx
>
> ==================================================================
> BUG: KASAN: use-after-free in __list_add_valid+0xa5/0xb0 lib/list_debug.c:30
> Read of size 8 at addr ffff8880775905c8 by task syz-executor328/3786
>
> CPU: 1 PID: 3786 Comm: syz-executor328 Not tainted 6.0.0-syzkaller-02744-g2e30960097f6 #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022
> Call Trace:
> <TASK>
> __dump_stack lib/dump_stack.c:88 [inline]
> dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
> print_address_description mm/kasan/report.c:317 [inline]
> print_report.cold+0x2ba/0x719 mm/kasan/report.c:433
> kasan_report+0xb1/0x1e0 mm/kasan/report.c:495
> __list_add_valid+0xa5/0xb0 lib/list_debug.c:30
> __list_add include/linux/list.h:69 [inline]
> list_add_tail include/linux/list.h:102 [inline]
> register_shrinker_prepared mm/vmscan.c:684 [inline]

I trust that tree didn't have this fix?

commit bd86c69dae65de30f6d47249418ba7889809e31a
Author: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx>
Date: Mon Oct 10 14:59:02 2022 +0900

NFSD: unregister shrinker when nfsd_init_net() fails