syzbot


KASAN: slab-out-of-bounds Read in xfrm_policy_inexact_list_reinsert

Status: upstream: reported C repro on 2025/01/26 21:48
Reported-by: syzbot+2a66123e41252788b0ca@syzkaller.appspotmail.com
First crash: 10d, last: 5d05h
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-15 KASAN: slab-out-of-bounds Read in xfrm_policy_inexact_list_reinsert origin:lts C 14 5d01h 5d21h 0/2 upstream: reported C repro on 2025/01/31 02:52
linux-5.15 KASAN: slab-out-of-bounds Read in xfrm_policy_inexact_list_reinsert C 18 4d20h 5d20h 0/3 upstream: reported C repro on 2025/01/31 02:56
android-54 KASAN: slab-out-of-bounds Read in xfrm_policy_inexact_list_reinsert C 14 2h01m 6d00h 0/2 upstream: reported C repro on 2025/01/30 23:29

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in xfrm_policy_inexact_list_reinsert+0x5b0/0x660 net/xfrm/xfrm_policy.c:853
Read of size 1 at addr ffff88811ce0dbd8 by task syz-executor193/287

CPU: 1 PID: 287 Comm: syz-executor193 Not tainted 5.10.233-syzkaller-00881-gfbe98d68b6b3 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118
 print_address_description+0x81/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:435 [inline]
 kasan_report+0x179/0x1c0 mm/kasan/report.c:452
 __asan_report_load1_noabort+0x14/0x20 mm/kasan/report_generic.c:306
 xfrm_policy_inexact_list_reinsert+0x5b0/0x660 net/xfrm/xfrm_policy.c:853
 xfrm_policy_inexact_node_merge net/xfrm/xfrm_policy.c:985 [inline]
 xfrm_policy_inexact_insert_node+0x917/0xb00 net/xfrm/xfrm_policy.c:1041
 xfrm_policy_inexact_alloc_chain+0x4ec/0xaf0 net/xfrm/xfrm_policy.c:1157
 xfrm_policy_inexact_insert+0x6a/0x1160 net/xfrm/xfrm_policy.c:1200
 xfrm_policy_insert+0xe7/0x940 net/xfrm/xfrm_policy.c:1583
 xfrm_add_policy+0x4f2/0x980 net/xfrm/xfrm_user.c:1733
 xfrm_user_rcv_msg+0x4e7/0x7c0 net/xfrm/xfrm_user.c:2789
 netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2485
 xfrm_netlink_rcv+0x72/0x90 net/xfrm/xfrm_user.c:2811
 netlink_unicast_kernel net/netlink/af_netlink.c:1307 [inline]
 netlink_unicast+0x8df/0xac0 net/netlink/af_netlink.c:1333
 netlink_sendmsg+0xa46/0xd00 net/netlink/af_netlink.c:1901
 sock_sendmsg_nosec net/socket.c:652 [inline]
 __sock_sendmsg net/socket.c:664 [inline]
 ____sys_sendmsg+0x59e/0x8f0 net/socket.c:2376
 ___sys_sendmsg+0x252/0x2e0 net/socket.c:2430
 __sys_sendmsg net/socket.c:2459 [inline]
 __do_sys_sendmsg net/socket.c:2468 [inline]
 __se_sys_sendmsg+0x1b1/0x280 net/socket.c:2466
 __x64_sys_sendmsg+0x7b/0x90 net/socket.c:2466
 do_syscall_64+0x34/0x70
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7f47b7a51e29
Code: 48 83 c4 28 c3 e8 37 17 00 00 0f 1f 80 00 00 00 00 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffd09ba7498 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007ffd09ba7668 RCX: 00007f47b7a51e29
RDX: 0000000000000000 RSI: 0000000020000580 RDI: 0000000000000003
RBP: 00007f47b7ac5610 R08: 000000000000000a R09: 00007ffd09ba7668
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
R13: 00007ffd09ba7658 R14: 0000000000000001 R15: 0000000000000001

Allocated by task 287:
 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:430 [inline]
 ____kasan_kmalloc+0xdb/0x110 mm/kasan/common.c:509
 __kasan_kmalloc+0x9/0x10 mm/kasan/common.c:518
 kasan_kmalloc include/linux/kasan.h:254 [inline]
 __kmalloc+0x1aa/0x330 mm/slub.c:4033
 kmalloc include/linux/slab.h:557 [inline]
 sk_prot_alloc+0xbe/0x370 net/core/sock.c:1716
 sk_alloc+0x38/0x4d0 net/core/sock.c:1774
 pfkey_create+0x12c/0x620 net/key/af_key.c:154
 __sock_create+0x3a6/0x760 net/socket.c:1436
 sock_create net/socket.c:1487 [inline]
 __sys_socket+0x132/0x370 net/socket.c:1529
 __do_sys_socket net/socket.c:1538 [inline]
 __se_sys_socket net/socket.c:1536 [inline]
 __x64_sys_socket+0x7a/0x90 net/socket.c:1536
 do_syscall_64+0x34/0x70
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

The buggy address belongs to the object at ffff88811ce0d800
 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 984 bytes inside of
 1024-byte region [ffff88811ce0d800, ffff88811ce0dc00)
The buggy address belongs to the page:
page:ffffea0004738200 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11ce08
head:ffffea0004738200 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head)
raw: 4000000000010200 dead000000000100 dead000000000122 ffff888100042f00
raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000
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 281, ts 20884197848, free_ts 20877317649
 set_page_owner include/linux/page_owner.h:35 [inline]
 post_alloc_hook mm/page_alloc.c:2456 [inline]
 prep_new_page+0x166/0x180 mm/page_alloc.c:2462
 get_page_from_freelist+0x2d8c/0x2f30 mm/page_alloc.c:4254
 __alloc_pages_nodemask+0x435/0xaf0 mm/page_alloc.c:5348
 allocate_slab mm/slub.c:1808 [inline]
 new_slab+0x80/0x400 mm/slub.c:1869
 new_slab_objects mm/slub.c:2627 [inline]
 ___slab_alloc+0x302/0x4b0 mm/slub.c:2791
 __slab_alloc+0x63/0xa0 mm/slub.c:2831
 slab_alloc_node mm/slub.c:2913 [inline]
 slab_alloc mm/slub.c:2955 [inline]
 __kmalloc_track_caller+0x1f8/0x320 mm/slub.c:4536
 __kmalloc_reserve net/core/skbuff.c:144 [inline]
 __alloc_skb+0xbc/0x510 net/core/skbuff.c:212
 alloc_skb_fclone include/linux/skbuff.h:1176 [inline]
 sk_stream_alloc_skb+0x1f8/0xae0 net/ipv4/tcp.c:892
 tcp_sendmsg_locked+0xce3/0x3ae0 net/ipv4/tcp.c:1300
 tcp_sendmsg+0x2f/0x50 net/ipv4/tcp.c:1452
 inet_sendmsg+0xa1/0xc0 net/ipv4/af_inet.c:830
 sock_sendmsg_nosec net/socket.c:652 [inline]
 __sock_sendmsg net/socket.c:664 [inline]
 sock_write_iter+0x39b/0x530 net/socket.c:1018
 call_write_iter include/linux/fs.h:2058 [inline]
 new_sync_write fs/read_write.c:518 [inline]
 vfs_write+0xb4c/0xe70 fs/read_write.c:605
 ksys_write+0x199/0x2c0 fs/read_write.c:658
 __do_sys_write fs/read_write.c:670 [inline]
 __se_sys_write fs/read_write.c:667 [inline]
 __x64_sys_write+0x7b/0x90 fs/read_write.c:667
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:28 [inline]
 free_pages_prepare mm/page_alloc.c:1349 [inline]
 __free_pages_ok+0x82c/0x850 mm/page_alloc.c:1629
 free_compound_page+0x73/0x90 mm/page_alloc.c:710
 destroy_compound_page include/linux/mm.h:959 [inline]
 __put_compound_page+0x73/0xb0 mm/swap.c:117
 __put_page+0xc0/0xe0 mm/swap.c:133
 put_page include/linux/mm.h:1257 [inline]
 page_to_skb+0x3f6/0x900 drivers/net/virtio_net.c:453
 receive_mergeable drivers/net/virtio_net.c:1019 [inline]
 receive_buf+0xe79/0x53d0 drivers/net/virtio_net.c:1129
 virtnet_receive drivers/net/virtio_net.c:1421 [inline]
 virtnet_poll+0x5df/0x1240 drivers/net/virtio_net.c:1530
 napi_poll net/core/dev.c:6873 [inline]
 net_rx_action+0x516/0x10d0 net/core/dev.c:6943
 __do_softirq+0x268/0x5bb kernel/softirq.c:309

Memory state around the buggy address:
 ffff88811ce0da80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88811ce0db00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88811ce0db80: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
                                                    ^
 ffff88811ce0dc00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88811ce0dc80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
=================================================

Crashes (14):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/01/26 21:46 android13-5.10-lts fbe98d68b6b3 9fbd772e .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: slab-out-of-bounds Read in xfrm_policy_inexact_list_reinsert
2025/01/31 18:09 android13-5.10-lts fbe98d68b6b3 aa47157c .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: slab-out-of-bounds Read in xfrm_policy_inexact_list_reinsert
2025/01/31 18:09 android13-5.10-lts fbe98d68b6b3 aa47157c .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: slab-out-of-bounds Read in xfrm_policy_inexact_list_reinsert
2025/01/31 18:08 android13-5.10-lts fbe98d68b6b3 aa47157c .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: slab-out-of-bounds Read in xfrm_policy_inexact_list_reinsert
2025/01/31 15:59 android13-5.10-lts fbe98d68b6b3 4c6ac32f .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: slab-out-of-bounds Read in xfrm_policy_inexact_list_reinsert
2025/01/31 15:59 android13-5.10-lts fbe98d68b6b3 4c6ac32f .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: slab-out-of-bounds Read in xfrm_policy_inexact_list_reinsert
2025/01/31 06:59 android13-5.10-lts fbe98d68b6b3 4c6ac32f .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: slab-out-of-bounds Read in xfrm_policy_inexact_list_reinsert
2025/01/31 02:19 android13-5.10-lts fbe98d68b6b3 4c6ac32f .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: slab-out-of-bounds Read in xfrm_policy_inexact_list_reinsert
2025/01/31 02:19 android13-5.10-lts fbe98d68b6b3 4c6ac32f .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: slab-out-of-bounds Read in xfrm_policy_inexact_list_reinsert
2025/01/31 02:19 android13-5.10-lts fbe98d68b6b3 4c6ac32f .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: slab-out-of-bounds Read in xfrm_policy_inexact_list_reinsert
2025/01/26 21:14 android13-5.10-lts fbe98d68b6b3 9fbd772e .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: slab-out-of-bounds Read in xfrm_policy_inexact_list_reinsert
2025/01/26 21:14 android13-5.10-lts fbe98d68b6b3 9fbd772e .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: slab-out-of-bounds Read in xfrm_policy_inexact_list_reinsert
2025/01/26 21:14 android13-5.10-lts fbe98d68b6b3 9fbd772e .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: slab-out-of-bounds Read in xfrm_policy_inexact_list_reinsert
2025/01/26 21:14 android13-5.10-lts fbe98d68b6b3 9fbd772e .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: slab-out-of-bounds Read in xfrm_policy_inexact_list_reinsert
* Struck through repros no longer work on HEAD.