[v5.15] KASAN: use-after-free Read in sysv_new_block

15 views
Skip to first unread message

syzbot

unread,
Oct 20, 2024, 1:31:29 AM10/20/24
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 584a40a22cb9 Linux 5.15.168
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=133c825f980000
kernel config: https://syzkaller.appspot.com/x/.config?x=afb077b44202210c
dashboard link: https://syzkaller.appspot.com/bug?extid=bc2a78caad1e0b7874c4
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/efb306d086fc/disk-584a40a2.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/4ce735bbc902/vmlinux-584a40a2.xz
kernel image: https://storage.googleapis.com/syzbot-assets/ca277f48b364/bzImage-584a40a2.xz

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

VFS: Found a Xenix FS (block size = 1024) on device loop2
attempt to access beyond end of device
loop2: rw=0, want=6491538, limit=128
Buffer I/O error on dev loop2, logical block 3245768, async page read
==================================================================
BUG: KASAN: use-after-free in sysv_new_block+0x788/0x960 fs/sysv/balloc.c:113
Read of size 4 at addr ffff888068bbf0c8 by task syz.2.11/3722

CPU: 1 PID: 3722 Comm: syz.2.11 Not tainted 5.15.168-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106
print_address_description+0x63/0x3b0 mm/kasan/report.c:248
__kasan_report mm/kasan/report.c:434 [inline]
kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
sysv_new_block+0x788/0x960 fs/sysv/balloc.c:113
alloc_branch fs/sysv/itree.c:134 [inline]
get_block+0x2e7/0x1790 fs/sysv/itree.c:253
__block_write_begin_int+0x60b/0x1650 fs/buffer.c:2012
__block_write_begin fs/buffer.c:2062 [inline]
block_write_begin+0x4f/0xc0 fs/buffer.c:2122
sysv_write_begin+0x36/0x70 fs/sysv/itree.c:487
__page_symlink+0x15b/0x2a0 fs/namei.c:5177
sysv_symlink+0xcb/0x180 fs/sysv/namei.c:86
vfs_symlink+0x247/0x3d0 fs/namei.c:4429
do_symlinkat+0x1fd/0x600 fs/namei.c:4458
__do_sys_symlink fs/namei.c:4480 [inline]
__se_sys_symlink fs/namei.c:4478 [inline]
__x64_sys_symlink+0x7a/0x90 fs/namei.c:4478
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7f800e7aeff9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f800cc27038 EFLAGS: 00000246 ORIG_RAX: 0000000000000058
RAX: ffffffffffffffda RBX: 00007f800e966f80 RCX: 00007f800e7aeff9
RDX: 0000000000000000 RSI: 00000000200059c0 RDI: 00000000200049c0
RBP: 00007f800e821296 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f800e966f80 R15: 00007fff48dd94b8
</TASK>

The buggy address belongs to the page:
page:ffffea0001a2efc0 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x68bbf
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 ffffea0001a2f008 ffffea0001a2ef88 0000000000000000
raw: 0000000000000001 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as freed
page last allocated via order 0, migratetype Movable, gfp_mask 0x1100cca(GFP_HIGHUSER_MOVABLE), pid 3665, ts 66477440752, free_ts 68043255258
prep_new_page mm/page_alloc.c:2426 [inline]
get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159
__alloc_pages+0x272/0x700 mm/page_alloc.c:5423
alloc_pages_vma+0x39a/0x800 mm/mempolicy.c:2146
shmem_alloc_page mm/shmem.c:1586 [inline]
shmem_alloc_and_acct_page+0x4d1/0xd10 mm/shmem.c:1611
shmem_getpage_gfp+0x17b1/0x3190 mm/shmem.c:1906
shmem_getpage mm/shmem.c:151 [inline]
shmem_write_begin+0xce/0x1a0 mm/shmem.c:2477
generic_perform_write+0x2bf/0x5b0 mm/filemap.c:3785
__generic_file_write_iter+0x243/0x4f0 mm/filemap.c:3912
generic_file_write_iter+0xa7/0x1b0 mm/filemap.c:3944
call_write_iter include/linux/fs.h:2174 [inline]
new_sync_write fs/read_write.c:507 [inline]
vfs_write+0xacd/0xe50 fs/read_write.c:594
ksys_write+0x1a2/0x2c0 fs/read_write.c:647
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1340 [inline]
free_pcp_prepare mm/page_alloc.c:1391 [inline]
free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317
free_unref_page_list+0x1f7/0x8e0 mm/page_alloc.c:3433
release_pages+0x1bb9/0x1f40 mm/swap.c:963
__pagevec_release+0x80/0xf0 mm/swap.c:983
pagevec_release include/linux/pagevec.h:81 [inline]
shmem_undo_range+0x67a/0x1b50 mm/shmem.c:964
shmem_truncate_range mm/shmem.c:1063 [inline]
shmem_evict_inode+0x21b/0xa00 mm/shmem.c:1145
evict+0x529/0x930 fs/inode.c:622
__dentry_kill+0x436/0x650 fs/dcache.c:586
dentry_kill+0xbb/0x290
dput+0xd8/0x1a0 fs/dcache.c:893
__fput+0x636/0x8e0 fs/file_table.c:288
task_work_run+0x129/0x1a0 kernel/task_work.c:188
tracehook_notify_resume include/linux/tracehook.h:189 [inline]
exit_to_user_mode_loop+0x106/0x130 kernel/entry/common.c:181
exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:214
__syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline]
syscall_exit_to_user_mode+0x5d/0x240 kernel/entry/common.c:307
do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:86

Memory state around the buggy address:
ffff888068bbef80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff888068bbf000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff888068bbf080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff888068bbf100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff888068bbf180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================


---
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 report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

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

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

If you want to undo deduplication, reply with:
#syz undup

syzbot

unread,
Oct 20, 2024, 1:57:28 AM10/20/24
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 584a40a22cb9 Linux 5.15.168
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=15442430580000
kernel config: https://syzkaller.appspot.com/x/.config?x=afb077b44202210c
dashboard link: https://syzkaller.appspot.com/bug?extid=bc2a78caad1e0b7874c4
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=13dd0c87980000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=12d2825f980000
mounted in repro: https://storage.googleapis.com/syzbot-assets/1d7a72db2fb2/mount_0.gz

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

unable to read i-node block
==================================================================
BUG: KASAN: use-after-free in sysv_new_block+0x788/0x960 fs/sysv/balloc.c:113
Read of size 4 at addr ffff888065def0c8 by task syz-executor296/3587

CPU: 0 PID: 3587 Comm: syz-executor296 Not tainted 5.15.168-syzkaller #0
RIP: 0033:0x7f2ab20089e9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 b1 1f 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f2ab1fba228 EFLAGS: 00000246 ORIG_RAX: 0000000000000058
RAX: ffffffffffffffda RBX: 00007f2ab2099468 RCX: 00007f2ab20089e9
RDX: 00007f2ab20089e9 RSI: 00000000200059c0 RDI: 00000000200049c0
RBP: 00007f2ab2099460 R08: 00007f2ab1fba6c0 R09: 00007f2ab1fba6c0
R10: 00007f2ab1fba6c0 R11: 0000000000000246 R12: 00007f2ab209946c
R13: 0030656c69662f2e R14: 00007f2ab2055340 R15: 00007ffeec4f1de8
</TASK>

The buggy address belongs to the page:
page:ffffea0001977bc0 refcount:1 mapcount:1 mapping:0000000000000000 index:0x7fffffffb pfn:0x65def
memcg:ffff888017284000
anon flags: 0xfff00000080014(uptodate|lru|swapbacked|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000080014 ffffea0001977b88 ffffea0001977c08 ffff88807d42a441
raw: 00000007fffffffb 0000000000000000 0000000100000000 ffff888017284000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Movable, gfp_mask 0x1100cca(GFP_HIGHUSER_MOVABLE), pid 3029, ts 46767703584, free_ts 10434344804
prep_new_page mm/page_alloc.c:2426 [inline]
get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159
__alloc_pages+0x272/0x700 mm/page_alloc.c:5423
alloc_pages_vma+0x39a/0x800 mm/mempolicy.c:2146
wp_page_copy+0x24e/0x2070 mm/memory.c:3043
handle_pte_fault mm/memory.c:4655 [inline]
__handle_mm_fault mm/memory.c:4772 [inline]
handle_mm_fault+0x2a3d/0x5960 mm/memory.c:4870
do_user_addr_fault arch/x86/mm/fault.c:1357 [inline]
handle_page_fault arch/x86/mm/fault.c:1445 [inline]
exc_page_fault+0x271/0x700 arch/x86/mm/fault.c:1501
asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:606
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1340 [inline]
free_pcp_prepare mm/page_alloc.c:1391 [inline]
free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317
free_unref_page+0x95/0x2d0 mm/page_alloc.c:3396
free_contig_range+0x95/0xf0 mm/page_alloc.c:9342
destroy_args+0xfe/0x980 mm/debug_vm_pgtable.c:1018
debug_vm_pgtable+0x40d/0x470 mm/debug_vm_pgtable.c:1331
do_one_initcall+0x22b/0x7a0 init/main.c:1302
do_initcall_level+0x157/0x210 init/main.c:1375
do_initcalls+0x49/0x90 init/main.c:1391
kernel_init_freeable+0x425/0x5c0 init/main.c:1615
kernel_init+0x19/0x290 init/main.c:1506
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

Memory state around the buggy address:
ffff888065deef80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff888065def000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff888065def080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
ffff888065def100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff888065def180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================


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

syzbot

unread,
Oct 28, 2024, 8:55:25 AM10/28/24
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 7ec6f9fa3d97 Linux 6.1.114
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=15b6fe5f980000
kernel config: https://syzkaller.appspot.com/x/.config?x=c3430b5172170129
dashboard link: https://syzkaller.appspot.com/bug?extid=9aec3b4fc9b5eac66815
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/85855dd3567d/disk-7ec6f9fa.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/2938cf086485/vmlinux-7ec6f9fa.xz
kernel image: https://storage.googleapis.com/syzbot-assets/708aae50ad2d/bzImage-7ec6f9fa.xz

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

VFS: Found a Xenix FS (block size = 1024) on device loop6
syz.6.274: attempt to access beyond end of device
loop6: rw=0, sector=6491536, nr_sectors = 2 limit=128
Buffer I/O error on dev loop6, logical block 3245768, async page read
==================================================================
BUG: KASAN: use-after-free in sysv_new_block+0x788/0x960 fs/sysv/balloc.c:113
Read of size 4 at addr ffff8880518b10c8 by task syz.6.274/6160

CPU: 1 PID: 6160 Comm: syz.6.274 Not tainted 6.1.114-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
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
sysv_new_block+0x788/0x960 fs/sysv/balloc.c:113
alloc_branch fs/sysv/itree.c:134 [inline]
get_block+0x2e7/0x1790 fs/sysv/itree.c:253
__block_write_begin_int+0x544/0x1a30 fs/buffer.c:1991
__block_write_begin fs/buffer.c:2041 [inline]
block_write_begin+0x98/0x1f0 fs/buffer.c:2102
sysv_write_begin+0x2d/0x60 fs/sysv/itree.c:487
page_symlink+0x2c1/0x4e0 fs/namei.c:5218
sysv_symlink+0xcb/0x180 fs/sysv/namei.c:86
vfs_symlink+0x247/0x3d0 fs/namei.c:4471
do_symlinkat+0x21e/0x390 fs/namei.c:4500
__do_sys_symlink fs/namei.c:4522 [inline]
__se_sys_symlink fs/namei.c:4520 [inline]
__x64_sys_symlink+0x7a/0x90 fs/namei.c:4520
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7fd0fe97e719
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fd0ff796038 EFLAGS: 00000246 ORIG_RAX: 0000000000000058
RAX: ffffffffffffffda RBX: 00007fd0feb35f80 RCX: 00007fd0fe97e719
RDX: 0000000000000000 RSI: 0000000020000000 RDI: 0000000020000080
RBP: 00007fd0fe9f132e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007fd0feb35f80 R15: 00007fffc6c40638
</TASK>

The buggy address belongs to the physical page:
page:ffffea0001462c40 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x518b1
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 ffffea0001462c88 ffffea0001462c08 0000000000000000
raw: 0000000000000001 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as freed
page last allocated via order 0, migratetype Movable, gfp_mask 0x140cca(GFP_HIGHUSER_MOVABLE|__GFP_COMP), pid 6114, tgid 6112 (syz.6.269), ts 214490630819, free_ts 215360087688
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2517
prep_new_page mm/page_alloc.c:2524 [inline]
get_page_from_freelist+0x322e/0x33b0 mm/page_alloc.c:4290
__alloc_pages+0x28d/0x770 mm/page_alloc.c:5558
__folio_alloc+0xf/0x30 mm/page_alloc.c:5590
vma_alloc_folio+0x486/0x990 mm/mempolicy.c:2243
shmem_alloc_folio mm/shmem.c:1589 [inline]
shmem_alloc_and_acct_folio+0x5a8/0xd50 mm/shmem.c:1613
shmem_get_folio_gfp+0x13f0/0x3470 mm/shmem.c:1941
shmem_fault+0x235/0x9c0 mm/shmem.c:2156
__do_fault+0x136/0x4f0 mm/memory.c:4278
do_read_fault mm/memory.c:4629 [inline]
do_fault mm/memory.c:4758 [inline]
handle_pte_fault mm/memory.c:5029 [inline]
__handle_mm_fault mm/memory.c:5171 [inline]
handle_mm_fault+0x3410/0x5340 mm/memory.c:5292
faultin_page mm/gup.c:1009 [inline]
__get_user_pages+0x4f3/0x1190 mm/gup.c:1233
populate_vma_page_range+0x217/0x2b0 mm/gup.c:1590
__mm_populate+0x275/0x440 mm/gup.c:1704
mm_populate include/linux/mm.h:2801 [inline]
vm_mmap_pgoff+0x22b/0x2d0 mm/util.c:525
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1444 [inline]
free_pcp_prepare mm/page_alloc.c:1494 [inline]
free_unref_page_prepare+0xf63/0x1120 mm/page_alloc.c:3369
free_unref_page_list+0x663/0x900 mm/page_alloc.c:3510
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]
shmem_undo_range+0x865/0x2390 mm/shmem.c:946
shmem_truncate_range mm/shmem.c:1062 [inline]
shmem_evict_inode+0x265/0xa60 mm/shmem.c:1171
evict+0x529/0x930 fs/inode.c:701
__dentry_kill+0x436/0x650 fs/dcache.c:611
dentry_kill+0xbb/0x290
dput+0xfb/0x1d0 fs/dcache.c:918
__fput+0x62e/0x8d0 fs/file_table.c:328
task_work_run+0x246/0x300 kernel/task_work.c:203
exit_task_work include/linux/task_work.h:39 [inline]
do_exit+0xa73/0x26a0 kernel/exit.c:871
do_group_exit+0x202/0x2b0 kernel/exit.c:1021
get_signal+0x16f7/0x17d0 kernel/signal.c:2870
arch_do_signal_or_restart+0xb0/0x1a10 arch/x86/kernel/signal.c:871

Memory state around the buggy address:
ffff8880518b0f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff8880518b1000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff8880518b1080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff8880518b1100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff8880518b1180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

syzbot

unread,
Jan 31, 2025, 3:19:23 AM1/31/25
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 75cefdf153f5 Linux 6.1.127
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=10a576b0580000
kernel config: https://syzkaller.appspot.com/x/.config?x=3dc848f1f9c50685
dashboard link: https://syzkaller.appspot.com/bug?extid=9aec3b4fc9b5eac66815
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14838518580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1428ab64580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/9fa70d9fd10a/disk-75cefdf1.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/d01cb9bb9789/vmlinux-75cefdf1.xz
kernel image: https://storage.googleapis.com/syzbot-assets/487423b91d50/bzImage-75cefdf1.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/36ec0acb78ce/mount_0.gz

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

syz-executor239: attempt to access beyond end of device
loop0: rw=0, sector=6491536, nr_sectors = 2 limit=128
Buffer I/O error on dev loop0, logical block 3245768, async page read
unable to read i-node block
==================================================================
BUG: KASAN: use-after-free in sysv_new_block+0x788/0x960 fs/sysv/balloc.c:113
Read of size 4 at addr ffff88806f0d40c8 by task syz-executor239/4260

CPU: 0 PID: 4260 Comm: syz-executor239 Not tainted 6.1.127-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024
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:316 [inline]
print_report+0x15f/0x4f0 mm/kasan/report.c:427
kasan_report+0x136/0x160 mm/kasan/report.c:531
sysv_new_block+0x788/0x960 fs/sysv/balloc.c:113
alloc_branch fs/sysv/itree.c:134 [inline]
get_block+0x2e7/0x1790 fs/sysv/itree.c:253
__block_write_begin_int+0x544/0x1a30 fs/buffer.c:1991
__block_write_begin fs/buffer.c:2041 [inline]
block_write_begin+0x98/0x1f0 fs/buffer.c:2102
sysv_write_begin+0x2d/0x60 fs/sysv/itree.c:487
page_symlink+0x2c1/0x4e0 fs/namei.c:5218
sysv_symlink+0xcb/0x180 fs/sysv/namei.c:86
vfs_symlink+0x247/0x3d0 fs/namei.c:4471
do_symlinkat+0x21e/0x390 fs/namei.c:4500
__do_sys_symlink fs/namei.c:4522 [inline]
__se_sys_symlink fs/namei.c:4520 [inline]
__x64_sys_symlink+0x7a/0x90 fs/namei.c:4520
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f25f0c1e0e9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 21 18 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffe97f5e688 EFLAGS: 00000246 ORIG_RAX: 0000000000000058
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f25f0c1e0e9
RDX: 0000000000000000 RSI: 000000002000acc0 RDI: 000000002000ad80
RBP: 0000000000000004 R08: 0000000000009e80 R09: 0000000000000000
R10: 00007ffe97f5e710 R11: 0000000000000246 R12: 00007ffe97f5e6d0
R13: 00007ffe97f5e710 R14: 0000000000010000 R15: 0000000000000003
</TASK>

The buggy address belongs to the physical page:
page:ffffea0001bc3500 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x6f0d4
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 ffffea0001bc3548 ffffea0001bc34c8 0000000000000000
raw: 0000000000000001 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as freed
page last allocated via order 0, migratetype Movable, gfp_mask 0x8(__GFP_MOVABLE), pid 1, tgid 1 (swapper/0), ts 20233614458, free_ts 21685061719
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2532
split_map_pages+0x246/0x510 mm/compaction.c:97
isolate_freepages_range+0x47c/0x4e0 mm/compaction.c:735
alloc_contig_range+0x62a/0x990 mm/page_alloc.c:9440
__alloc_contig_pages mm/page_alloc.c:9463 [inline]
alloc_contig_pages+0x3f0/0x4e0 mm/page_alloc.c:9543
debug_vm_pgtable_alloc_huge_page+0xb9/0x108 mm/debug_vm_pgtable.c:1098
init_args+0xc92/0x1022 mm/debug_vm_pgtable.c:1221
debug_vm_pgtable+0xaa/0x46b mm/debug_vm_pgtable.c:1259
do_one_initcall+0x265/0x8f0 init/main.c:1298
do_initcall_level+0x157/0x207 init/main.c:1371
do_initcalls+0x49/0x86 init/main.c:1387
kernel_init_freeable+0x45c/0x60f init/main.c:1626
kernel_init+0x19/0x290 init/main.c:1514
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1459 [inline]
free_pcp_prepare mm/page_alloc.c:1509 [inline]
free_unref_page_prepare+0x12a6/0x15b0 mm/page_alloc.c:3384
free_unref_page+0x33/0x3e0 mm/page_alloc.c:3479
free_contig_range+0x9a/0x150 mm/page_alloc.c:9565
destroy_args+0xfe/0x997 mm/debug_vm_pgtable.c:1031
debug_vm_pgtable+0x416/0x46b mm/debug_vm_pgtable.c:1354
do_one_initcall+0x265/0x8f0 init/main.c:1298
do_initcall_level+0x157/0x207 init/main.c:1371
do_initcalls+0x49/0x86 init/main.c:1387
kernel_init_freeable+0x45c/0x60f init/main.c:1626
kernel_init+0x19/0x290 init/main.c:1514
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Memory state around the buggy address:
ffff88806f0d3f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff88806f0d4000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff88806f0d4080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff88806f0d4100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff88806f0d4180: 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