KASAN: use-after-free Read in tasklet_action_common

11 views
Skip to first unread message

syzbot

unread,
May 17, 2020, 4:44:13 PM5/17/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 258f0cf7 Linux 4.19.123
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=161a6e6e100000
kernel config: https://syzkaller.appspot.com/x/.config?x=b296d33c12741d24
dashboard link: https://syzkaller.appspot.com/bug?extid=999c19450d1efd698a94
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+999c19...@syzkaller.appspotmail.com

nbd3: unable to read partition table
ldm_validate_partition_table(): Disk read failed.
Dev nbd3: unable to read RDB block 0
==================================================================
BUG: KASAN: use-after-free in tasklet_action_common.isra.0+0x3fe/0x4c0 kernel/softirq.c:515
Read of size 8 at addr ffff8880a44c8e90 by task syz-executor.0/24809
nbd3: unable to read partition table

CPU: 1 PID: 24809 Comm: syz-executor.0 Not tainted 4.19.123-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
<IRQ>
__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
tasklet_action_common.isra.0+0x3fe/0x4c0 kernel/softirq.c:515
__do_softirq+0x26c/0x93c kernel/softirq.c:292
do_softirq_own_stack+0x2a/0x40 arch/x86/entry/entry_64.S:1092
</IRQ>
do_softirq.part.0+0x10f/0x160 kernel/softirq.c:336
do_softirq kernel/softirq.c:328 [inline]
__local_bh_enable_ip+0x20e/0x270 kernel/softirq.c:189
sock_orphan include/net/sock.h:1800 [inline]
bcm_release+0x49b/0x5e0 net/can/bcm.c:1572
__sock_release+0xcd/0x2a0 net/socket.c:579
sock_close+0x15/0x20 net/socket.c:1140
__fput+0x2cd/0x890 fs/file_table.c:278
task_work_run+0x13f/0x1b0 kernel/task_work.c:113
tracehook_notify_resume include/linux/tracehook.h:193 [inline]
exit_to_usermode_loop+0x25a/0x2b0 arch/x86/entry/common.c:167
prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x416621
Code: 75 14 b8 03 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 04 1b 00 00 c3 48 83 ec 08 e8 0a fc ff ff 48 89 04 24 b8 03 00 00 00 0f 05 <48> 8b 3c 24 48 89 c2 e8 53 fc ff ff 48 89 d0 48 83 c4 08 48 3d 01
RSP: 002b:00007fffb1b53150 EFLAGS: 00000293 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 0000000000000006 RCX: 0000000000416621
RDX: 0000000000000000 RSI: 0000000000000511 RDI: 0000000000000005
RBP: 0000000000000001 R08: 00000000b5652514 R09: 0000000000000000
R10: 00007fffb1b53240 R11: 0000000000000293 R12: 0000000000791678
R13: 0000000000076457 R14: ffffffffffffffff R15: 000000000078bf0c

Allocated by task 24816:
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]
kzalloc include/linux/slab.h:709 [inline]
bcm_tx_setup net/can/bcm.c:939 [inline]
bcm_sendmsg+0x21d0/0x3e12 net/can/bcm.c:1378
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

Freed by task 24809:
set_track mm/kasan/kasan.c:460 [inline]
__kasan_slab_free+0xf7/0x140 mm/kasan/kasan.c:521
__cache_free mm/slab.c:3503 [inline]
kfree+0xce/0x220 mm/slab.c:3822
bcm_release+0xff/0x5e0 net/can/bcm.c:1530
__sock_release+0xcd/0x2a0 net/socket.c:579
sock_close+0x15/0x20 net/socket.c:1140
__fput+0x2cd/0x890 fs/file_table.c:278
task_work_run+0x13f/0x1b0 kernel/task_work.c:113
tracehook_notify_resume include/linux/tracehook.h:193 [inline]
exit_to_usermode_loop+0x25a/0x2b0 arch/x86/entry/common.c:167
prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296
entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880a44c8dc0
which belongs to the cache kmalloc-1024 of size 1024
The buggy address is located 208 bytes inside of
1024-byte region [ffff8880a44c8dc0, ffff8880a44c91c0)
The buggy address belongs to the page:
page:ffffea0002913200 count:1 mapcount:0 mapping:ffff88812c39cac0 index:0xffff8880a44c9b40 compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffffea00025d7588 ffffea0002829c88 ffff88812c39cac0
raw: ffff8880a44c9b40 ffff8880a44c8040 0000000100000006 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880a44c8d80: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
ffff8880a44c8e00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880a44c8e80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880a44c8f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880a44c8f80: 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

unread,
May 18, 2020, 4:14:15 AM5/18/20
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following crash on:

HEAD commit: 258f0cf7 Linux 4.19.123
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=11bd20d6100000
kernel config: https://syzkaller.appspot.com/x/.config?x=b296d33c12741d24
dashboard link: https://syzkaller.appspot.com/bug?extid=999c19450d1efd698a94
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=15a7684a100000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16f0023c100000

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

==================================================================
BUG: KASAN: use-after-free in tasklet_action_common.isra.0+0x3fe/0x4c0 kernel/softirq.c:515
Read of size 8 at addr ffff8880a059b310 by task syz-executor020/7849

CPU: 0 PID: 7849 Comm: syz-executor020 Not tainted 4.19.123-syzkaller #0
RIP: 0033:0x408a81
Code: 75 14 b8 03 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 24 1a 00 00 c3 48 83 ec 08 e8 6a fc ff ff 48 89 04 24 b8 03 00 00 00 0f 05 <48> 8b 3c 24 48 89 c2 e8 b3 fc ff ff 48 89 d0 48 83 c4 08 48 3d 01
RSP: 002b:00007fff6a497a90 EFLAGS: 00000293 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 0000000000000006 RCX: 0000000000408a81
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000005
RBP: 00000000006e0c5c R08: 00000000004b27cc R09: 00000000004b27cc
R10: 00007fff6a497ab0 R11: 0000000000000293 R12: 00000000006e0c50
R13: 000000000000002d R14: 20c49ba5e353f7cf R15: 0000000000000001

Allocated by task 7851:
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]
kzalloc include/linux/slab.h:709 [inline]
bcm_tx_setup net/can/bcm.c:939 [inline]
bcm_sendmsg+0x21d0/0x3e12 net/can/bcm.c:1378
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

Freed by task 7849:
set_track mm/kasan/kasan.c:460 [inline]
__kasan_slab_free+0xf7/0x140 mm/kasan/kasan.c:521
__cache_free mm/slab.c:3503 [inline]
kfree+0xce/0x220 mm/slab.c:3822
bcm_release+0xff/0x5e0 net/can/bcm.c:1530
__sock_release+0xcd/0x2a0 net/socket.c:579
sock_close+0x15/0x20 net/socket.c:1140
__fput+0x2cd/0x890 fs/file_table.c:278
task_work_run+0x13f/0x1b0 kernel/task_work.c:113
tracehook_notify_resume include/linux/tracehook.h:193 [inline]
exit_to_usermode_loop+0x25a/0x2b0 arch/x86/entry/common.c:167
prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296
entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880a059b240
which belongs to the cache kmalloc-1024 of size 1024
The buggy address is located 208 bytes inside of
1024-byte region [ffff8880a059b240, ffff8880a059b640)
The buggy address belongs to the page:
page:ffffea0002816680 count:1 mapcount:0 mapping:ffff88812c39cac0 index:0xffff8880a059bb40 compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffffea0002234408 ffffea000229b508 ffff88812c39cac0
raw: ffff8880a059bb40 ffff8880a059a040 0000000100000006 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880a059b200: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
ffff8880a059b280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880a059b300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880a059b380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880a059b400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Reply all
Reply to author
Forward
0 new messages