syzbot


KASAN: stack-out-of-bounds Read in process_one_work

Status: closed as dup on 2019/01/14 17:06
Subsystems: kernel
[Documentation on labels]
Reported-by: syzbot+f1c14c09621d0f85d6ec@syzkaller.appspotmail.com
First crash: 2175d, last: 2175d
Duplicate of
Title Repro Cause bisect Fix bisect Count Last Reported
kernel panic: stack is corrupted in udp4_lib_lookup2 net 11 2187d 2184d

Sample crash report:
==================================================================
kasan: CONFIG_KASAN_INLINE enabled
BUG: KASAN: stack-out-of-bounds in hlist_del_init include/linux/list.h:716 [inline]
BUG: KASAN: stack-out-of-bounds in hash_del include/linux/hashtable.h:107 [inline]
BUG: KASAN: stack-out-of-bounds in process_one_work+0x1bab/0x1ce0 kernel/workqueue.c:2188
kasan: GPF could be caused by NULL-ptr deref or user memory access
Read of size 8 at addr ffff8880a9de1508 by task kworker/u4:1/21
general protection fault: 0000 [#1] PREEMPT SMP KASAN

CPU: 0 PID: 1734894600 Comm: ¿ Not tainted 4.20.0+ #3
CPU: 1 PID: 21 Comm: kworker/u4:1 Not tainted 4.20.0+ #3
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:__read_once_size include/linux/compiler.h:191 [inline]
RIP: 0010:get_running_cputimer include/linux/sched/cputime.h:85 [inline]
RIP: 0010:account_group_system_time include/linux/sched/cputime.h:149 [inline]
RIP: 0010:account_system_index_time+0xe8/0x5f0 kernel/sched/cputime.c:168
Call Trace:
Code: 04 00 00 49 8b 84 24 00 07 00 00 48 ba 00 00 00 00 00 fc ff df 48 8d b8 40 01 00 00 48 8d 88 28 01 00 00 48 89 fe 48 c1 ee 03 <0f> b6 14 16 48 89 fe 83 e6 07 40 38 f2 7f 08 84 d2 0f 85 93 03 00
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1db/0x2d0 lib/dump_stack.c:113
RSP: 0018:ffff8880ae607a80 EFLAGS: 00010006
RAX: 0000000000000000 RBX: 1ffff11015cc0f54 RCX: 0000000000000128
RDX: dffffc0000000000 RSI: 0000000000000028 RDI: 0000000000000140
RBP: ffff8880ae607b48 R08: ffff8880ae61f5f0 R09: ffffffff8a99f01d
 print_address_description.cold+0x7c/0x20d mm/kasan/report.c:256
R10: ffffffff8a99f010 R11: 0000000000000001 R12: ffff8880a9e62240
R13: 0000000000982d5e R14: 0000000000000003 R15: ffff8880ae607b20
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report mm/kasan/report.c:412 [inline]
 kasan_report.cold+0x8c/0x2ba mm/kasan/report.c:396
FS:  0000000000000000(0000) GS:ffff8880ae600000(0000) knlGS:0000000000000000
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000068 CR3: 000000008d181000 CR4: 00000000001406f0
 hlist_del_init include/linux/list.h:716 [inline]
 hash_del include/linux/hashtable.h:107 [inline]
 process_one_work+0x1bab/0x1ce0 kernel/workqueue.c:2188
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <IRQ>
 irqtime_account_process_tick.isra.0+0x3a2/0x490 kernel/sched/cputime.c:380
 account_process_tick+0x27f/0x350 kernel/sched/cputime.c:483
 update_process_times+0x25/0x80 kernel/time/timer.c:1633
 worker_thread+0x143/0x14a0 kernel/workqueue.c:2296
 tick_sched_handle+0xa2/0x190 kernel/time/tick-sched.c:161
 tick_sched_timer+0x47/0x130 kernel/time/tick-sched.c:1271
 __run_hrtimer kernel/time/hrtimer.c:1389 [inline]
 __hrtimer_run_queues+0x3a7/0x1050 kernel/time/hrtimer.c:1451
 hrtimer_interrupt+0x314/0x770 kernel/time/hrtimer.c:1509
 local_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1035 [inline]
 smp_apic_timer_interrupt+0x18d/0x760 arch/x86/kernel/apic/apic.c:1060
 kthread+0x357/0x430 kernel/kthread.c:246
 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:352

Allocated by task 2842273024:
 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:807
 </IRQ>
Modules linked in:

======================================================
WARNING: possible circular locking dependency detected
4.20.0+ #3 Not tainted
------------------------------------------------------
kworker/u4:1/21 is trying to acquire lock:
000000003b79617c (console_owner){-.-.}, at: log_next kernel/printk/printk.c:492 [inline]
000000003b79617c (console_owner){-.-.}, at: console_unlock+0x4d3/0x11e0 kernel/printk/printk.c:2395

but task is already holding lock:
00000000e2db80d7 (report_lock){....}, at: kasan_start_report mm/kasan/report.c:170 [inline]
00000000e2db80d7 (report_lock){....}, at: kasan_report_error mm/kasan/report.c:346 [inline]
00000000e2db80d7 (report_lock){....}, at: kasan_report mm/kasan/report.c:412 [inline]
00000000e2db80d7 (report_lock){....}, at: kasan_report+0x8d/0x110 mm/kasan/report.c:396

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #4 (report_lock){....}:
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
       _raw_spin_lock_irqsave+0x95/0xcd kernel/locking/spinlock.c:152
       kasan_start_report mm/kasan/report.c:170 [inline]
       kasan_report_error mm/kasan/report.c:346 [inline]
       kasan_report mm/kasan/report.c:412 [inline]
       kasan_report+0x8d/0x110 mm/kasan/report.c:396
       __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433
       hlist_del_init include/linux/list.h:716 [inline]
       hash_del include/linux/hashtable.h:107 [inline]
       process_one_work+0x1bab/0x1ce0 kernel/workqueue.c:2188
       worker_thread+0x143/0x14a0 kernel/workqueue.c:2296
       kthread+0x357/0x430 kernel/kthread.c:246
       ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:352

-> #3 (&pool->lock/1){..-.}:
       __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline]
       _raw_spin_lock+0x2f/0x40 kernel/locking/spinlock.c:144
       spin_lock include/linux/spinlock.h:329 [inline]
       __queue_work+0x2d9/0x1450 kernel/workqueue.c:1417
       queue_work_on+0x192/0x200 kernel/workqueue.c:1486
       queue_work include/linux/workqueue.h:512 [inline]
       tty_schedule_flip+0x149/0x1e0 drivers/tty/tty_buffer.c:413
       tty_flip_buffer_push+0x16/0x20 drivers/tty/tty_buffer.c:556
       pty_write+0x1a6/0x200 drivers/tty/pty.c:125
       n_tty_write+0xb9e/0x11d0 drivers/tty/n_tty.c:2354
       do_tty_write drivers/tty/tty_io.c:959 [inline]
       tty_write+0x45b/0x7a0 drivers/tty/tty_io.c:1043
       __vfs_write+0x116/0xa80 fs/read_write.c:485
       vfs_write+0x20c/0x560 fs/read_write.c:549
       ksys_write+0x105/0x260 fs/read_write.c:598
       __do_sys_write fs/read_write.c:610 [inline]
       __se_sys_write fs/read_write.c:607 [inline]
       __x64_sys_write+0x73/0xb0 fs/read_write.c:607
       do_syscall_64+0x1a3/0x800 arch/x86/entry/common.c:290
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

-> #2 (&(&port->lock)->rlock){-.-.}:
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
       _raw_spin_lock_irqsave+0x95/0xcd kernel/locking/spinlock.c:152
       tty_port_tty_get+0x22/0x80 drivers/tty/tty_port.c:287
       tty_port_default_wakeup+0x16/0x40 drivers/tty/tty_port.c:47
       tty_port_tty_wakeup+0x5d/0x70 drivers/tty/tty_port.c:387
       uart_write_wakeup+0x46/0x70 drivers/tty/serial/serial_core.c:103
       serial8250_tx_chars+0x4a4/0xb20 drivers/tty/serial/8250/8250_port.c:1806
       serial8250_handle_irq.part.0+0x1e2/0x270 drivers/tty/serial/8250/8250_port.c:1879
       serial8250_handle_irq drivers/tty/serial/8250/8250_port.c:1865 [inline]
       serial8250_default_handle_irq+0xc5/0x150 drivers/tty/serial/8250/8250_port.c:1895
       serial8250_interrupt+0xfb/0x1a0 drivers/tty/serial/8250/8250_core.c:125
       __handle_irq_event_percpu+0x1c6/0xb10 kernel/irq/handle.c:149
       handle_irq_event_percpu+0xa0/0x1d0 kernel/irq/handle.c:189
       handle_irq_event+0xa7/0x134 kernel/irq/handle.c:206
       handle_edge_irq+0x232/0x8a0 kernel/irq/chip.c:791
       generic_handle_irq_desc include/linux/irqdesc.h:154 [inline]
       handle_irq+0x252/0x3d8 arch/x86/kernel/irq_64.c:78
       do_IRQ+0x99/0x1d0 arch/x86/kernel/irq.c:246
       ret_from_intr+0x0/0x1e
       native_safe_halt+0x2/0x10 arch/x86/include/asm/irqflags.h:57
       arch_cpu_idle+0x10/0x20 arch/x86/kernel/process.c:555
       default_idle_call+0x36/0x90 kernel/sched/idle.c:93
       cpuidle_idle_call kernel/sched/idle.c:153 [inline]
       do_idle+0x386/0x5d0 kernel/sched/idle.c:262
       cpu_startup_entry+0x1b/0x20 kernel/sched/idle.c:353
       start_secondary+0x435/0x620 arch/x86/kernel/smpboot.c:271
       secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:243

-> #1 (&port_lock_key){-.-.}:
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
       _raw_spin_lock_irqsave+0x95/0xcd kernel/locking/spinlock.c:152
       serial8250_console_write+0x894/0xb00 drivers/tty/serial/8250/8250_port.c:3247
       univ8250_console_write+0x5f/0x70 drivers/tty/serial/8250/8250_core.c:586
       call_console_drivers kernel/printk/printk.c:1737 [inline]
       console_unlock+0xcff/0x11e0 kernel/printk/printk.c:2408
       vprintk_emit+0x370/0x960 kernel/printk/printk.c:1931
       vprintk_default+0x28/0x30 kernel/printk/printk.c:1958
       vprintk_func+0x7e/0x189 kernel/printk/printk_safe.c:398
       printk+0xba/0xed kernel/printk/printk.c:1991
       register_console+0x74d/0xb50 kernel/printk/printk.c:2723
       univ8250_console_init+0x3e/0x4b drivers/tty/serial/8250/8250_core.c:681
       console_init+0x6b7/0x9fe kernel/printk/printk.c:2809
       start_kernel+0x5da/0x8bd init/main.c:667
       x86_64_start_reservations+0x29/0x2b arch/x86/kernel/head64.c:470
       x86_64_start_kernel+0x77/0x7b arch/x86/kernel/head64.c:451
       secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:243

-> #0 (console_owner){-.-.}:
       lock_acquire+0x1db/0x570 kernel/locking/lockdep.c:3841
       console_lock_spinning_enable kernel/printk/printk.c:1600 [inline]
       console_unlock+0x53d/0x11e0 kernel/printk/printk.c:2405
       vprintk_emit+0x370/0x960 kernel/printk/printk.c:1931
       vprintk_default+0x28/0x30 kernel/printk/printk.c:1958
       vprintk_func+0x7e/0x189 kernel/printk/printk_safe.c:398
       printk+0xba/0xed kernel/printk/printk.c:1991
       kasan_start_report mm/kasan/report.c:171 [inline]
       kasan_report_error mm/kasan/report.c:346 [inline]
       kasan_report mm/kasan/report.c:412 [inline]
       kasan_report+0x9d/0x110 mm/kasan/report.c:396
       __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433
       hlist_del_init include/linux/list.h:716 [inline]
       hash_del include/linux/hashtable.h:107 [inline]
       process_one_work+0x1bab/0x1ce0 kernel/workqueue.c:2188
       worker_thread+0x143/0x14a0 kernel/workqueue.c:2296
       kthread+0x357/0x430 kernel/kthread.c:246
       ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:352

other info that might help us debug this:

Chain exists of:
  console_owner --> &pool->lock/1 --> report_lock

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(report_lock);
                               lock(&pool->lock/1);
                               lock(report_lock);
  lock(console_owner);

 *** DEADLOCK ***

3 locks held by kworker/u4:1/21:
 #0: 0000000067b1518f (&pool->lock/1){..-.}, at: spin_lock_irq include/linux/spinlock.h:354 [inline]
 #0: 0000000067b1518f (&pool->lock/1){..-.}, at: process_one_work+0xe68/0x1ce0 kernel/workqueue.c:2181
 #1: 00000000e2db80d7 (report_lock){....}, at: kasan_start_report mm/kasan/report.c:170 [inline]
 #1: 00000000e2db80d7 (report_lock){....}, at: kasan_report_error mm/kasan/report.c:346 [inline]
 #1: 00000000e2db80d7 (report_lock){....}, at: kasan_report mm/kasan/report.c:412 [inline]
 #1: 00000000e2db80d7 (report_lock){....}, at: kasan_report+0x8d/0x110 mm/kasan/report.c:396
 #2: 00000000144cf159 (console_lock){+.+.}, at: console_trylock_spinning kernel/printk/printk.c:1662 [inline]
 #2: 00000000144cf159 (console_lock){+.+.}, at: vprintk_emit+0x351/0x960 kernel/printk/printk.c:1930

stack backtrace:
CPU: 1 PID: 21 Comm: kworker/u4:1 Not tainted 4.20.0+ #3
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+0x1db/0x2d0 lib/dump_stack.c:113
 print_circular_bug.isra.0.cold+0x1cc/0x28f kernel/locking/lockdep.c:1224
 check_prev_add kernel/locking/lockdep.c:1866 [inline]
 check_prevs_add kernel/locking/lockdep.c:1979 [inline]
 validate_chain kernel/locking/lockdep.c:2350 [inline]
 __lock_acquire+0x3014/0x4a30 kernel/locking/lockdep.c:3338
 lock_acquire+0x1db/0x570 kernel/locking/lockdep.c:3841
 console_lock_spinning_enable kernel/printk/printk.c:1600 [inline]
 console_unlock+0x53d/0x11e0 kernel/printk/printk.c:2405
 vprintk_emit+0x370/0x960 kernel/printk/printk.c:1931
 vprintk_default+0x28/0x30 kernel/printk/printk.c:1958
 vprintk_func+0x7e/0x189 kernel/printk/printk_safe.c:398
 printk+0xba/0xed kernel/printk/printk.c:1991
 kasan_start_report mm/kasan/report.c:171 [inline]
 kasan_report_error mm/kasan/report.c:346 [inline]
 kasan_report mm/kasan/report.c:412 [inline]
 kasan_report+0x9d/0x110 mm/kasan/report.c:396
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433
 hlist_del_init include/linux/list.h:716 [inline]
 hash_del include/linux/hashtable.h:107 [inline]
 process_one_work+0x1bab/0x1ce0 kernel/workqueue.c:2188
 worker_thread+0x143/0x14a0 kernel/workqueue.c:2296
 kthread+0x357/0x430 kernel/kthread.c:246
 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:352
---[ end trace be49151e898d3ba7 ]---
BUG: unable to handle kernel paging request at ffffffff8cac6ad0
#PF error: [normal kernel read fault]
RIP: 0010:__read_once_size include/linux/compiler.h:191 [inline]
RIP: 0010:get_running_cputimer include/linux/sched/cputime.h:85 [inline]
RIP: 0010:account_group_system_time include/linux/sched/cputime.h:149 [inline]
RIP: 0010:account_system_index_time+0xe8/0x5f0 kernel/sched/cputime.c:168
PGD 9871067 P4D 9871067 PUD 9872063 PMD 0 
Code: 04 00 00 49 8b 84 24 00 07 00 00 48 ba 00 00 00 00 00 fc ff df 48 8d b8 40 01 00 00 48 8d 88 28 01 00 00 48 89 fe 48 c1 ee 03 <0f> b6 14 16 48 89 fe 83 e6 07 40 38 f2 7f 08 84 d2 0f 85 93 03 00
Oops: 0000 [#2] PREEMPT SMP KASAN
RSP: 0018:ffff8880ae607a80 EFLAGS: 00010006
CPU: 1 PID: 21 Comm: kworker/u4:1 Tainted: G      D           4.20.0+ #3
RAX: 0000000000000000 RBX: 1ffff11015cc0f54 RCX: 0000000000000128
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RDX: dffffc0000000000 RSI: 0000000000000028 RDI: 0000000000000140
RIP: 0010:depot_fetch_stack+0x10/0x30 lib/stackdepot.c:202
RBP: ffff8880ae607b48 R08: ffff8880ae61f5f0 R09: ffffffff8a99f01d
Code: f6 3f 20 fe e9 20 fe ff ff 48 89 df e8 e9 3f 20 fe e9 f1 fd ff ff 90 90 90 90 89 f8 c1 ef 11 25 ff ff 1f 00 81 e7 f0 3f 00 00 <48> 03 3c c5 60 64 f4 8b 8b 47 0c 48 83 c7 18 c7 46 10 00 00 00 00
R10: ffffffff8a99f010 R11: 0000000000000001 R12: ffff8880a9e62240
R13: 0000000000982d5e R14: 0000000000000003 R15: ffff8880ae607b20
RSP: 0018:ffff8880a9fef920 EFLAGS: 00010002
FS:  0000000000000000(0000) GS:ffff8880ae600000(0000) knlGS:0000000000000000
RAX: 00000000001700ce RBX: ffff8880a9de15c4 RCX: 0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
RDX: 0000000000000000 RSI: ffff8880a9fef928 RDI: 00000000000009e0
CR2: 0000000000000068 CR3: 000000008d181000 CR4: 00000000001406f0
RBP: ffff8880a9fef950 R08: 000000000000001d R09: ffffed1015ce3ef9
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
R10: ffffed1015ce3ef8 R11: ffff8880ae71f7c7 R12: ffffea0002a77840
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
R13: ffff8880a9de1508 R14: ffff88812c3f0040 R15: ffff8880a9de15c0

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/01/11 16:14 net-next-old b71acb0e3721 c3f3344c .config console log report ci-upstream-net-kasan-gce
* Struck through repros no longer work on HEAD.