syzbot


KASAN: use-after-free Read in xfrm_lookup_with_ifid

Status: auto-closed as invalid on 2020/06/09 00:55
Subsystems: net
[Documentation on labels]
First crash: 1536d, last: 1500d

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in xfrm_lookup_with_ifid+0x214d/0x2390 net/xfrm/xfrm_policy.c:3082
Read of size 4 at addr ffff888064afd61c by task udevd/17592

CPU: 1 PID: 17592 Comm: udevd Not tainted 5.5.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x197/0x210 lib/dump_stack.c:118
 print_address_description.constprop.0.cold+0xd4/0x30b mm/kasan/report.c:374
 __kasan_report.cold+0x1b/0x32 mm/kasan/report.c:506
 kasan_report+0x12/0x20 mm/kasan/common.c:639
 __asan_report_load4_noabort+0x14/0x20 mm/kasan/generic_report.c:134
 xfrm_lookup_with_ifid+0x214d/0x2390 net/xfrm/xfrm_policy.c:3082
 xfrmi_xmit2 net/xfrm/xfrm_interface.c:272 [inline]
 xfrmi_xmit+0x43f/0x15f0 net/xfrm/xfrm_interface.c:387
 __netdev_start_xmit include/linux/netdevice.h:4510 [inline]
 netdev_start_xmit include/linux/netdevice.h:4524 [inline]
 xmit_one net/core/dev.c:3470 [inline]
 dev_hard_start_xmit+0x1a3/0x9b0 net/core/dev.c:3486
 __dev_queue_xmit+0x2b05/0x35c0 net/core/dev.c:4063
 dev_queue_xmit+0x18/0x20 net/core/dev.c:4096
 neigh_direct_output+0x16/0x20 net/core/neighbour.c:1527
 neigh_output include/net/neighbour.h:510 [inline]
 ip6_finish_output2+0x109a/0x25c0 net/ipv6/ip6_output.c:116
 __ip6_finish_output+0x444/0xaa0 net/ipv6/ip6_output.c:142
 ip6_finish_output+0x38/0x1f0 net/ipv6/ip6_output.c:152
 NF_HOOK_COND include/linux/netfilter.h:296 [inline]
 ip6_output+0x25e/0x880 net/ipv6/ip6_output.c:175
 dst_output include/net/dst.h:436 [inline]
 NF_HOOK include/linux/netfilter.h:307 [inline]
 ndisc_send_skb+0xf1f/0x1490 net/ipv6/ndisc.c:505
 ndisc_send_rs+0x134/0x720 net/ipv6/ndisc.c:699
 addrconf_rs_timer+0x30f/0x6e0 net/ipv6/addrconf.c:3879
 call_timer_fn+0x1ac/0x780 kernel/time/timer.c:1404
 expire_timers kernel/time/timer.c:1449 [inline]
 __run_timers kernel/time/timer.c:1773 [inline]
 __run_timers kernel/time/timer.c:1740 [inline]
 run_timer_softirq+0x6c3/0x1790 kernel/time/timer.c:1786
 __do_softirq+0x262/0x98c kernel/softirq.c:292
 invoke_softirq kernel/softirq.c:373 [inline]
 irq_exit+0x19b/0x1e0 kernel/softirq.c:413
 exiting_irq arch/x86/include/asm/apic.h:536 [inline]
 smp_apic_timer_interrupt+0x1a3/0x610 arch/x86/kernel/apic/apic.c:1137
 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:829
 </IRQ>
RIP: 0010:__sanitizer_cov_trace_const_cmp1+0x0/0x20 kernel/kcov.c:259
Code: 5d c3 0f 1f 84 00 00 00 00 00 55 48 89 f2 48 89 fe bf 06 00 00 00 48 89 e5 48 8b 4d 08 e8 18 ff ff ff 5d c3 66 0f 1f 44 00 00 <55> 40 0f b6 d6 40 0f b6 f7 bf 01 00 00 00 48 89 e5 48 8b 4d 08 e8
RSP: 0018:ffffc90004b57438 EFLAGS: 00000202 ORIG_RAX: ffffffffffffff13
RAX: ffff8880653a4000 RBX: 0000000000000002 RCX: ffffffff83671012
RDX: 0000000000000000 RSI: 0000000000000002 RDI: 0000000000000010
RBP: ffffc90004b57480 R08: ffff8880653a4000 R09: fffffbfff1740821
R10: fffffbfff1740820 R11: ffffffff8ba04107 R12: ffff8880a724a180
R13: 0000000000000001 R14: 0000000000000311 R15: 0000000000000000
 tomoyo_supervisor+0x2d5/0xee0 security/tomoyo/common.c:2089
 tomoyo_audit_path_log security/tomoyo/file.c:168 [inline]
 tomoyo_path_permission security/tomoyo/file.c:587 [inline]
 tomoyo_path_permission+0x263/0x360 security/tomoyo/file.c:573
 tomoyo_check_open_permission+0x36d/0x3e0 security/tomoyo/file.c:780
 tomoyo_file_open security/tomoyo/tomoyo.c:319 [inline]
 tomoyo_file_open+0xa9/0xd0 security/tomoyo/tomoyo.c:314
 security_file_open+0x71/0x300 security/security.c:1529
 do_dentry_open+0x37a/0x1380 fs/open.c:784
 vfs_open+0xa0/0xd0 fs/open.c:914
 do_last fs/namei.c:3490 [inline]
 path_openat+0x12f3/0x3460 fs/namei.c:3607
 do_filp_open+0x192/0x260 fs/namei.c:3637
 do_sys_openat2+0x5eb/0x7e0 fs/open.c:1149
 do_sys_open+0xf2/0x180 fs/open.c:1165
 ksys_open include/linux/syscalls.h:1386 [inline]
 __do_sys_open fs/open.c:1171 [inline]
 __se_sys_open fs/open.c:1169 [inline]
 __x64_sys_open+0x7e/0xc0 fs/open.c:1169
 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7fd9077dd120
Code: 48 8b 15 1b 4d 2b 00 f7 d8 64 89 02 83 c8 ff c3 90 90 90 90 90 90 90 90 90 90 83 3d d5 a4 2b 00 00 75 10 b8 02 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 31 c3 48 83 ec 08 e8 5e 8c 01 00 48 89 04 24
RSP: 002b:00007ffdfb3ca008 EFLAGS: 00000246 ORIG_RAX: 0000000000000002
RAX: ffffffffffffffda RBX: 0000000001fbd4e0 RCX: 00007fd9077dd120
RDX: 00000000000001b6 RSI: 0000000000080241 RDI: 00007ffdfb3ca4f0
RBP: 00007ffdfb3ca080 R08: 0000000000000004 R09: 0000000000000001
R10: 0000000000000001 R11: 0000000000000246 R12: 0000000000000004
R13: 0000000000420721 R14: 00007ffdfb3ca0f0 R15: 0000000000000001

Allocated by task 19963:
 save_stack+0x23/0x90 mm/kasan/common.c:72
 set_track mm/kasan/common.c:80 [inline]
 __kasan_kmalloc mm/kasan/common.c:513 [inline]
 __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:486
 kasan_slab_alloc+0xf/0x20 mm/kasan/common.c:521
 slab_post_alloc_hook mm/slab.h:584 [inline]
 slab_alloc mm/slab.c:3320 [inline]
 kmem_cache_alloc+0x121/0x710 mm/slab.c:3484
 getname_flags fs/namei.c:138 [inline]
 getname_flags+0xd6/0x5b0 fs/namei.c:128
 getname fs/namei.c:209 [inline]
 do_symlinkat+0x8b/0x290 fs/namei.c:4217
 __do_sys_symlink fs/namei.c:4247 [inline]
 __se_sys_symlink fs/namei.c:4245 [inline]
 __x64_sys_symlink+0x59/0x80 fs/namei.c:4245
 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 19963:
 save_stack+0x23/0x90 mm/kasan/common.c:72
 set_track mm/kasan/common.c:80 [inline]
 kasan_set_free_info mm/kasan/common.c:335 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/common.c:474
 kasan_slab_free+0xe/0x10 mm/kasan/common.c:483
 __cache_free mm/slab.c:3426 [inline]
 kmem_cache_free+0x86/0x320 mm/slab.c:3694
 putname+0xef/0x130 fs/namei.c:259
 do_symlinkat+0x181/0x290 fs/namei.c:4235
 __do_sys_symlink fs/namei.c:4247 [inline]
 __se_sys_symlink fs/namei.c:4245 [inline]
 __x64_sys_symlink+0x59/0x80 fs/namei.c:4245
 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff888064afc700
 which belongs to the cache names_cache of size 4096
The buggy address is located 3868 bytes inside of
 4096-byte region [ffff888064afc700, ffff888064afd700)
The buggy address belongs to the page:
page:ffffea000192bf00 refcount:1 mapcount:0 mapping:ffff8880aa5f7a80 index:0x0 compound_mapcount: 0
raw: 00fffe0000010200 ffffea0002465288 ffffea000192aa08 ffff8880aa5f7a80
raw: 0000000000000000 ffff888064afc700 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888064afd500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888064afd580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888064afd600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                            ^
 ffff888064afd680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888064afd700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/02/04 06:40 net-old 3d80c653f996 93e5e335 .config console log report ci-upstream-net-this-kasan-gce
2020/03/11 00:48 net-next-old 1e09e5818b3a 35f53e45 .config console log report ci-upstream-net-kasan-gce
2020/02/21 01:40 net-next-old 2e92a2d0e450 bd2a74a3 .config console log report ci-upstream-net-kasan-gce
2020/02/16 02:37 net-next-old 2019fc96af22 5d7b90f1 .config console log report ci-upstream-net-kasan-gce
* Struck through repros no longer work on HEAD.