syzbot


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

Status: auto-closed as invalid on 2019/10/28 14:24
Reported-by: syzbot+edb62c973ff9f07e408d@syzkaller.appspotmail.com
First crash: 1209d, last: 1134d
similar bugs (1):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in xfrm_sk_policy_lookup 1 1407d 1406d 0/23 auto-closed as invalid on 2019/03/29 04:29

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in xfrm_sk_policy_lookup+0x319/0x490 net/xfrm/xfrm_policy.c:2167
Read of size 2 at addr ffff88809264cf9e by task syz-executor.2/20406

CPU: 0 PID: 20406 Comm: syz-executor.2 Not tainted 5.2.0-rc7 #12
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1d8/0x2f8 lib/dump_stack.c:113
 print_address_description+0x6d/0x310 mm/kasan/report.c:188
 __kasan_report+0x14b/0x1c0 mm/kasan/report.c:317
 kasan_report+0x26/0x50 mm/kasan/common.c:614
 __asan_report_load2_noabort+0x14/0x20 mm/kasan/generic_report.c:130
 xfrm_sk_policy_lookup+0x319/0x490 net/xfrm/xfrm_policy.c:2167
 xfrm_lookup_with_ifid+0x219/0x2470 net/xfrm/xfrm_policy.c:3036
 xfrm_lookup net/xfrm/xfrm_policy.c:3173 [inline]
 xfrm_lookup_route+0x3b/0x190 net/xfrm/xfrm_policy.c:3184
 ip6_dst_lookup_flow+0x168/0x1a0 net/ipv6/ip6_output.c:1096
 inet6_csk_route_socket+0x581/0xb80 net/ipv6/inet6_connection_sock.c:106
 inet6_csk_xmit+0xf3/0x470 net/ipv6/inet6_connection_sock.c:121
 l2tp_xmit_core net/l2tp/l2tp_core.c:1030 [inline]
 l2tp_xmit_skb+0xb71/0x10a0 net/l2tp/l2tp_core.c:1132
 pppol2tp_sendmsg+0x3f8/0x650 net/l2tp/l2tp_ppp.c:325
 sock_sendmsg_nosec net/socket.c:646 [inline]
 sock_sendmsg net/socket.c:665 [inline]
 ___sys_sendmsg+0x66b/0x9a0 net/socket.c:2286
 __sys_sendmmsg+0x2ac/0x520 net/socket.c:2381
 __do_sys_sendmmsg net/socket.c:2410 [inline]
 __se_sys_sendmmsg net/socket.c:2407 [inline]
 __x64_sys_sendmmsg+0xa0/0xb0 net/socket.c:2407
 do_syscall_64+0xfe/0x140 arch/x86/entry/common.c:301
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x459519
Code: fd b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 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 0f 83 cb b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fd2a1719c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000133
RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 0000000000459519
RDX: 0800000000000059 RSI: 0000000020005fc0 RDI: 0000000000000007
RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fd2a171a6d4
R13: 00000000004c6af9 R14: 00000000004dbd80 R15: 00000000ffffffff

Allocated by task 20406:
 save_stack mm/kasan/common.c:71 [inline]
 set_track mm/kasan/common.c:79 [inline]
 __kasan_kmalloc+0x11c/0x1b0 mm/kasan/common.c:489
 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:503
 kmem_cache_alloc_trace+0x209/0x2c0 mm/slab.c:3555
 kmalloc include/linux/slab.h:547 [inline]
 kzalloc include/linux/slab.h:742 [inline]
 xfrm_policy_alloc+0x7e/0x2a0 net/xfrm/xfrm_policy.c:388
 xfrm_compile_policy+0x83b/0x13d0 net/xfrm/xfrm_user.c:3001
 xfrm_user_policy+0x450/0x820 net/xfrm/xfrm_state.c:2079
 do_ipv6_setsockopt+0xf38/0x3bc0 net/ipv6/ipv6_sockglue.c:832
 ipv6_setsockopt+0x51/0x170 net/ipv6/ipv6_sockglue.c:944
 udpv6_setsockopt+0x7b/0x90 net/ipv6/udp.c:1571
 sock_common_setsockopt+0x99/0xb0 net/core/sock.c:3126
 __sys_setsockopt+0x1e2/0x250 net/socket.c:2072
 __do_sys_setsockopt net/socket.c:2083 [inline]
 __se_sys_setsockopt net/socket.c:2080 [inline]
 __x64_sys_setsockopt+0xbf/0xd0 net/socket.c:2080
 do_syscall_64+0xfe/0x140 arch/x86/entry/common.c:301
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 20432:
 save_stack mm/kasan/common.c:71 [inline]
 set_track mm/kasan/common.c:79 [inline]
 __kasan_slab_free+0x12a/0x1e0 mm/kasan/common.c:451
 kasan_slab_free+0xe/0x10 mm/kasan/common.c:459
 __cache_free mm/slab.c:3432 [inline]
 kfree+0xae/0x120 mm/slab.c:3755
 xfrm_policy_destroy_rcu+0x50/0x60 net/xfrm/xfrm_policy.c:412
 __rcu_reclaim kernel/rcu/rcu.h:222 [inline]
 rcu_do_batch kernel/rcu/tree.c:2092 [inline]
 invoke_rcu_callbacks kernel/rcu/tree.c:2310 [inline]
 rcu_core+0x8d6/0xf90 kernel/rcu/tree.c:2291
 __do_softirq+0x340/0x7b0 arch/x86/include/asm/paravirt.h:777

The buggy address belongs to the object at ffff88809264cd80
 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 542 bytes inside of
 1024-byte region [ffff88809264cd80, ffff88809264d180)
The buggy address belongs to the page:
page:ffffea0002499300 refcount:1 mapcount:0 mapping:ffff8880aa400ac0 index:0x0 compound_mapcount: 0
flags: 0x1fffc0000010200(slab|head)
raw: 01fffc0000010200 ffffea0002787c08 ffffea00022f4308 ffff8880aa400ac0
raw: 0000000000000000 ffff88809264c000 0000000100000007 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88809264ce80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88809264cf00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88809264cf80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                            ^
 ffff88809264d000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88809264d080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (2):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce-smack-root 2019/06/30 14:23 upstream 6fbc7275c7a9 7509bf36 .config log report
ci-upstream-linux-next-kasan-gce-root 2019/04/16 04:53 linux-next f9221a7a1014 505ab413 .config log report