Re: INFO: rcu detected stall in blkdev_ioctl
If various stall reports regarding loop_set_fd() are hitting below sequence, a patch was proposed at https://groups.google.com/d/msg/syzkaller-bugs/5pzXJ8yQFR0/vWeRytaQBAAJ . -- #include #include #include #include #include int main(int argc, char *argv[]) { const int fd = open("/tmp/file", O_RDWR | O_CREAT | O_TRUNC, 0600); const int fd0 = open("/dev/loop0", O_RDONLY); const int fd1 = open("/dev/loop1", O_RDONLY); ioctl(fd0, LOOP_SET_FD, fd); ioctl(fd0, LOOP_CHANGE_FD, fd0); ioctl(fd1, LOOP_SET_FD, fd0); return 0; } --
Re: INFO: rcu detected stall in blkdev_ioctl
Like I noted in a patch at https://groups.google.com/d/msg/syzkaller-bugs/2Rw8-OM6IbM/PzdobV8kAgAJ loop module is not thread safe. Can we use more global lock?
Re: INFO: rcu detected stall in blkdev_ioctl
syzbot has found reproducer for the following crash on upstream commit d8a332730e757129e70675679f2b2a03f1ecf65e (Fri Apr 27 17:39:38 2018 +) Merge tag 'char-misc-4.17-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc syzbot dashboard link: https://syzkaller.appspot.com/bug?extid=369c35474963daf8f8eea897ecf33cb6ad6c7ea2 So far this crash happened 132 times on linux-next, mmots, upstream. C reproducer: https://syzkaller.appspot.com/x/repro.c?id=5968408013176832 syzkaller reproducer: https://syzkaller.appspot.com/x/repro.syz?id=5497672618213376 Raw console output: https://syzkaller.appspot.com/x/log.txt?id=4900987307294720 Kernel config: https://syzkaller.appspot.com/x/.config?id=7043958930931867332 compiler: gcc (GCC) 8.0.1 20180413 (experimental) IMPORTANT: if you fix the bug, please add the following tag to the commit: Reported-by: syzbot+369c35474963daf8f8eea897ecf33cb6ad6c7...@syzkaller.appspotmail.com It will help syzbot understand when the bug is fixed. random: sshd: uninitialized urandom read (32 bytes read) random: sshd: uninitialized urandom read (32 bytes read) random: sshd: uninitialized urandom read (32 bytes read) random: sshd: uninitialized urandom read (32 bytes read) random: sshd: uninitialized urandom read (32 bytes read) INFO: rcu_sched self-detected stall on CPU 0-: (124998 ticks this GP) idle=45e/1/4611686018427387906 softirq=9820/9820 fqs=31227 (t=125000 jiffies g=4939 c=4938 q=43) NMI backtrace for cpu 0 CPU: 0 PID: 4515 Comm: syz-executor699 Not tainted 4.17.0-rc2+ #20 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+0x1b9/0x294 lib/dump_stack.c:113 nmi_cpu_backtrace.cold.4+0x19/0xce lib/nmi_backtrace.c:103 nmi_trigger_cpumask_backtrace+0x151/0x192 lib/nmi_backtrace.c:62 arch_trigger_cpumask_backtrace+0x14/0x20 arch/x86/kernel/apic/hw_nmi.c:38 trigger_single_cpu_backtrace include/linux/nmi.h:156 [inline] rcu_dump_cpu_stacks+0x175/0x1c2 kernel/rcu/tree.c:1376 print_cpu_stall kernel/rcu/tree.c:1525 [inline] check_cpu_stall.isra.61.cold.80+0x36c/0x59a kernel/rcu/tree.c:1593 __rcu_pending kernel/rcu/tree.c:3356 [inline] rcu_pending kernel/rcu/tree.c:3401 [inline] rcu_check_callbacks+0x21b/0xad0 kernel/rcu/tree.c:2763 update_process_times+0x2d/0x70 kernel/time/timer.c:1636 tick_sched_handle+0x9f/0x180 kernel/time/tick-sched.c:173 tick_sched_timer+0x45/0x130 kernel/time/tick-sched.c:1283 __run_hrtimer kernel/time/hrtimer.c:1386 [inline] __hrtimer_run_queues+0x3e3/0x10a0 kernel/time/hrtimer.c:1448 hrtimer_interrupt+0x286/0x650 kernel/time/hrtimer.c:1506 local_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1025 [inline] smp_apic_timer_interrupt+0x15d/0x710 arch/x86/kernel/apic/apic.c:1050 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:863 RIP: 0010:is_loop_device drivers/block/loop.c:713 [inline] RIP: 0010:loop_set_fd drivers/block/loop.c:901 [inline] RIP: 0010:lo_ioctl+0x1bb4/0x2130 drivers/block/loop.c:1397 RSP: 0018:8801b37d7948 EFLAGS: 0293 ORIG_RAX: ff13 RAX: RBX: 8801d2930d80 RCX: 84b2b784 RDX: 0007 RSI: 0007 RDI: 0005 RBP: 8801b37d79c0 R08: 8801b2d52500 R09: ed003b5c46c2 R10: 0003 R11: 0001 R12: R13: 8801d4ff7418 R14: 8801b70936e0 R15: 8801b7093600 __blkdev_driver_ioctl block/ioctl.c:303 [inline] blkdev_ioctl+0x9b6/0x2020 block/ioctl.c:601 block_ioctl+0xee/0x130 fs/block_dev.c:1877 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:500 [inline] do_vfs_ioctl+0x1cf/0x16a0 fs/ioctl.c:684 ksys_ioctl+0xa9/0xd0 fs/ioctl.c:701 __do_sys_ioctl fs/ioctl.c:708 [inline] __se_sys_ioctl fs/ioctl.c:706 [inline] __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:706 do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x443e59 RSP: 002b:7fff93b51bd8 EFLAGS: 0217 ORIG_RAX: 0010 RAX: ffda RBX: 6f6f6c2f7665642f RCX: 00443e59 RDX: 0007 RSI: 4c00 RDI: 0008 RBP: 702f74656e2f666c R08: 004002e0 R09: 004002e0 R10: R11: 0217 R12: 65732f636f72702f R13: 00401b90 R14: R15: