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

7 views
Skip to first unread message

syzbot

unread,
Jan 21, 2020, 6:32:10 PM1/21/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: c1141b3a Linux 4.14.166
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1707ea6ee00000
kernel config: https://syzkaller.appspot.com/x/.config?x=a99b4b74c4c01851
dashboard link: https://syzkaller.appspot.com/bug?extid=4b811c6c00652025a8a7
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+4b811c...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: slab-out-of-bounds in ipt_init_target+0x24e/0x290 net/sched/act_ipt.c:46
Read of size 1 at addr ffff88808e85639f by task syz-executor.2/18128

CPU: 1 PID: 18128 Comm: syz-executor.2 Not tainted 4.14.166-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_load1_noabort+0x14/0x20 mm/kasan/report.c:427
ipt_init_target+0x24e/0x290 net/sched/act_ipt.c:46
__tcf_ipt_init+0x48c/0xb50 net/sched/act_ipt.c:168
tcf_xt_init+0x4e/0x60 net/sched/act_ipt.c:210
tcf_action_init_1+0x53c/0xaa0 net/sched/act_api.c:682
tcf_action_init+0x2ab/0x480 net/sched/act_api.c:751
tcf_action_add net/sched/act_api.c:1079 [inline]
tc_ctl_action+0x30a/0x548 net/sched/act_api.c:1131
rtnetlink_rcv_msg+0x3da/0xb70 net/core/rtnetlink.c:4306
netlink_rcv_skb+0x14f/0x3c0 net/netlink/af_netlink.c:2432
rtnetlink_rcv+0x1d/0x30 net/core/rtnetlink.c:4318
netlink_unicast_kernel net/netlink/af_netlink.c:1286 [inline]
netlink_unicast+0x44d/0x650 net/netlink/af_netlink.c:1312
netlink_sendmsg+0x7c4/0xc60 net/netlink/af_netlink.c:1877
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xce/0x110 net/socket.c:656
___sys_sendmsg+0x70a/0x840 net/socket.c:2062
__sys_sendmsg+0xb9/0x140 net/socket.c:2096
SYSC_sendmsg net/socket.c:2107 [inline]
SyS_sendmsg+0x2d/0x50 net/socket.c:2103
do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x45b349
RSP: 002b:00007f6f7842cc78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007f6f7842d6d4 RCX: 000000000045b349
RDX: 0000000000000000 RSI: 0000000020000300 RDI: 0000000000000003
RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
R13: 000000000000099f R14: 00000000004cb163 R15: 000000000075bf2c

Allocated by task 18128:
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 mm/slab.c:3720 [inline]
__kmalloc_track_caller+0x159/0x790 mm/slab.c:3735
kmemdup+0x27/0x60 mm/util.c:118
kmemdup include/linux/string.h:420 [inline]
__tcf_ipt_init+0x463/0xb50 net/sched/act_ipt.c:164
tcf_xt_init+0x4e/0x60 net/sched/act_ipt.c:210
tcf_action_init_1+0x53c/0xaa0 net/sched/act_api.c:682
tcf_action_init+0x2ab/0x480 net/sched/act_api.c:751
tcf_action_add net/sched/act_api.c:1079 [inline]
tc_ctl_action+0x30a/0x548 net/sched/act_api.c:1131
rtnetlink_rcv_msg+0x3da/0xb70 net/core/rtnetlink.c:4306
netlink_rcv_skb+0x14f/0x3c0 net/netlink/af_netlink.c:2432
rtnetlink_rcv+0x1d/0x30 net/core/rtnetlink.c:4318
netlink_unicast_kernel net/netlink/af_netlink.c:1286 [inline]
netlink_unicast+0x44d/0x650 net/netlink/af_netlink.c:1312
netlink_sendmsg+0x7c4/0xc60 net/netlink/af_netlink.c:1877
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xce/0x110 net/socket.c:656
___sys_sendmsg+0x70a/0x840 net/socket.c:2062
__sys_sendmsg+0xb9/0x140 net/socket.c:2096
SYSC_sendmsg net/socket.c:2107 [inline]
SyS_sendmsg+0x2d/0x50 net/socket.c:2103
do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 16467:
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
tty_free_file drivers/tty/tty_io.c:219 [inline]
tty_del_file drivers/tty/tty_io.c:231 [inline]
tty_release+0x8e1/0xd60 drivers/tty/tty_io.c:1745
__fput+0x275/0x7a0 fs/file_table.c:210
____fput+0x16/0x20 fs/file_table.c:244
task_work_run+0x114/0x190 kernel/task_work.c:113
tracehook_notify_resume include/linux/tracehook.h:191 [inline]
exit_to_usermode_loop+0x1da/0x220 arch/x86/entry/common.c:164
prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
syscall_return_slowpath arch/x86/entry/common.c:270 [inline]
do_syscall_64+0x4bc/0x640 arch/x86/entry/common.c:297
entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff88808e856380
which belongs to the cache kmalloc-32 of size 32
The buggy address is located 31 bytes inside of
32-byte region [ffff88808e856380, ffff88808e8563a0)
The buggy address belongs to the page:
page:ffffea00023a1580 count:1 mapcount:0 mapping:ffff88808e856000 index:0xffff88808e856fc1
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffff88808e856000 ffff88808e856fc1 0000000100000039
raw: ffffea0002827460 ffffea0002a1bfe0 ffff8880aa8001c0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88808e856280: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
ffff88808e856300: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
>ffff88808e856380: 04 fc fc fc fc fc fc fc fb fb fb fb fc fc fc fc
^
ffff88808e856400: fb fb fb fb fc fc fc fc 00 01 fc fc fc fc fc fc
ffff88808e856480: fb fb fb fb fc fc fc fc 00 01 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,
Jan 21, 2020, 6:59:10 PM1/21/20
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following crash on:

HEAD commit: c1141b3a Linux 4.14.166
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1180ca6ee00000
kernel config: https://syzkaller.appspot.com/x/.config?x=a99b4b74c4c01851
dashboard link: https://syzkaller.appspot.com/bug?extid=4b811c6c00652025a8a7
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=101ea721e00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=15f36bd1e00000

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

random: sshd: uninitialized urandom read (32 bytes read)
random: sshd: uninitialized urandom read (32 bytes read)
random: sshd: uninitialized urandom read (32 bytes read)
audit: type=1400 audit(1579650957.147:36): avc: denied { map } for pid=7369 comm="syz-executor521" path="/root/syz-executor521664430" 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: slab-out-of-bounds in ipt_init_target+0x24e/0x290 net/sched/act_ipt.c:46
Read of size 1 at addr ffff88809fb90a1f by task syz-executor521/7369

CPU: 1 PID: 7369 Comm: syz-executor521 Not tainted 4.14.166-syzkaller #0
RIP: 0033:0x440579
RSP: 002b:00007ffdc216e4b8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 0000000000440579
RDX: 0000000000000000 RSI: 0000000020000300 RDI: 0000000000000003
RBP: 00000000006ca018 R08: 0000000000000000 R09: 00000000004002c8
R10: 0000000000000004 R11: 0000000000000246 R12: 0000000000401e00
R13: 0000000000401e90 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 7369:
Freed by task 5391:
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
kvfree+0x4d/0x60 mm/util.c:416
setxattr+0x1f8/0x350 fs/xattr.c:455
path_setxattr+0x11f/0x140 fs/xattr.c:472
SYSC_lsetxattr fs/xattr.c:494 [inline]
SyS_lsetxattr+0x38/0x50 fs/xattr.c:490
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 ffff88809fb90a00
which belongs to the cache kmalloc-32 of size 32
The buggy address is located 31 bytes inside of
32-byte region [ffff88809fb90a00, ffff88809fb90a20)
The buggy address belongs to the page:
page:ffffea00027ee400 count:1 mapcount:0 mapping:ffff88809fb90000 index:0xffff88809fb90fc1
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffff88809fb90000 ffff88809fb90fc1 000000010000003f
raw: ffffea00027d0f20 ffffea00029549e0 ffff8880aa8001c0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88809fb90900: 00 04 fc fc fc fc fc fc 00 04 fc fc fc fc fc fc
ffff88809fb90980: fb fb fb fb fc fc fc fc 00 00 01 fc fc fc fc fc
>ffff88809fb90a00: 04 fc fc fc fc fc fc fc 00 00 fc fc fc fc fc fc
^
ffff88809fb90a80: 00 00 00 fc fc fc fc fc 00 07 fc fc fc fc fc fc
ffff88809fb90b00: 00 fc fc fc fc fc fc fc 00 01 fc fc fc fc fc fc
==================================================================

Reply all
Reply to author
Forward
0 new messages