Re: WARNING in free_kthread_struct

From: Dmitry Vyukov
Date: Tue Nov 07 2017 - 09:55:07 EST


On Tue, Nov 7, 2017 at 3:46 PM, syzbot
<bot+28a52b4b1430f7b2e8ced22340031dab2a0e728a@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:
> Hello,
>
> syzkaller hit the following crash on
> 0f611fb6dcc0d6d91b4e1fec911321f434a3b858
> git://git.cmpxchg.org/linux-mmots.git/master
> compiler: gcc (GCC) 7.1.1 20170620
> .config is attached
> Raw console output is attached.
> C reproducer is attached
> syzkaller reproducer is attached. See https://goo.gl/kgGztJ
> for information about syzkaller reproducers


This also happens on linux-next (e.g. on current HEAD
8b82a8a7ab53ee1a065ac69c835737a701f46b2e), but not on Linus tree.

Seems to be added by :

commit 05e3db95ebfc5c06a29a1d8c7a3e02f46f3a25a7
Author: Shaohua Li
Date: Thu Sep 14 14:02:04 2017 -0700
kthread: add a mechanism to store cgroup info

This severe hurts our testing, so far this crashed 133565 VMs.



> WARNING: CPU: 0 PID: 4918 at kernel/kthread.c:87
> free_kthread_struct+0xa2/0xe0 kernel/kthread.c:87
> Kernel panic - not syncing: panic_on_warn set ...
>
> CPU: 0 PID: 4918 Comm: modprobe Not tainted 4.14.0-rc5-mm1+ #20
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 01/01/2011
> Call Trace:
> <IRQ>
> __dump_stack lib/dump_stack.c:16 [inline]
> dump_stack+0x194/0x257 lib/dump_stack.c:52
> panic+0x1e4/0x41c kernel/panic.c:183
> __warn+0x1c4/0x1e0 kernel/panic.c:546
> report_bug+0x211/0x2d0 lib/bug.c:183
> fixup_bug+0x40/0x90 arch/x86/kernel/traps.c:177
> do_trap_no_signal arch/x86/kernel/traps.c:211 [inline]
> do_trap+0x260/0x390 arch/x86/kernel/traps.c:260
> do_error_trap+0x120/0x390 arch/x86/kernel/traps.c:297
> do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:310
> invalid_op+0x18/0x20 arch/x86/entry/entry_64.S:905
> RIP: 0010:free_kthread_struct+0xa2/0xe0 kernel/kthread.c:87
> RSP: 0000:ffff8801db207768 EFLAGS: 00010206
> RAX: ffff8801c431e680 RBX: ffff8801c548f400 RCX: ffffffff8148d7e2
> RDX: 0000000000000100 RSI: 0000000000000000 RDI: ffff8801c548f4b8
> RBP: ffff8801db207770 R08: 0000000000000001 R09: 1ffff1003b640edc
> R10: ffff8801db2076a8 R11: 0000000000000004 R12: 1ffff1003b640ef0
> R13: 1ffff1003b640ef4 R14: 0000000000000000 R15: ffff8801db2077e0
> free_task+0x134/0x1a0 kernel/fork.c:390
> __put_task_struct+0x229/0x3b0 kernel/fork.c:668
> put_task_struct include/linux/sched/task.h:95 [inline]
> delayed_put_task_struct+0xca/0x3d0 kernel/exit.c:180
> __rcu_reclaim kernel/rcu/rcu.h:172 [inline]
> rcu_do_batch kernel/rcu/tree.c:2676 [inline]
> invoke_rcu_callbacks kernel/rcu/tree.c:2930 [inline]
> __rcu_process_callbacks kernel/rcu/tree.c:2897 [inline]
> rcu_process_callbacks+0xd74/0x17d0 kernel/rcu/tree.c:2914
> __do_softirq+0x2d7/0xb85 kernel/softirq.c:284
> invoke_softirq kernel/softirq.c:364 [inline]
> irq_exit+0x1cc/0x200 kernel/softirq.c:405
> exiting_irq arch/x86/include/asm/apic.h:540 [inline]
> smp_apic_timer_interrupt+0x16b/0x700 arch/x86/kernel/apic/apic.c:1052
> apic_timer_interrupt+0x9d/0xb0 arch/x86/entry/entry_64.S:770
> </IRQ>
> RIP: 0010:__read_once_size include/linux/compiler.h:276 [inline]
> RIP: 0010:compound_head include/linux/page-flags.h:146 [inline]
> RIP: 0010:PageSwapBacked include/linux/page-flags.h:287 [inline]
> RIP: 0010:mm_counter_file include/linux/mm.h:1522 [inline]
> RIP: 0010:alloc_set_pte+0x71a/0x1880 mm/memory.c:3420
> RSP: 0000:ffff8801c402f3e0 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff11
> RAX: dffffc0000000000 RBX: ffff8801c402fb80 RCX: ffffffff81987189
> RDX: 1ffff10038805e98 RSI: ffffea00076cb000 RDI: ffffea00076cb020
> RBP: ffff8801c402f528 R08: 0000000000000001 R09: 1ffff10038805e0a
> R10: ffff8801c402ef88 R11: 0000000000000003 R12: 1ffff10038805e84
> R13: 1ffff10038805e98 R14: 0000000000000025 R15: ffffea00076cafe0
> filemap_map_pages+0x1080/0x15d0 mm/filemap.c:2680
> do_fault_around mm/memory.c:3567 [inline]
> do_read_fault mm/memory.c:3601 [inline]
> do_fault mm/memory.c:3706 [inline]
> handle_pte_fault mm/memory.c:3936 [inline]
> __handle_mm_fault+0x1f57/0x39c0 mm/memory.c:4060
> handle_mm_fault+0x334/0x8d0 mm/memory.c:4097
> __do_page_fault+0x5bd/0xd60 arch/x86/mm/fault.c:1438
> do_page_fault+0xee/0x720 arch/x86/mm/fault.c:1514
> page_fault+0x22/0x30 arch/x86/entry/entry_64.S:1066
> RIP: 0033:0x7fe25f595390
> RSP: 002b:00007ffeb59a5f08 EFLAGS: 00010202
> RAX: 0000000000000000 RBX: 00007ffeb59a72a8 RCX: 0000563871b59660
> RDX: 00005638719547f0 RSI: 00007ffeb59a72a8 RDI: 0000000000000004
> RBP: 00007ffeb59a72a8 R08: 00007ffeb59a5f7c R09: 0000000000000000
> R10: 0000000000000000 R11: 00007fe25f595390 R12: 0000000000000004
> R13: 0000563871954608 R14: 0000000000000000 R15: 0000000000000000
> Dumping ftrace buffer:
> (ftrace buffer empty)
> Kernel Offset: disabled
> Rebooting in 86400 seconds..
>
>
> ---
> This bug is generated by a dumb bot. It may contain errors.
> See https://goo.gl/tpsmEJ for details.
> Direct all questions to syzkaller@xxxxxxxxxxxxxxxxx
> Please credit me with: Reported-by: syzbot <syzkaller@xxxxxxxxxxxxxxxx>
>
> syzbot will keep track of this bug report.
> Once a fix for this bug is committed, please reply to this email with:
> #syz fix: exact-commit-title
> To mark this as a duplicate of another syzbot report, please reply with:
> #syz dup: exact-subject-of-another-report
> If it's a one-off invalid bug report, please reply with:
> #syz invalid
> Note: if the crash happens again, it will cause creation of a new bug
> report.
> Note: all commands must start from beginning of the line.
>
> --
> 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/001a113ffe5a30836e055d65a1c5%40google.com.
> For more options, visit https://groups.google.com/d/optout.