syzbot


KASAN: slab-out-of-bounds Write in setup_udp_tunnel_sock

Status: fixed on 2020/02/23 20:58
Reported-by: syzbot+784f9d87d03669f98028@syzkaller.appspotmail.com
Fix commit: c57b0f88fce8 Documentation: Document arm64 kpti control
First crash: 1045d, last: 1045d

Fix bisection: fixed by (bisect log) :
commit c57b0f88fce8b4f697f323cfb3b7acc195b7560f
Author: Jeremy Linton <jeremy.linton@arm.com>
Date: Fri Jan 25 18:07:00 2019 +0000

  Documentation: Document arm64 kpti control

similar bugs (4):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 KASAN: slab-out-of-bounds Write in setup_udp_tunnel_sock C done 1 1046d 1046d 1/1 fixed on 2020/02/22 11:44
upstream KASAN: slab-out-of-bounds Write in setup_udp_tunnel_sock C 4 1734d 1734d 4/24 fixed on 2018/03/23 18:14
upstream KASAN: slab-out-of-bounds Write in setup_udp_tunnel_sock (2) C done 8 1046d 1048d 16/24 fixed on 2020/02/18 14:31
upstream KASAN: slab-out-of-bounds Write in setup_udp_tunnel_sock (3) 1 920d 920d 17/24 fixed on 2020/07/17 17:58

Sample crash report:
random: sshd: uninitialized urandom read (32 bytes read)
random: sshd: uninitialized urandom read (32 bytes read)
random: sshd: uninitialized urandom read (32 bytes read)
audit: type=1400 audit(1579832180.204:36): avc:  denied  { map } for  pid=7308 comm="syz-executor733" path="/root/syz-executor733289983" dev="sda1" ino=16484 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=1
==================================================================
BUG: KASAN: slab-out-of-bounds in setup_udp_tunnel_sock+0x343/0x410 net/ipv4/udp_tunnel.c:69
Write of size 1 at addr ffff8880a6440558 by task syz-executor733/7308

CPU: 0 PID: 7308 Comm: syz-executor733 Not tainted 4.14.167-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x142/0x197 lib/dump_stack.c:58
 print_address_description.cold+0x7c/0x1dc mm/kasan/report.c:252
 kasan_report_error mm/kasan/report.c:351 [inline]
 kasan_report mm/kasan/report.c:409 [inline]
 kasan_report.cold+0xa9/0x2af mm/kasan/report.c:393
 __asan_report_store1_noabort+0x17/0x20 mm/kasan/report.c:432
 setup_udp_tunnel_sock+0x343/0x410 net/ipv4/udp_tunnel.c:69
 gtp_encap_enable_socket+0x2a3/0x3d0 drivers/net/gtp.c:830
 gtp_encap_enable drivers/net/gtp.c:848 [inline]
 gtp_newlink+0x93/0xc50 drivers/net/gtp.c:670
 rtnl_newlink+0xecb/0x1700 net/core/rtnetlink.c:2719
 rtnetlink_rcv_msg+0x3da/0xb70 net/core/rtnetlink.c:4306
 netlink_rcv_skb+0x14f/0x3c0 net/netlink/af_netlink.c:2432
 rtnetlink_rcv+0x1d/0x30 net/core/rtnetlink.c:4318
 netlink_unicast_kernel net/netlink/af_netlink.c:1286 [inline]
 netlink_unicast+0x44d/0x650 net/netlink/af_netlink.c:1312
 netlink_sendmsg+0x7c4/0xc60 net/netlink/af_netlink.c:1877
 sock_sendmsg_nosec net/socket.c:646 [inline]
 sock_sendmsg+0xce/0x110 net/socket.c:656
 ___sys_sendmsg+0x70a/0x840 net/socket.c:2062
 __sys_sendmsg+0xb9/0x140 net/socket.c:2096
 SYSC_sendmsg net/socket.c:2107 [inline]
 SyS_sendmsg+0x2d/0x50 net/socket.c:2103
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x4402b9
RSP: 002b:00007fffa7840708 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 00000000004402b9
RDX: 0000000000000000 RSI: 0000000020000100 RDI: 0000000000000003
RBP: 00000000006ca018 R08: 00000000004002c8 R09: 00000000004002c8
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000401b40
R13: 0000000000401bd0 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 7308:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x45/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc mm/kasan/kasan.c:551 [inline]
 kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:529
 kasan_slab_alloc+0xf/0x20 mm/kasan/kasan.c:489
 kmem_cache_alloc+0x12e/0x780 mm/slab.c:3552
 sk_prot_alloc+0x67/0x2a0 net/core/sock.c:1461
 sk_alloc+0x39/0xd70 net/core/sock.c:1521
 inet_create net/ipv4/af_inet.c:318 [inline]
 inet_create+0x2f0/0xca0 net/ipv4/af_inet.c:244
 __sock_create+0x2f6/0x620 net/socket.c:1275
 sock_create net/socket.c:1315 [inline]
 SYSC_socket net/socket.c:1345 [inline]
 SyS_socket+0xd3/0x170 net/socket.c:1325
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 0:
(stack is not available)

The buggy address belongs to the object at ffff8880a6440040
 which belongs to the cache RAW of size 1304
The buggy address is located 0 bytes to the right of
 1304-byte region [ffff8880a6440040, ffff8880a6440558)
The buggy address belongs to the page:
page:ffffea0002991000 count:1 mapcount:0 mapping:ffff8880a6440040 index:0x0 compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffff8880a6440040 0000000000000000 0000000100000005
raw: ffff8880a7981248 ffff8880a7981248 ffff8880a68adb00 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a6440400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8880a6440480: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8880a6440500: 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc
                                                    ^
 ffff8880a6440580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8880a6440600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (1):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-linux-4-14 2020/01/24 02:18 linux-4.14.y 8bac50406cca 11ebf937 .config log report syz C
* Struck through repros no longer work on HEAD.