[syzbot] [udf?] KASAN: use-after-free Read in udf_sync_fs

17 views
Skip to first unread message

syzbot

unread,
Aug 12, 2023, 6:09:09 AM8/12/23
to ja...@suse.com, linux-...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: f8de32cc060b Merge tag 'tpmdd-v6.5-rc7' of git://git.kerne..
git tree: upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=12ac6b63a80000
kernel config: https://syzkaller.appspot.com/x/.config?x=171b698bc2e613cf
dashboard link: https://syzkaller.appspot.com/bug?extid=82df44ede2faca24c729
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=10df55d7a80000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=17e4d78ba80000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/e92cdc2deca7/disk-f8de32cc.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/f821f8a8a452/vmlinux-f8de32cc.xz
kernel image: https://storage.googleapis.com/syzbot-assets/b58fb75b1ad9/bzImage-f8de32cc.xz
mounted in repro #1: https://storage.googleapis.com/syzbot-assets/6f92232ea34d/mount_0.gz
mounted in repro #2: https://storage.googleapis.com/syzbot-assets/9c162574e7a2/mount_2.gz

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

option from the mount to silence this warning.
=======================================================
UDF-fs: INFO Mounting volume 'LinuxUDF', timestamp 2022/11/22 14:59 (1000)
==================================================================
BUG: KASAN: use-after-free in crc_itu_t+0x21c/0x2a0 lib/crc-itu-t.c:60
Read of size 1 at addr ffff88807615a000 by task syz-executor345/5015

CPU: 0 PID: 5015 Comm: syz-executor345 Not tainted 6.5.0-rc5-syzkaller-00296-gf8de32cc060b #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/2023
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:364 [inline]
print_report+0x163/0x540 mm/kasan/report.c:475
kasan_report+0x175/0x1b0 mm/kasan/report.c:588
crc_itu_t+0x21c/0x2a0 lib/crc-itu-t.c:60
udf_finalize_lvid fs/udf/super.c:1984 [inline]
udf_sync_fs+0x1d2/0x380 fs/udf/super.c:2340
sync_filesystem+0xec/0x220 fs/sync.c:56
generic_shutdown_super+0x6f/0x340 fs/super.c:472
kill_block_super+0x68/0xa0 fs/super.c:1417
deactivate_locked_super+0xa4/0x110 fs/super.c:330
cleanup_mnt+0x426/0x4c0 fs/namespace.c:1254
task_work_run+0x24a/0x300 kernel/task_work.c:179
exit_task_work include/linux/task_work.h:38 [inline]
do_exit+0x68f/0x2290 kernel/exit.c:874
do_group_exit+0x206/0x2c0 kernel/exit.c:1024
__do_sys_exit_group kernel/exit.c:1035 [inline]
__se_sys_exit_group kernel/exit.c:1033 [inline]
__x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1033
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f655d3c5a09
Code: Unable to access opcode bytes at 0x7f655d3c59df.
RSP: 002b:00007ffd9560b9e8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 00007f655d3c5a09
RDX: 000000000000003c RSI: 00000000000000e7 RDI: 0000000000000001
RBP: 00007f655d4612d0 R08: ffffffffffffffb8 R09: 0000000000000004
R10: 0000000000001400 R11: 0000000000000246 R12: 00007f655d4612d0
R13: 0000000000000000 R14: 00007f655d462040 R15: 00007f655d393f30
</TASK>

The buggy address belongs to the physical page:
page:ffffea0001d85680 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x7615a
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000000 ffffea0001d85408 ffffea0001ce1548 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 0x140dca(GFP_HIGHUSER_MOVABLE|__GFP_COMP|__GFP_ZERO), pid 4872, tgid 4872 (sshd), ts 47777475140, free_ts 47861737656
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x1e6/0x210 mm/page_alloc.c:1570
prep_new_page mm/page_alloc.c:1577 [inline]
get_page_from_freelist+0x31e8/0x3370 mm/page_alloc.c:3221
__alloc_pages+0x255/0x670 mm/page_alloc.c:4477
__folio_alloc+0x13/0x30 mm/page_alloc.c:4509
vma_alloc_folio+0x48a/0x9a0 mm/mempolicy.c:2253
do_anonymous_page mm/memory.c:4104 [inline]
do_pte_missing mm/memory.c:3662 [inline]
handle_pte_fault mm/memory.c:4939 [inline]
__handle_mm_fault mm/memory.c:5079 [inline]
handle_mm_fault+0x20c7/0x5410 mm/memory.c:5233
do_user_addr_fault arch/x86/mm/fault.c:1343 [inline]
handle_page_fault arch/x86/mm/fault.c:1486 [inline]
exc_page_fault+0x3cf/0x7c0 arch/x86/mm/fault.c:1542
asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1161 [inline]
free_unref_page_prepare+0x903/0xa30 mm/page_alloc.c:2348
free_unref_page_list+0x596/0x830 mm/page_alloc.c:2489
release_pages+0x2193/0x2470 mm/swap.c:1042
tlb_batch_pages_flush mm/mmu_gather.c:97 [inline]
tlb_flush_mmu_free mm/mmu_gather.c:292 [inline]
tlb_flush_mmu+0x100/0x210 mm/mmu_gather.c:299
tlb_finish_mmu+0xd4/0x1f0 mm/mmu_gather.c:391
unmap_region+0x258/0x2a0 mm/mmap.c:2318
do_vmi_align_munmap+0x135d/0x1630 mm/mmap.c:2557
do_vmi_munmap+0x24d/0x2d0 mm/mmap.c:2624
__vm_munmap+0x230/0x450 mm/mmap.c:2906
__do_sys_munmap mm/mmap.c:2923 [inline]
__se_sys_munmap mm/mmap.c:2920 [inline]
__x64_sys_munmap+0x69/0x80 mm/mmap.c:2920
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd

Memory state around the buggy address:
ffff888076159f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff888076159f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88807615a000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff88807615a080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff88807615a100: 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 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

Hillf Danton

unread,
Aug 12, 2023, 9:08:17 PM8/12/23
to syzbot, linux-...@vger.kernel.org, syzkall...@googlegroups.com
On Sat, 12 Aug 2023 03:09:08 -0700
> HEAD commit: f8de32cc060b Merge tag 'tpmdd-v6.5-rc7' of git://git.kerne..
> git tree: upstream
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=17e4d78ba80000

Check if crc len is oob.

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git f8de32cc060b

--- x/fs/udf/super.c
+++ y/fs/udf/super.c
@@ -2337,6 +2337,8 @@ static int udf_sync_fs(struct super_bloc
struct logicalVolIntegrityDesc *lvid;

lvid = (struct logicalVolIntegrityDesc *)bh->b_data;
+ WARN_ON(le16_to_cpu(lvid->descTag.descCRCLength) + sizeof(struct tag) >
+ sb->s_blocksize);
udf_finalize_lvid(lvid);

/*
--

syzbot

unread,
Aug 12, 2023, 9:34:36 PM8/12/23
to hda...@sina.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
WARNING in udf_sync_fs

------------[ cut here ]------------
WARNING: CPU: 1 PID: 5372 at fs/udf/super.c:2341 udf_sync_fs+0x321/0x450
Modules linked in:
CPU: 1 PID: 5372 Comm: syz-executor.0 Not tainted 6.5.0-rc5-syzkaller-00296-gf8de32cc060b-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/2023
RIP: 0010:udf_sync_fs+0x321/0x450 fs/udf/super.c:2340
Code: 04 25 28 00 00 00 48 3b 84 24 80 00 00 00 0f 85 34 01 00 00 31 c0 48 8d 65 d8 5b 41 5c 41 5d 41 5e 41 5f 5d c3 e8 cf ad 88 fe <0f> 0b e9 78 fe ff ff 89 d9 80 e1 07 80 c1 03 38 c1 0f 8c 8c fd ff
RSP: 0018:ffffc900064b7be0 EFLAGS: 00010293
RAX: ffffffff83030a61 RBX: 0000000000000200 RCX: ffff888022cabb80
RDX: 0000000000000000 RSI: 0000000000000200 RDI: 0000000000004e25
RBP: ffffc900064b7cb0 R08: ffffffff830308d2 R09: 1ffffffff1d30e8d
R10: dffffc0000000000 R11: fffffbfff1d30e8e R12: 0000000000004e25
R13: ffff88802baba018 R14: ffffc900064b7c40 R15: ffff8880679f7000
FS: 0000555555808480(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000555555811938 CR3: 000000002b2fe000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
sync_filesystem+0xec/0x220 fs/sync.c:56
generic_shutdown_super+0x6f/0x340 fs/super.c:472
kill_block_super+0x68/0xa0 fs/super.c:1417
deactivate_locked_super+0xa4/0x110 fs/super.c:330
cleanup_mnt+0x426/0x4c0 fs/namespace.c:1254
task_work_run+0x24a/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+0x64/0x280 kernel/entry/common.c:297
do_syscall_64+0x4d/0xc0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f506367de17
Code: b0 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 0f 1f 44 00 00 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 00 00 00 b8 a6 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 c7 c2 b0 ff ff ff f7 d8 64 89 02 b8
RSP: 002b:00007ffc04cedad8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00007f506367de17
RDX: 0000000000000000 RSI: 000000000000000a RDI: 00007ffc04cedb90
RBP: 00007ffc04cedb90 R08: 0000000000000000 R09: 0000000000000000
R10: 00000000ffffffff R11: 0000000000000246 R12: 00007ffc04ceec50
R13: 00007f50636c73b9 R14: 0000000000014bdb R15: 0000000000000007
</TASK>


Tested on:

commit: f8de32cc Merge tag 'tpmdd-v6.5-rc7' of git://git.kerne..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=134267c3a80000
kernel config: https://syzkaller.appspot.com/x/.config?x=171b698bc2e613cf
dashboard link: https://syzkaller.appspot.com/bug?extid=82df44ede2faca24c729
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=13debc65a80000

Hillf Danton

unread,
Aug 12, 2023, 10:03:53 PM8/12/23
to syzbot, linux-...@vger.kernel.org, syzkall...@googlegroups.com
On Sat, 12 Aug 2023 03:09:08 -0700
> HEAD commit: f8de32cc060b Merge tag 'tpmdd-v6.5-rc7' of git://git.kerne..
> git tree: upstream
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=17e4d78ba80000

Check if crc len is oob.

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git f8de32cc060b

--- x/fs/udf/super.c
+++ y/fs/udf/super.c
@@ -2337,6 +2337,10 @@ static int udf_sync_fs(struct super_bloc
struct logicalVolIntegrityDesc *lvid;

lvid = (struct logicalVolIntegrityDesc *)bh->b_data;
+ if (le16_to_cpu(lvid->descTag.descCRCLength) + sizeof(struct tag) >
+ sb->s_blocksize)
+ lvid->descTag.descCRCLength = cpu_to_le16(sb->s_blocksize -
+ sizeof(struct tag));
udf_finalize_lvid(lvid);

/*
--

syzbot

unread,
Aug 12, 2023, 10:41:30 PM8/12/23
to hda...@sina.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
KASAN: slab-out-of-bounds Write in udf_close_lvid

==================================================================
BUG: KASAN: slab-out-of-bounds in udf_close_lvid+0x6a8/0x9a0 fs/udf/super.c:2035
Write of size 1 at addr ffff88807d255e28 by task syz-executor.0/5372

CPU: 0 PID: 5372 Comm: syz-executor.0 Not tainted 6.5.0-rc5-syzkaller-00296-gf8de32cc060b-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/2023
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:364 [inline]
print_report+0x163/0x540 mm/kasan/report.c:475
kasan_report+0x175/0x1b0 mm/kasan/report.c:588
udf_close_lvid+0x6a8/0x9a0 fs/udf/super.c:2035
udf_put_super+0xcd/0x160 fs/udf/super.c:2322
generic_shutdown_super+0x134/0x340 fs/super.c:499
kill_block_super+0x68/0xa0 fs/super.c:1417
deactivate_locked_super+0xa4/0x110 fs/super.c:330
cleanup_mnt+0x426/0x4c0 fs/namespace.c:1254
task_work_run+0x24a/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+0x64/0x280 kernel/entry/common.c:297
do_syscall_64+0x4d/0xc0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7ff30167de17
Code: b0 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 0f 1f 44 00 00 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 00 00 00 b8 a6 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 c7 c2 b0 ff ff ff f7 d8 64 89 02 b8
RSP: 002b:00007ffd888c4358 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00007ff30167de17
RDX: 0000000000000000 RSI: 000000000000000a RDI: 00007ffd888c4410
RBP: 00007ffd888c4410 R08: 0000000000000000 R09: 0000000000000000
R10: 00000000ffffffff R11: 0000000000000246 R12: 00007ffd888c54d0
R13: 00007ff3016c73b9 R14: 0000000000014647 R15: 0000000000000007
</TASK>

Allocated by task 5271:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4f/0x70 mm/kasan/common.c:52
____kasan_kmalloc mm/kasan/common.c:374 [inline]
__kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:383
kasan_kmalloc include/linux/kasan.h:196 [inline]
__do_kmalloc_node mm/slab_common.c:985 [inline]
__kmalloc+0xb9/0x230 mm/slab_common.c:998
kmalloc include/linux/slab.h:586 [inline]
tomoyo_realpath_from_path+0xcf/0x5e0 security/tomoyo/realpath.c:251
tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
tomoyo_path_perm+0x28d/0x700 security/tomoyo/file.c:822
security_inode_getattr+0xd3/0x120 security/security.c:2114
vfs_getattr fs/stat.c:167 [inline]
vfs_statx+0x18f/0x480 fs/stat.c:242
vfs_fstatat fs/stat.c:276 [inline]
__do_sys_newfstatat fs/stat.c:446 [inline]
__se_sys_newfstatat fs/stat.c:440 [inline]
__x64_sys_newfstatat+0x14f/0x1d0 fs/stat.c:440
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd

Freed by task 5271:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4f/0x70 mm/kasan/common.c:52
kasan_save_free_info+0x28/0x40 mm/kasan/generic.c:522
____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236
kasan_slab_free include/linux/kasan.h:162 [inline]
slab_free_hook mm/slub.c:1792 [inline]
slab_free_freelist_hook mm/slub.c:1818 [inline]
slab_free mm/slub.c:3801 [inline]
__kmem_cache_free+0x25f/0x3b0 mm/slub.c:3814
tomoyo_realpath_from_path+0x5a3/0x5e0 security/tomoyo/realpath.c:286
tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
tomoyo_path_perm+0x28d/0x700 security/tomoyo/file.c:822
security_inode_getattr+0xd3/0x120 security/security.c:2114
vfs_getattr fs/stat.c:167 [inline]
vfs_statx+0x18f/0x480 fs/stat.c:242
vfs_fstatat fs/stat.c:276 [inline]
__do_sys_newfstatat fs/stat.c:446 [inline]
__se_sys_newfstatat fs/stat.c:440 [inline]
__x64_sys_newfstatat+0x14f/0x1d0 fs/stat.c:440
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd

The buggy address belongs to the object at ffff88807d254000
which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 3624 bytes to the right of
allocated 4096-byte region [ffff88807d254000, ffff88807d255000)

The buggy address belongs to the physical page:
page:ffffea0001f49400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7d250
head:ffffea0001f49400 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000010200 ffff888012842140 dead000000000100 dead000000000122
raw: 0000000000000000 0000000000040004 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 4479, tgid 4479 (udevd), ts 26549380925, free_ts 26143601613
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x1e6/0x210 mm/page_alloc.c:1570
prep_new_page mm/page_alloc.c:1577 [inline]
get_page_from_freelist+0x31e8/0x3370 mm/page_alloc.c:3221
__alloc_pages+0x255/0x670 mm/page_alloc.c:4477
alloc_slab_page+0x6a/0x160 mm/slub.c:1862
allocate_slab mm/slub.c:2009 [inline]
new_slab+0x84/0x2f0 mm/slub.c:2062
___slab_alloc+0xade/0x1100 mm/slub.c:3215
__slab_alloc mm/slub.c:3314 [inline]
__slab_alloc_node mm/slub.c:3367 [inline]
slab_alloc_node mm/slub.c:3460 [inline]
__kmem_cache_alloc_node+0x1af/0x270 mm/slub.c:3509
__do_kmalloc_node mm/slab_common.c:984 [inline]
__kmalloc+0xa8/0x230 mm/slab_common.c:998
kmalloc include/linux/slab.h:586 [inline]
tomoyo_realpath_from_path+0xcf/0x5e0 security/tomoyo/realpath.c:251
tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
tomoyo_path2_perm+0x3b8/0xb20 security/tomoyo/file.c:923
tomoyo_path_rename+0x198/0x1e0 security/tomoyo/tomoyo.c:299
security_path_rename+0x173/0x210 security/security.c:1789
do_renameat2+0x924/0x1660 fs/namei.c:4996
__do_sys_rename fs/namei.c:5055 [inline]
__se_sys_rename fs/namei.c:5053 [inline]
__x64_sys_rename+0x86/0x90 fs/namei.c:5053
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x41/0xc0 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:1161 [inline]
free_unref_page_prepare+0x903/0xa30 mm/page_alloc.c:2348
free_unref_page+0x37/0x3f0 mm/page_alloc.c:2443
discard_slab mm/slub.c:2108 [inline]
__unfreeze_partials+0x1dc/0x220 mm/slub.c:2647
put_cpu_partial+0x116/0x180 mm/slub.c:2723
__slab_free+0x2b6/0x390 mm/slub.c:3671
qlist_free_all+0x22/0x60 mm/kasan/quarantine.c:185
kasan_quarantine_reduce+0x14b/0x160 mm/kasan/quarantine.c:292
__kasan_slab_alloc+0x23/0x70 mm/kasan/common.c:305
kasan_slab_alloc include/linux/kasan.h:186 [inline]
slab_post_alloc_hook+0x6c/0x3b0 mm/slab.h:762
slab_alloc_node mm/slub.c:3470 [inline]
slab_alloc mm/slub.c:3478 [inline]
__kmem_cache_alloc_lru mm/slub.c:3485 [inline]
kmem_cache_alloc+0x123/0x300 mm/slub.c:3494
getname_flags+0xbc/0x4e0 fs/namei.c:140
vfs_fstatat fs/stat.c:275 [inline]
__do_sys_newfstatat fs/stat.c:446 [inline]
__se_sys_newfstatat fs/stat.c:440 [inline]
__x64_sys_newfstatat+0x12e/0x1d0 fs/stat.c:440
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd

Memory state around the buggy address:
ffff88807d255d00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88807d255d80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88807d255e00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff88807d255e80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88807d255f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================


Tested on:

commit: f8de32cc Merge tag 'tpmdd-v6.5-rc7' of git://git.kerne..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=1231456fa80000
kernel config: https://syzkaller.appspot.com/x/.config?x=171b698bc2e613cf
dashboard link: https://syzkaller.appspot.com/bug?extid=82df44ede2faca24c729
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=14c5e773a80000

Hillf Danton

unread,
Aug 13, 2023, 3:49:14 AM8/13/23
to syzbot, linux-...@vger.kernel.org, syzkall...@googlegroups.com
On Sat, 12 Aug 2023 03:09:08 -0700
> HEAD commit: f8de32cc060b Merge tag 'tpmdd-v6.5-rc7' of git://git.kerne..
> git tree: upstream
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=17e4d78ba80000

Check if crc len is oob.

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git f8de32cc060b

--- x/fs/udf/super.c
+++ y/fs/udf/super.c
@@ -114,6 +114,11 @@ struct logicalVolIntegrityDescImpUse *ud
partnum = le32_to_cpu(lvid->numOfPartitions);
/* The offset is to skip freeSpaceTable and sizeTable arrays */
offset = partnum * 2 * sizeof(uint32_t);
+ if (sb->s_blocksize < sizeof(*lvid))
+ return NULL;
+ if (sb->s_blocksize - sizeof(*lvid) <
+ offset + sizeof(struct logicalVolIntegrityDescImpUse))
+ return NULL;
return (struct logicalVolIntegrityDescImpUse *)
(((uint8_t *)(lvid + 1)) + offset);
}
@@ -2337,6 +2342,10 @@ static int udf_sync_fs(struct super_bloc

syzbot

unread,
Aug 13, 2023, 4:45:32 AM8/13/23
to hda...@sina.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+82df44...@syzkaller.appspotmail.com

Tested on:

commit: f8de32cc Merge tag 'tpmdd-v6.5-rc7' of git://git.kerne..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=11fbc127a80000
kernel config: https://syzkaller.appspot.com/x/.config?x=171b698bc2e613cf
dashboard link: https://syzkaller.appspot.com/bug?extid=82df44ede2faca24c729
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=156fae3da80000

Note: testing is done by a robot and is best-effort only.

syzbot

unread,
Aug 14, 2023, 4:07:36 PM8/14/23
to hda...@sina.com, ja...@suse.com, ja...@suse.cz, linux-...@vger.kernel.org, linux-...@vger.kernel.org, steve....@digidescorp.com, st...@digidescorp.com, syzkall...@googlegroups.com
syzbot has bisected this issue to:

commit e8b4274735e416621cfb28c2802b4ad52da35d0f
Author: Steve Magnani <steve....@digidescorp.com>
Date: Fri Feb 8 17:34:55 2019 +0000

udf: finalize integrity descriptor before writeback

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=14e3d76fa80000
start commit: f8de32cc060b Merge tag 'tpmdd-v6.5-rc7' of git://git.kerne..
git tree: upstream
final oops: https://syzkaller.appspot.com/x/report.txt?x=16e3d76fa80000
console output: https://syzkaller.appspot.com/x/log.txt?x=12e3d76fa80000
Reported-by: syzbot+82df44...@syzkaller.appspotmail.com
Fixes: e8b4274735e4 ("udf: finalize integrity descriptor before writeback")

For information about bisection process see: https://goo.gl/tpsmEJ#bisection

syzbot

unread,
Jan 31, 2024, 7:18:05 PMJan 31
to ax...@kernel.dk, bra...@kernel.org, gro...@google.com, hda...@sina.com, ja...@suse.com, ja...@suse.cz, ker...@collabora.com, linux-...@vger.kernel.org, linux-...@vger.kernel.org, shreey...@collabora.com, steve....@digidescorp.com, st...@digidescorp.com, syzkall...@googlegroups.com, z...@google.com
syzbot suspects this issue was fixed by commit:

commit 6f861765464f43a71462d52026fbddfc858239a5
Author: Jan Kara <ja...@suse.cz>
Date: Wed Nov 1 17:43:10 2023 +0000

fs: Block writes to mounted block devices

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=11282540180000
start commit: 55cb5f43689d Merge tag 'trace-v6.7-rc6' of git://git.kerne..
git tree: upstream
kernel config: https://syzkaller.appspot.com/x/.config?x=e5751b3a2226135d
dashboard link: https://syzkaller.appspot.com/bug?extid=82df44ede2faca24c729
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=12dbd63ee80000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1534bed1e80000

If the result looks correct, please mark the issue as fixed by replying with:

#syz fix: fs: Block writes to mounted block devices

Jan Kara

unread,
Feb 1, 2024, 4:14:24 AMFeb 1
to syzbot, ax...@kernel.dk, bra...@kernel.org, gro...@google.com, hda...@sina.com, ja...@suse.com, ja...@suse.cz, ker...@collabora.com, linux-...@vger.kernel.org, linux-...@vger.kernel.org, shreey...@collabora.com, steve....@digidescorp.com, st...@digidescorp.com, syzkall...@googlegroups.com, z...@google.com
On Wed 31-01-24 16:18:04, syzbot wrote:
> syzbot suspects this issue was fixed by commit:
>
> commit 6f861765464f43a71462d52026fbddfc858239a5
> Author: Jan Kara <ja...@suse.cz>
> Date: Wed Nov 1 17:43:10 2023 +0000
>
> fs: Block writes to mounted block devices
>
> bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=11282540180000
> start commit: 55cb5f43689d Merge tag 'trace-v6.7-rc6' of git://git.kerne..
> git tree: upstream
> kernel config: https://syzkaller.appspot.com/x/.config?x=e5751b3a2226135d
> dashboard link: https://syzkaller.appspot.com/bug?extid=82df44ede2faca24c729
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=12dbd63ee80000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1534bed1e80000
>
> If the result looks correct, please mark the issue as fixed by replying with:

Looks good.

#syz fix: fs: Block writes to mounted block devices

Honza
--
Jan Kara <ja...@suse.com>
SUSE Labs, CR
Reply all
Reply to author
Forward
0 new messages