syzbot


KASAN: use-after-free Read in sock_def_write_space

Status: auto-obsoleted due to no activity on 2023/11/03 11:19
Reported-by: syzbot+510baeb4e47cc9a4f59a@syzkaller.appspotmail.com
First crash: 210d, last: 210d
Similar bugs (5)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in sock_def_write_space (3) intel-wired-lan 21 1007d 1244d 0/26 auto-closed as invalid on 2021/08/18 10:16
linux-5.15 KASAN: use-after-free Read in sock_def_write_space (2) 1 77d 77d 0/3 upstream: reported on 2023/12/06 00:46
upstream KASAN: use-after-free Read in sock_def_write_space (4) virtualization net 7 655d 823d 0/26 auto-closed as invalid on 2022/08/04 16:53
upstream KASAN: use-after-free Read in sock_def_write_space (2) arm-msm net C error 29 1253d 1310d 15/26 fixed on 2020/09/16 22:51
upstream KASAN: use-after-free Read in sock_def_write_space arm-msm net C done 67 1311d 1676d 15/26 fixed on 2020/07/20 08:03

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in list_empty include/linux/list.h:290 [inline]
BUG: KASAN: use-after-free in waitqueue_active include/linux/wait.h:129 [inline]
BUG: KASAN: use-after-free in wq_has_sleeper include/linux/wait.h:163 [inline]
BUG: KASAN: use-after-free in skwq_has_sleeper include/net/sock.h:2270 [inline]
BUG: KASAN: use-after-free in sock_def_write_space+0x18c/0x394 net/core/sock.c:3086
Read of size 8 at addr ffff0000fe04f880 by task ksoftirqd/0/14

CPU: 0 PID: 14 Comm: ksoftirqd/0 Not tainted 5.15.122-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/03/2023
Call trace:
 dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
 print_address_description+0x7c/0x3f0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x174/0x1e4 mm/kasan/report.c:451
 __asan_report_load8_noabort+0x44/0x50 mm/kasan/report_generic.c:309
 list_empty include/linux/list.h:290 [inline]
 waitqueue_active include/linux/wait.h:129 [inline]
 wq_has_sleeper include/linux/wait.h:163 [inline]
 skwq_has_sleeper include/net/sock.h:2270 [inline]
 sock_def_write_space+0x18c/0x394 net/core/sock.c:3086
 sock_wfree+0x110/0x230 net/core/sock.c:2205
 skb_release_head_state+0x108/0x2a0 net/core/skbuff.c:729
 skb_release_all net/core/skbuff.c:740 [inline]
 __kfree_skb net/core/skbuff.c:756 [inline]
 consume_skb+0x10c/0x40c net/core/skbuff.c:914
 __dev_kfree_skb_any+0xc8/0xf4 net/core/dev.c:3121
 dev_consume_skb_any include/linux/netdevice.h:4020 [inline]
 gve_clean_tx_done+0x26c/0xce8 drivers/net/ethernet/google/gve/gve_tx.c:639
 gve_tx_poll+0x15c/0x214 drivers/net/ethernet/google/gve/gve_tx.c:701
 gve_napi_poll+0x7c/0x27c drivers/net/ethernet/google/gve/gve_main.c:203
 __napi_poll+0xb4/0x624 net/core/dev.c:7012
 napi_poll net/core/dev.c:7079 [inline]
 net_rx_action+0x500/0xc10 net/core/dev.c:7166
 __do_softirq+0x344/0xe20 kernel/softirq.c:558
 do_softirq_own_stack include/asm-generic/softirq_stack.h:10 [inline]
 invoke_softirq kernel/softirq.c:439 [inline]
 __irq_exit_rcu+0x28c/0x534 kernel/softirq.c:636
 irq_exit+0x14/0x88 kernel/softirq.c:660
 handle_domain_irq+0xf4/0x178 kernel/irq/irqdesc.c:710
 gic_handle_irq+0x78/0x1c8 drivers/irqchip/irq-gic-v3.c:758
 call_on_irq_stack+0x24/0x4c arch/arm64/kernel/entry.S:899
 do_interrupt_handler+0x74/0x94 arch/arm64/kernel/entry-common.c:267
 el1_interrupt+0x30/0x58 arch/arm64/kernel/entry-common.c:442
 el1h_64_irq_handler+0x18/0x24 arch/arm64/kernel/entry-common.c:458
 el1h_64_irq+0x78/0x7c arch/arm64/kernel/entry.S:580
 arch_local_irq_enable arch/arm64/include/asm/irqflags.h:35 [inline]
 ksoftirqd_run_end kernel/softirq.c:412 [inline]
 run_ksoftirqd+0x74/0x258 kernel/softirq.c:921
 smpboot_thread_fn+0x4b0/0x920 kernel/smpboot.c:164
 kthread+0x37c/0x45c kernel/kthread.c:319
 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:870

Allocated by task 15931:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:434 [inline]
 __kasan_slab_alloc+0x8c/0xcc mm/kasan/common.c:467
 kasan_slab_alloc include/linux/kasan.h:254 [inline]
 slab_post_alloc_hook+0x74/0x3f4 mm/slab.h:519
 slab_alloc_node mm/slub.c:3220 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 kmem_cache_alloc+0x1dc/0x45c mm/slub.c:3233
 sock_alloc_inode+0x24/0xc4 net/socket.c:303
 alloc_inode fs/inode.c:236 [inline]
 new_inode_pseudo+0x68/0x200 fs/inode.c:937
 sock_alloc net/socket.c:626 [inline]
 __sock_create+0x134/0x884 net/socket.c:1431
 sock_create net/socket.c:1518 [inline]
 __sys_socket+0x168/0x310 net/socket.c:1560
 __do_sys_socket net/socket.c:1569 [inline]
 __se_sys_socket net/socket.c:1567 [inline]
 __arm64_sys_socket+0x7c/0x94 net/socket.c:1567
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:596
 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614
 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

Freed by task 20:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4c/0x84 mm/kasan/common.c:46
 kasan_set_free_info+0x28/0x4c mm/kasan/generic.c:360
 ____kasan_slab_free+0x118/0x164 mm/kasan/common.c:366
 __kasan_slab_free+0x18/0x28 mm/kasan/common.c:374
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:1705 [inline]
 slab_free_freelist_hook+0x128/0x1ec mm/slub.c:1731
 slab_free mm/slub.c:3499 [inline]
 kmem_cache_free+0xdc/0x3c4 mm/slub.c:3515
 sock_free_inode+0x28/0x38 net/socket.c:324
 i_callback+0x50/0x78 fs/inode.c:225
 rcu_do_batch kernel/rcu/tree.c:2510 [inline]
 rcu_core+0x830/0x1b34 kernel/rcu/tree.c:2750
 rcu_core_si+0x10/0x1c kernel/rcu/tree.c:2763
 __do_softirq+0x344/0xe20 kernel/softirq.c:558

Last potentially related work creation:
 kasan_save_stack+0x38/0x68 mm/kasan/common.c:38
 kasan_record_aux_stack+0xd4/0x11c mm/kasan/generic.c:348
 __call_rcu kernel/rcu/tree.c:2994 [inline]
 call_rcu+0x118/0xb40 kernel/rcu/tree.c:3074
 destroy_inode fs/inode.c:291 [inline]
 evict+0x5fc/0x68c fs/inode.c:602
 iput_final fs/inode.c:1705 [inline]
 iput+0x744/0x824 fs/inode.c:1731
 dentry_unlink_inode+0x370/0x4b0 fs/dcache.c:376
 __dentry_kill+0x324/0x5e4 fs/dcache.c:582
 dentry_kill+0xc8/0x250
 dput+0x21c/0x458 fs/dcache.c:888
 __fput+0x500/0x7f0 fs/file_table.c:288
 ____fput+0x20/0x30 fs/file_table.c:308
 task_work_run+0x130/0x1e4 kernel/task_work.c:164
 get_signal+0x1450/0x1550 kernel/signal.c:2661
 do_signal arch/arm64/kernel/signal.c:890 [inline]
 do_notify_resume+0x3d0/0x32b8 arch/arm64/kernel/signal.c:943
 prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:133 [inline]
 exit_to_user_mode arch/arm64/kernel/entry-common.c:138 [inline]
 el0_svc+0xfc/0x1f0 arch/arm64/kernel/entry-common.c:597
 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614
 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

Second to last potentially related work creation:
 kasan_save_stack+0x38/0x68 mm/kasan/common.c:38
 kasan_record_aux_stack+0xd4/0x11c mm/kasan/generic.c:348
 __call_rcu kernel/rcu/tree.c:2994 [inline]
 call_rcu+0x118/0xb40 kernel/rcu/tree.c:3074
 destroy_inode fs/inode.c:291 [inline]
 evict+0x5fc/0x68c fs/inode.c:602
 iput_final fs/inode.c:1705 [inline]
 iput+0x744/0x824 fs/inode.c:1731
 dentry_unlink_inode+0x370/0x4b0 fs/dcache.c:376
 __dentry_kill+0x324/0x5e4 fs/dcache.c:582
 dentry_kill+0xc8/0x250
 dput+0x21c/0x458 fs/dcache.c:888
 __fput+0x500/0x7f0 fs/file_table.c:288
 ____fput+0x20/0x30 fs/file_table.c:308
 task_work_run+0x130/0x1e4 kernel/task_work.c:164
 tracehook_notify_resume include/linux/tracehook.h:189 [inline]
 do_notify_resume+0x262c/0x32b8 arch/arm64/kernel/signal.c:946
 prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:133 [inline]
 exit_to_user_mode arch/arm64/kernel/entry-common.c:138 [inline]
 el0_svc+0xfc/0x1f0 arch/arm64/kernel/entry-common.c:597
 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614
 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

The buggy address belongs to the object at ffff0000fe04f800
 which belongs to the cache sock_inode_cache of size 1408
The buggy address is located 128 bytes inside of
 1408-byte region [ffff0000fe04f800, ffff0000fe04fd80)
The buggy address belongs to the page:
page:000000008ecb85ce refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x13e048
head:000000008ecb85ce order:3 compound_mapcount:0 compound_pincount:0
memcg:ffff0000d063d001
flags: 0x5ffc00000010200(slab|head|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000010200 dead000000000100 dead000000000122 ffff0000c0854480
raw: 0000000000000000 0000000080150015 00000001ffffffff ffff0000d063d001
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff0000fe04f780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff0000fe04f800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff0000fe04f880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff0000fe04f900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000fe04f980: 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/26 11:18 linux-5.15.y 5c6a716301d9 2a509c27 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in sock_def_write_space
* Struck through repros no longer work on HEAD.