KASAN: slab-out-of-bounds Write in decode_data

28 views
Skip to first unread message

syzbot

unread,
Feb 22, 2020, 3:09:12 AM2/22/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 98db2bf2 Linux 4.14.171
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1037e27ee00000
kernel config: https://syzkaller.appspot.com/x/.config?x=365f8162d5a0794b
dashboard link: https://syzkaller.appspot.com/bug?extid=fa2b40c50b2740e679f6
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+fa2b40...@syzkaller.appspotmail.com

sp0: Synchronizing with TNC
==================================================================
BUG: KASAN: slab-out-of-bounds in decode_data.part.0+0x23b/0x270 drivers/net/hamradio/6pack.c:874
Write of size 1 at addr ffff88805ca53a8e by task kworker/u4:3/177

CPU: 1 PID: 177 Comm: kworker/u4:3 Not tainted 4.14.171-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: events_unbound flush_to_ldisc
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_store1_noabort+0x17/0x20 mm/kasan/report.c:432
decode_data.part.0+0x23b/0x270 drivers/net/hamradio/6pack.c:874
decode_data drivers/net/hamradio/6pack.c:1004 [inline]
sixpack_decode drivers/net/hamradio/6pack.c:1007 [inline]
sixpack_receive_buf drivers/net/hamradio/6pack.c:458 [inline]
sixpack_receive_buf+0xaf7/0x1170 drivers/net/hamradio/6pack.c:435
tty_ldisc_receive_buf+0x14d/0x1a0 drivers/tty/tty_buffer.c:459
tty_port_default_receive_buf+0x73/0xa0 drivers/tty/tty_port.c:37
receive_buf drivers/tty/tty_buffer.c:475 [inline]
flush_to_ldisc+0x1ec/0x400 drivers/tty/tty_buffer.c:527
process_one_work+0x863/0x1600 kernel/workqueue.c:2114
worker_thread+0x5d9/0x1050 kernel/workqueue.c:2248
kthread+0x319/0x430 kernel/kthread.c:232
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

Allocated by task 21056:
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]
kvzalloc include/linux/mm.h:539 [inline]
alloc_netdev_mqs+0x7b/0xbc0 net/core/dev.c:8097
sixpack_open+0xdf/0xc85 drivers/net/hamradio/6pack.c:572
tty_ldisc_open.isra.0+0x73/0xb0 drivers/tty/tty_ldisc.c:481
tty_set_ldisc+0x28e/0x600 drivers/tty/tty_ldisc.c:606
tiocsetd drivers/tty/tty_io.c:2351 [inline]
tty_ioctl+0x95b/0x1320 drivers/tty/tty_io.c:2595
vfs_ioctl fs/ioctl.c:46 [inline]
file_ioctl fs/ioctl.c:500 [inline]
do_vfs_ioctl+0x7ae/0x1060 fs/ioctl.c:684
SYSC_ioctl fs/ioctl.c:701 [inline]
SyS_ioctl+0x8f/0xc0 fs/ioctl.c:692
do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 20807:
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
seq_release fs/seq_file.c:368 [inline]
single_release+0x7e/0xb0 fs/seq_file.c:605
__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 ffff88805ca52700
which belongs to the cache kmalloc-4096 of size 4096
The buggy address is located 910 bytes to the right of
4096-byte region [ffff88805ca52700, ffff88805ca53700)
The buggy address belongs to the page:
page:ffffea0001729480 count:1 mapcount:0 mapping:ffff88805ca52700 index:0x0 compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffff88805ca52700 0000000000000000 0000000100000001
raw: ffffea0002251c20 ffffea000225f5a0 ffff8880aa800dc0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88805ca53980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88805ca53a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88805ca53a80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff88805ca53b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88805ca53b80: 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,
Feb 22, 2020, 3:37:13 AM2/22/20
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following crash on:

HEAD commit: 98db2bf2 Linux 4.14.171
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=146b9de9e00000
kernel config: https://syzkaller.appspot.com/x/.config?x=365f8162d5a0794b
dashboard link: https://syzkaller.appspot.com/bug?extid=fa2b40c50b2740e679f6
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=16264265e00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13e48931e00000

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

random: sshd: uninitialized urandom read (32 bytes read)
random: sshd: uninitialized urandom read (32 bytes read)
audit: type=1400 audit(1582360479.823:36): avc: denied { map } for pid=7145 comm="syz-executor813" path="/root/syz-executor813650321" 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
sp0: Synchronizing with TNC
==================================================================
BUG: KASAN: slab-out-of-bounds in decode_data.part.0+0x23b/0x270 drivers/net/hamradio/6pack.c:874
Write of size 1 at addr ffff8880a0d8994e by task kworker/u4:1/22

CPU: 1 PID: 22 Comm: kworker/u4:1 Not tainted 4.14.171-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: events_unbound flush_to_ldisc
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_store1_noabort+0x17/0x20 mm/kasan/report.c:432
decode_data.part.0+0x23b/0x270 drivers/net/hamradio/6pack.c:874
decode_data drivers/net/hamradio/6pack.c:1004 [inline]
sixpack_decode drivers/net/hamradio/6pack.c:1007 [inline]
sixpack_receive_buf drivers/net/hamradio/6pack.c:458 [inline]
sixpack_receive_buf+0xaf7/0x1170 drivers/net/hamradio/6pack.c:435
tty_ldisc_receive_buf+0x14d/0x1a0 drivers/tty/tty_buffer.c:459
tty_port_default_receive_buf+0x73/0xa0 drivers/tty/tty_port.c:37
receive_buf drivers/tty/tty_buffer.c:475 [inline]
flush_to_ldisc+0x1ec/0x400 drivers/tty/tty_buffer.c:527
process_one_work+0x863/0x1600 kernel/workqueue.c:2114
worker_thread+0x5d9/0x1050 kernel/workqueue.c:2248
kthread+0x319/0x430 kernel/kthread.c:232
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

Allocated by task 7145:
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]
kvzalloc include/linux/mm.h:539 [inline]
alloc_netdev_mqs+0x7b/0xbc0 net/core/dev.c:8097
sixpack_open+0xdf/0xc85 drivers/net/hamradio/6pack.c:572
tty_ldisc_open.isra.0+0x73/0xb0 drivers/tty/tty_ldisc.c:481
tty_set_ldisc+0x28e/0x600 drivers/tty/tty_ldisc.c:606
tiocsetd drivers/tty/tty_io.c:2351 [inline]
tty_ioctl+0x95b/0x1320 drivers/tty/tty_io.c:2595
vfs_ioctl fs/ioctl.c:46 [inline]
file_ioctl fs/ioctl.c:500 [inline]
do_vfs_ioctl+0x7ae/0x1060 fs/ioctl.c:684
SYSC_ioctl fs/ioctl.c:701 [inline]
SyS_ioctl+0x8f/0xc0 fs/ioctl.c:692
do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 5599:
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+0x194/0x3e50 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 ffff8880a0d885c0
which belongs to the cache kmalloc-4096 of size 4096
The buggy address is located 910 bytes to the right of
4096-byte region [ffff8880a0d885c0, ffff8880a0d895c0)
The buggy address belongs to the page:
page:ffffea0002836200 count:1 mapcount:0 mapping:ffff8880a0d885c0 index:0x0 compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffff8880a0d885c0 0000000000000000 0000000100000001
raw: ffffea000284c620 ffffea0002820320 ffff8880aa800dc0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880a0d89800: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8880a0d89880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8880a0d89900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff8880a0d89980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8880a0d89a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

syzbot

unread,
Feb 23, 2020, 1:53:15 AM2/23/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 4fccc250 Linux 4.19.105
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=115c03ede00000
kernel config: https://syzkaller.appspot.com/x/.config?x=d603c1cf5fa8b03d
dashboard link: https://syzkaller.appspot.com/bug?extid=85108ecaedb786fb81f4
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1167a779e00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1741fe09e00000

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

audit: type=1400 audit(1582440605.106:36): avc: denied { map } for pid=8072 comm="syz-executor371" path="/root/syz-executor371299512" 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
sp0: Synchronizing with TNC
==================================================================
BUG: KASAN: slab-out-of-bounds in decode_data.part.0+0x23b/0x270 drivers/net/hamradio/6pack.c:863
Write of size 1 at addr ffff88808b30d94e by task kworker/u4:3/949

CPU: 0 PID: 949 Comm: kworker/u4:3 Not tainted 4.19.105-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: events_unbound flush_to_ldisc
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_store1_noabort+0x17/0x20 mm/kasan/report.c:435
decode_data.part.0+0x23b/0x270 drivers/net/hamradio/6pack.c:863
decode_data drivers/net/hamradio/6pack.c:985 [inline]
sixpack_decode drivers/net/hamradio/6pack.c:988 [inline]
sixpack_receive_buf drivers/net/hamradio/6pack.c:458 [inline]
sixpack_receive_buf+0xdfe/0x1440 drivers/net/hamradio/6pack.c:435
tty_ldisc_receive_buf+0x15f/0x1c0 drivers/tty/tty_buffer.c:460
tty_port_default_receive_buf+0x7d/0xb0 drivers/tty/tty_port.c:38
receive_buf drivers/tty/tty_buffer.c:476 [inline]
flush_to_ldisc+0x222/0x390 drivers/tty/tty_buffer.c:528
process_one_work+0x989/0x1750 kernel/workqueue.c:2153
worker_thread+0x98/0xe40 kernel/workqueue.c:2296
kthread+0x354/0x420 kernel/kthread.c:246
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

Allocated by task 8072:
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
__do_kmalloc_node mm/slab.c:3689 [inline]
__kmalloc_node+0x51/0x80 mm/slab.c:3696
kmalloc_node include/linux/slab.h:557 [inline]
kvmalloc_node+0x68/0x100 mm/util.c:423
kvmalloc include/linux/mm.h:577 [inline]
kvzalloc include/linux/mm.h:585 [inline]
alloc_netdev_mqs+0x98/0xdb0 net/core/dev.c:9122
sixpack_open+0x104/0xbf5 drivers/net/hamradio/6pack.c:563
tty_ldisc_open.isra.0+0x89/0xd0 drivers/tty/tty_ldisc.c:469
tty_set_ldisc+0x2d7/0x690 drivers/tty/tty_ldisc.c:594
tiocsetd drivers/tty/tty_io.c:2359 [inline]
tty_ioctl+0x65e/0x1510 drivers/tty/tty_io.c:2603
vfs_ioctl fs/ioctl.c:46 [inline]
file_ioctl fs/ioctl.c:501 [inline]
do_vfs_ioctl+0xd5f/0x1380 fs/ioctl.c:688
ksys_ioctl+0xab/0xd0 fs/ioctl.c:705
__do_sys_ioctl fs/ioctl.c:712 [inline]
__se_sys_ioctl fs/ioctl.c:710 [inline]
__x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:710
do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 6335:
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
kfree_link+0x16/0x20 fs/libfs.c:1109
do_delayed_call include/linux/delayed_call.h:28 [inline]
put_link fs/namei.c:883 [inline]
step_into fs/namei.c:1773 [inline]
walk_component+0x447/0x2000 fs/namei.c:1830
link_path_walk.part.0+0x594/0x1330 fs/namei.c:2139
link_path_walk fs/namei.c:2073 [inline]
path_openat+0x211/0x44a0 fs/namei.c:3536
do_filp_open+0x1a1/0x280 fs/namei.c:3567
do_sys_open+0x3fe/0x550 fs/open.c:1088
__do_sys_open fs/open.c:1106 [inline]
__se_sys_open fs/open.c:1101 [inline]
__x64_sys_open+0x7e/0xc0 fs/open.c:1101
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 ffff88808b30c5c0
which belongs to the cache kmalloc-4096 of size 4096
The buggy address is located 910 bytes to the right of
4096-byte region [ffff88808b30c5c0, ffff88808b30d5c0)
The buggy address belongs to the page:
page:ffffea00022cc300 count:1 mapcount:0 mapping:ffff88812c31cdc0 index:0x0 compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffffea00022e6708 ffffea00022c0508 ffff88812c31cdc0
raw: 0000000000000000 ffff88808b30c5c0 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88808b30d800: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88808b30d880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88808b30d900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff88808b30d980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88808b30da00: 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

syzbot

unread,
Sep 21, 2021, 8:08:07 PM9/21/21
to syzkaller...@googlegroups.com
syzbot suspects this issue was fixed by commit:

commit 4e370cc081a78ee23528311ca58fd98a06768ec7
Author: Pavel Skripkin <paskr...@gmail.com>
Date: Fri Aug 13 15:14:33 2021 +0000

net: 6pack: fix slab-out-of-bounds in decode_data

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=17beef9b300000
start commit: 4fccc2503536 Linux 4.19.105
git tree: linux-4.19.y
If the result looks correct, please mark the issue as fixed by replying with:

#syz fix: net: 6pack: fix slab-out-of-bounds in decode_data

For information about bisection process see: https://goo.gl/tpsmEJ#bisection
Reply all
Reply to author
Forward
0 new messages