KASAN: use-after-free Read in __nf_tables_abort

11 views
Skip to first unread message

syzbot

unread,
Jan 27, 2020, 3:32:10 AM1/27/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: d183c8e2 Linux 4.19.98
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=12a0c695e00000
kernel config: https://syzkaller.appspot.com/x/.config?x=2ec5d533b79bf93
dashboard link: https://syzkaller.appspot.com/bug?extid=b611d325af55b7843ffc
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=145f1a6ee00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=105f15c9e00000

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

audit: type=1400 audit(1580113720.793:38): avc: denied { write } for pid=8013 comm="syz-executor049" 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
==================================================================
BUG: KASAN: use-after-free in __list_del_entry_valid+0xd2/0xf5 lib/list_debug.c:42
Read of size 8 at addr ffff88809a072a48 by task syz-executor049/8024

CPU: 0 PID: 8024 Comm: syz-executor049 Not tainted 4.19.98-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_load8_noabort+0x14/0x20 mm/kasan/report.c:433
__list_del_entry_valid+0xd2/0xf5 lib/list_debug.c:42
__list_del_entry include/linux/list.h:117 [inline]
list_del_rcu include/linux/rculist.h:130 [inline]
__nf_tables_abort+0x1e77/0x2a70 net/netfilter/nf_tables_api.c:6648
nf_tables_abort+0x17/0x30 net/netfilter/nf_tables_api.c:6758
nfnetlink_rcv_batch+0xae3/0x1750 net/netfilter/nfnetlink.c:491
nfnetlink_rcv_skb_batch net/netfilter/nfnetlink.c:540 [inline]
nfnetlink_rcv+0x3ed/0x460 net/netfilter/nfnetlink.c:558
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:0x447089
Code: e8 dc e6 ff ff 48 83 c4 18 c3 0f 1f 80 00 00 00 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 2b 06 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f0556bc4d98 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00000000006dcc28 RCX: 0000000000447089
RDX: 0000000000000000 RSI: 00000000200001c0 RDI: 0000000000000003
RBP: 00000000006dcc20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006dcc2c
R13: 000000200a000000 R14: 0000000000006c00 R15: 0000001000000014

Allocated by task 8024:
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
kmem_cache_alloc_trace+0x152/0x760 mm/slab.c:3625
kmalloc include/linux/slab.h:515 [inline]
kzalloc include/linux/slab.h:709 [inline]
nf_tables_newtable+0xa99/0x1430 net/netfilter/nf_tables_api.c:869
nfnetlink_rcv_batch+0xef6/0x1750 net/netfilter/nfnetlink.c:430
nfnetlink_rcv_skb_batch net/netfilter/nfnetlink.c:540 [inline]
nfnetlink_rcv+0x3ed/0x460 net/netfilter/nfnetlink.c:558
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

Freed by task 8027:
save_stack+0x45/0xd0 mm/kasan/kasan.c:448
set_track mm/kasan/kasan.c:460 [inline]
__kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521
kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
__cache_free mm/slab.c:3503 [inline]
kfree+0xcf/0x220 mm/slab.c:3822
nf_tables_table_destroy.isra.0+0xef/0x130 net/netfilter/nf_tables_api.c:1048
nft_commit_release net/netfilter/nf_tables_api.c:6265 [inline]
nf_tables_commit_release net/netfilter/nf_tables_api.c:6305 [inline]
nf_tables_commit+0x2d9d/0x41a0 net/netfilter/nf_tables_api.c:6595
nfnetlink_rcv_batch+0xcf6/0x1750 net/netfilter/nfnetlink.c:482
nfnetlink_rcv_skb_batch net/netfilter/nfnetlink.c:540 [inline]
nfnetlink_rcv+0x3ed/0x460 net/netfilter/nfnetlink.c:558
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

The buggy address belongs to the object at ffff88809a072a40
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 8 bytes inside of
512-byte region [ffff88809a072a40, ffff88809a072c40)
The buggy address belongs to the page:
page:ffffea0002681c80 count:1 mapcount:0 mapping:ffff88812c31c940 index:0x0
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffffea000294efc8 ffffea0002633a48 ffff88812c31c940
raw: 0000000000000000 ffff88809a072040 0000000100000006 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88809a072900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88809a072980: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff88809a072a00: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
^
ffff88809a072a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88809a072b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
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
Reply all
Reply to author
Forward
0 new messages