syzbot


KASAN: out-of-bounds Read in i801_isr

Status: fixed on 2021/11/10 00:50
Reported-by: syzbot+b4d3fd1dfd53e90afd79@syzkaller.appspotmail.com
Fix commit: e4d8716c3dce i2c: i801: Don't generate an interrupt on bus reset
First crash: 557d, last: 470d
similar bugs (3):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: out-of-bounds Write in i801_isr 1 761d 755d 0/24 auto-closed as invalid on 2020/12/31 09:40
upstream KASAN: stack-out-of-bounds Read in i801_isr 1 993d 993d 0/24 closed as dup on 2020/01/15 06:49
upstream KASAN: stack-out-of-bounds Write in i801_isr 3 685d 768d 0/24 auto-closed as invalid on 2021/03/18 06:45

Sample crash report:
==================================================================
BUG: KASAN: out-of-bounds in i801_isr_byte_done drivers/i2c/busses/i2c-i801.c:608 [inline]
BUG: KASAN: out-of-bounds in i801_isr drivers/i2c/busses/i2c-i801.c:668 [inline]
BUG: KASAN: out-of-bounds in i801_isr+0xc70/0xd60 drivers/i2c/busses/i2c-i801.c:649
Read of size 1 at addr ffffc90000e37d61 by task syz-executor.0/18565

CPU: 2 PID: 18565 Comm: syz-executor.0 Not tainted 5.13.0-rc6-syzkaller #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:79 [inline]
 dump_stack+0x141/0x1d7 lib/dump_stack.c:120
 print_address_description.constprop.0.cold+0x5/0x2f8 mm/kasan/report.c:233
 __kasan_report mm/kasan/report.c:419 [inline]
 kasan_report.cold+0x7c/0xd8 mm/kasan/report.c:436
 i801_isr_byte_done drivers/i2c/busses/i2c-i801.c:608 [inline]
 i801_isr drivers/i2c/busses/i2c-i801.c:668 [inline]
 i801_isr+0xc70/0xd60 drivers/i2c/busses/i2c-i801.c:649
 __handle_irq_event_percpu+0x303/0x8f0 kernel/irq/handle.c:156
 handle_irq_event_percpu kernel/irq/handle.c:196 [inline]
 handle_irq_event+0x102/0x290 kernel/irq/handle.c:213
 handle_fasteoi_irq+0x22f/0x9f0 kernel/irq/chip.c:714
 generic_handle_irq_desc include/linux/irqdesc.h:158 [inline]
 handle_irq arch/x86/kernel/irq.c:231 [inline]
 __common_interrupt+0x9e/0x200 arch/x86/kernel/irq.c:250
 common_interrupt+0x4c/0xd0 arch/x86/kernel/irq.c:240
 asm_common_interrupt+0x1e/0x40 arch/x86/include/asm/idtentry.h:638
RIP: 0010:__do_softirq+0x196/0x9f6 kernel/softirq.c:545
Code: 00 48 01 f0 48 89 44 24 18 48 c7 c7 20 55 6a 89 e8 cf fa d6 ff 65 66 c7 05 b5 4a c3 76 00 00 e8 80 e8 3a f8 fb b8 ff ff ff ff <48> c7 c3 c0 a0 c0 8b 41 0f bc c5 41 89 c7 41 83 c7 01 75 47 e9 d2
RSP: 0018:ffffc90000550f70 EFLAGS: 00000202
RAX: 00000000ffffffff RBX: ffff8880146e0000 RCX: 1ffffffff2045f0a
RDX: 0000000000000000 RSI: 0000000000000103 RDI: 0000000000000000
RBP: ffff888011af9c40 R08: 0000000000000001 R09: ffffffff902288b7
R10: 0000000000000001 R11: 0000000000000001 R12: 0000000000000000
R13: 0000000000000002 R14: 0000000000000000 R15: 0000000000000000
 invoke_softirq kernel/softirq.c:433 [inline]
 __irq_exit_rcu+0x136/0x200 kernel/softirq.c:637
 irq_exit_rcu+0x5/0x20 kernel/softirq.c:649
 sysvec_apic_timer_interrupt+0x93/0xc0 arch/x86/kernel/apic/apic.c:1100
 </IRQ>
 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:647
RIP: 0010:debug_smp_processor_id+0x5/0x20 lib/smp_processor_id.c:64
Code: ff 48 8b 74 24 28 48 c7 c7 40 e8 c2 89 e8 10 36 bf ff e8 ad 8f cd ff eb a2 66 66 2e 0f 1f 84 00 00 00 00 00 90 0f 1f 44 00 00 <48> c7 c6 80 e8 c2 89 48 c7 c7 c0 e8 c2 89 e9 98 fe ff ff 0f 1f 84
RSP: 0018:ffffc90000dd7598 EFLAGS: 00000286
RAX: 0000000000000001 RBX: 1ffff920001baebb RCX: ffffffff815a8768
RDX: 0000000000000002 RSI: 0000000000000008 RDI: ffffffff8dc97a90
RBP: 0000000000000000 R08: 0000000000000000 R09: ffffffff8dc97a97
R10: fffffbfff1b92f52 R11: 0000000000000000 R12: 0000000000000001
R13: ffffffff8bf79660 R14: 0000000000000000 R15: 0000000000000000
 rcu_dynticks_curr_cpu_in_eqs kernel/rcu/tree.c:325 [inline]
 rcu_is_watching+0xe/0xc0 kernel/rcu/tree.c:1168
 rcu_read_lock_held_common kernel/rcu/update.c:108 [inline]
 rcu_read_lock_sched_held+0x1c/0x70 kernel/rcu/update.c:123
 trace_lock_acquire include/trace/events/lock.h:13 [inline]
 lock_acquire+0x5e9/0x740 kernel/locking/lockdep.c:5483
 rcu_lock_acquire include/linux/rcupdate.h:267 [inline]
 rcu_read_lock include/linux/rcupdate.h:657 [inline]
 lock_page_memcg+0x66/0x7d0 mm/memcontrol.c:1982
 page_remove_rmap+0x25/0x1430 mm/rmap.c:1345
 zap_pte_range mm/memory.c:1270 [inline]
 zap_pmd_range mm/memory.c:1385 [inline]
 zap_pud_range mm/memory.c:1414 [inline]
 zap_p4d_range mm/memory.c:1435 [inline]
 unmap_page_range+0xea6/0x2890 mm/memory.c:1456
 unmap_single_vma+0x198/0x300 mm/memory.c:1501
 unmap_vmas+0x16d/0x2f0 mm/memory.c:1533
 exit_mmap+0x2a8/0x590 mm/mmap.c:3208
 __mmput+0x122/0x470 kernel/fork.c:1096
 mmput+0x58/0x60 kernel/fork.c:1117
 exit_mm kernel/exit.c:502 [inline]
 do_exit+0xb0a/0x2a60 kernel/exit.c:813
 do_group_exit+0x125/0x310 kernel/exit.c:923
 get_signal+0x47f/0x2150 kernel/signal.c:2835
 arch_do_signal_or_restart+0x2a8/0x1eb0 arch/x86/kernel/signal.c:789
 handle_signal_work kernel/entry/common.c:148 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:172 [inline]
 exit_to_user_mode_prepare+0x180/0x290 kernel/entry/common.c:209
 __syscall_exit_to_user_mode_work kernel/entry/common.c:291 [inline]
 syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:302
 __do_fast_syscall_32+0x74/0xe0 arch/x86/entry/common.c:146
 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:168
 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c
RIP: 0023:0xf7ff4549
Code: Unable to access opcode bytes at RIP 0xf7ff451f.
RSP: 002b:00000000f55ee68c EFLAGS: 00000246 ORIG_RAX: 00000000000000f0
RAX: 0000000000000001 RBX: 000000000819afcc RCX: 0000000000000081
RDX: 00000000000f4240 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 00000000080525a9 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000


Memory state around the buggy address:
 ffffc90000e37c00: f2 f2 00 00 f3 f3 00 00 00 00 00 00 00 00 00 00
 ffffc90000e37c80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffffc90000e37d00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                                                       ^
 ffffc90000e37d80: 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1 00
 ffffc90000e37e00: f2 f2 f2 00 00 00 00 00 00 00 00 00 00 00 f3 f3
==================================================================

Crashes (16):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-qemu-upstream-386 2021/06/20 20:58 upstream cba5e97280f5 aba2b2fb .config log report info KASAN: out-of-bounds Read in i801_isr
ci-qemu-upstream-386 2021/06/17 13:23 upstream 70585216fe77 aba2b2fb .config log report info KASAN: out-of-bounds Read in i801_isr
ci-qemu-upstream-386 2021/06/16 21:14 upstream 6b00bc639f1f c06f97ad .config log report info KASAN: out-of-bounds Read in i801_isr
ci-qemu-upstream-386 2021/06/16 19:04 upstream 6b00bc639f1f c06f97ad .config log report info KASAN: out-of-bounds Read in i801_isr
ci-qemu-upstream-386 2021/06/15 00:46 upstream 009c9aa5be65 1ba81399 .config log report info KASAN: out-of-bounds Read in i801_isr
ci-qemu-upstream-386 2021/06/01 14:16 upstream c2131f7e73c9 032639db .config log report info KASAN: out-of-bounds Read in i801_isr
ci-qemu-upstream-386 2021/05/28 16:06 upstream 97e5bf604b7a 858ea628 .config log report info KASAN: out-of-bounds Read in i801_isr
ci-qemu-upstream-386 2021/03/25 18:33 upstream e138138003eb 6a383ecf .config log report info KASAN: out-of-bounds Read in i801_isr
ci-qemu-upstream 2021/06/01 16:54 upstream c2131f7e73c9 032639db .config log report info KASAN: stack-out-of-bounds Write in i801_isr
ci-qemu-upstream 2021/05/17 00:40 upstream 63d1cb53e26a f54a5c09 .config log report info KASAN: out-of-bounds Write in i801_isr
ci-qemu-upstream 2021/05/16 16:22 upstream 63d1cb53e26a f54a5c09 .config log report info KASAN: vmalloc-out-of-bounds Read in i801_isr
ci-qemu-upstream 2021/05/11 22:51 upstream 88b06399c9c7 b3c3bb8e .config log report info KASAN: stack-out-of-bounds Read in i801_isr
ci-qemu-upstream 2021/05/08 18:54 upstream ab159ac569fd bc5434be .config log report info KASAN: vmalloc-out-of-bounds Read in i801_isr
ci-qemu-upstream-386 2021/06/15 13:55 upstream 009c9aa5be65 8022d7e3 .config log report info KASAN: stack-out-of-bounds Read in i801_isr
ci-qemu-upstream-386 2021/05/06 12:54 upstream 18a3c5f7abfd 06c27ff5 .config log report info KASAN: out-of-bounds Write in i801_isr
ci-qemu-upstream-386 2021/04/23 07:26 upstream 90c911ad7445 590921a5 .config log report info KASAN: out-of-bounds Write in i801_isr
* Struck through repros no longer work on HEAD.