syzbot


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

Status: fixed on 2020/02/22 11:44
Reported-by: syzbot+1261b3bfb90133b8220e@syzkaller.appspotmail.com
Fix commit: d3b5ecceea7d gtp: make sure only SOCK_DGRAM UDP sockets are accepted
First crash: 1553d, last: 1553d
Fix bisection: fixed by (bisect log) :
commit d3b5ecceea7dc3ce36c5306b3e45bd75cd192291
Author: Eric Dumazet <edumazet@google.com>
Date: Wed Jan 22 07:17:14 2020 +0000

  gtp: make sure only SOCK_DGRAM UDP sockets are accepted

  
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: slab-out-of-bounds Write in setup_udp_tunnel_sock C done 1 1552d 1552d 1/1 fixed on 2020/02/23 20:58
upstream KASAN: slab-out-of-bounds Write in setup_udp_tunnel_sock net C 4 2241d 2241d 4/26 fixed on 2018/03/23 18:14
upstream KASAN: slab-out-of-bounds Write in setup_udp_tunnel_sock (2) net C done 8 1553d 1555d 15/26 fixed on 2020/02/18 14:31
upstream KASAN: slab-out-of-bounds Write in setup_udp_tunnel_sock (3) net 1 1427d 1427d 15/26 fixed on 2020/07/17 17:58

Sample crash report:
kauditd_printk_skb: 5 callbacks suppressed
audit: type=1400 audit(1579765814.873:36): avc:  denied  { map } for  pid=8188 comm="syz-executor570" path="/root/syz-executor570990499" 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+0x356/0x420 net/ipv4/udp_tunnel.c:69
Write of size 1 at addr ffff8880a672a568 by task syz-executor570/8188

CPU: 1 PID: 8188 Comm: syz-executor570 Not tainted 4.19.97-syzkaller #0
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+0x197/0x210 lib/dump_stack.c:118
 print_address_description.cold+0x7c/0x20d mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report mm/kasan/report.c:412 [inline]
 kasan_report.cold+0x8c/0x2ba mm/kasan/report.c:396
 __asan_report_store1_noabort+0x17/0x20 mm/kasan/report.c:435
 setup_udp_tunnel_sock+0x356/0x420 net/ipv4/udp_tunnel.c:69
 gtp_encap_enable_socket+0x2cb/0x3a0 drivers/net/gtp.c:832
 gtp_encap_enable drivers/net/gtp.c:850 [inline]
 gtp_newlink+0x95/0xc10 drivers/net/gtp.c:670
 rtnl_newlink+0x1042/0x1600 net/core/rtnetlink.c:3132
 rtnetlink_rcv_msg+0x463/0xb00 net/core/rtnetlink.c:4768
 netlink_rcv_skb+0x17d/0x460 net/netlink/af_netlink.c:2454
 rtnetlink_rcv+0x1d/0x30 net/core/rtnetlink.c:4786
 netlink_unicast_kernel net/netlink/af_netlink.c:1317 [inline]
 netlink_unicast+0x53a/0x730 net/netlink/af_netlink.c:1343
 netlink_sendmsg+0x8ae/0xd70 net/netlink/af_netlink.c:1908
 sock_sendmsg_nosec net/socket.c:622 [inline]
 sock_sendmsg+0xd7/0x130 net/socket.c:632
 ___sys_sendmsg+0x803/0x920 net/socket.c:2115
 __sys_sendmsg+0x105/0x1d0 net/socket.c:2153
 __do_sys_sendmsg net/socket.c:2162 [inline]
 __se_sys_sendmsg net/socket.c:2160 [inline]
 __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2160
 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x4402b9
Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 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 0f 83 fb 13 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffffec32fb8 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 8188:
 save_stack+0x45/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc mm/kasan/kasan.c:553 [inline]
 kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:531
 kasan_slab_alloc+0xf/0x20 mm/kasan/kasan.c:490
 kmem_cache_alloc+0x12e/0x700 mm/slab.c:3559
 sk_prot_alloc+0x67/0x2e0 net/core/sock.c:1460
 sk_alloc+0x39/0xf70 net/core/sock.c:1520
 inet_create net/ipv4/af_inet.c:321 [inline]
 inet_create+0x368/0xdf0 net/ipv4/af_inet.c:247
 __sock_create+0x3d8/0x730 net/socket.c:1276
 sock_create net/socket.c:1316 [inline]
 __sys_socket+0x103/0x220 net/socket.c:1346
 __do_sys_socket net/socket.c:1355 [inline]
 __se_sys_socket net/socket.c:1353 [inline]
 __x64_sys_socket+0x73/0xb0 net/socket.c:1353
 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 0:
(stack is not available)

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

Memory state around the buggy address:
 ffff8880a672a400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8880a672a480: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8880a672a500: 00 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc
                                                          ^
 ffff8880a672a580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8880a672a600: 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
2020/01/23 07:52 linux-4.19.y dc4ba5be1bab 3334d684 .config console log report syz C ci2-linux-4-19
* Struck through repros no longer work on HEAD.