syzbot


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

Status: fixed on 2020/10/30 09:40
Reported-by: syzbot+4c4a593a162f85c75aa0@syzkaller.appspotmail.com
Fix commit: 60634d81cb43 netfilter: ctnetlink: add a range check for l3/l4 protonum
First crash: 1686d, last: 1513d
Fix bisection: fixed by (bisect log) :
commit 60634d81cb43b19817b79a8a1d38e25e907e5ea1
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.19 KASAN: global-out-of-bounds Read in get_unique_tuple C done 1 1517d 1758d 1/1 fixed on 2020/10/26 09:24
Fix bisection attempts (5)
Created Duration User Patch Repo Result
2020/10/29 20:19 3h01m bisect fix linux-4.14.y OK (1) job log
2020/09/29 19:55 24m bisect fix linux-4.14.y OK (0) job log log
2020/08/30 19:18 26m bisect fix linux-4.14.y OK (0) job log log
2020/07/31 17:40 25m bisect fix linux-4.14.y OK (0) job log log
2020/05/10 14:53 26m bisect fix linux-4.14.y OK (0) job log log

Sample crash report:
audit: type=1400 audit(1593625130.721:8): avc:  denied  { execmem } for  pid=6330 comm="syz-executor561" scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:system_r:kernel_t:s0 tclass=process permissive=1
==================================================================
BUG: KASAN: global-out-of-bounds in __read_once_size include/linux/compiler.h:183 [inline]
BUG: KASAN: global-out-of-bounds in __nf_nat_l4proto_find net/netfilter/nf_nat_core.c:54 [inline]
BUG: KASAN: global-out-of-bounds in get_unique_tuple+0x16c7/0x19e0 net/netfilter/nf_nat_core.c:313
Read of size 8 at addr ffffffff871c7300 by task syz-executor561/6330

CPU: 0 PID: 6330 Comm: syz-executor561 Not tainted 4.14.184-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+0x1b2/0x283 lib/dump_stack.c:58
 print_address_description.cold+0x5/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/0x2b9 mm/kasan/report.c:393
 __read_once_size include/linux/compiler.h:183 [inline]
 __nf_nat_l4proto_find net/netfilter/nf_nat_core.c:54 [inline]
 get_unique_tuple+0x16c7/0x19e0 net/netfilter/nf_nat_core.c:313
 nf_nat_setup_info+0x17b/0x720 net/netfilter/nf_nat_core.c:407
 __nf_nat_alloc_null_binding+0x13f/0x180 net/netfilter/nf_nat_core.c:466
 nfnetlink_parse_nat_setup+0x318/0x380 net/netfilter/nf_nat_core.c:782
 ctnetlink_parse_nat_setup+0x70/0x490 net/netfilter/nf_conntrack_netlink.c:1421
 ctnetlink_setup_nat net/netfilter/nf_conntrack_netlink.c:1491 [inline]
 ctnetlink_create_conntrack+0x437/0x1040 net/netfilter/nf_conntrack_netlink.c:1840
 ctnetlink_new_conntrack+0x45f/0xbf4 net/netfilter/nf_conntrack_netlink.c:1964
 nfnetlink_rcv_msg+0x9e1/0xc00 net/netfilter/nfnetlink.c:214
 netlink_rcv_skb+0x127/0x370 net/netlink/af_netlink.c:2433
 nfnetlink_rcv+0x1ab/0x1650 net/netfilter/nfnetlink.c:515
 netlink_unicast_kernel net/netlink/af_netlink.c:1287 [inline]
 netlink_unicast+0x437/0x610 net/netlink/af_netlink.c:1313
 netlink_sendmsg+0x64a/0xbb0 net/netlink/af_netlink.c:1878
 sock_sendmsg_nosec net/socket.c:646 [inline]
 sock_sendmsg+0xb5/0x100 net/socket.c:656
 ___sys_sendmsg+0x70a/0x840 net/socket.c:2062
 __sys_sendmsg+0xa3/0x120 net/socket.c:2096
 SYSC_sendmsg net/socket.c:2107 [inline]
 SyS_sendmsg+0x27/0x40 net/socket.c:2103
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x4402d9
RSP: 002b:00007ffdd0520888 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 00000000004402d9
RDX: 0000000000000000 RSI: 0000000020000300 RDI: 0000000000000003
RBP: 00000000006ca018 R08: 0000000000000000 R09: 00000000004002c8
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000401b60
R13: 0000000000401bf0 R14: 0000000000000000 R15: 0000000000000000

The buggy address belongs to the variable:
 nft_nat_ops+0x80/0xc0

Memory state around the buggy address:
 ffffffff871c7200: 00 00 00 00 00 00 00 00 00 00 fa fa fa fa fa fa
 ffffffff871c7280: 00 00 00 00 00 00 00 00 00 00 00 fa fa fa fa fa
>ffffffff871c7300: 04 fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
                   ^
 ffffffff871c7380: 00 00 00 00 00 00 00 00 fa fa fa fa 00 00 00 00
 ffffffff871c7400: 00 00 00 00 00 00 00 00 fa fa fa fa 00 00 00 00
==================================================================

Crashes (5):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/07/01 17:40 linux-4.14.y b850307b279c 39acb39d .config console log report syz C ci2-linux-4-14
2020/04/10 14:53 linux-4.14.y 4520f06b03ae a8c6a3f8 .config console log report syz C ci2-linux-4-14
2020/06/10 11:09 linux-4.14.y c6db52a88798 860c4de9 .config console log report ci2-linux-4-14
2020/05/21 21:13 linux-4.14.y a41ba30d9df2 4afdfa20 .config console log report ci2-linux-4-14
2020/04/10 14:35 linux-4.14.y 4520f06b03ae a8c6a3f8 .config console log report ci2-linux-4-14
* Struck through repros no longer work on HEAD.