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

15 views
Skip to first unread message

syzbot

unread,
Feb 3, 2020, 12:49:13 PM2/3/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 9fa690a2 Linux 4.14.169
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=147b1911e00000
kernel config: https://syzkaller.appspot.com/x/.config?x=eb55b601e76e3476
dashboard link: https://syzkaller.appspot.com/bug?extid=a3549cee4884a784747e
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=178988a1e00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11d874b5e00000

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

==================================================================
BUG: KASAN: slab-out-of-bounds in u32_match_it net/netfilter/xt_u32.c:79 [inline]
BUG: KASAN: slab-out-of-bounds in u32_mt+0x55c/0x5c0 net/netfilter/xt_u32.c:94
Read of size 4 at addr ffff88809417b940 by task syz-executor615/7562

CPU: 0 PID: 7562 Comm: syz-executor615 Not tainted 4.14.169-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+0x142/0x197 lib/dump_stack.c:58
print_address_description.cold+0x7c/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/0x2af mm/kasan/report.c:393
__asan_report_load4_noabort+0x14/0x20 mm/kasan/report.c:429
u32_match_it net/netfilter/xt_u32.c:79 [inline]
u32_mt+0x55c/0x5c0 net/netfilter/xt_u32.c:94
ip6t_do_table+0x813/0x1860 net/ipv6/netfilter/ip6_tables.c:324
ip6table_filter_hook+0x65/0x80 net/ipv6/netfilter/ip6table_filter.c:41
nf_hook_entry_hookfn include/linux/netfilter.h:108 [inline]
nf_hook_slow+0xaf/0x1b0 net/netfilter/core.c:467
nf_hook include/linux/netfilter.h:205 [inline]
__ip6_local_out+0x3e5/0x890 net/ipv6/output_core.c:166
ip6_local_out+0x29/0x170 net/ipv6/output_core.c:176
ip6_send_skb+0xa2/0x330 net/ipv6/ip6_output.c:1688
udp_v6_send_skb+0x50b/0xee0 net/ipv6/udp.c:1081
udpv6_sendmsg+0x1eb9/0x2610 net/ipv6/udp.c:1353
inet_sendmsg+0x122/0x500 net/ipv4/af_inet.c:762
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xce/0x110 net/socket.c:656
kernel_sendmsg+0x44/0x50 net/socket.c:664
sock_no_sendpage+0x107/0x130 net/core/sock.c:2569
kernel_sendpage+0x92/0xf0 net/socket.c:3407
sock_sendpage+0x8b/0xc0 net/socket.c:871
pipe_to_sendpage+0x242/0x340 fs/splice.c:451
splice_from_pipe_feed fs/splice.c:502 [inline]
__splice_from_pipe+0x348/0x780 fs/splice.c:626
splice_from_pipe+0xf0/0x150 fs/splice.c:661
generic_splice_sendpage+0x3c/0x50 fs/splice.c:832
do_splice_from fs/splice.c:851 [inline]
do_splice fs/splice.c:1147 [inline]
SYSC_splice fs/splice.c:1402 [inline]
SyS_splice+0xd92/0x1430 fs/splice.c:1382
do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x448669
RSP: 002b:00007fdd30a5cd98 EFLAGS: 00000246 ORIG_RAX: 0000000000000113
RAX: ffffffffffffffda RBX: 00000000006dec68 RCX: 0000000000448669
RDX: 0000000000000004 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 00000000006dec60 R08: 000000011fffffff R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006dec6c
R13: 0000000020001440 R14: 00000000004b0c00 R15: 0000000000000000

Allocated by task 7559:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
save_stack+0x45/0xd0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc mm/kasan/kasan.c:551 [inline]
kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:529
__do_kmalloc_node mm/slab.c:3682 [inline]
__kmalloc_node+0x51/0x80 mm/slab.c:3689
kmalloc_node include/linux/slab.h:530 [inline]
kvmalloc_node+0x4e/0xe0 mm/util.c:397
kvmalloc include/linux/mm.h:531 [inline]
xt_alloc_table_info+0x71/0xf0 net/netfilter/x_tables.c:1062
do_replace net/ipv6/netfilter/ip6_tables.c:1146 [inline]
do_ip6t_set_ctl+0x1eb/0x3f4 net/ipv6/netfilter/ip6_tables.c:1685
nf_sockopt net/netfilter/nf_sockopt.c:106 [inline]
nf_setsockopt+0x67/0xc0 net/netfilter/nf_sockopt.c:115
ipv6_setsockopt net/ipv6/ipv6_sockglue.c:930 [inline]
ipv6_setsockopt+0x105/0x130 net/ipv6/ipv6_sockglue.c:914
tcp_setsockopt net/ipv4/tcp.c:2820 [inline]
tcp_setsockopt+0x84/0xd0 net/ipv4/tcp.c:2814
sock_common_setsockopt+0x94/0xd0 net/core/sock.c:2968
SYSC_setsockopt net/socket.c:1865 [inline]
SyS_setsockopt+0x13c/0x210 net/socket.c:1844
do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 5827:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
save_stack+0x45/0xd0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0x75/0xc0 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3496 [inline]
kfree+0xcc/0x270 mm/slab.c:3815
kfree_link+0x16/0x20 fs/libfs.c:1070
do_delayed_call include/linux/delayed_call.h:28 [inline]
put_link fs/namei.c:900 [inline]
step_into fs/namei.c:1787 [inline]
walk_component+0x3db/0x1d00 fs/namei.c:1844
link_path_walk+0x4d0/0x10a0 fs/namei.c:2151
path_openat+0x190/0x3db0 fs/namei.c:3568
do_filp_open+0x18e/0x250 fs/namei.c:3603
do_sys_open+0x2c5/0x430 fs/open.c:1084
SYSC_open fs/open.c:1102 [inline]
SyS_open+0x2d/0x40 fs/open.c:1097
do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff88809417adc0
which belongs to the cache kmalloc-4096 of size 4096
The buggy address is located 2944 bytes inside of
4096-byte region [ffff88809417adc0, ffff88809417bdc0)
The buggy address belongs to the page:
page:ffffea0002505e80 count:1 mapcount:0 mapping:ffff88809417adc0 index:0x0 compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffff88809417adc0 0000000000000000 0000000100000001
raw: ffffea0001e88b20 ffffea00024f36a0 ffff8880aa800dc0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88809417b800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff88809417b880: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88809417b900: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
^
ffff88809417b980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88809417ba00: 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 can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches
Reply all
Reply to author
Forward
0 new messages