syzbot


KASAN: use-after-free Read in xfrm_sk_policy_lookup

Status: auto-closed as invalid on 2019/03/29 04:29
Subsystems: net
[Documentation on labels]
Reported-by: syzbot+fa158127e8a7f651dbbf@syzkaller.appspotmail.com
First crash: 2035d, last: 2035d
Discussions (1)
Title Replies (including bot) Last reply
KASAN: use-after-free Read in xfrm_sk_policy_lookup 0 (1) 2018/10/01 06:55
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 (2) net 2 1761d 1829d 0/26 auto-closed as invalid on 2019/10/28 14:24

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in xfrm_sk_policy_lookup+0x61c/0x640 net/xfrm/xfrm_policy.c:1191
Read of size 2 at addr ffff8801995e5d1c by task syz-executor1/9885

CPU: 0 PID: 9885 Comm: syz-executor1 Not tainted 4.19.0-rc5+ #38
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+0x1c4/0x2b4 lib/dump_stack.c:113
 print_address_description.cold.8+0x9/0x1ff mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report.cold.9+0x242/0x309 mm/kasan/report.c:412
 __asan_report_load2_noabort+0x14/0x20 mm/kasan/report.c:431
 xfrm_sk_policy_lookup+0x61c/0x640 net/xfrm/xfrm_policy.c:1191
 xfrm_lookup_with_ifid+0x2a1/0x2b80 net/xfrm/xfrm_policy.c:2063
 xfrm_lookup net/xfrm/xfrm_policy.c:2200 [inline]
 xfrm_lookup_route+0x3c/0x1f0 net/xfrm/xfrm_policy.c:2211
 ip6_dst_lookup_flow+0x1c6/0x270 net/ipv6/ip6_output.c:1083
 inet6_csk_route_socket+0x8bd/0x1020 net/ipv6/inet6_connection_sock.c:110
 inet6_csk_xmit+0x118/0x630 net/ipv6/inet6_connection_sock.c:125
 l2tp_xmit_core net/l2tp/l2tp_core.c:1030 [inline]
 l2tp_xmit_skb+0x134c/0x1670 net/l2tp/l2tp_core.c:1132
 pppol2tp_sendmsg+0x4b1/0x6c0 net/l2tp/l2tp_ppp.c:329
 sock_sendmsg_nosec net/socket.c:621 [inline]
 sock_sendmsg+0xd5/0x120 net/socket.c:631
 ___sys_sendmsg+0x51d/0x930 net/socket.c:2116
 __sys_sendmmsg+0x246/0x6d0 net/socket.c:2211
 __do_sys_sendmmsg net/socket.c:2240 [inline]
 __se_sys_sendmmsg net/socket.c:2237 [inline]
 __x64_sys_sendmmsg+0x9d/0x100 net/socket.c:2237
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x457579
Code: 1d b4 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 eb b3 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f36fada1c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000133
RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 0000000000457579
RDX: 0800000000000059 RSI: 0000000020005fc0 RDI: 0000000000000007
RBP: 000000000072bf00 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000003 R11: 0000000000000246 R12: 00007f36fada26d4
R13: 00000000004c34ed R14: 00000000004d52b0 R15: 00000000ffffffff

Allocated by task 9885:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:553
 kmem_cache_alloc_trace+0x152/0x750 mm/slab.c:3620
 kmalloc include/linux/slab.h:513 [inline]
 kzalloc include/linux/slab.h:707 [inline]
 xfrm_policy_alloc+0xd9/0x480 net/xfrm/xfrm_policy.c:267
 xfrm_compile_policy+0x257/0x430 net/xfrm/xfrm_user.c:2994
 xfrm_user_policy+0x3ef/0xb10 net/xfrm/xfrm_state.c:2102
 do_ipv6_setsockopt.isra.9+0xfd6/0x45d0 net/ipv6/ipv6_sockglue.c:821
 ipv6_setsockopt+0xbd/0x170 net/ipv6/ipv6_sockglue.c:933
 udpv6_setsockopt+0x62/0xa0 net/ipv6/udp.c:1482
 sock_common_setsockopt+0x9a/0xe0 net/core/sock.c:3038
 __sys_setsockopt+0x1ba/0x3c0 net/socket.c:1902
 __do_sys_setsockopt net/socket.c:1913 [inline]
 __se_sys_setsockopt net/socket.c:1910 [inline]
 __x64_sys_setsockopt+0xbe/0x150 net/socket.c:1910
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 32034:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3498 [inline]
 kfree+0xcf/0x230 mm/slab.c:3813
 xfrm_policy_destroy_rcu+0x4a/0x60 net/xfrm/xfrm_policy.c:290
 __rcu_reclaim kernel/rcu/rcu.h:236 [inline]
 rcu_do_batch kernel/rcu/tree.c:2576 [inline]
 invoke_rcu_callbacks kernel/rcu/tree.c:2880 [inline]
 __rcu_process_callbacks kernel/rcu/tree.c:2847 [inline]
 rcu_process_callbacks+0xf23/0x2670 kernel/rcu/tree.c:2864
 __do_softirq+0x30b/0xad8 kernel/softirq.c:292

The buggy address belongs to the object at ffff8801995e5b00
 which belongs to the cache kmalloc-1024 of size 1024
The buggy address is located 540 bytes inside of
 1024-byte region [ffff8801995e5b00, ffff8801995e5f00)
The buggy address belongs to the page:
page:ffffea0006657900 count:1 mapcount:0 mapping:ffff8801da800ac0 index:0x0 compound_mapcount: 0
flags: 0x2fffc0000008100(slab|head)
raw: 02fffc0000008100 ffffea000730b108 ffffea00075ef008 ffff8801da800ac0
raw: 0000000000000000 ffff8801995e4000 0000000100000007 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801995e5c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801995e5c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8801995e5d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                            ^
 ffff8801995e5d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801995e5e00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/09/30 04:28 upstream 291d0e5d81e1 41e4b329 .config console log report ci-upstream-kasan-gce-smack-root
* Struck through repros no longer work on HEAD.