syzbot


KASAN: slab-use-after-free Read in handle_tx

Status: auto-obsoleted due to no activity on 2023/10/27 13:43
Subsystems: net
[Documentation on labels]
Reported-by: syzbot+da88f03ae6b6b541dfa3@syzkaller.appspotmail.com
First crash: 515d, last: 515d
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-use-after-free Read in handle_tx (2) net 110 4h52m 308d 0/28 upstream: reported on 2024/02/21 10:58
upstream KASAN: use-after-free Read in handle_tx net 15 1048d 1161d 0/28 auto-closed as invalid on 2022/05/12 13:20
upstream KASAN: use-after-free Read in handle_tx (2) net 1 684d 680d 0/28 auto-obsoleted due to no activity on 2023/05/11 18:22
linux-6.1 KASAN: use-after-free Read in handle_tx 1 59d 59d 0/3 upstream: reported on 2024/10/28 09:49

Sample crash report:
ieee802154 phy0 wpan0: encryption failed: -22
ieee802154 phy1 wpan1: encryption failed: -22
==================================================================
BUG: KASAN: slab-use-after-free in handle_tx+0x589/0x620 drivers/net/caif/caif_serial.c:236
Read of size 8 at addr ffff88802a77c018 by task aoe_tx0/1355

CPU: 2 PID: 1355 Comm: aoe_tx0 Not tainted 6.5.0-rc3-syzkaller-00275-gffabf7c73176 #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:364 [inline]
 print_report+0xc4/0x620 mm/kasan/report.c:475
 kasan_report+0xda/0x110 mm/kasan/report.c:588
 handle_tx+0x589/0x620 drivers/net/caif/caif_serial.c:236
 __netdev_start_xmit include/linux/netdevice.h:4910 [inline]
 netdev_start_xmit include/linux/netdevice.h:4924 [inline]
 xmit_one net/core/dev.c:3537 [inline]
 dev_hard_start_xmit+0x13d/0x6c0 net/core/dev.c:3553
 __dev_queue_xmit+0xa55/0x3f20 net/core/dev.c:4203
 dev_queue_xmit include/linux/netdevice.h:3088 [inline]
 tx+0x76/0x100 drivers/block/aoe/aoenet.c:63
 kthread+0x1e4/0x3b0 drivers/block/aoe/aoecmd.c:1229
 kthread+0x33a/0x430 kernel/kthread.c:389
 ret_from_fork+0x2c/0x70 arch/x86/kernel/process.c:145
 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:296
RIP: 0000:0x0
Code: Unable to access opcode bytes at 0xffffffffffffffd6.
RSP: 0000:0000000000000000 EFLAGS: 00000000 ORIG_RAX: 0000000000000000
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>

Allocated by task 27992:
 kasan_save_stack+0x33/0x50 mm/kasan/common.c:45
 kasan_set_track+0x25/0x30 mm/kasan/common.c:52
 ____kasan_kmalloc mm/kasan/common.c:374 [inline]
 __kasan_kmalloc+0xa3/0xb0 mm/kasan/common.c:383
 kmalloc include/linux/slab.h:582 [inline]
 kzalloc include/linux/slab.h:703 [inline]
 alloc_tty_struct+0x98/0x8b0 drivers/tty/tty_io.c:3099
 tty_init_dev.part.0+0x1e/0x660 drivers/tty/tty_io.c:1417
 tty_init_dev include/linux/err.h:61 [inline]
 tty_open_by_driver drivers/tty/tty_io.c:2090 [inline]
 tty_open+0xb29/0x1020 drivers/tty/tty_io.c:2137
 chrdev_open+0x277/0x700 fs/char_dev.c:414
 do_dentry_open+0x88b/0x1780 fs/open.c:914
 do_open fs/namei.c:3636 [inline]
 path_openat+0x19af/0x29c0 fs/namei.c:3793
 do_filp_open+0x1de/0x430 fs/namei.c:3820
 do_sys_openat2+0x176/0x1e0 fs/open.c:1407
 do_sys_open fs/open.c:1422 [inline]
 __do_sys_openat fs/open.c:1438 [inline]
 __se_sys_openat fs/open.c:1433 [inline]
 __x64_sys_openat+0x175/0x210 fs/open.c:1433
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Freed by task 11306:
 kasan_save_stack+0x33/0x50 mm/kasan/common.c:45
 kasan_set_track+0x25/0x30 mm/kasan/common.c:52
 kasan_save_free_info+0x28/0x40 mm/kasan/generic.c:522
 ____kasan_slab_free mm/kasan/common.c:236 [inline]
 ____kasan_slab_free+0x13f/0x190 mm/kasan/common.c:200
 kasan_slab_free include/linux/kasan.h:162 [inline]
 __cache_free mm/slab.c:3370 [inline]
 __do_kmem_cache_free mm/slab.c:3557 [inline]
 __kmem_cache_free+0xcc/0x2d0 mm/slab.c:3564
 process_one_work+0xaa2/0x16f0 kernel/workqueue.c:2597
 worker_thread+0x687/0x1110 kernel/workqueue.c:2748
 kthread+0x33a/0x430 kernel/kthread.c:389
 ret_from_fork+0x2c/0x70 arch/x86/kernel/process.c:145
 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:296

Last potentially related work creation:
 kasan_save_stack+0x33/0x50 mm/kasan/common.c:45
 __kasan_record_aux_stack+0x78/0x80 mm/kasan/generic.c:492
 insert_work+0x4a/0x330 kernel/workqueue.c:1553
 __queue_work+0x5f5/0x1040 kernel/workqueue.c:1714
 queue_work_on+0xed/0x110 kernel/workqueue.c:1744
 kref_put include/linux/kref.h:65 [inline]
 tty_kref_put drivers/tty/tty_io.c:1574 [inline]
 tty_kref_put drivers/tty/tty_io.c:1571 [inline]
 release_tty+0x4de/0x600 drivers/tty/tty_io.c:1610
 tty_release_struct+0xb7/0xe0 drivers/tty/tty_io.c:1709
 tty_release+0xe23/0x1410 drivers/tty/tty_io.c:1869
 __fput+0x3fd/0xac0 fs/file_table.c:384
 task_work_run+0x14d/0x240 kernel/task_work.c:179
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:171 [inline]
 exit_to_user_mode_prepare+0x210/0x240 kernel/entry/common.c:204
 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline]
 syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:297
 do_syscall_64+0x44/0xb0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Second to last potentially related work creation:
 kasan_save_stack+0x33/0x50 mm/kasan/common.c:45
 __kasan_record_aux_stack+0x78/0x80 mm/kasan/generic.c:492
 __call_rcu_common.constprop.0+0x9a/0x790 kernel/rcu/tree.c:2649
 in6_dev_finish_destroy+0x175/0x220 net/ipv6/addrconf_core.c:271
 in6_dev_put include/net/addrconf.h:380 [inline]
 addrconf_ifdown.isra.0+0x17ef/0x1c50 net/ipv6/addrconf.c:3916
 addrconf_notify+0x22d/0x1940 net/ipv6/addrconf.c:3683
 notifier_call_chain+0xb6/0x3b0 kernel/notifier.c:93
 call_netdevice_notifiers_info+0xb9/0x130 net/core/dev.c:1962
 call_netdevice_notifiers_extack net/core/dev.c:2000 [inline]
 call_netdevice_notifiers net/core/dev.c:2014 [inline]
 unregister_netdevice_many_notify+0x82b/0x19a0 net/core/dev.c:10850
 unregister_netdevice_many net/core/dev.c:10906 [inline]
 unregister_netdevice_queue+0x2e5/0x3c0 net/core/dev.c:10786
 unregister_netdevice include/linux/netdevice.h:3112 [inline]
 ser_release+0x195/0x280 drivers/net/caif/caif_serial.c:310
 process_one_work+0xaa2/0x16f0 kernel/workqueue.c:2597
 worker_thread+0x687/0x1110 kernel/workqueue.c:2748
 kthread+0x33a/0x430 kernel/kthread.c:389
 ret_from_fork+0x2c/0x70 arch/x86/kernel/process.c:145
 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:296

The buggy address belongs to the object at ffff88802a77c000
 which belongs to the cache kmalloc-cg-2k of size 2048
The buggy address is located 24 bytes inside of
 freed 2048-byte region [ffff88802a77c000, ffff88802a77c800)

The buggy address belongs to the physical page:
page:ffffea0000a9df00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2a77c
memcg:ffff88802b7dd681
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0x1()
raw: 00fff00000000200 ffff88801284d900 ffffea0000a7d750 ffffea0000975750
raw: 0000000000000000 ffff88802a77c000 0000000100000001 ffff88802b7dd681
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x2420c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_COMP|__GFP_THISNODE), pid 24849, tgid 24848 (syz-executor.1), ts 1388499372252, free_ts 1388215741202
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x2d2/0x350 mm/page_alloc.c:1570
 prep_new_page mm/page_alloc.c:1577 [inline]
 get_page_from_freelist+0x10a9/0x31e0 mm/page_alloc.c:3221
 __alloc_pages_slowpath.constprop.0+0x2dd/0x2360 mm/page_alloc.c:4011
 __alloc_pages+0x411/0x4a0 mm/page_alloc.c:4490
 __alloc_pages_node include/linux/gfp.h:237 [inline]
 kmem_getpages mm/slab.c:1356 [inline]
 cache_grow_begin+0x99/0x3a0 mm/slab.c:2550
 cache_alloc_refill+0x294/0x3a0 mm/slab.c:2923
 ____cache_alloc mm/slab.c:2999 [inline]
 ____cache_alloc mm/slab.c:2982 [inline]
 __do_cache_alloc mm/slab.c:3182 [inline]
 slab_alloc_node mm/slab.c:3230 [inline]
 __kmem_cache_alloc_node+0x3c9/0x470 mm/slab.c:3521
 __do_kmalloc_node mm/slab_common.c:984 [inline]
 __kmalloc+0x4c/0x100 mm/slab_common.c:998
 kmalloc include/linux/slab.h:586 [inline]
 kzalloc include/linux/slab.h:703 [inline]
 __register_sysctl_table+0x10e/0x1660 fs/proc/proc_sysctl.c:1367
 __devinet_sysctl_register+0x1b0/0x360 net/ipv4/devinet.c:2590
 devinet_sysctl_register net/ipv4/devinet.c:2630 [inline]
 devinet_sysctl_register+0x156/0x220 net/ipv4/devinet.c:2620
 inetdev_init+0x286/0x570 net/ipv4/devinet.c:286
 inetdev_event+0x1156/0x1900 net/ipv4/devinet.c:1538
 notifier_call_chain+0xb6/0x3b0 kernel/notifier.c:93
 call_netdevice_notifiers_info+0xb9/0x130 net/core/dev.c:1962
 call_netdevice_notifiers_extack net/core/dev.c:2000 [inline]
 call_netdevice_notifiers net/core/dev.c:2014 [inline]
 register_netdevice+0x1029/0x1630 net/core/dev.c:10084
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1161 [inline]
 free_unref_page_prepare+0x508/0xb90 mm/page_alloc.c:2348
 free_unref_page+0x33/0x3b0 mm/page_alloc.c:2443
 slab_destroy mm/slab.c:1608 [inline]
 slabs_destroy+0x85/0xc0 mm/slab.c:1628
 cache_flusharray mm/slab.c:3341 [inline]
 ___cache_free+0x2b6/0x420 mm/slab.c:3404
 qlink_free mm/kasan/quarantine.c:166 [inline]
 qlist_free_all+0x4c/0x1b0 mm/kasan/quarantine.c:185
 kasan_quarantine_reduce+0x18b/0x1d0 mm/kasan/quarantine.c:292
 __kasan_slab_alloc+0x65/0x90 mm/kasan/common.c:305
 kasan_slab_alloc include/linux/kasan.h:186 [inline]
 slab_post_alloc_hook mm/slab.h:762 [inline]
 slab_alloc_node mm/slab.c:3237 [inline]
 slab_alloc mm/slab.c:3246 [inline]
 __kmem_cache_alloc_lru mm/slab.c:3423 [inline]
 kmem_cache_alloc+0x15e/0x400 mm/slab.c:3432
 getname_flags.part.0+0x50/0x4d0 fs/namei.c:140
 getname_flags include/linux/audit.h:319 [inline]
 getname fs/namei.c:219 [inline]
 __do_sys_unlink fs/namei.c:4443 [inline]
 __se_sys_unlink fs/namei.c:4441 [inline]
 __x64_sys_unlink+0xb3/0x110 fs/namei.c:4441
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Memory state around the buggy address:
 ffff88802a77bf00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88802a77bf80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88802a77c000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                            ^
 ffff88802a77c080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88802a77c100: 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
2023/07/29 13:42 upstream ffabf7c73176 92476829 .config console log report info ci-qemu-upstream KASAN: slab-use-after-free Read in handle_tx
* Struck through repros no longer work on HEAD.