syzbot


KASAN: slab-out-of-bounds Read in __xfrm_state_lookup (4)

Status: closed as invalid on 2022/12/01 17:02
Subsystems: net
[Documentation on labels]
First crash: 1018d, last: 1018d
Similar bugs (3)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-out-of-bounds Read in __xfrm_state_lookup (3) net 17 1 1376d 1376d 0/29 closed as invalid on 2021/12/14 20:12
upstream KASAN: slab-out-of-bounds Read in __xfrm_state_lookup (2) net 17 1 1725d 1724d 0/29 auto-closed as invalid on 2021/02/10 22:23
upstream KASAN: slab-out-of-bounds Read in __xfrm_state_lookup net 17 1 1860d 1856d 0/29 auto-closed as invalid on 2020/08/30 00:39

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in __xfrm_state_lookup.isra.0+0x809/0x870 net/xfrm/xfrm_state.c:962
Read of size 8 at addr ffff888021e1ceb8 by task syz-executor.1/20012

CPU: 1 PID: 20012 Comm: syz-executor.1 Not tainted 6.1.0-rc1-syzkaller-00093-g6d36c728bc2e #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/11/2022
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:284 [inline]
 print_report+0x15e/0x45d mm/kasan/report.c:395
 kasan_report+0xbb/0x1f0 mm/kasan/report.c:495
 __xfrm_state_lookup.isra.0+0x809/0x870 net/xfrm/xfrm_state.c:962
 xfrm_state_find+0x1cac/0x4f10 net/xfrm/xfrm_state.c:1129
 xfrm_tmpl_resolve_one net/xfrm/xfrm_policy.c:2392 [inline]
 xfrm_tmpl_resolve+0x2f3/0xd40 net/xfrm/xfrm_policy.c:2437
 xfrm_resolve_and_create_bundle+0x123/0x2580 net/xfrm/xfrm_policy.c:2730
 xfrm_lookup_with_ifid+0x229/0x20f0 net/xfrm/xfrm_policy.c:3064
 xfrm_lookup net/xfrm/xfrm_policy.c:3193 [inline]
 xfrm_lookup_route+0x36/0x1e0 net/xfrm/xfrm_policy.c:3204
 ip6_dst_lookup_flow+0x159/0x1d0 net/ipv6/ip6_output.c:1228
 rawv6_sendmsg+0xc95/0x3b40 net/ipv6/raw.c:894
 inet_sendmsg+0x99/0xe0 net/ipv4/af_inet.c:825
 sock_sendmsg_nosec net/socket.c:714 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:734
 ____sys_sendmsg+0x334/0x8c0 net/socket.c:2482
 ___sys_sendmsg+0x110/0x1b0 net/socket.c:2536
 __sys_sendmmsg+0x18b/0x460 net/socket.c:2622
 __do_sys_sendmmsg net/socket.c:2651 [inline]
 __se_sys_sendmmsg net/socket.c:2648 [inline]
 __x64_sys_sendmmsg+0x99/0x100 net/socket.c:2648
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f63e1a8b5a9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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:00007f63e2bf4168 EFLAGS: 00000246 ORIG_RAX: 0000000000000133
RAX: ffffffffffffffda RBX: 00007f63e1bac120 RCX: 00007f63e1a8b5a9
RDX: 00000000000002e9 RSI: 0000000020000480 RDI: 0000000000000005
RBP: 00007f63e1ae6580 R08: 0000000000000000 R09: 0000000000000000
R10: 00000000000001f4 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffcd6328aef R14: 00007f63e2bf4300 R15: 0000000000022000
 </TASK>

Allocated by task 4218:
 kasan_save_stack+0x1e/0x40 mm/kasan/common.c:45
 kasan_set_track+0x21/0x30 mm/kasan/common.c:52
 ____kasan_kmalloc mm/kasan/common.c:371 [inline]
 ____kasan_kmalloc mm/kasan/common.c:330 [inline]
 __kasan_kmalloc+0xa1/0xb0 mm/kasan/common.c:380
 kasan_kmalloc include/linux/kasan.h:211 [inline]
 __do_kmalloc_node mm/slab_common.c:955 [inline]
 __kmalloc+0x54/0xc0 mm/slab_common.c:968
 kmalloc include/linux/slab.h:581 [inline]
 kzalloc include/linux/slab.h:712 [inline]
 xfrm_hash_alloc+0xcb/0xf0 net/xfrm/xfrm_hash.c:21
 xfrm_hash_resize+0x99/0x1880 net/xfrm/xfrm_state.c:146
 process_one_work+0x9bf/0x1710 kernel/workqueue.c:2289
 process_scheduled_works kernel/workqueue.c:2352 [inline]
 worker_thread+0x854/0x1080 kernel/workqueue.c:2438
 kthread+0x2e4/0x3a0 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306

The buggy address belongs to the object at ffff888021e1c800
 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 696 bytes to the right of
 1024-byte region [ffff888021e1c800, ffff888021e1cc00)

The buggy address belongs to the physical page:
page:ffffea0000878600 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x21e18
head:ffffea0000878600 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 0000000000000000 dead000000000122 ffff888011841dc0
raw: 0000000000000000 0000000000100010 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 0x1d2a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 20002, tgid 19991 (syz-executor.3), ts 501682442899, free_ts 501663742622
 prep_new_page mm/page_alloc.c:2538 [inline]
 get_page_from_freelist+0x10b5/0x2d50 mm/page_alloc.c:4287
 __alloc_pages+0x1c7/0x5a0 mm/page_alloc.c:5554
 alloc_pages+0x1a6/0x270 mm/mempolicy.c:2280
 alloc_slab_page mm/slub.c:1794 [inline]
 allocate_slab+0x213/0x300 mm/slub.c:1939
 new_slab mm/slub.c:1992 [inline]
 ___slab_alloc+0xa91/0x1400 mm/slub.c:3180
 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3279
 slab_alloc_node mm/slub.c:3364 [inline]
 __kmem_cache_alloc_node+0x191/0x3e0 mm/slub.c:3437
 __do_kmalloc_node mm/slab_common.c:954 [inline]
 __kmalloc_node_track_caller+0x45/0xc0 mm/slab_common.c:975
 kmalloc_reserve net/core/skbuff.c:437 [inline]
 __alloc_skb+0xd9/0x2f0 net/core/skbuff.c:509
 alloc_skb include/linux/skbuff.h:1267 [inline]
 pfkey_send_acquire+0x1b7/0x2520 net/key/af_key.c:3173
 km_query+0xac/0x220 net/xfrm/xfrm_state.c:2248
 xfrm_state_find+0x2bfe/0x4f10 net/xfrm/xfrm_state.c:1165
 xfrm_tmpl_resolve_one net/xfrm/xfrm_policy.c:2392 [inline]
 xfrm_tmpl_resolve+0x2f3/0xd40 net/xfrm/xfrm_policy.c:2437
 xfrm_resolve_and_create_bundle+0x123/0x2580 net/xfrm/xfrm_policy.c:2730
 xfrm_lookup_with_ifid+0x229/0x20f0 net/xfrm/xfrm_policy.c:3064
 xfrm_lookup net/xfrm/xfrm_policy.c:3193 [inline]
 xfrm_lookup_route+0x36/0x1e0 net/xfrm/xfrm_policy.c:3204
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1458 [inline]
 free_pcp_prepare+0x65c/0xd90 mm/page_alloc.c:1508
 free_unref_page_prepare mm/page_alloc.c:3386 [inline]
 free_unref_page+0x19/0x4d0 mm/page_alloc.c:3482
 __unfreeze_partials+0x17c/0x1a0 mm/slub.c:2586
 qlink_free mm/kasan/quarantine.c:168 [inline]
 qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:187
 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:294
 __kasan_slab_alloc+0x62/0x80 mm/kasan/common.c:302
 kasan_slab_alloc include/linux/kasan.h:201 [inline]
 slab_post_alloc_hook mm/slab.h:737 [inline]
 slab_alloc_node mm/slub.c:3398 [inline]
 __kmem_cache_alloc_node+0x2da/0x3e0 mm/slub.c:3437
 __do_kmalloc_node mm/slab_common.c:954 [inline]
 __kmalloc+0x44/0xc0 mm/slab_common.c:968
 kmalloc include/linux/slab.h:581 [inline]
 kzalloc include/linux/slab.h:712 [inline]
 xfrm_hash_alloc+0xcb/0xf0 net/xfrm/xfrm_hash.c:21
 xfrm_hash_resize+0x65/0x1880 net/xfrm/xfrm_state.c:138
 process_one_work+0x9bf/0x1710 kernel/workqueue.c:2289
 process_scheduled_works kernel/workqueue.c:2352 [inline]
 worker_thread+0x854/0x1080 kernel/workqueue.c:2438
 kthread+0x2e4/0x3a0 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306

Memory state around the buggy address:
 ffff888021e1cd80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888021e1ce00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888021e1ce80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                                        ^
 ffff888021e1cf00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888021e1cf80: 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
2022/10/21 02:25 net-old 6d36c728bc2e a0fd4dab .config console log report info ci-upstream-net-this-kasan-gce KASAN: slab-out-of-bounds Read in __xfrm_state_lookup
* Struck through repros no longer work on HEAD.