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

15 views
Skip to first unread message

syzbot

unread,
Jan 23, 2020, 2:53:12 AM1/23/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: dc4ba5be Linux 4.19.97
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=13273879e00000
kernel config: https://syzkaller.appspot.com/x/.config?x=cc17a984a7e9c2f3
dashboard link: https://syzkaller.appspot.com/bug?extid=1261b3bfb90133b8220e
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=167b1a95e00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=14637369e00000

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+1261b3...@syzkaller.appspotmail.com

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
==================================================================


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches

syzbot

unread,
Jan 23, 2020, 9:19:11 PM1/23/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 8bac5040 Linux 4.14.167
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=152166bee00000
kernel config: https://syzkaller.appspot.com/x/.config?x=ed52db44a31a52da
dashboard link: https://syzkaller.appspot.com/bug?extid=784f9d87d03669f98028
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=12b68479e00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10a6d6bee00000

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+784f9d...@syzkaller.appspotmail.com

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

syzbot

unread,
Feb 22, 2020, 5:56:04 AM2/22/20
to syzkaller...@googlegroups.com
syzbot suspects this bug was fixed by commit:

commit d3b5ecceea7dc3ce36c5306b3e45bd75cd192291
Author: Eric Dumazet <edum...@google.com>
Date: Wed Jan 22 07:17:14 2020 +0000

gtp: make sure only SOCK_DGRAM UDP sockets are accepted

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=132cfe09e00000
start commit: dc4ba5be Linux 4.19.97
git tree: linux-4.19.y
If the result looks correct, please mark the bug fixed by replying with:

#syz fix: gtp: make sure only SOCK_DGRAM UDP sockets are accepted

For information about bisection process see: https://goo.gl/tpsmEJ#bisection

syzbot

unread,
Feb 23, 2020, 2:12:04 AM2/23/20
to syzkaller...@googlegroups.com
syzbot suspects this bug was fixed by commit:

commit c57b0f88fce8b4f697f323cfb3b7acc195b7560f
Author: Jeremy Linton <jeremy...@arm.com>
Date: Fri Jan 25 18:07:00 2019 +0000

Documentation: Document arm64 kpti control

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=11597a29e00000
start commit: 8bac5040 Linux 4.14.167
git tree: linux-4.14.y
If the result looks correct, please mark the bug fixed by replying with:

#syz fix: Documentation: Document arm64 kpti control
Reply all
Reply to author
Forward
0 new messages