[syzbot] KASAN: out-of-bounds Write in end_buffer_read_sync

From: syzbot
Date: Sun Apr 24 2022 - 23:07:39 EST


Hello,

syzbot found the following issue on:

HEAD commit: 22da5264abf4 Merge tag '5.18-rc3-ksmbd-fixes' of git://git..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1230fd64f00000
kernel config: https://syzkaller.appspot.com/x/.config?x=6bc13fa21dd76a9b
dashboard link: https://syzkaller.appspot.com/bug?extid=3f7f291a3d327486073c
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2

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

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+3f7f291a3d327486073c@xxxxxxxxxxxxxxxxxxxxxxxxx

==================================================================
BUG: KASAN: out-of-bounds in instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
BUG: KASAN: out-of-bounds in atomic_dec include/linux/atomic/atomic-instrumented.h:257 [inline]
BUG: KASAN: out-of-bounds in put_bh include/linux/buffer_head.h:284 [inline]
BUG: KASAN: out-of-bounds in end_buffer_read_sync+0x24/0x30 fs/buffer.c:160
Write of size 4 at addr ffffc9000302f9d8 by task ksoftirqd/2/28

CPU: 2 PID: 28 Comm: ksoftirqd/2 Not tainted 5.18.0-rc3-syzkaller-00235-g22da5264abf4 #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
print_address_description.constprop.0.cold+0xf/0x467 mm/kasan/report.c:313
print_report mm/kasan/report.c:429 [inline]
kasan_report.cold+0xf4/0x1c6 mm/kasan/report.c:491
check_region_inline mm/kasan/generic.c:183 [inline]
kasan_check_range+0x13d/0x180 mm/kasan/generic.c:189
instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
atomic_dec include/linux/atomic/atomic-instrumented.h:257 [inline]
put_bh include/linux/buffer_head.h:284 [inline]
end_buffer_read_sync+0x24/0x30 fs/buffer.c:160
end_bio_bh_io_sync+0xda/0x130 fs/buffer.c:2999
bio_endio+0x5fe/0x780 block/bio.c:1541
req_bio_endio block/blk-mq.c:686 [inline]
blk_update_request+0x401/0x1310 block/blk-mq.c:815
blk_mq_end_request+0x4b/0x80 block/blk-mq.c:941
lo_complete_rq+0x1c2/0x280 drivers/block/loop.c:369
blk_complete_reqs+0xad/0xe0 block/blk-mq.c:1012
__do_softirq+0x29b/0x9c2 kernel/softirq.c:558
run_ksoftirqd kernel/softirq.c:921 [inline]
run_ksoftirqd+0x2d/0x60 kernel/softirq.c:913
smpboot_thread_fn+0x645/0x9c0 kernel/smpboot.c:164
kthread+0x2e9/0x3a0 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298
</TASK>

The buggy address belongs to the virtual mapping at
[ffffc90003028000, ffffc90003031000) created by:
kernel_clone+0xe7/0xab0 kernel/fork.c:2639

------------[ cut here ]------------
kernel BUG at mm/vmalloc.c:660!
invalid opcode: 0000 [#1] PREEMPT SMP KASAN
CPU: 2 PID: 28 Comm: ksoftirqd/2 Not tainted 5.18.0-rc3-syzkaller-00235-g22da5264abf4 #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014
RIP: 0010:vmalloc_to_page+0x46e/0x4f0 mm/vmalloc.c:660
Code: c1 ff 4d 31 fc 4d 21 f4 49 c1 ec 0c 4c 01 e3 49 bc 00 00 00 00 00 ea ff ff 48 c1 e3 06 49 01 dc e9 35 ff ff ff e8 c2 d5 c1 ff <0f> 0b e8 bb d5 c1 ff 0f 0b 45 31 e4 e9 1f ff ff ff e8 ac d5 c1 ff
RSP: 0018:ffffc90000777be8 EFLAGS: 00010046
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000100
RDX: ffff888011aac0c0 RSI: ffffffff81b68f6e RDI: 0000000000000003
RBP: ffffffff8ba8e000 R08: 00001ffffffffffe R09: 0000000000000001
R10: ffffffff81b68b86 R11: 0000000000000000 R12: 0000370000000000
R13: 0000000000000000 R14: ffff888011aac0c0 R15: ffff888022c8f688
FS: 0000000000000000(0000) GS:ffff88802cc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffbb1d08922 CR3: 000000006e266000 CR4: 0000000000150ee0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
print_address_description.constprop.0.cold+0x2ce/0x467 mm/kasan/report.c:350
print_report mm/kasan/report.c:429 [inline]
kasan_report.cold+0xf4/0x1c6 mm/kasan/report.c:491
check_region_inline mm/kasan/generic.c:183 [inline]
kasan_check_range+0x13d/0x180 mm/kasan/generic.c:189
instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
atomic_dec include/linux/atomic/atomic-instrumented.h:257 [inline]
put_bh include/linux/buffer_head.h:284 [inline]
end_buffer_read_sync+0x24/0x30 fs/buffer.c:160
end_bio_bh_io_sync+0xda/0x130 fs/buffer.c:2999
bio_endio+0x5fe/0x780 block/bio.c:1541
req_bio_endio block/blk-mq.c:686 [inline]
blk_update_request+0x401/0x1310 block/blk-mq.c:815
blk_mq_end_request+0x4b/0x80 block/blk-mq.c:941
lo_complete_rq+0x1c2/0x280 drivers/block/loop.c:369
blk_complete_reqs+0xad/0xe0 block/blk-mq.c:1012
__do_softirq+0x29b/0x9c2 kernel/softirq.c:558
run_ksoftirqd kernel/softirq.c:921 [inline]
run_ksoftirqd+0x2d/0x60 kernel/softirq.c:913
smpboot_thread_fn+0x645/0x9c0 kernel/smpboot.c:164
kthread+0x2e9/0x3a0 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:vmalloc_to_page+0x46e/0x4f0 mm/vmalloc.c:660
Code: c1 ff 4d 31 fc 4d 21 f4 49 c1 ec 0c 4c 01 e3 49 bc 00 00 00 00 00 ea ff ff 48 c1 e3 06 49 01 dc e9 35 ff ff ff e8 c2 d5 c1 ff <0f> 0b e8 bb d5 c1 ff 0f 0b 45 31 e4 e9 1f ff ff ff e8 ac d5 c1 ff
RSP: 0018:ffffc90000777be8 EFLAGS: 00010046
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000100
RDX: ffff888011aac0c0 RSI: ffffffff81b68f6e RDI: 0000000000000003
RBP: ffffffff8ba8e000 R08: 00001ffffffffffe R09: 0000000000000001
R10: ffffffff81b68b86 R11: 0000000000000000 R12: 0000370000000000
R13: 0000000000000000 R14: ffff888011aac0c0 R15: ffff888022c8f688
FS: 0000000000000000(0000) GS:ffff88802cc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffbb1d08922 CR3: 000000006e266000 CR4: 0000000000150ee0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400


---
This report 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 syzkaller@xxxxxxxxxxxxxxxx.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.