KASAN: global-out-of-bounds Read in get_unique_tuple

5 views
Skip to first unread message

syzbot

unread,
Jan 29, 2020, 6:35:10 AM1/29/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 88d6de67 Linux 4.19.99
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=15f149bee00000
kernel config: https://syzkaller.appspot.com/x/.config?x=bbdca1178922fa69
dashboard link: https://syzkaller.appspot.com/bug?extid=1b10aa07f76f44ff2d33
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1677ae95e00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10d7bb76e00000

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

audit: type=1400 audit(1580297500.381:36): avc: denied { map } for pid=8161 comm="syz-executor175" path="/root/syz-executor175804167" dev="sda1" ino=16483 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: global-out-of-bounds in __read_once_size include/linux/compiler.h:193 [inline]
BUG: KASAN: global-out-of-bounds in __nf_nat_l4proto_find net/netfilter/nf_nat_core.c:73 [inline]
BUG: KASAN: global-out-of-bounds in get_unique_tuple+0x1a23/0x1d40 net/netfilter/nf_nat_core.c:336
Read of size 8 at addr ffffffff884fc480 by task syz-executor175/8161

CPU: 1 PID: 8161 Comm: syz-executor175 Not tainted 4.19.99-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+0x5/0x20d mm/kasan/report.c:256
audit: type=1400 audit(1580297500.381:37): avc: denied { create } for pid=8161 comm="syz-executor175" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=netlink_netfilter_socket permissive=1
audit: type=1400 audit(1580297500.381:38): avc: denied { write } for pid=8161 comm="syz-executor175" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=netlink_netfilter_socket permissive=1
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_load8_noabort+0x14/0x20 mm/kasan/report.c:433
__read_once_size include/linux/compiler.h:193 [inline]
__nf_nat_l4proto_find net/netfilter/nf_nat_core.c:73 [inline]
get_unique_tuple+0x1a23/0x1d40 net/netfilter/nf_nat_core.c:336
nf_nat_setup_info+0x212/0x9e0 net/netfilter/nf_nat_core.c:431
__nf_nat_alloc_null_binding+0x164/0x1d0 net/netfilter/nf_nat_core.c:490
nfnetlink_parse_nat_setup+0x3ca/0x450 net/netfilter/nf_nat_core.c:882
ctnetlink_parse_nat_setup+0xc5/0x660 net/netfilter/nf_conntrack_netlink.c:1521
ctnetlink_setup_nat net/netfilter/nf_conntrack_netlink.c:1591 [inline]
ctnetlink_create_conntrack+0x4ea/0x1300 net/netfilter/nf_conntrack_netlink.c:1984
ctnetlink_new_conntrack+0x527/0xe50 net/netfilter/nf_conntrack_netlink.c:2114
nfnetlink_rcv_msg+0xd0d/0xfcf net/netfilter/nfnetlink.c:228
netlink_rcv_skb+0x17d/0x460 net/netlink/af_netlink.c:2454
nfnetlink_rcv+0x1c0/0x460 net/netfilter/nfnetlink.c:560
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:0x440229
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:00007ffe7ea27a68 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 0000000000440229
RDX: 0000000000000000 RSI: 0000000020000640 RDI: 0000000000000003
RBP: 00000000006ca018 R08: 0000000000000000 R09: 00000000004002c8
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000401ab0
R13: 0000000000401b40 R14: 0000000000000000 R15: 0000000000000000

The buggy address belongs to the variable:
nft_rt_policy+0x1a0/0x1e0

Memory state around the buggy address:
ffffffff884fc380: 00 00 00 00 fa fa fa fa 00 00 00 00 fa fa fa fa
ffffffff884fc400: 00 00 00 00 fa fa fa fa 00 00 00 00 fa fa fa fa
>ffffffff884fc480: 07 fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
^
ffffffff884fc500: 00 00 00 00 00 fa fa fa fa fa fa fa 00 00 00 00
ffffffff884fc580: 00 00 00 00 00 00 00 00 00 fa fa fa fa fa fa fa
==================================================================


---
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,
Oct 25, 2020, 9:06:06 PM10/25/20
to syzkaller...@googlegroups.com
syzbot suspects this issue was fixed by commit:

commit 289fe546ea16c2dcb57c5198c5a7b7387604530e
Author: Will McVicker <willmc...@google.com>
Date: Mon Aug 24 19:38:32 2020 +0000

netfilter: ctnetlink: add a range check for l3/l4 protonum

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=15e6e964500000
start commit: 88d6de67 Linux 4.19.99
git tree: linux-4.19.y
If the result looks correct, please mark the issue as fixed by replying with:

#syz fix: netfilter: ctnetlink: add a range check for l3/l4 protonum

For information about bisection process see: https://goo.gl/tpsmEJ#bisection
Reply all
Reply to author
Forward
0 new messages