[v6.1] KASAN: out-of-bounds Write in end_buffer_read_sync

0 views
Skip to first unread message

syzbot

unread,
May 29, 2023, 3:57:10 PM5/29/23
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: a343b0dd87b4 Linux 6.1.30
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=14b9bfe5280000
kernel config: https://syzkaller.appspot.com/x/.config?x=5265a3c898f3cbbb
dashboard link: https://syzkaller.appspot.com/bug?extid=a4e609731ea45e9086d3
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1141c63e280000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/195d974b1f1c/disk-a343b0dd.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/ea41850547fb/vmlinux-a343b0dd.xz
kernel image: https://storage.googleapis.com/syzbot-assets/13ec9e70ad28/bzImage-a343b0dd.xz
mounted in repro #1: https://storage.googleapis.com/syzbot-assets/0a884e9082d9/mount_0.gz
mounted in repro #2: https://storage.googleapis.com/syzbot-assets/9eac8ea7c6f3/mount_12.gz

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

==================================================================
BUG: KASAN: out-of-bounds in instrument_atomic_read_write include/linux/instrumented.h:102 [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:320 [inline]
BUG: KASAN: out-of-bounds in end_buffer_read_sync+0xbd/0xd0 fs/buffer.c:160
Write of size 4 at addr ffffc90003ba7820 by task ksoftirqd/1/21

CPU: 1 PID: 21 Comm: ksoftirqd/1 Not tainted 6.1.30-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/25/2023
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
print_address_description mm/kasan/report.c:284 [inline]
print_report+0x15f/0x4f0 mm/kasan/report.c:395
kasan_report+0x136/0x160 mm/kasan/report.c:495
kasan_check_range+0x27f/0x290 mm/kasan/generic.c:189
instrument_atomic_read_write include/linux/instrumented.h:102 [inline]
atomic_dec include/linux/atomic/atomic-instrumented.h:257 [inline]
put_bh include/linux/buffer_head.h:320 [inline]
end_buffer_read_sync+0xbd/0xd0 fs/buffer.c:160
end_bio_bh_io_sync+0xb3/0x110 fs/buffer.c:2655
req_bio_endio block/blk-mq.c:763 [inline]
blk_update_request+0x53b/0x1010 block/blk-mq.c:908
blk_mq_end_request+0x3a/0x70 block/blk-mq.c:1035
blk_complete_reqs block/blk-mq.c:1113 [inline]
blk_done_softirq+0xf8/0x140 block/blk-mq.c:1118
__do_softirq+0x2e9/0xa4c kernel/softirq.c:571
run_ksoftirqd+0xc1/0x120 kernel/softirq.c:934
smpboot_thread_fn+0x51b/0xa10 kernel/smpboot.c:164
kthread+0x26e/0x300 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
</TASK>

The buggy address belongs to the virtual mapping at
[ffffc90003ba0000, ffffc90003ba9000) created by:
copy_process+0x637/0x4020 kernel/fork.c:2090

The buggy address belongs to the physical page:
page:ffffea000062fd80 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x18bf6
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 0000000000000000 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x102dc2(GFP_HIGHUSER|__GFP_NOWARN|__GFP_ZERO), pid 3595, tgid 3595 (syz-executor.0), ts 845488137720, free_ts 845392226828
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2533
prep_new_page mm/page_alloc.c:2540 [inline]
get_page_from_freelist+0x32ed/0x3480 mm/page_alloc.c:4292
__alloc_pages+0x28d/0x770 mm/page_alloc.c:5559
vm_area_alloc_pages mm/vmalloc.c:2979 [inline]
__vmalloc_area_node mm/vmalloc.c:3047 [inline]
__vmalloc_node_range+0x96c/0x1460 mm/vmalloc.c:3219
alloc_thread_stack_node kernel/fork.c:311 [inline]
dup_task_struct+0x3e5/0x6d0 kernel/fork.c:980
copy_process+0x637/0x4020 kernel/fork.c:2090
kernel_clone+0x222/0x920 kernel/fork.c:2679
__do_sys_clone kernel/fork.c:2820 [inline]
__se_sys_clone kernel/fork.c:2804 [inline]
__x64_sys_clone+0x231/0x280 kernel/fork.c:2804
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1460 [inline]
free_pcp_prepare mm/page_alloc.c:1510 [inline]
free_unref_page_prepare+0xf63/0x1120 mm/page_alloc.c:3388
free_unref_page_list+0x107/0x810 mm/page_alloc.c:3530
release_pages+0x2836/0x2b40 mm/swap.c:1055
__pagevec_release+0x80/0xf0 mm/swap.c:1075
pagevec_release include/linux/pagevec.h:71 [inline]
folio_batch_release include/linux/pagevec.h:135 [inline]
truncate_inode_pages_range+0x48a/0x1340 mm/truncate.c:373
kill_bdev block/bdev.c:76 [inline]
blkdev_flush_mapping+0x154/0x2b0 block/bdev.c:662
blkdev_put_whole block/bdev.c:693 [inline]
blkdev_put+0x4c0/0x750 block/bdev.c:953
blkdev_close+0x56/0x80 block/fops.c:514
__fput+0x3b7/0x890 fs/file_table.c:320
task_work_run+0x246/0x300 kernel/task_work.c:179
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
exit_to_user_mode_loop+0xd9/0x100 kernel/entry/common.c:171
exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:204
__syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline]
syscall_exit_to_user_mode+0x60/0x270 kernel/entry/common.c:297
do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x63/0xcd

Memory state around the buggy address:
ffffc90003ba7700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffffc90003ba7780: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffffc90003ba7800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
ffffc90003ba7880: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffffc90003ba7900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================


---
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 syzk...@googlegroups.com.

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

If the bug is already fixed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to change bug's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the bug is a duplicate of another bug, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup
Reply all
Reply to author
Forward
0 new messages