syzbot
KASAN: use-after-free Read in check_tty_count
Status:
upstream: reported C repro on 2026/08/10 02:57
Reported-by: syzbot+90ffe1583ffe9c58c485@syzkaller.appspotmail.com
First crash: 108d, last: 2d15h
▶
▼
Last patch testing requests (2)
▶
▼
Fix bisection attempts (1)
Sample crash report:
==================================================================
BUG: KASAN: use-after-free in instrument_atomic_read include/linux/instrumented.h:71 [inline]
BUG: KASAN: use-after-free in test_bit include/asm-generic/bitops/instrumented-non-atomic.h:134 [inline]
BUG: KASAN: use-after-free in tty_port_kopened include/linux/tty.h:616 [inline]
BUG: KASAN: use-after-free in check_tty_count+0x1a8/0x330 drivers/tty/tty_io.c:295
Read of size 8 at addr ffff88810b17a110 by task syz-executor287/336
CPU: 1 PID: 336 Comm: syz-executor287 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
Call Trace:
__dump_stack+0x21/0x24 lib/dump_stack.c:77
dump_stack_lvl+0x1a7/0x208 lib/dump_stack.c:118
print_address_description+0x7f/0x2c0 mm/kasan/report.c:248
__kasan_report mm/kasan/report.c:435 [inline]
kasan_report+0x100/0x140 mm/kasan/report.c:452
check_region_inline mm/kasan/generic.c:-1 [inline]
kasan_check_range+0x249/0x2a0 mm/kasan/generic.c:189
__kasan_check_read+0x11/0x20 mm/kasan/shadow.c:31
instrument_atomic_read include/linux/instrumented.h:71 [inline]
test_bit include/asm-generic/bitops/instrumented-non-atomic.h:134 [inline]
tty_port_kopened include/linux/tty.h:616 [inline]
check_tty_count+0x1a8/0x330 drivers/tty/tty_io.c:295
tty_release+0xc9/0x1330 drivers/tty/tty_io.c:1747
__fput+0x2dc/0x730 fs/file_table.c:281
____fput+0x15/0x20 fs/file_table.c:314
task_work_run+0x127/0x190 kernel/task_work.c:189
exit_task_work include/linux/task_work.h:33 [inline]
do_exit+0xa7c/0x24e0 kernel/exit.c:879
do_group_exit+0x149/0x310 kernel/exit.c:993
__do_sys_exit_group kernel/exit.c:1004 [inline]
__se_sys_exit_group kernel/exit.c:1002 [inline]
__x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1002
do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46
entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7f166e671fc5
Code: Unable to access opcode bytes at RIP 0x7f166e671f9b.
RSP: 002b:00007ffcde81cec8 EFLAGS: 00000206 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 00007f166e671fc5
RDX: 00000000000000e7 RSI: ffffffffffffffd0 RDI: 0000000000000000
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 00007ffcde81cf60 R11: 0000000000000206 R12: 0000000000000000
R13: 00007f166e724120 R14: 00007f166e7264e8 R15: 00007f166e726500
Allocated by task 335:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track mm/kasan/common.c:45 [inline]
set_alloc_info mm/kasan/common.c:430 [inline]
____kasan_kmalloc mm/kasan/common.c:509 [inline]
__kasan_kmalloc+0xd4/0x100 mm/kasan/common.c:518
kasan_kmalloc include/linux/kasan.h:254 [inline]
kmem_cache_alloc_trace+0x179/0x2e0 mm/slub.c:2979
kmalloc include/linux/slab.h:555 [inline]
kzalloc include/linux/slab.h:667 [inline]
gs_port_alloc drivers/usb/gadget/function/u_serial.c:1158 [inline]
gserial_alloc_line_no_console+0x238/0x700 drivers/usb/gadget/function/u_serial.c:1238
gserial_alloc_line+0x15/0x20 drivers/usb/gadget/function/u_serial.c:1272
acm_alloc_instance+0x86/0xe0 drivers/usb/gadget/function/f_acm.c:849
try_get_usb_function_instance drivers/usb/gadget/functions.c:28 [inline]
usb_get_function_instance+0xe2/0x2f0 drivers/usb/gadget/functions.c:44
function_make+0x118/0x350 drivers/usb/gadget/configfs.c:636
configfs_mkdir+0x5d2/0xd90 fs/configfs/dir.c:1378
vfs_mkdir+0x42c/0x600 fs/namei.c:3840
do_mkdirat+0x14c/0x340 fs/namei.c:3862
__do_sys_mkdir fs/namei.c:3878 [inline]
__se_sys_mkdir fs/namei.c:3876 [inline]
__x64_sys_mkdir+0x60/0x70 fs/namei.c:3876
do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46
entry_SYSCALL_64_after_hwframe+0x61/0xcb
Freed by task 335:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track+0x4a/0x70 mm/kasan/common.c:45
kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370
____kasan_slab_free+0x125/0x160 mm/kasan/common.c:362
__kasan_slab_free+0x11/0x20 mm/kasan/common.c:370
kasan_slab_free include/linux/kasan.h:220 [inline]
slab_free_hook mm/slub.c:1600 [inline]
slab_free_freelist_hook+0xc5/0x190 mm/slub.c:1626
slab_free mm/slub.c:3208 [inline]
kfree+0xc0/0x270 mm/slub.c:4196
gserial_free_port+0x240/0x2d0 drivers/usb/gadget/function/u_serial.c:1202
gserial_free_line+0x9f/0x1b0 drivers/usb/gadget/function/u_serial.c:1219
acm_free_instance+0x39/0x60 drivers/usb/gadget/function/f_acm.c:836
usb_put_function_instance+0x8a/0xb0 drivers/usb/gadget/functions.c:77
acm_attr_release+0x15/0x20 drivers/usb/gadget/function/f_acm.c:785
config_item_cleanup fs/configfs/item.c:130 [inline]
config_item_release fs/configfs/item.c:139 [inline]
kref_put include/linux/kref.h:65 [inline]
config_item_put+0x158/0x210 fs/configfs/item.c:151
configfs_rmdir+0x89f/0x960 fs/configfs/dir.c:1604
vfs_rmdir+0x1ab/0x3c0 fs/namei.c:3902
do_rmdir+0x232/0x630 fs/namei.c:3962
__do_sys_rmdir fs/namei.c:3980 [inline]
__se_sys_rmdir fs/namei.c:3978 [inline]
__x64_sys_rmdir+0x49/0x50 fs/namei.c:3978
do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46
entry_SYSCALL_64_after_hwframe+0x61/0xcb
The buggy address belongs to the object at ffff88810b17a000
which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 272 bytes inside of
1024-byte region [ffff88810b17a000, ffff88810b17a400)
The buggy address belongs to the page:
page:ffffea00042c5e00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10b178
head:ffffea00042c5e00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head)
raw: 4000000000010200 0000000000000000 0000000100000001 ffff888100042f00
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 1, ts 2558282119, free_ts 0
set_page_owner include/linux/page_owner.h:35 [inline]
post_alloc_hook mm/page_alloc.c:2456 [inline]
prep_new_page+0x176/0x190 mm/page_alloc.c:2462
get_page_from_freelist+0x225f/0x23f0 mm/page_alloc.c:4254
__alloc_pages_nodemask+0x29a/0x640 mm/page_alloc.c:5384
alloc_slab_page mm/slub.c:-1 [inline]
allocate_slab mm/slub.c:1813 [inline]
new_slab+0x84/0x3f0 mm/slub.c:1874
new_slab_objects mm/slub.c:2632 [inline]
___slab_alloc+0x2f8/0x4c0 mm/slub.c:2796
__slab_alloc+0x63/0xa0 mm/slub.c:2836
slab_alloc_node mm/slub.c:2918 [inline]
slab_alloc mm/slub.c:2960 [inline]
__kmalloc+0x1f9/0x330 mm/slub.c:4034
kmalloc include/linux/slab.h:560 [inline]
kzalloc include/linux/slab.h:667 [inline]
scsi_alloc_target+0x135/0xbd0 drivers/scsi/scsi_scan.c:437
__scsi_scan_target+0x150/0xbf0 drivers/scsi/scsi_scan.c:1564
scsi_scan_channel drivers/scsi/scsi_scan.c:1669 [inline]
scsi_scan_host_selected+0x34e/0x600 drivers/scsi/scsi_scan.c:1698
do_scsi_scan_host drivers/scsi/scsi_scan.c:1837 [inline]
scsi_scan_host+0x39e/0x670 drivers/scsi/scsi_scan.c:1867
virtscsi_probe+0x8f6/0xab0 drivers/scsi/virtio_scsi.c:915
virtio_dev_probe+0x8df/0xb30 drivers/virtio/virtio.c:274
really_probe+0x373/0xa60 drivers/base/dd.c:558
driver_probe_device+0xe1/0x190 drivers/base/dd.c:752
device_driver_attach+0x17a/0x280 drivers/base/dd.c:1035
page_owner free stack trace missing
Memory state around the buggy address:
ffff88810b17a000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88810b17a080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88810b17a100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88810b17a180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88810b17a200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
------------[ cut here ]------------
WARNING: CPU: 1 PID: 336 at drivers/usb/gadget/function/u_serial.c:686 gs_close+0x17d/0x9a0 drivers/usb/gadget/function/u_serial.c:686
Modules linked in:
CPU: 1 PID: 336 Comm: syz-executor287 Tainted: G B syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
RIP: 0010:gs_close+0x17d/0x9a0 drivers/usb/gadget/function/u_serial.c:686
Code: ee 52 fe 41 ff cc 42 0f b6 04 2b 84 c0 0f 85 c1 06 00 00 48 8b 44 24 20 44 89 20 48 8b 5c 24 38 e9 bd 02 00 00 e8 03 ee 52 fe <0f> 0b 48 8b 5c 24 38 e9 ac 02 00 00 e8 f2 ed 52 fe 49 8d bf 90 02
RSP: 0018:ffffc90000d77ac0 EFLAGS: 00010093
RAX: ffffffff8311cded RBX: 1ffff1102162f41a RCX: ffff88811f4c3c00
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffffc90000d77bd8 R08: 0000000000000003 R09: 0000000000000004
R10: dffffc0000000000 R11: fffff520001aef48 R12: 0000000000000000
R13: dffffc0000000000 R14: 1ffff920001aef60 R15: ffff88810b17a000
FS: 0000000000000000(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f166e6ef43c CR3: 000000010d517000 CR4: 00000000003506a0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
tty_release+0x3c8/0x1330 drivers/tty/tty_io.c:1764
__fput+0x2dc/0x730 fs/file_table.c:281
____fput+0x15/0x20 fs/file_table.c:314
task_work_run+0x127/0x190 kernel/task_work.c:189
exit_task_work include/linux/task_work.h:33 [inline]
do_exit+0xa7c/0x24e0 kernel/exit.c:879
do_group_exit+0x149/0x310 kernel/exit.c:993
__do_sys_exit_group kernel/exit.c:1004 [inline]
__se_sys_exit_group kernel/exit.c:1002 [inline]
__x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1002
do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46
entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7f166e671fc5
Code: Unable to access opcode bytes at RIP 0x7f166e671f9b.
RSP: 002b:00007ffcde81cec8 EFLAGS: 00000206 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 00007f166e671fc5
RDX: 00000000000000e7 RSI: ffffffffffffffd0 RDI: 0000000000000000
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 00007ffcde81cf60 R11: 0000000000000206 R12: 0000000000000000
R13: 00007f166e724120 R14: 00007f166e7264e8 R15: 00007f166e726500
---[ end trace c9cde5cbc86249dc ]---
general protection fault, probably for non-canonical address 0xfa7bfc1d60000020: 0000 [#1] PREEMPT SMP KASAN
KASAN: maybe wild-memory-access in range [0xd3e000eb00000100-0xd3e000eb00000107]
CPU: 1 PID: 336 Comm: syz-executor287 Tainted: G B W syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
RIP: 0010:get_work_pool kernel/workqueue.c:728 [inline]
RIP: 0010:try_to_grab_pending+0x1c5/0x570 kernel/workqueue.c:1286
Code: 00 e8 8f 20 24 00 e9 0b 01 00 00 e8 85 20 24 00 31 c0 e9 73 01 00 00 e8 79 20 24 00 49 81 e6 00 ff ff ff 4c 89 f0 48 c1 e8 03 <80> 3c 18 00 74 08 4c 89 f7 e8 6d b4 5e 00 49 8b 06 48 85 c0 0f 84
RSP: 0018:ffffc90000d77920 EFLAGS: 00010802
RAX: 1a7c001d60000020 RBX: dffffc0000000000 RCX: ffff88811f4c3c00
RDX: 0000000000000000 RSI: 0000000000000004 RDI: 0000000000000000
RBP: ffffc90000d779f0 R08: 0000000000000007 R09: 00000000fffffffb
R10: dffffc0000000000 R11: ffffed102162f401 R12: ffff88810b17a008
R13: ffffc90000d77a38 R14: d3e000eb00000100 R15: 1ffff920001aef47
FS: 0000000000000000(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f166e6ef43c CR3: 000000010d517000 CR4: 00000000003506a0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
__cancel_work_timer+0xb8/0x4c0 kernel/workqueue.c:3122
cancel_work_sync+0x17/0x20 kernel/workqueue.c:3199
tty_buffer_cancel_work+0x19/0x20 drivers/tty/tty_buffer.c:639
release_tty+0x47d/0x840 drivers/tty/tty_io.c:1606
tty_release_struct+0xbf/0xe0 drivers/tty/tty_io.c:1710
tty_release+0xc87/0x1330 drivers/tty/tty_io.c:1870
__fput+0x2dc/0x730 fs/file_table.c:281
____fput+0x15/0x20 fs/file_table.c:314
task_work_run+0x127/0x190 kernel/task_work.c:189
exit_task_work include/linux/task_work.h:33 [inline]
do_exit+0xa7c/0x24e0 kernel/exit.c:879
do_group_exit+0x149/0x310 kernel/exit.c:993
__do_sys_exit_group kernel/exit.c:1004 [inline]
__se_sys_exit_group kernel/exit.c:1002 [inline]
__x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1002
do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46
entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7f166e671fc5
Code: Unable to access opcode bytes at RIP 0x7f166e671f9b.
RSP: 002b:00007ffcde81cec8 EFLAGS: 00000206 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 00007f166e671fc5
RDX: 00000000000000e7 RSI: ffffffffffffffd0 RDI: 0000000000000000
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 00007ffcde81cf60 R11: 0000000000000206 R12: 0000000000000000
R13: 00007f166e724120 R14: 00007f166e7264e8 R15: 00007f166e726500
Modules linked in:
---[ end trace c9cde5cbc86249dd ]---
RIP: 0010:get_work_pool kernel/workqueue.c:728 [inline]
RIP: 0010:try_to_grab_pending+0x1c5/0x570 kernel/workqueue.c:1286
Code: 00 e8 8f 20 24 00 e9 0b 01 00 00 e8 85 20 24 00 31 c0 e9 73 01 00 00 e8 79 20 24 00 49 81 e6 00 ff ff ff 4c 89 f0 48 c1 e8 03 <80> 3c 18 00 74 08 4c 89 f7 e8 6d b4 5e 00 49 8b 06 48 85 c0 0f 84
RSP: 0018:ffffc90000d77920 EFLAGS: 00010802
RAX: 1a7c001d60000020 RBX: dffffc0000000000 RCX: ffff88811f4c3c00
RDX: 0000000000000000 RSI: 0000000000000004 RDI: 0000000000000000
RBP: ffffc90000d779f0 R08: 0000000000000007 R09: 00000000fffffffb
R10: dffffc0000000000 R11: ffffed102162f401 R12: ffff88810b17a008
R13: ffffc90000d77a38 R14: d3e000eb00000100 R15: 1ffff920001aef47
FS: 0000000000000000(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f166e6ef43c CR3: 000000010d517000 CR4: 00000000003506a0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess), 1 bytes skipped:
0: e8 8f 20 24 00 call 0x242094
5: e9 0b 01 00 00 jmp 0x115
a: e8 85 20 24 00 call 0x242094
f: 31 c0 xor %eax,%eax
11: e9 73 01 00 00 jmp 0x189
16: e8 79 20 24 00 call 0x242094
1b: 49 81 e6 00 ff ff ff and $0xffffffffffffff00,%r14
22: 4c 89 f0 mov %r14,%rax
25: 48 c1 e8 03 shr $0x3,%rax
* 29: 80 3c 18 00 cmpb $0x0,(%rax,%rbx,1) <-- trapping instruction
2d: 74 08 je 0x37
2f: 4c 89 f7 mov %r14,%rdi
32: e8 6d b4 5e 00 call 0x5eb4a4
37: 49 8b 06 mov (%r14),%rax
3a: 48 85 c0 test %rax,%rax
3d: 0f .byte 0xf
3e: 84 .byte 0x84
* Struck through repros no longer work on HEAD.