Re: KASAN: null-ptr-deref Read in PageHuge
From: Mike Kravetz
Date: Fri Sep 18 2020 - 15:42:45 EST
On 9/18/20 4:02 AM, syzbot wrote:
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 6b02addb Add linux-next specific files for 20200915
> git tree: linux-next
> console output: https://syzkaller.appspot.com/x/log.txt?x=17a7441d900000
> kernel config: https://syzkaller.appspot.com/x/.config?x=7086d0e9e44d4a14
> dashboard link: https://syzkaller.appspot.com/bug?extid=3a21fd5ecfc677248e77
> compiler: gcc (GCC) 10.1.0-syz 20200507
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=141489f1900000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1694fd55900000
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+3a21fd5ecfc677248e77@xxxxxxxxxxxxxxxxxxxxxxxxx
>
> ==================================================================
> BUG: KASAN: null-ptr-deref in instrument_atomic_read include/linux/instrumented.h:71 [inline]
> BUG: KASAN: null-ptr-deref in test_bit include/asm-generic/bitops/instrumented-non-atomic.h:134 [inline]
> BUG: KASAN: null-ptr-deref in PageCompound include/linux/page-flags.h:196 [inline]
> BUG: KASAN: null-ptr-deref in PageHuge+0x19/0x170 mm/hugetlb.c:1551
> Read of size 8 at addr 0000000000000000 by task syz-executor410/6864
>
> CPU: 1 PID: 6864 Comm: syz-executor410 Not tainted 5.9.0-rc5-next-20200915-syzkaller #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
> Call Trace:
> __dump_stack lib/dump_stack.c:77 [inline]
> dump_stack+0x198/0x1fb lib/dump_stack.c:118
> __kasan_report mm/kasan/report.c:549 [inline]
> kasan_report.cold+0x5/0x37 mm/kasan/report.c:562
> check_memory_region_inline mm/kasan/generic.c:186 [inline]
> check_memory_region+0x13d/0x180 mm/kasan/generic.c:192
> instrument_atomic_read include/linux/instrumented.h:71 [inline]
> test_bit include/asm-generic/bitops/instrumented-non-atomic.h:134 [inline]
> PageCompound include/linux/page-flags.h:196 [inline]
> PageHuge+0x19/0x170 mm/hugetlb.c:1551
> find_subpage include/linux/pagemap.h:410 [inline]
> find_get_incore_page+0x165/0x2e0 mm/swap_state.c:435
> mincore_page+0x1e/0x310 mm/mincore.c:62
> __mincore_unmapped_range+0x171/0x2c0 mm/mincore.c:82
> mincore_pte_range+0x69f/0x980 mm/mincore.c:125
> walk_pmd_range mm/pagewalk.c:89 [inline]
> walk_pud_range mm/pagewalk.c:160 [inline]
> walk_p4d_range mm/pagewalk.c:193 [inline]
> walk_pgd_range mm/pagewalk.c:229 [inline]
> __walk_page_range+0xeed/0x22c0 mm/pagewalk.c:331
> walk_page_range+0x20d/0x400 mm/pagewalk.c:427
> do_mincore mm/mincore.c:199 [inline]
> __do_sys_mincore+0x279/0x7a0 mm/mincore.c:264
> do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
> entry_SYSCALL_64_after_hwframe+0x44/0xa9
> RIP: 0033:0x440329
> Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 7b 13 fc ff c3 66 2e 0f 1f 84 00 00 00 00
> RSP: 002b:00007ffe6fca7ae8 EFLAGS: 00000246 ORIG_RAX: 000000000000001b
> RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 0000000000440329
> RDX: 0000000000000000 RSI: 0000000000004000 RDI: 0000000020001000
> RBP: 00000000006ca018 R08: 0000000000000000 R09: 0000000000000000
> R10: 0000000000000003 R11: 0000000000000246 R12: 0000000000401b30
> R13: 0000000000401bc0 R14: 0000000000000000 R15: 0000000000000000
> ==================================================================
I assume this would also be fixed by 5d1903f712ac
("mm-convert-find_get_entry-to-return-the-head-page-fix")
--
Mike Kravetz