bisecting fixing commit since d567f5db412ed52de0b3b3efca4a451263de6108
building syzkaller on 8b9ca619df135211a89cc19719f2705d0016045d
testing commit d567f5db412ed52de0b3b3efca4a451263de6108
compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2
kernel signature: cf80ba14810e88307f516768131762910f93b3bd8681d7fbc2f8ebbb8e07ee8e
all runs: crashed: KASAN: use-after-free Read in ath9k_hif_usb_reg_in_cb
testing current HEAD 7a3ecddc571cc3294e5d6bb5948ff2b0cfa12735
testing commit 7a3ecddc571cc3294e5d6bb5948ff2b0cfa12735
compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2
kernel signature: d01ed71edb604ae04ec00804812fd3b2e5c5fbbf0333b04dd608e33998206753
all runs: crashed: KASAN: use-after-free Read in ath9k_hif_usb_reg_in_cb
revisions tested: 2, total time: 20m32.956647709s (build: 12m30.550962503s, test: 7m13.936647083s)
the crash still happens on HEAD
commit msg: Merge tag '5.18-rc-ksmbd-server-fixes' of git://git.samba.org/ksmbd
crash: KASAN: use-after-free Read in ath9k_hif_usb_reg_in_cb
usb 1-1: ath: unknown panic pattern!
==================================================================
BUG: KASAN: use-after-free in instrument_atomic_read include/linux/instrumented.h:71 [inline]
BUG: KASAN: use-after-free in atomic_read include/linux/atomic/atomic-instrumented.h:27 [inline]
BUG: KASAN: use-after-free in refcount_read include/linux/refcount.h:147 [inline]
BUG: KASAN: use-after-free in skb_unref include/linux/skbuff.h:1234 [inline]
BUG: KASAN: use-after-free in kfree_skb_reason+0x28/0xb0 net/core/skbuff.c:772
Read of size 4 at addr ffff88801e3e8d54 by task swapper/0/0
CPU: 0 PID: 0 Comm: swapper/0 Tainted: G W 5.17.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x57/0x7d lib/dump_stack.c:106
print_address_description.constprop.0.cold+0xeb/0x495 mm/kasan/report.c:313
print_report mm/kasan/report.c:429 [inline]
kasan_report.cold+0xf4/0x1c6 mm/kasan/report.c:491
check_region_inline mm/kasan/generic.c:183 [inline]
kasan_check_range+0x13d/0x180 mm/kasan/generic.c:189
instrument_atomic_read include/linux/instrumented.h:71 [inline]
atomic_read include/linux/atomic/atomic-instrumented.h:27 [inline]
refcount_read include/linux/refcount.h:147 [inline]
skb_unref include/linux/skbuff.h:1234 [inline]
kfree_skb_reason+0x28/0xb0 net/core/skbuff.c:772
kfree_skb include/linux/skbuff.h:1250 [inline]
ath9k_hif_usb_reg_in_cb+0x470/0x600 drivers/net/wireless/ath/ath9k/hif_usb.c:771
__usb_hcd_giveback_urb+0x238/0x3f0 drivers/usb/core/hcd.c:1670
dummy_timer+0xeb8/0x2eb0 drivers/usb/gadget/udc/dummy_hcd.c:1988
call_timer_fn+0x163/0x4a0 kernel/time/timer.c:1421
expire_timers kernel/time/timer.c:1466 [inline]
__run_timers.part.0+0x52e/0x8a0 kernel/time/timer.c:1734
__run_timers kernel/time/timer.c:1715 [inline]
run_timer_softirq+0x9c/0x190 kernel/time/timer.c:1747
__do_softirq+0x29b/0x9c2 kernel/softirq.c:558
invoke_softirq kernel/softirq.c:432 [inline]
__irq_exit_rcu+0x123/0x180 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:1097
asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:645
RIP: 0010:native_save_fl arch/x86/include/asm/irqflags.h:29 [inline]
RIP: 0010:arch_local_save_flags arch/x86/include/asm/irqflags.h:70 [inline]
RIP: 0010:arch_irqs_disabled arch/x86/include/asm/irqflags.h:130 [inline]
RIP: 0010:acpi_safe_halt drivers/acpi/processor_idle.c:116 [inline]
RIP: 0010:acpi_idle_do_entry+0x15e/0x1c0 drivers/acpi/processor_idle.c:556
Code: 00 00 00 00 00 fc ff df 48 c1 ea 03 80 3c 02 00 75 6a 48 8b 45 00 a8 08 75 c9 e8 ad 21 e2 f8 eb 07 0f 00 2d 34 4d bd 00 fb f4 <9c> 58 fa f6 c4 02 74 b1 5d e9 84 20 e2 f8 48 89 ef 5d e9 ab f9 ff
RSP: 0018:ffffffff8aa07d88 EFLAGS: 00000246
RAX: 0000000000000007 RBX: ffff888145e6d065 RCX: 1ffffffff194e04d
RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffffffff889018c3
RBP: ffffffff8aabb4c0 R08: 0000000000000000 R09: 0000000000000000
R10: fffffbfff1557698 R11: 0000000000000001 R12: 0000000000000001
R13: ffff888145e6d064 R14: ffffffff8b738420 R15: ffff88801783d804
acpi_idle_enter+0x2c0/0x4b0 drivers/acpi/processor_idle.c:692
cpuidle_enter_state+0x152/0xb40 drivers/cpuidle/cpuidle.c:237
cpuidle_enter+0x45/0xa0 drivers/cpuidle/cpuidle.c:351
call_cpuidle kernel/sched/idle.c:155 [inline]
cpuidle_idle_call kernel/sched/idle.c:236 [inline]
do_idle+0x3e8/0x590 kernel/sched/idle.c:303
cpu_startup_entry+0x14/0x20 kernel/sched/idle.c:400
start_kernel+0x343/0x361 init/main.c:1140
secondary_startup_64_no_verify+0xc3/0xcb
Allocated by task 142:
kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38
kasan_set_track mm/kasan/common.c:45 [inline]
set_alloc_info mm/kasan/common.c:436 [inline]
__kasan_slab_alloc+0x90/0xc0 mm/kasan/common.c:469
kasan_slab_alloc include/linux/kasan.h:224 [inline]
slab_post_alloc_hook mm/slab.h:749 [inline]
slab_alloc_node mm/slub.c:3217 [inline]
kmem_cache_alloc_node+0x255/0x3f0 mm/slub.c:3267
__alloc_skb+0x151/0x270 net/core/skbuff.c:414
alloc_skb include/linux/skbuff.h:1300 [inline]
ath9k_hif_usb_alloc_reg_in_urbs drivers/net/wireless/ath/ath9k/hif_usb.c:964 [inline]
ath9k_hif_usb_alloc_urbs+0x877/0xef0 drivers/net/wireless/ath/ath9k/hif_usb.c:1023
ath9k_hif_usb_dev_init drivers/net/wireless/ath/ath9k/hif_usb.c:1109 [inline]
ath9k_hif_usb_firmware_cb+0x121/0x4d0 drivers/net/wireless/ath/ath9k/hif_usb.c:1242
request_firmware_work_func+0x126/0x230 drivers/base/firmware_loader/main.c:1022
process_one_work+0x865/0x13d0 kernel/workqueue.c:2289
worker_thread+0x598/0xec0 kernel/workqueue.c:2436
kthread+0x299/0x340 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298
Freed by task 0:
kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38
kasan_set_track+0x21/0x30 mm/kasan/common.c:45
kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370
____kasan_slab_free mm/kasan/common.c:366 [inline]
____kasan_slab_free+0x166/0x1a0 mm/kasan/common.c:328
kasan_slab_free include/linux/kasan.h:200 [inline]
slab_free_hook mm/slub.c:1728 [inline]
slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1754
slab_free mm/slub.c:3510 [inline]
kmem_cache_free+0xdd/0x5a0 mm/slub.c:3527
ath9k_hif_usb_reg_in_cb+0x178/0x600 drivers/net/wireless/ath/ath9k/hif_usb.c:740
__usb_hcd_giveback_urb+0x238/0x3f0 drivers/usb/core/hcd.c:1670
dummy_timer+0xeb8/0x2eb0 drivers/usb/gadget/udc/dummy_hcd.c:1988
call_timer_fn+0x163/0x4a0 kernel/time/timer.c:1421
expire_timers kernel/time/timer.c:1466 [inline]
__run_timers.part.0+0x52e/0x8a0 kernel/time/timer.c:1734
__run_timers kernel/time/timer.c:1715 [inline]
run_timer_softirq+0x9c/0x190 kernel/time/timer.c:1747
__do_softirq+0x29b/0x9c2 kernel/softirq.c:558
The buggy address belongs to the object at ffff88801e3e8c80
which belongs to the cache skbuff_head_cache of size 224
The buggy address is located 212 bytes inside of
224-byte region [ffff88801e3e8c80, ffff88801e3e8d60)
The buggy address belongs to the physical page:
page:ffffea000078fa00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1e3e8
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 0000000000000000 dead000000000001 ffff888014c10500
raw: 0000000000000000 00000000000c000c 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_HARDWALL), pid 2923, tgid 2923 (kworker/1:3), ts 40636175040, free_ts 40350842458
prep_new_page mm/page_alloc.c:2441 [inline]
get_page_from_freelist+0x178d/0x3da0 mm/page_alloc.c:4182
__alloc_pages+0x1b2/0x500 mm/page_alloc.c:5408
alloc_slab_page mm/slub.c:1799 [inline]
allocate_slab+0x26c/0x3c0 mm/slub.c:1944
new_slab mm/slub.c:2004 [inline]
___slab_alloc+0x8e1/0xf20 mm/slub.c:3005
__slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3092
slab_alloc_node mm/slub.c:3183 [inline]
kmem_cache_alloc_node+0x122/0x3f0 mm/slub.c:3267
__alloc_skb+0x151/0x270 net/core/skbuff.c:414
alloc_skb include/linux/skbuff.h:1300 [inline]
nsim_dev_trap_skb_build drivers/net/netdevsim/dev.c:742 [inline]
nsim_dev_trap_report drivers/net/netdevsim/dev.c:799 [inline]
nsim_dev_trap_report_work+0x25f/0xb20 drivers/net/netdevsim/dev.c:840
process_one_work+0x865/0x13d0 kernel/workqueue.c:2289
worker_thread+0x598/0xec0 kernel/workqueue.c:2436
kthread+0x299/0x340 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1356 [inline]
free_pcp_prepare+0x549/0xd20 mm/page_alloc.c:1406
free_unref_page_prepare mm/page_alloc.c:3328 [inline]
free_unref_page+0x19/0x690 mm/page_alloc.c:3423
mm_free_pgd kernel/fork.c:739 [inline]
__mmdrop+0xb9/0x350 kernel/fork.c:790
mmdrop include/linux/sched/mm.h:50 [inline]
mmdrop_sched include/linux/sched/mm.h:78 [inline]
finish_task_switch.isra.0+0x792/0xb40 kernel/sched/core.c:4978
context_switch kernel/sched/core.c:5076 [inline]
__schedule+0xa62/0x4900 kernel/sched/core.c:6382
schedule+0xd2/0x1f0 kernel/sched/core.c:6454
schedule_hrtimeout_range_clock+0x148/0x300 kernel/time/hrtimer.c:2305
ep_poll fs/eventpoll.c:1856 [inline]
do_epoll_wait+0xebc/0x14e0 fs/eventpoll.c:2234
__do_sys_epoll_wait fs/eventpoll.c:2246 [inline]
__se_sys_epoll_wait fs/eventpoll.c:2241 [inline]
__x64_sys_epoll_wait+0x126/0x240 fs/eventpoll.c:2241
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x35/0x80 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x44/0xae
Memory state around the buggy address:
ffff88801e3e8c00: 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc
ffff88801e3e8c80: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88801e3e8d00: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
^
ffff88801e3e8d80: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
ffff88801e3e8e00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
0: 00 00 add %al,(%rax)
2: 00 00 add %al,(%rax)
4: 00 fc add %bh,%ah
6: ff (bad)
7: df 48 c1 fisttps -0x3f(%rax)
a: ea (bad)
b: 03 80 3c 02 00 75 add 0x7500023c(%rax),%eax
11: 6a 48 pushq $0x48
13: 8b 45 00 mov 0x0(%rbp),%eax
16: a8 08 test $0x8,%al
18: 75 c9 jne 0xffffffe3
1a: e8 ad 21 e2 f8 callq 0xf8e221cc
1f: eb 07 jmp 0x28
21: 0f 00 2d 34 4d bd 00 verw 0xbd4d34(%rip) # 0xbd4d5c
28: fb sti
29: f4 hlt
* 2a: 9c pushfq <-- trapping instruction
2b: 58 pop %rax
2c: fa cli
2d: f6 c4 02 test $0x2,%ah
30: 74 b1 je 0xffffffe3
32: 5d pop %rbp
33: e9 84 20 e2 f8 jmpq 0xf8e220bc
38: 48 89 ef mov %rbp,%rdi
3b: 5d pop %rbp
3c: e9 .byte 0xe9
3d: ab stos %eax,%es:(%rdi)
3e: f9 stc
3f: ff .byte 0xff