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: 834c7d75d6dc97fec759c900783439560674fbcd8b5975682e451e9e7047e1ca
all runs: crashed: KASAN: use-after-free Read in ath9k_hif_usb_reg_in_cb
testing current HEAD 42226c989789d8da4af1de0c31070c96726d990c
testing commit 42226c989789d8da4af1de0c31070c96726d990c
compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2
kernel signature: af932172f1f821c940f891a2bff91edc8f41c271e8979f3a4c019a263c635692
all runs: crashed: KASAN: use-after-free Read in ath9k_hif_usb_reg_in_cb
revisions tested: 2, total time: 19m39.701449114s (build: 12m17.441734475s, test: 6m51.899492418s)
the crash still happens on HEAD
commit msg: Linux 5.18-rc7
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 ffff8880235bed54 by task swapper/1/0
CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.18.0-rc7-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+0x530/0x8e0 kernel/time/timer.c:1737
__run_timers kernel/time/timer.c:1715 [inline]
run_timer_softirq+0x9c/0x190 kernel/time/timer.c:1750
__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:111 [inline]
RIP: 0010:acpi_idle_do_entry+0x15e/0x1c0 drivers/acpi/processor_idle.c:551
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 5d d2 e1 f8 eb 07 0f 00 2d 54 ff bc 00 fb f4 <9c> 58 fa f6 c4 02 74 b1 5d e9 34 d1 e1 f8 48 89 ef 5d e9 ab f9 ff
RSP: 0018:ffffc90000177d38 EFLAGS: 00000202
RAX: 0000000000053d25 RBX: ffff88801533d065 RCX: 1ffffffff194d489
RDX: 0000000000000000 RSI: ffffffff88eb90a0 RDI: ffffffff8942c2a0
RBP: ffff88800fe71d40 R08: 0000000000000001 R09: 0000000000000001
R10: ffffed1001fce3a8 R11: 0000000000000001 R12: 0000000000000001
R13: ffff88801533d064 R14: ffffffff8b7396c0 R15: ffff8881474b4804
acpi_idle_enter+0x2c0/0x4b0 drivers/acpi/processor_idle.c:686
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_secondary+0x224/0x2c0 arch/x86/kernel/smpboot.c:266
secondary_startup_64_no_verify+0xc3/0xcb
Allocated by task 3603:
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:1039
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+0x530/0x8e0 kernel/time/timer.c:1737
__run_timers kernel/time/timer.c:1715 [inline]
run_timer_softirq+0x9c/0x190 kernel/time/timer.c:1750
__do_softirq+0x29b/0x9c2 kernel/softirq.c:558
The buggy address belongs to the object at ffff8880235bec80
which belongs to the cache skbuff_head_cache of size 224
The buggy address is located 212 bytes inside of
224-byte region [ffff8880235bec80, ffff8880235bed60)
The buggy address belongs to the physical page:
page:ffffea00008d6f80 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x235be
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 ffffea00005ef9c0 dead000000000002 ffff888140aee500
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 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 2961, tgid 2961 (udevd), ts 12079950250, free_ts 12055431560
prep_new_page mm/page_alloc.c:2441 [inline]
get_page_from_freelist+0x178d/0x3dc0 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]
netlink_alloc_large_skb net/netlink/af_netlink.c:1191 [inline]
netlink_sendmsg+0x7f3/0xc20 net/netlink/af_netlink.c:1896
sock_sendmsg_nosec net/socket.c:705 [inline]
sock_sendmsg+0xab/0xe0 net/socket.c:725
____sys_sendmsg+0x5b9/0x7a0 net/socket.c:2413
___sys_sendmsg+0xd3/0x150 net/socket.c:2467
__sys_sendmsg+0xb2/0x140 net/socket.c:2496
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
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/0x6a0 mm/page_alloc.c:3423
__unfreeze_partials+0x17c/0x1a0 mm/slub.c:2523
qlink_free mm/kasan/quarantine.c:157 [inline]
qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:176
kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:283
__kasan_slab_alloc+0xa2/0xc0 mm/kasan/common.c:446
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]
slab_alloc mm/slub.c:3225 [inline]
__kmalloc+0x200/0x350 mm/slub.c:4410
kmalloc include/linux/slab.h:586 [inline]
tomoyo_realpath_from_path+0xb0/0x6a0 security/tomoyo/realpath.c:254
tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
tomoyo_check_open_permission+0x21c/0x2c0 security/tomoyo/file.c:771
security_file_open+0x34/0x80 security/security.c:1651
do_dentry_open+0x300/0xfd0 fs/open.c:811
do_open fs/namei.c:3476 [inline]
path_openat+0x9cf/0x2360 fs/namei.c:3609
do_filp_open+0x199/0x3d0 fs/namei.c:3636
do_sys_openat2+0x11e/0x3f0 fs/open.c:1213
do_sys_open fs/open.c:1229 [inline]
__do_sys_openat fs/open.c:1245 [inline]
__se_sys_openat fs/open.c:1240 [inline]
__x64_sys_openat+0x11b/0x1d0 fs/open.c:1240
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x35/0x80 arch/x86/entry/common.c:80
Memory state around the buggy address:
ffff8880235bec00: 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc
ffff8880235bec80: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880235bed00: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
^
ffff8880235bed80: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
ffff8880235bee00: 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 5d d2 e1 f8 callq 0xf8e1d27c
1f: eb 07 jmp 0x28
21: 0f 00 2d 54 ff bc 00 verw 0xbcff54(%rip) # 0xbcff7c
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 34 d1 e1 f8 jmpq 0xf8e1d16c
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