syzbot


KASAN: use-after-free Read in unix_stream_read_actor

Status: auto-obsoleted due to no activity on 2024/02/19 03:43
Bug presence: origin:upstream
[Documentation on labels]
Reported-by: syzbot+0f45031d26c6e8a1d1e2@syzkaller.appspotmail.com
First crash: 172d, last: 172d
Bug presence (3)
Date Name Commit Repro Result
2023/11/11 lts (merge base) 12952a23a5da C [report] KASAN: use-after-free Read in unix_stream_read_actor
2023/11/11 upstream (ToT) 3ca112b71f35 C [report] KASAN: slab-use-after-free Read in __skb_datagram_iter
2023/12/26 upstream (ToT) fbafc3e621c3 C Didn't crash
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-6-1 KASAN: use-after-free Read in unix_stream_read_actor missing-backport origin:upstream C done done 2 98d 172d 0/2 upstream: reported C repro on 2023/11/11 01:48
linux-5.15 KASAN: use-after-free Read in unix_stream_read_actor origin:lts-only C done 1 170d 172d 3/3 fixed on 2023/12/13 18:20
linux-6.1 KASAN: use-after-free Read in unix_stream_read_actor origin:lts-only C done 1 168d 172d 3/3 fixed on 2023/12/18 16:47
upstream KASAN: slab-use-after-free Read in unix_stream_read_actor net C error 6 156d 172d 25/26 fixed on 2024/01/20 21:18
Last patch testing requests (1)
Created Duration User Patch Repo Result
2023/11/25 03:47 11m retest repro android13-5.15-lts report log

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in unix_stream_read_actor+0xa3/0xb0 net/unix/af_unix.c:2809
Read of size 4 at addr ffff88811ed1ce04 by task syz-executor396/943

CPU: 0 PID: 943 Comm: syz-executor396 Not tainted 5.15.137-syzkaller-01792-g61cfd264993d #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/09/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106
 print_address_description+0x87/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:427 [inline]
 kasan_report+0x179/0x1c0 mm/kasan/report.c:444
 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:308
 unix_stream_read_actor+0xa3/0xb0 net/unix/af_unix.c:2809
 unix_stream_recv_urg+0x1b4/0x2f0 net/unix/af_unix.c:2535
 unix_stream_read_generic+0x2147/0x2240 net/unix/af_unix.c:2615
 unix_stream_recvmsg+0x22d/0x2c0 net/unix/af_unix.c:2847
 ____sys_recvmsg+0x286/0x530
 ___sys_recvmsg+0x1ec/0x690 net/socket.c:2690
 __sys_recvmsg net/socket.c:2720 [inline]
 __do_sys_recvmsg net/socket.c:2730 [inline]
 __se_sys_recvmsg net/socket.c:2727 [inline]
 __x64_sys_recvmsg+0x1dc/0x2b0 net/socket.c:2727
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7f01363844e9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 51 18 00 00 90 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f0136303228 EFLAGS: 00000246 ORIG_RAX: 000000000000002f
RAX: ffffffffffffffda RBX: 0000000000000028 RCX: 00007f01363844e9
RDX: 0000000040010083 RSI: 0000000020000140 RDI: 0000000000000004
RBP: 00007f013640e348 R08: 00007f01363036c0 R09: 00007f01363036c0
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f013640e340
R13: 00007f013640e34c R14: 00007ffca2664350 R15: 00007ffca2664438
 </TASK>

Allocated by task 942:
 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_slab_alloc+0xb1/0xe0 mm/kasan/common.c:466
 kasan_slab_alloc include/linux/kasan.h:217 [inline]
 slab_post_alloc_hook+0x53/0x2c0 mm/slab.h:550
 slab_alloc_node mm/slub.c:3240 [inline]
 slab_alloc mm/slub.c:3248 [inline]
 kmem_cache_alloc+0xf5/0x200 mm/slub.c:3253
 kmem_cache_alloc_node include/linux/slab.h:474 [inline]
 __alloc_skb+0xbe/0x550 net/core/skbuff.c:416
 alloc_skb include/linux/skbuff.h:1183 [inline]
 alloc_skb_with_frags+0xa6/0x680 net/core/skbuff.c:6156
 sock_alloc_send_pskb+0x915/0xa50 net/core/sock.c:2518
 sock_alloc_send_skb+0x32/0x40 net/core/sock.c:2535
 queue_oob+0xfd/0x8c0 net/unix/af_unix.c:1980
 unix_stream_sendmsg+0xe06/0x1060 net/unix/af_unix.c:2117
 sock_sendmsg_nosec net/socket.c:704 [inline]
 __sock_sendmsg net/socket.c:716 [inline]
 ____sys_sendmsg+0x59e/0x8f0 net/socket.c:2429
 ___sys_sendmsg+0x252/0x2e0 net/socket.c:2483
 __sys_sendmsg net/socket.c:2512 [inline]
 __do_sys_sendmsg net/socket.c:2521 [inline]
 __se_sys_sendmsg+0x19a/0x260 net/socket.c:2519
 __x64_sys_sendmsg+0x7b/0x90 net/socket.c:2519
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Freed by task 942:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:45
 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370
 ____kasan_slab_free+0x126/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:1723 [inline]
 slab_free_freelist_hook+0xbd/0x190 mm/slub.c:1749
 slab_free mm/slub.c:3519 [inline]
 kmem_cache_free+0x116/0x2e0 mm/slub.c:3535
 kfree_skbmem+0x104/0x170
 __kfree_skb net/core/skbuff.c:758 [inline]
 consume_skb+0xb4/0x250 net/core/skbuff.c:930
 queue_oob+0x522/0x8c0 net/unix/af_unix.c:2011
 unix_stream_sendmsg+0xe06/0x1060 net/unix/af_unix.c:2117
 sock_sendmsg_nosec net/socket.c:704 [inline]
 __sock_sendmsg net/socket.c:716 [inline]
 ____sys_sendmsg+0x59e/0x8f0 net/socket.c:2429
 ___sys_sendmsg+0x252/0x2e0 net/socket.c:2483
 __sys_sendmsg net/socket.c:2512 [inline]
 __do_sys_sendmsg net/socket.c:2521 [inline]
 __se_sys_sendmsg+0x19a/0x260 net/socket.c:2519
 __x64_sys_sendmsg+0x7b/0x90 net/socket.c:2519
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

The buggy address belongs to the object at ffff88811ed1cdc0
 which belongs to the cache skbuff_head_cache of size 248
The buggy address is located 68 bytes inside of
 248-byte region [ffff88811ed1cdc0, ffff88811ed1ceb8)
The buggy address belongs to the page:
page:ffffea00047b4700 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11ed1c
flags: 0x4000000000000200(slab|zone=1)
raw: 4000000000000200 0000000000000000 dead000000000122 ffff888100351b00
raw: 0000000000000000 00000000000c000c 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 938, ts 42766038655, free_ts 42713201046
 set_page_owner include/linux/page_owner.h:33 [inline]
 post_alloc_hook+0x1a3/0x1b0 mm/page_alloc.c:2602
 prep_new_page+0x1b/0x110 mm/page_alloc.c:2608
 get_page_from_freelist+0x3550/0x35d0 mm/page_alloc.c:4482
 __alloc_pages+0x206/0x5e0 mm/page_alloc.c:5773
 allocate_slab mm/slub.c:1932 [inline]
 new_slab+0x9a/0x4e0 mm/slub.c:1995
 ___slab_alloc+0x39e/0x830 mm/slub.c:3028
 __slab_alloc+0x4a/0x90 mm/slub.c:3115
 slab_alloc_node mm/slub.c:3206 [inline]
 slab_alloc mm/slub.c:3248 [inline]
 kmem_cache_alloc+0x134/0x200 mm/slub.c:3253
 kmem_cache_alloc_node include/linux/slab.h:474 [inline]
 __alloc_skb+0xbe/0x550 net/core/skbuff.c:416
 alloc_skb include/linux/skbuff.h:1183 [inline]
 alloc_skb_with_frags+0xa6/0x680 net/core/skbuff.c:6156
 sock_alloc_send_pskb+0x915/0xa50 net/core/sock.c:2518
 sock_alloc_send_skb+0x32/0x40 net/core/sock.c:2535
 queue_oob+0xfd/0x8c0 net/unix/af_unix.c:1980
 unix_stream_sendmsg+0xe06/0x1060 net/unix/af_unix.c:2117
 sock_sendmsg_nosec net/socket.c:704 [inline]
 __sock_sendmsg net/socket.c:716 [inline]
 ____sys_sendmsg+0x59e/0x8f0 net/socket.c:2429
 ___sys_sendmsg+0x252/0x2e0 net/socket.c:2483
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:26 [inline]
 free_pages_prepare mm/page_alloc.c:1469 [inline]
 free_pcp_prepare mm/page_alloc.c:1541 [inline]
 free_unref_page_prepare+0x7c8/0x7d0 mm/page_alloc.c:3531
 free_unref_page+0xe6/0x730 mm/page_alloc.c:3613
 free_the_page mm/page_alloc.c:802 [inline]
 __free_pages+0x61/0xf0 mm/page_alloc.c:5849
 free_pages+0x7c/0x90 mm/page_alloc.c:5860
 tlb_batch_list_free mm/mmu_gather.c:61 [inline]
 tlb_finish_mmu+0x253/0x320 mm/mmu_gather.c:341
 exit_mmap+0x3ef/0x6f0 mm/mmap.c:3211
 __mmput+0x95/0x310 kernel/fork.c:1179
 mmput+0x5b/0x170 kernel/fork.c:1202
 exit_mm kernel/exit.c:551 [inline]
 do_exit+0xbb4/0x2b60 kernel/exit.c:862
 do_group_exit+0x141/0x310 kernel/exit.c:997
 get_signal+0x7a3/0x1630 kernel/signal.c:2891
 arch_do_signal_or_restart+0xbd/0x1680 arch/x86/kernel/signal.c:867
 handle_signal_work kernel/entry/common.c:148 [inline]
 exit_to_user_mode_loop+0xa0/0xe0 kernel/entry/common.c:172
 exit_to_user_mode_prepare+0x5a/0xa0 kernel/entry/common.c:208
 __syscall_exit_to_user_mode_work kernel/entry/common.c:290 [inline]
 syscall_exit_to_user_mode+0x26/0x160 kernel/entry/common.c:301
 do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86

Memory state around the buggy address:
 ffff88811ed1cd00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc
 ffff88811ed1cd80: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
>ffff88811ed1ce00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff88811ed1ce80: fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc fc
 ffff88811ed1cf00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/11/11 03:42 android13-5.15-lts 61cfd264993d d80eec66 .config console log report syz C ci2-android-5-15-perf KASAN: use-after-free Read in unix_stream_read_actor
* Struck through repros no longer work on HEAD.