[v6.1] KASAN: use-after-free Read in pty_write_room

0 views
Skip to first unread message

syzbot

unread,
Mar 20, 2026, 10:43:23 AM (2 days ago) Mar 20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: f2ddafa93a25 Linux 6.1.166
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=136f1e02580000
kernel config: https://syzkaller.appspot.com/x/.config?x=f0605c5af04d7603
dashboard link: https://syzkaller.appspot.com/bug?extid=b212af49a9645096502e
compiler: Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/5d86a86f0032/disk-f2ddafa9.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/aafc10ea040b/vmlinux-f2ddafa9.xz
kernel image: https://storage.googleapis.com/syzbot-assets/f6b46858e7a5/bzImage-f2ddafa9.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+b212af...@syzkaller.appspotmail.com

ieee802154 phy0 wpan0: encryption failed: -22
ieee802154 phy1 wpan1: encryption failed: -22
==================================================================
BUG: KASAN: use-after-free in pty_write_room+0x82/0xb0 drivers/tty/pty.c:133
Read of size 8 at addr ffff888027fd96b8 by task aoe_tx0/1274

CPU: 0 PID: 1274 Comm: aoe_tx0 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2026
Call Trace:
<TASK>
dump_stack_lvl+0x188/0x24e lib/dump_stack.c:106
print_address_description mm/kasan/report.c:316 [inline]
print_report+0xa8/0x210 mm/kasan/report.c:420
kasan_report+0x10b/0x140 mm/kasan/report.c:524
pty_write_room+0x82/0xb0 drivers/tty/pty.c:133
handle_tx+0x164/0x600 drivers/net/caif/caif_serial.c:226
__netdev_start_xmit include/linux/netdevice.h:4896 [inline]
netdev_start_xmit include/linux/netdevice.h:4910 [inline]
xmit_one net/core/dev.c:3683 [inline]
dev_hard_start_xmit+0x262/0x870 net/core/dev.c:3699
__dev_queue_xmit+0x1aa3/0x37c0 net/core/dev.c:4363
dev_queue_xmit include/linux/netdevice.h:3051 [inline]
tx+0x67/0x170 drivers/block/aoe/aoenet.c:63
kthread+0x1ce/0x3b0 drivers/block/aoe/aoecmd.c:1241
kthread+0x29d/0x330 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
</TASK>

Allocated by task 4915:
kasan_save_stack mm/kasan/common.c:46 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:53
____kasan_kmalloc mm/kasan/common.c:375 [inline]
__kasan_kmalloc+0x8e/0xa0 mm/kasan/common.c:384
kmalloc include/linux/slab.h:563 [inline]
kzalloc include/linux/slab.h:699 [inline]
alloc_tty_struct+0xa6/0x760 drivers/tty/tty_io.c:3089
pty_common_install+0x17b/0x760 drivers/tty/pty.c:379
tty_driver_install_tty drivers/tty/tty_io.c:1303 [inline]
tty_init_dev+0xcf/0x4c0 drivers/tty/tty_io.c:1415
ptmx_open+0xdb/0x2c0 drivers/tty/pty.c:824
chrdev_open+0x5c5/0x6a0 fs/char_dev.c:414
do_dentry_open+0x7e9/0x10d0 fs/open.c:882
do_open fs/namei.c:3634 [inline]
path_openat+0x2635/0x2ee0 fs/namei.c:3791
do_filp_open+0x1f1/0x430 fs/namei.c:3818
do_sys_openat2+0x150/0x4b0 fs/open.c:1320
do_sys_open fs/open.c:1336 [inline]
__do_sys_openat fs/open.c:1352 [inline]
__se_sys_openat fs/open.c:1347 [inline]
__x64_sys_openat+0x135/0x160 fs/open.c:1347
do_syscall_x64 arch/x86/entry/common.c:46 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
entry_SYSCALL_64_after_hwframe+0x68/0xd2

Freed by task 4352:
kasan_save_stack mm/kasan/common.c:46 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:53
kasan_save_free_info+0x2d/0x50 mm/kasan/generic.c:516
____kasan_slab_free+0x126/0x1e0 mm/kasan/common.c:237
kasan_slab_free include/linux/kasan.h:177 [inline]
slab_free_hook mm/slub.c:1729 [inline]
slab_free_freelist_hook+0x131/0x1a0 mm/slub.c:1755
slab_free mm/slub.c:3687 [inline]
__kmem_cache_free+0xb6/0x1f0 mm/slub.c:3700
process_one_work+0x8a2/0x1160 kernel/workqueue.c:2292
worker_thread+0xaa2/0x1270 kernel/workqueue.c:2439
kthread+0x29d/0x330 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Last potentially related work creation:
kasan_save_stack+0x3a/0x60 mm/kasan/common.c:46
__kasan_record_aux_stack+0xb2/0xc0 mm/kasan/generic.c:486
insert_work+0x54/0x3c0 kernel/workqueue.c:1361
__queue_work+0xba3/0xfb0 kernel/workqueue.c:1520
queue_work_on+0x124/0x1f0 kernel/workqueue.c:1548
release_tty+0x4b8/0x560 drivers/tty/tty_io.c:1600
tty_release_struct+0xb4/0xd0 drivers/tty/tty_io.c:1700
tty_release+0xc72/0x1600 drivers/tty/tty_io.c:1860
__fput+0x22c/0x920 fs/file_table.c:320
task_work_run+0x1d0/0x260 kernel/task_work.c:203
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
exit_to_user_mode_loop+0xe6/0x110 kernel/entry/common.c:177
exit_to_user_mode_prepare+0xee/0x180 kernel/entry/common.c:210
__syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline]
syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:303
do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:82
entry_SYSCALL_64_after_hwframe+0x68/0xd2

Second to last potentially related work creation:
kasan_save_stack+0x3a/0x60 mm/kasan/common.c:46
__kasan_record_aux_stack+0xb2/0xc0 mm/kasan/generic.c:486
insert_work+0x54/0x3c0 kernel/workqueue.c:1361
__queue_work+0xba3/0xfb0 kernel/workqueue.c:1520
queue_work_on+0x124/0x1f0 kernel/workqueue.c:1548
__bpf_prog_release net/core/filter.c:1183 [inline]
bpf_prepare_filter+0xfb7/0x11d0 net/core/filter.c:1333
bpf_prog_create_from_user+0x2ce/0x420 net/core/filter.c:1451
seccomp_prepare_filter kernel/seccomp.c:671 [inline]
seccomp_prepare_user_filter kernel/seccomp.c:708 [inline]
seccomp_set_mode_filter kernel/seccomp.c:1869 [inline]
do_seccomp+0x80d/0xe10 kernel/seccomp.c:1989
do_syscall_x64 arch/x86/entry/common.c:46 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
entry_SYSCALL_64_after_hwframe+0x68/0xd2

The buggy address belongs to the object at ffff888027fd9000
which belongs to the cache kmalloc-cg-2k of size 2048
The buggy address is located 1720 bytes inside of
2048-byte region [ffff888027fd9000, ffff888027fd9800)

The buggy address belongs to the physical page:
page:ffffea00009ff600 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x27fd8
head:ffffea00009ff600 order:3 compound_mapcount:0 compound_pincount:0
memcg:ffff88801db7a281
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 dead000000000100 dead000000000122 ffff88801744c140
raw: 0000000000000000 0000000000080008 00000001ffffffff ffff88801db7a281
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 4267, tgid 4267 (syz-executor), ts 70706084708, free_ts 70700585696
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x173/0x1a0 mm/page_alloc.c:2559
prep_new_page mm/page_alloc.c:2566 [inline]
get_page_from_freelist+0x1a1e/0x1ab0 mm/page_alloc.c:4357
__alloc_pages+0x1ec/0x4f0 mm/page_alloc.c:5657
alloc_slab_page+0x5d/0x160 mm/slub.c:1799
allocate_slab mm/slub.c:1944 [inline]
new_slab+0x87/0x2c0 mm/slub.c:1997
___slab_alloc+0xbc6/0x1240 mm/slub.c:3154
__slab_alloc mm/slub.c:3240 [inline]
slab_alloc_node mm/slub.c:3325 [inline]
__kmem_cache_alloc_node+0x1a0/0x260 mm/slub.c:3398
__do_kmalloc_node mm/slab_common.c:935 [inline]
__kmalloc_node_track_caller+0x9e/0x230 mm/slab_common.c:956
kmemdup+0x27/0x60 mm/util.c:129
kmemdup include/linux/fortify-string.h:585 [inline]
neigh_sysctl_register+0xab/0xa80 net/core/neighbour.c:3796
devinet_sysctl_register+0xa8/0x1f0 net/ipv4/devinet.c:2649
inetdev_init+0x2b4/0x4f0 net/ipv4/devinet.c:280
inetdev_event+0x26f/0x1400 net/ipv4/devinet.c:1547
notifier_call_chain kernel/notifier.c:87 [inline]
raw_notifier_call_chain+0xcb/0x160 kernel/notifier.c:455
call_netdevice_notifiers_extack net/core/dev.c:2052 [inline]
call_netdevice_notifiers net/core/dev.c:2066 [inline]
register_netdevice+0x163f/0x1b00 net/core/dev.c:10263
nsim_init_netdevsim drivers/net/netdevsim/netdev.c:317 [inline]
nsim_create+0x35f/0x410 drivers/net/netdevsim/netdev.c:365
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1486 [inline]
free_pcp_prepare mm/page_alloc.c:1536 [inline]
free_unref_page_prepare+0x8b4/0x9a0 mm/page_alloc.c:3413
free_unref_page+0x2e/0x3f0 mm/page_alloc.c:3508
free_slab mm/slub.c:2036 [inline]
discard_slab mm/slub.c:2042 [inline]
__unfreeze_partials+0x1a5/0x200 mm/slub.c:2591
put_cpu_partial+0x17c/0x250 mm/slub.c:2667
qlink_free mm/kasan/quarantine.c:168 [inline]
qlist_free_all+0x76/0xe0 mm/kasan/quarantine.c:187
kasan_quarantine_reduce+0x144/0x160 mm/kasan/quarantine.c:294
__kasan_slab_alloc+0x1e/0x80 mm/kasan/common.c:306
kasan_slab_alloc include/linux/kasan.h:201 [inline]
slab_post_alloc_hook+0x4b/0x480 mm/slab.h:737
slab_alloc_node mm/slub.c:3359 [inline]
__kmem_cache_alloc_node+0x140/0x260 mm/slub.c:3398
kmalloc_trace+0x26/0xe0 mm/slab_common.c:1026
kmalloc include/linux/slab.h:563 [inline]
netdevice_queue_work drivers/infiniband/core/roce_gid_mgmt.c:643 [inline]
netdevice_event+0x325/0x900 drivers/infiniband/core/roce_gid_mgmt.c:802
notifier_call_chain kernel/notifier.c:87 [inline]
raw_notifier_call_chain+0xcb/0x160 kernel/notifier.c:455
call_netdevice_notifiers_extack net/core/dev.c:2052 [inline]
call_netdevice_notifiers net/core/dev.c:2066 [inline]
__dev_notify_flags+0x194/0x300 net/core/dev.c:8702
dev_change_flags+0xe3/0x1a0 net/core/dev.c:8740
do_setlink+0xba1/0x3e60 net/core/rtnetlink.c:2833
__rtnl_newlink net/core/rtnetlink.c:3608 [inline]
rtnl_newlink+0x177c/0x2080 net/core/rtnetlink.c:3655

Memory state around the buggy address:
ffff888027fd9580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888027fd9600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888027fd9680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888027fd9700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888027fd9780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup
Reply all
Reply to author
Forward
0 new messages