syzbot


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

Status: fixed on 2020/10/26 09:24
Reported-by: syzbot+1b10aa07f76f44ff2d33@syzkaller.appspotmail.com
Fix commit: 289fe546ea16 netfilter: ctnetlink: add a range check for l3/l4 protonum
First crash: 1758d, last: 1517d
Fix bisection: fixed by (bisect log) :
commit 289fe546ea16c2dcb57c5198c5a7b7387604530e
Author: Will McVicker <willmcvicker@google.com>
Date: Mon Aug 24 19:38:32 2020 +0000

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

  
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: global-out-of-bounds Read in get_unique_tuple C done 5 1513d 1686d 1/1 fixed on 2020/10/30 09:40
Fix bisection attempts (9)
Created Duration User Patch Repo Result
2020/10/25 22:00 3h05m bisect fix linux-4.19.y OK (1) job log
2020/09/25 21:34 25m bisect fix linux-4.19.y OK (0) job log log
2020/08/26 21:06 28m bisect fix linux-4.19.y OK (0) job log log
2020/07/27 20:37 28m bisect fix linux-4.19.y OK (0) job log log
2020/06/27 20:05 23m bisect fix linux-4.19.y OK (0) job log log
2020/05/28 14:13 24m bisect fix linux-4.19.y OK (0) job log log
2020/04/28 12:59 26m bisect fix linux-4.19.y OK (0) job log log
2020/03/29 12:25 24m bisect fix linux-4.19.y OK (0) job log log
2020/02/28 11:58 26m bisect fix linux-4.19.y OK (0) job log log

Sample crash report:
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
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/01/29 11:34 linux-4.19.y 88d6de67e390 c8e81ce4 .config console log report syz C ci2-linux-4-19
* Struck through repros no longer work on HEAD.