KASAN: use-after-free Read in tty_open

Status: premoderation: reported syz repro on 2026/08/13 02:17
Reported-by: syzbot+1847f4dc96bdec0a9aef@syzkaller.appspotmail.com
First crash: 1d02h, last: 1d02h
Similar bugs (3)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in tty_open serial 19 syz, C done done 8 2333d 2445d 15/29 fixed on 2020/05/10 10:41
linux-4.14 KASAN: use-after-free Read in tty_open 19 syz, C done 5 2343d 2446d 1/1 fixed on 2020/04/13 10:52
linux-4.19 KASAN: use-after-free Read in tty_open 19 syz, C done 2 2340d 2446d 1/1 fixed on 2020/04/17 06:51

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_port.h:180 [inline]
BUG: KASAN: use-after-free in tty_open_by_driver drivers/tty/tty_io.c:2079 [inline]
BUG: KASAN: use-after-free in tty_open+0x823/0x1040 drivers/tty/tty_io.c:2148
Read of size 8 at addr ffff8881138f0110 by task syz.5.17/401

CPU: 1 PID: 401 Comm: syz.5.17 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
Call Trace:
 <TASK>
 __dump_stack+0x21/0x30 lib/dump_stack.c:88
 dump_stack_lvl+0x110/0x170 lib/dump_stack.c:106
 print_address_description+0x7f/0x2c0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:427 [inline]
 kasan_report+0x10f/0x150 mm/kasan/report.c:444
 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_port.h:180 [inline]
 tty_open_by_driver drivers/tty/tty_io.c:2079 [inline]
 tty_open+0x823/0x1040 drivers/tty/tty_io.c:2148
 chrdev_open+0x585/0x5f0 fs/char_dev.c:414
 do_dentry_open+0x82a/0x1010 fs/open.c:828
 vfs_open+0x73/0x80 fs/open.c:960
 do_open fs/namei.c:3616 [inline]
 path_openat+0x26e6/0x2f80 fs/namei.c:3750
 do_filp_open+0x1df/0x400 fs/namei.c:3777
 do_sys_openat2+0x15e/0x7f0 fs/open.c:1236
 do_sys_open fs/open.c:1252 [inline]
 __do_sys_openat fs/open.c:1268 [inline]
 __se_sys_openat fs/open.c:1263 [inline]
 __x64_sys_openat+0x136/0x160 fs/open.c:1263
 x64_sys_call+0x219/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:258
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7fa9cab840d9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fa9ca9e5028 EFLAGS: 00000246
 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007fa9cae0bfa0 RCX: 00007fa9cab840d9
RDX: 0000000000000002 RSI: 0000200000000800 RDI: ffffffffffffff9c
RBP: 00007fa9cac1b024 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fa9cae0c038 R14: 00007fa9cae0bfa0 R15: 00007ffe67d253d8
 </TASK>

Allocated by task 395:
 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:433 [inline]
 ____kasan_kmalloc mm/kasan/common.c:512 [inline]
 __kasan_kmalloc+0xd4/0x100 mm/kasan/common.c:521
 kasan_kmalloc include/linux/kasan.h:227 [inline]
 kmem_cache_alloc_trace+0x119/0x270 mm/slub.c:3274
 kmalloc include/linux/slab.h:619 [inline]
 kzalloc include/linux/slab.h:750 [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:845
 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:642
 configfs_mkdir+0x50a/0x9c0 fs/configfs/dir.c:1329
 vfs_mkdir+0x38b/0x590 fs/namei.c:4073
 do_mkdirat+0x174/0x4d0 fs/namei.c:4098
 __do_sys_mkdirat fs/namei.c:4113 [inline]
 __se_sys_mkdirat fs/namei.c:4111 [inline]
 __x64_sys_mkdirat+0x89/0xa0 fs/namei.c:4111
 x64_sys_call+0x37e/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:259
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Freed by task 395:
 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:365
 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:373
 kasan_slab_free include/linux/kasan.h:193 [inline]
 slab_free_hook mm/slub.c:1728 [inline]
 slab_free_freelist_hook+0xc2/0x190 mm/slub.c:1754
 slab_free mm/slub.c:3526 [inline]
 kfree+0xc4/0x270 mm/slub.c:4588
 gserial_free_port+0x245/0x2e0 drivers/usb/gadget/function/u_serial.c:1202
 gserial_free_line+0x9b/0x1a0 drivers/usb/gadget/function/u_serial.c:1219
 acm_free_instance+0x39/0x60 drivers/usb/gadget/function/f_acm.c:832
 usb_put_function_instance+0x85/0xa0 drivers/usb/gadget/functions.c:77
 acm_attr_release+0x15/0x20 drivers/usb/gadget/function/f_acm.c:781
 config_item_cleanup fs/configfs/item.c:128 [inline]
 config_item_release fs/configfs/item.c:137 [inline]
 kref_put include/linux/kref.h:65 [inline]
 config_item_put+0x158/0x210 fs/configfs/item.c:149
 configfs_rmdir+0x89f/0x960 fs/configfs/dir.c:1540
 vfs_rmdir+0x1ae/0x450 fs/namei.c:4157
 do_rmdir+0x261/0x6b0 fs/namei.c:4218
 __do_sys_rmdir fs/namei.c:4237 [inline]
 __se_sys_rmdir fs/namei.c:4235 [inline]
 __x64_sys_rmdir+0x49/0x50 fs/namei.c:4235
 x64_sys_call+0x25f/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:85
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

The buggy address belongs to the object at ffff8881138f0000
 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 272 bytes inside of
 1024-byte region [ffff8881138f0000, ffff8881138f0400)
The buggy address belongs to the page:
page:ffffea00044e3c00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1138f0
head:ffffea00044e3c00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head|zone=1)
raw: 4000000000010200 0000000000000000 0000000100000001 ffff888100043080
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 101, ts 4924100586, free_ts 0
 set_page_owner include/linux/page_owner.h:33 [inline]
 post_alloc_hook+0x192/0x1b0 mm/page_alloc.c:2607
 prep_new_page+0x1c/0x110 mm/page_alloc.c:2613
 get_page_from_freelist+0x2c3a/0x2cd0 mm/page_alloc.c:4487
 __alloc_pages+0x1a2/0x460 mm/page_alloc.c:5824
 alloc_slab_page mm/slub.c:-1 [inline]
 allocate_slab mm/slub.c:1937 [inline]
 new_slab+0xa0/0x4d0 mm/slub.c:2000
 ___slab_alloc+0x3ac/0x840 mm/slub.c:3033
 __slab_alloc+0x49/0x90 mm/slub.c:3120
 slab_alloc_node mm/slub.c:3211 [inline]
 slab_alloc mm/slub.c:3255 [inline]
 __kmalloc_track_caller+0x169/0x2c0 mm/slub.c:4954
 kmalloc_reserve net/core/skbuff.c:357 [inline]
 __alloc_skb+0x210/0x730 net/core/skbuff.c:428
 alloc_skb include/linux/skbuff.h:1183 [inline]
 netlink_alloc_large_skb net/netlink/af_netlink.c:1186 [inline]
 netlink_sendmsg+0x611/0xb80 net/netlink/af_netlink.c:1902
 sock_sendmsg_nosec net/socket.c:704 [inline]
 __sock_sendmsg net/socket.c:716 [inline]
 ____sys_sendmsg+0x5be/0x8f0 net/socket.c:2436
 ___sys_sendmsg+0x236/0x2e0 net/socket.c:2490
 __sys_sendmsg net/socket.c:2519 [inline]
 __do_sys_sendmsg net/socket.c:2528 [inline]
 __se_sys_sendmsg net/socket.c:2526 [inline]
 __x64_sys_sendmsg+0x201/0x2d0 net/socket.c:2526
 x64_sys_call+0x4b/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:47
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
page_owner free stack trace missing

Memory state around the buggy address:
 ffff8881138f0000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881138f0080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8881138f0100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                         ^
 ffff8881138f0180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881138f0200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/08/13 02:16 android13-5.15-lts 54275df9611d 359b2492 .config console log report syz / log [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in tty_open
* Struck through repros no longer work on HEAD.