syzbot


KASAN: use-after-free Read in sock_def_write_space (2)

Status: upstream: reported on 2023/12/06 00:46
Reported-by: syzbot+a72dfe1c550b7feb34f8@syzkaller.appspotmail.com
First crash: 77d, last: 77d
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
upstream KASAN: use-after-free Read in sock_def_write_space (4) virtualization net 7 656d 824d 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
linux-5.15 KASAN: use-after-free Read in sock_def_write_space 1 210d 210d 0/3 auto-obsoleted due to no activity on 2023/11/03 11:19
upstream KASAN: use-after-free Read in sock_def_write_space arm-msm net C done 67 1311d 1677d 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:2289 [inline]
BUG: KASAN: use-after-free in sock_def_write_space+0x18c/0x394 net/core/sock.c:3090
Read of size 8 at addr ffff00011cc56080 by task ksoftirqd/0/14

CPU: 0 PID: 14 Comm: ksoftirqd/0 Not tainted 5.15.141-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/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:2289 [inline]
 sock_def_write_space+0x18c/0x394 net/core/sock.c:3090
 sock_wfree+0x110/0x230 net/core/sock.c:2209
 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:3141
 dev_consume_skb_any include/linux/netdevice.h:4021 [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:7032
 napi_poll net/core/dev.c:7099 [inline]
 net_rx_action+0x500/0xc10 net/core/dev.c:7186
 __do_softirq+0x344/0xdb0 kernel/softirq.c:558
 run_ksoftirqd+0x68/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 5155:
 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:1448
 sock_create net/socket.c:1535 [inline]
 __sys_socket+0x168/0x310 net/socket.c:1577
 __do_sys_socket net/socket.c:1586 [inline]
 __se_sys_socket net/socket.c:1584 [inline]
 __arm64_sys_socket+0x7c/0x94 net/socket.c:1584
 __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:608
 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

Freed by task 5141:
 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:2523 [inline]
 rcu_core+0x830/0x1b34 kernel/rcu/tree.c:2763
 rcu_core_si+0x10/0x1c kernel/rcu/tree.c:2776
 __do_softirq+0x344/0xdb0 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:3007 [inline]
 call_rcu+0x118/0xb40 kernel/rcu/tree.c:3087
 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:609
 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
 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:3007 [inline]
 call_rcu+0x118/0xb40 kernel/rcu/tree.c:3087
 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:609
 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

The buggy address belongs to the object at ffff00011cc56000
 which belongs to the cache sock_inode_cache of size 1408
The buggy address is located 128 bytes inside of
 1408-byte region [ffff00011cc56000, ffff00011cc56580)
The buggy address belongs to the page:
page:00000000e6f5f1c1 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x15cc50
head:00000000e6f5f1c1 order:3 compound_mapcount:0 compound_pincount:0
memcg:ffff0000c9053601
flags: 0x5ffc00000010200(slab|head|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000010200 fffffc00037b9800 0000000200000002 ffff0000c085a480
raw: 0000000000000000 0000000000150015 00000001ffffffff ffff0000c9053601
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff00011cc55f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff00011cc56000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff00011cc56080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff00011cc56100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff00011cc56180: 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/12/06 00:45 linux-5.15.y 9b91d36ba301 858d62d1 .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.