KASAN: slab-out-of-bounds Read in ntfs_attr_find (2)

7 views
Skip to first unread message

syzbot

unread,
Aug 25, 2022, 7:21:30 AM8/25/22
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: e548869f356f Linux 4.14.291
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1400b113080000
kernel config: https://syzkaller.appspot.com/x/.config?x=14f65e3c6215eb84
dashboard link: https://syzkaller.appspot.com/bug?extid=d1c69adac1c973a02e29
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/edb4b0800592/disk-e548869f.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/1e0119ec09aa/vmlinux-e548869f.xz

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

==================================================================
BUG: KASAN: slab-out-of-bounds in ntfs_attr_find+0xb48/0xc20 fs/ntfs/attrib.c:611
Read of size 2 at addr ffff888098450a09 by task syz-executor.4/10116

CPU: 0 PID: 10116 Comm: syz-executor.4 Not tainted 4.14.291-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/22/2022
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x1b2/0x281 lib/dump_stack.c:58
print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
kasan_report_error.cold+0x8a/0x191 mm/kasan/report.c:351
kasan_report mm/kasan/report.c:409 [inline]
__asan_report_load_n_noabort+0x6b/0x80 mm/kasan/report.c:440
ntfs_attr_find+0xb48/0xc20 fs/ntfs/attrib.c:611
ntfs_attr_lookup+0xeca/0x1f30 fs/ntfs/attrib.c:1207
ntfs_read_inode_mount+0x726/0x2060 fs/ntfs/inode.c:1879
ntfs_fill_super+0x9a6/0x7170 fs/ntfs/super.c:2871
mount_bdev+0x2b3/0x360 fs/super.c:1134
mount_fs+0x92/0x2a0 fs/super.c:1237
vfs_kern_mount.part.0+0x5b/0x470 fs/namespace.c:1046
vfs_kern_mount fs/namespace.c:1036 [inline]
do_new_mount fs/namespace.c:2572 [inline]
do_mount+0xe65/0x2a30 fs/namespace.c:2905
SYSC_mount fs/namespace.c:3121 [inline]
SyS_mount+0xa8/0x120 fs/namespace.c:3098
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x7f2509f357aa
RSP: 002b:00007f25088a8f88 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0000000020000200 RCX: 00007f2509f357aa
RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007f25088a8fe0
RBP: 00007f25088a9020 R08: 00007f25088a9020 R09: 0000000020000000
R10: 0000000000000000 R11: 0000000000000202 R12: 0000000020000000
R13: 0000000020000100 R14: 00007f25088a8fe0 R15: 0000000020086e00

Allocated by task 9997:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551
kmem_cache_alloc+0x124/0x3c0 mm/slab.c:3552
mempool_alloc+0x10e/0x2d0 mm/mempool.c:330
bvec_alloc+0xcc/0x2d0 block/bio.c:216
bio_alloc_bioset+0x585/0x830 block/bio.c:506
bio_alloc include/linux/bio.h:422 [inline]
mpage_alloc+0x56/0x2b0 fs/mpage.c:79
__mpage_writepage+0xb48/0x1210 fs/mpage.c:622
write_cache_pages+0x505/0xd20 mm/page-writeback.c:2257
mpage_writepages+0xbe/0x1f0 fs/mpage.c:716
do_writepages+0xc3/0x240 mm/page-writeback.c:2361
__filemap_fdatawrite_range+0x236/0x310 mm/filemap.c:346
file_write_and_wait_range+0x86/0xd0 mm/filemap.c:678
__generic_file_fsync+0x70/0x190 fs/libfs.c:985
fat_file_fsync+0x73/0x1f0 fs/fat/file.c:165
vfs_fsync_range+0x103/0x260 fs/sync.c:196
generic_write_sync include/linux/fs.h:2684 [inline]
generic_file_write_iter+0x410/0x650 mm/filemap.c:3212
call_write_iter include/linux/fs.h:1780 [inline]
new_sync_write fs/read_write.c:469 [inline]
__vfs_write+0x44c/0x630 fs/read_write.c:482
__kernel_write+0xf5/0x330 fs/read_write.c:501
write_pipe_buf+0x143/0x1c0 fs/splice.c:797
splice_from_pipe_feed fs/splice.c:502 [inline]
__splice_from_pipe+0x326/0x7a0 fs/splice.c:626
splice_from_pipe fs/splice.c:661 [inline]
default_file_splice_write+0xc5/0x150 fs/splice.c:809
do_splice_from fs/splice.c:851 [inline]
direct_splice_actor+0x115/0x160 fs/splice.c:1016
splice_direct_to_actor+0x25a/0x700 fs/splice.c:971
do_splice_direct+0x164/0x210 fs/splice.c:1059
do_sendfile+0x47f/0xb30 fs/read_write.c:1441
SYSC_sendfile64 fs/read_write.c:1496 [inline]
SyS_sendfile64+0x9b/0x110 fs/read_write.c:1488
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb

Freed by task 9998:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3496 [inline]
kmem_cache_free+0x7c/0x2b0 mm/slab.c:3758
mempool_free+0xcf/0x1d0 mm/mempool.c:439
bvec_free+0x7d/0xa0 block/bio.c:171
bio_free+0xd1/0x1a0 block/bio.c:257
bio_put+0x59/0x70 block/bio.c:558
bio_endio+0x290/0x690 block/bio.c:1918
req_bio_endio block/blk-core.c:204 [inline]
blk_update_request+0x2d0/0xa90 block/blk-core.c:2765
blk_mq_end_request+0x4c/0x1e0 block/blk-mq.c:530
__blk_mq_complete_request+0x30b/0x6c0 block/blk-mq.c:571
blk_mq_complete_request+0x52/0x60 block/blk-mq.c:591
loop_handle_cmd drivers/block/loop.c:1784 [inline]
loop_queue_work+0x228/0x21e0 drivers/block/loop.c:1793
kthread_worker_fn+0x271/0x6c0 kernel/kthread.c:667
kthread+0x30d/0x420 kernel/kthread.c:232
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

The buggy address belongs to the object at ffff888098451c80
which belongs to the cache biovec-max of size 8192
The buggy address is located 4727 bytes to the left of
8192-byte region [ffff888098451c80, ffff888098453c80)
The buggy address belongs to the page:
page:ffffea0002611400 count:1 mapcount:0 mapping:ffff888098451c80 index:0x0 compound_mapcount: 0
flags: 0xfff00000008100(slab|head)
raw: 00fff00000008100 ffff888098451c80 0000000000000000 0000000100000001
raw: ffffea0002363520 ffffea0002611520 ffff88823a804000 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff888098450900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888098450980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888098450a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff888098450a80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888098450b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================


---
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.

syzbot

unread,
Sep 19, 2022, 6:43:39 PM9/19/22
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 5df8b4735177 Linux 4.14.293
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1068560f080000
kernel config: https://syzkaller.appspot.com/x/.config?x=cc7e9ed39471e56f
dashboard link: https://syzkaller.appspot.com/bug?extid=d1c69adac1c973a02e29
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=161f760f080000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=112fe628880000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/0909a4c9f34f/disk-5df8b473.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/413a44ed225d/vmlinux-5df8b473.xz

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

ntfs: (device loop0): is_boot_sector_ntfs(): Invalid end of sector marker.
==================================================================
BUG: KASAN: use-after-free in ntfs_attr_find+0xacd/0xc20 fs/ntfs/attrib.c:611
Read of size 2 at addr ffff88809638a482 by task syz-executor607/7970

CPU: 1 PID: 7970 Comm: syz-executor607 Not tainted 4.14.293-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/26/2022
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x1b2/0x281 lib/dump_stack.c:58
print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
kasan_report_error.cold+0x8a/0x191 mm/kasan/report.c:351
kasan_report mm/kasan/report.c:409 [inline]
__asan_report_load_n_noabort+0x6b/0x80 mm/kasan/report.c:440
ntfs_attr_find+0xacd/0xc20 fs/ntfs/attrib.c:611
ntfs_attr_lookup+0xeca/0x1f30 fs/ntfs/attrib.c:1207
ntfs_read_inode_mount+0x726/0x2060 fs/ntfs/inode.c:1879
ntfs_fill_super+0x9a6/0x7170 fs/ntfs/super.c:2871
mount_bdev+0x2b3/0x360 fs/super.c:1134
mount_fs+0x92/0x2a0 fs/super.c:1237
vfs_kern_mount.part.0+0x5b/0x470 fs/namespace.c:1046
vfs_kern_mount fs/namespace.c:1036 [inline]
do_new_mount fs/namespace.c:2572 [inline]
do_mount+0xe65/0x2a30 fs/namespace.c:2905
SYSC_mount fs/namespace.c:3121 [inline]
SyS_mount+0xa8/0x120 fs/namespace.c:3098
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x7f24578d403a
RSP: 002b:00007fffff6bb148 EFLAGS: 00000286 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007fffff6bb1a0 RCX: 00007f24578d403a
RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007fffff6bb160
RBP: 00007fffff6bb160 R08: 00007fffff6bb1a0 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000286 R12: 0000000020000260
R13: 0000000000000003 R14: 0000000000000004 R15: 0000000000000004

The buggy address belongs to the page:
page:ffffea000258e280 count:0 mapcount:0 mapping: (null) index:0xffff88809638a640
flags: 0xfff00000000000()
raw: 00fff00000000000 0000000000000000 ffff88809638a640 00000000ffffffff
raw: dead000000000100 dead000000000200 0000000000000000 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88809638a380: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff88809638a400: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff88809638a480: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff88809638a500: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff88809638a580: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Reply all
Reply to author
Forward
0 new messages