KASAN: slab-out-of-bounds Read in xt_find_match

7 views
Skip to first unread message

syzbot

unread,
Mar 15, 2020, 1:47:13 AM3/15/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 56920971 Linux 4.19.109
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=11ab45e3e00000
kernel config: https://syzkaller.appspot.com/x/.config?x=c73648903e665531
dashboard link: https://syzkaller.appspot.com/bug?extid=550057e28c995e48263d
compiler: gcc (GCC) 9.0.0 20181231 (experimental)

Unfortunately, I don't have any reproducer for this crash yet.

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

==================================================================
BUG: KASAN: slab-out-of-bounds in __lock_acquire+0x34ac/0x49c0 kernel/locking/lockdep.c:3290
Read of size 8 at addr ffff88809ade7930 by task syz-executor.2/18924

CPU: 1 PID: 18924 Comm: syz-executor.2 Not tainted 4.19.109-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+0x188/0x20d lib/dump_stack.c:118
print_address_description.cold+0x7c/0x212 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+0x88/0x2b9 mm/kasan/report.c:396
__lock_acquire+0x34ac/0x49c0 kernel/locking/lockdep.c:3290
lock_acquire+0x170/0x400 kernel/locking/lockdep.c:3903
__mutex_lock_common kernel/locking/mutex.c:925 [inline]
__mutex_lock+0xf7/0x1300 kernel/locking/mutex.c:1072
xt_find_match net/netfilter/x_tables.c:189 [inline]
xt_find_match+0xa1/0x270 net/netfilter/x_tables.c:181
xt_request_find_match net/netfilter/x_tables.c:219 [inline]
xt_request_find_match+0x88/0x110 net/netfilter/x_tables.c:212
get_xt_match net/sched/em_ipt.c:112 [inline]
em_ipt_change+0x1c8/0x45e net/sched/em_ipt.c:132
tcf_em_validate net/sched/ematch.c:248 [inline]
tcf_em_tree_validate net/sched/ematch.c:365 [inline]
tcf_em_tree_validate+0x990/0xf48 net/sched/ematch.c:307
flow_change+0x408/0x1ca0 net/sched/cls_flow.c:439
tc_new_tfilter+0xa6b/0x1450 net/sched/cls_api.c:1320
rtnetlink_rcv_msg+0x453/0xaf0 net/core/rtnetlink.c:4777
netlink_rcv_skb+0x160/0x410 net/netlink/af_netlink.c:2455
netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline]
netlink_unicast+0x4d7/0x6a0 net/netlink/af_netlink.c:1344
netlink_sendmsg+0x80b/0xcd0 net/netlink/af_netlink.c:1909
sock_sendmsg_nosec net/socket.c:622 [inline]
sock_sendmsg+0xcf/0x120 net/socket.c:632
___sys_sendmsg+0x803/0x920 net/socket.c:2115
__sys_sendmsg+0xec/0x1b0 net/socket.c:2153
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x45c849
Code: ad b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 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 7b b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f93dcf68c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007f93dcf696d4 RCX: 000000000045c849
RDX: 0000000000000000 RSI: 00000000200001c0 RDI: 0000000000000003
RBP: 000000000076c040 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
R13: 00000000000009fa R14: 00000000004ccb28 R15: 000000000076c04c

Allocated by task 1:
set_track mm/kasan/kasan.c:460 [inline]
kasan_kmalloc mm/kasan/kasan.c:553 [inline]
kasan_kmalloc+0xbf/0xe0 mm/kasan/kasan.c:531
kmem_cache_alloc_trace+0x14d/0x7a0 mm/slab.c:3625
kmalloc include/linux/slab.h:515 [inline]
kmalloc_array include/linux/slab.h:636 [inline]
kcalloc include/linux/slab.h:648 [inline]
xt_init+0x128/0x2a9 net/netfilter/x_tables.c:1902
do_one_initcall+0xf1/0x734 init/main.c:883
do_initcall_level init/main.c:951 [inline]
do_initcalls init/main.c:959 [inline]
do_basic_setup init/main.c:977 [inline]
kernel_init_freeable+0x4c9/0x5bb init/main.c:1144
kernel_init+0xd/0x1c0 init/main.c:1061
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

Freed by task 0:
(stack is not available)

The buggy address belongs to the object at ffff88809ade6700
which belongs to the cache kmalloc-4096 of size 4096
The buggy address is located 560 bytes to the right of
4096-byte region [ffff88809ade6700, ffff88809ade7700)
The buggy address belongs to the page:
page:ffffea00026b7980 count:1 mapcount:0 mapping:ffff88812c3dcdc0 index:0x0 compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffffea00026b7908 ffffea00026b7a08 ffff88812c3dcdc0
raw: 0000000000000000 ffff88809ade6700 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88809ade7800: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88809ade7880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88809ade7900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff88809ade7980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88809ade7a00: 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

unread,
Mar 15, 2020, 2:17:11 AM3/15/20
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following crash on:

HEAD commit: 56920971 Linux 4.19.109
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1096a2b1e00000
kernel config: https://syzkaller.appspot.com/x/.config?x=c73648903e665531
dashboard link: https://syzkaller.appspot.com/bug?extid=550057e28c995e48263d
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=11d15591e00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=117b6a39e00000

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

audit: type=1400 audit(1584252826.901:36): avc: denied { map } for pid=8198 comm="syz-executor803" path="/root/syz-executor803261605" 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
IPVS: ftp: loaded support on port[0] = 21
==================================================================
BUG: KASAN: slab-out-of-bounds in __lock_acquire+0x34ac/0x49c0 kernel/locking/lockdep.c:3290
Read of size 8 at addr ffff8882160a56f0 by task syz-executor803/8199

CPU: 1 PID: 8199 Comm: syz-executor803 Not tainted 4.19.109-syzkaller #0
RIP: 0033:0x440e29
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 7b 10 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffd8748abf8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00000000004a2610 RCX: 0000000000440e29
RDX: 0000000000000000 RSI: 00000000200001c0 RDI: 0000000000000003
RBP: 00007ffd8748ac00 R08: 0000000120080522 R09: 0000000120080522
R10: 0000000120080522 R11: 0000000000000246 R12: 00000000004a2610
R13: 00000000004023c0 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 1:
set_track mm/kasan/kasan.c:460 [inline]
kasan_kmalloc mm/kasan/kasan.c:553 [inline]
kasan_kmalloc+0xbf/0xe0 mm/kasan/kasan.c:531
kmem_cache_alloc_trace+0x14d/0x7a0 mm/slab.c:3625
kmalloc include/linux/slab.h:515 [inline]
kmalloc_array include/linux/slab.h:636 [inline]
kcalloc include/linux/slab.h:648 [inline]
xt_init+0x128/0x2a9 net/netfilter/x_tables.c:1902
do_one_initcall+0xf1/0x734 init/main.c:883
do_initcall_level init/main.c:951 [inline]
do_initcalls init/main.c:959 [inline]
do_basic_setup init/main.c:977 [inline]
kernel_init_freeable+0x4c9/0x5bb init/main.c:1144
kernel_init+0xd/0x1c0 init/main.c:1061
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

Freed by task 0:
(stack is not available)

The buggy address belongs to the object at ffff8882160a44c0
which belongs to the cache kmalloc-4096 of size 4096
The buggy address is located 560 bytes to the right of
4096-byte region [ffff8882160a44c0, ffff8882160a54c0)
The buggy address belongs to the page:
page:ffffea0008582900 count:1 mapcount:0 mapping:ffff88812c3dcdc0 index:0x0 compound_mapcount: 0
flags: 0x57ffe0000008100(slab|head)
raw: 057ffe0000008100 ffffea0008582888 ffffea0008582a08 ffff88812c3dcdc0
raw: 0000000000000000 ffff8882160a44c0 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8882160a5580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8882160a5600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8882160a5680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff8882160a5700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8882160a5780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Reply all
Reply to author
Forward
0 new messages