Re: KASAN: out-of-bounds in update_curr

From: Dmitry Vyukov
Date: Tue Nov 27 2018 - 10:50:47 EST


On Tue, Nov 27, 2018 at 4:20 PM, syzbot
<syzbot+d3bf6aae26942dc9c8dc@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> Hello,
>
> syzbot found the following crash on:
>
> HEAD commit: 4bffc669d624 net: remove unsafe skb_insert()
> git tree: net-next
> console output: https://syzkaller.appspot.com/x/log.txt?x=1385db83400000
> kernel config: https://syzkaller.appspot.com/x/.config?x=c36a72af2123e78a
> dashboard link: https://syzkaller.appspot.com/bug?extid=d3bf6aae26942dc9c8dc
> compiler: gcc (GCC) 8.0.1 20180413 (experimental)
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=107b426d400000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11b2e533400000


>From reproducer it looks like something network related. So +netdev.
This also happened on net-next and there seems to be several memory-
corruption-looking crashes on net-next.


> IMPORTANT: if you fix the bug, please add the following tag to the commit:
> Reported-by: syzbot+d3bf6aae26942dc9c8dc@xxxxxxxxxxxxxxxxxxxxxxxxx
>
> DEBUG_LOCKS_WARN_ON(!hlock->nest_lock)
> ------------[ cut here ]------------
> Bad or missing usercopy whitelist? Kernel memory overwrite attempt detected
> to SLAB object 'task_struct' (offset 1432, size 2)!
> ==================================================================
> ------------[ cut here ]------------
> BUG: KASAN: out-of-bounds in calc_delta_fair kernel/sched/fair.c:630
> [inline]
> BUG: KASAN: out-of-bounds in update_curr+0x9c0/0xbd0 kernel/sched/fair.c:824
> kernel BUG at mm/slab.c:4425!
> Read of size 8 at addr ffff8881d9b4a4c0 by task ksoftirqd/0/9
> invalid opcode: 0000 [#1] PREEMPT SMP KASAN
>
> CPU: 1 PID: 38 Comm: ïïïÙïïïd ïïïïïï Not tainted 4.20.0-rc3+ #314
> CPU: 0 PID: 9 Comm: ksoftirqd/0 Not tainted 4.20.0-rc3+ #314
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 01/01/2011
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 01/01/2011
> RIP: 0010:__check_heap_object+0xa7/0xb5 mm/slab.c:4450
> Call Trace:
> Code: 48 c7 c7 5d df 14 89 e8 97 e3 0a 00 5d c3 41 8b 91 04 01 00 00 48 29
> c7 48 39 d7 77 be 48 01 d0 48 29 c8 48 39 f0 72 b3 5d c3 <0f> 0b 48 c7 c7 5d
> df 14 89 e8 fd eb 0a 00 44 89 e9 48 c7 c7 18 e0
> __dump_stack lib/dump_stack.c:77 [inline]
> dump_stack+0x244/0x39d lib/dump_stack.c:113
> RSP: 0018:ffff8881d9b49ea8 EFLAGS: 00010093
> RAX: 00000000000a57eb RBX: 1ffff1103b3693dc RCX: 000000000000000c
> RDX: ffff8881d9b4a440 RSI: 0000000000000001 RDI: ffff8881d9b4a088
> RBP: ffff8881d9b49ea8 R08: ffff8881d9b4a440 R09: ffff8881da970180
> print_address_description.cold.7+0x9/0x1ff mm/kasan/report.c:256
> R10: 000000004afd68ef R11: 0000000000000000 R12: ffff8881d9b4a088
> kasan_report_error mm/kasan/report.c:354 [inline]
> kasan_report.cold.8+0x242/0x309 mm/kasan/report.c:412
> R13: 0000000000000001 R14: ffffea000766d280 R15: 0000000000000001
> FS: 0000000000000000(0000) GS:ffff8881daf00000(0000) knlGS:0000000000000000
> __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433
> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> calc_delta_fair kernel/sched/fair.c:630 [inline]
> update_curr+0x9c0/0xbd0 kernel/sched/fair.c:824
> CR2: 0000000cffc5fa18 CR3: 00000001bfadf000 CR4: 00000000001406e0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> Call Trace:
> Modules linked in:
> ---[ end trace 04af116ff405efee ]---
> RIP: 0010:__check_heap_object+0xa7/0xb5 mm/slab.c:4450
> Code: 48 c7 c7 5d df 14 89 e8 97 e3 0a 00 5d c3 41 8b 91 04 01 00 00 48 29
> c7 48 39 d7 77 be 48 01 d0 48 29 c8 48 39 f0 72 b3 5d c3 <0f> 0b 48 c7 c7 5d
> df 14 89 e8 fd eb 0a 00 44 89 e9 48 c7 c7 18 e0
> RSP: 0018:ffff8881d9b49ea8 EFLAGS: 00010093
> RAX: 00000000000a57eb RBX: 1ffff1103b3693dc RCX: 000000000000000c
> enqueue_entity+0x3f5/0x20a0 kernel/sched/fair.c:3871
> RDX: ffff8881d9b4a440 RSI: 0000000000000001 RDI: ffff8881d9b4a088
> RBP: ffff8881d9b49ea8 R08: ffff8881d9b4a440 R09: ffff8881da970180
> R10: 000000004afd68ef R11: 0000000000000000 R12: ffff8881d9b4a088
> R13: 0000000000000001 R14: ffffea000766d280 R15: 0000000000000001
> FS: 0000000000000000(0000) GS:ffff8881daf00000(0000) knlGS:0000000000000000
> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 0000000cffc5fa18 CR3: 00000001bfadf000 CR4: 00000000001406e0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
>
>
> ---
> This bug is generated by a bot. It may contain errors.
> See https://goo.gl/tpsmEJ for more information about syzbot.
> syzbot engineers can be reached at syzkaller@xxxxxxxxxxxxxxxxx
>
> syzbot will keep track of this bug report. See:
> https://goo.gl/tpsmEJ#bug-status-tracking for how to communicate with
> syzbot.
> syzbot can test patches for this bug, for details see:
> https://goo.gl/tpsmEJ#testing-patches
>
> --
> You received this message because you are subscribed to the Google Groups
> "syzkaller-bugs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to syzkaller-bugs+unsubscribe@xxxxxxxxxxxxxxxxx
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/syzkaller-bugs/000000000000e10044057ba6fbcf%40google.com.
> For more options, visit https://groups.google.com/d/optout.