syzbot


KASAN: use-after-free Read in ext4_convert_inline_data_nolock

Status: upstream: reported C repro on 2023/04/15 09:27
Bug presence: origin:upstream
[Documentation on labels]
Reported-by: syzbot+824b138c39c77ad6775f@syzkaller.appspotmail.com
First crash: 401d, last: 28d
Bug presence (1)
Date Name Commit Repro Result
2023/05/23 upstream (ToT) 5fe326b44676 C [report] KASAN: slab-use-after-free Read in ext4_convert_inline_data_nolock
Similar bugs (5)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 KASAN: use-after-free Read in ext4_convert_inline_data_nolock origin:upstream C 1 29d 365d 0/3 upstream: reported C repro on 2023/05/21 13:36
upstream KASAN: slab-use-after-free Read in ext4_convert_inline_data_nolock ext4 C error done 7 143d 420d 26/26 fixed on 2024/02/03 12:44
android-5-10 KASAN: use-after-free Read in ext4_convert_inline_data_nolock syz 1 20d 20d 0/2 premoderation: reported syz repro on 2024/04/30 09:18
android-6-1 KASAN: use-after-free Read in ext4_convert_inline_data_nolock origin:upstream C 1 6d08h 20d 0/2 upstream: reported C repro on 2024/04/30 15:29
android-54 KASAN: use-after-free Read in ext4_convert_inline_data_nolock C 1 6d15h 20d 0/2 upstream: reported C repro on 2024/04/30 09:11
Fix bisection attempts (9)
Created Duration User Patch Repo Result
2024/04/22 17:11 2h05m bisect fix linux-6.1.y job log (0) log
2024/03/22 09:44 1h09m bisect fix linux-6.1.y job log (0) log
2024/02/21 05:34 1h01m bisect fix linux-6.1.y job log (0) log
2024/01/10 22:22 1h22m bisect fix linux-6.1.y job log (0) log
2023/12/11 13:50 1h26m bisect fix linux-6.1.y job log (0) log
2023/11/10 23:54 1h32m bisect fix linux-6.1.y job log (0) log
2023/10/08 14:18 1h12m bisect fix linux-6.1.y job log (0) log
2023/08/18 01:46 2h07m bisect fix linux-6.1.y job log (0) log
2023/06/23 05:39 55m bisect fix linux-6.1.y job log (0) log

Sample crash report:
loop0: detected capacity change from 0 to 2048
EXT4-fs (loop0): mounted filesystem without journal. Quota mode: none.
==================================================================
BUG: KASAN: slab-out-of-bounds in ext4_read_inline_data fs/ext4/inline.c:210 [inline]
BUG: KASAN: slab-out-of-bounds in ext4_convert_inline_data_nolock+0x319/0xda0 fs/ext4/inline.c:1216
Read of size 20 at addr ffff888021fc41a3 by task syz-executor200/3543

CPU: 1 PID: 3543 Comm: syz-executor200 Not tainted 6.1.29-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/28/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
 memcpy+0x25/0x60 mm/kasan/shadow.c:65
 ext4_read_inline_data fs/ext4/inline.c:210 [inline]
 ext4_convert_inline_data_nolock+0x319/0xda0 fs/ext4/inline.c:1216
 ext4_convert_inline_data+0x4cf/0x610 fs/ext4/inline.c:2077
 ext4_fallocate+0x149/0x2160 fs/ext4/extents.c:4702
 vfs_fallocate+0x547/0x6b0 fs/open.c:323
 ksys_fallocate fs/open.c:346 [inline]
 __do_sys_fallocate fs/open.c:354 [inline]
 __se_sys_fallocate fs/open.c:352 [inline]
 __x64_sys_fallocate+0xb9/0x100 fs/open.c:352
 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
RIP: 0033:0x7fd1575f3059
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 71 17 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 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fffbd64e728 EFLAGS: 00000246 ORIG_RAX: 000000000000011d
RAX: ffffffffffffffda RBX: 00007fd157661720 RCX: 00007fd1575f3059
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000004
RBP: 0000000000000001 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000008000 R11: 0000000000000246 R12: 0000000000000004
R13: 0000000000000003 R14: 00007fffbd64e760 R15: 000000000000000c
 </TASK>

Allocated by task 3397:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 __kasan_slab_alloc+0x65/0x70 mm/kasan/common.c:328
 kasan_slab_alloc include/linux/kasan.h:201 [inline]
 slab_post_alloc_hook+0x50/0x370 mm/slab.h:737
 slab_alloc_node mm/slub.c:3398 [inline]
 slab_alloc mm/slub.c:3406 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3413 [inline]
 kmem_cache_alloc+0x10c/0x2d0 mm/slub.c:3422
 vm_area_dup+0x23/0x1b0 kernel/fork.c:466
 dup_mmap kernel/fork.c:644 [inline]
 dup_mm+0xa7c/0x1610 kernel/fork.c:1532
 copy_mm+0xca/0x160 kernel/fork.c:1581
 copy_process+0x19a2/0x4020 kernel/fork.c:2259
 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

Freed by task 3398:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 kasan_save_free_info+0x27/0x40 mm/kasan/generic.c:516
 ____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236
 kasan_slab_free include/linux/kasan.h:177 [inline]
 slab_free_hook mm/slub.c:1724 [inline]
 slab_free_freelist_hook mm/slub.c:1750 [inline]
 slab_free mm/slub.c:3661 [inline]
 kmem_cache_free+0x292/0x510 mm/slub.c:3683
 remove_vma mm/mmap.c:144 [inline]
 exit_mmap+0x538/0x9f0 mm/mmap.c:3149
 __mmput+0x115/0x3c0 kernel/fork.c:1191
 exit_mm+0x226/0x300 kernel/exit.c:563
 do_exit+0x67e/0x2300 kernel/exit.c:856
 do_group_exit+0x202/0x2b0 kernel/exit.c:1019
 __do_sys_exit_group kernel/exit.c:1030 [inline]
 __se_sys_exit_group kernel/exit.c:1028 [inline]
 __x64_sys_exit_group+0x3b/0x40 kernel/exit.c:1028
 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

The buggy address belongs to the object at ffff888021fc40d8
 which belongs to the cache vm_area_struct of size 152
The buggy address is located 51 bytes to the right of
 152-byte region [ffff888021fc40d8, ffff888021fc4170)

The buggy address belongs to the physical page:
page:ffffea000087f100 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x21fc4
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 0000000000000000 dead000000000122 ffff888140007b40
raw: 0000000000000000 0000000000120012 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 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 3397, tgid 3397 (sshd), ts 46628352006, free_ts 45979203794
 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
 alloc_slab_page+0x6a/0x150 mm/slub.c:1794
 allocate_slab mm/slub.c:1939 [inline]
 new_slab+0x84/0x2d0 mm/slub.c:1992
 ___slab_alloc+0xa71/0x1080 mm/slub.c:3180
 __slab_alloc mm/slub.c:3279 [inline]
 slab_alloc_node mm/slub.c:3364 [inline]
 slab_alloc mm/slub.c:3406 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3413 [inline]
 kmem_cache_alloc+0x1a5/0x2d0 mm/slub.c:3422
 vm_area_dup+0x23/0x1b0 kernel/fork.c:466
 dup_mmap kernel/fork.c:644 [inline]
 dup_mm+0xa7c/0x1610 kernel/fork.c:1532
 copy_mm+0xca/0x160 kernel/fork.c:1581
 copy_process+0x19a2/0x4020 kernel/fork.c:2259
 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
 tlb_batch_pages_flush mm/mmu_gather.c:59 [inline]
 tlb_flush_mmu_free mm/mmu_gather.c:254 [inline]
 tlb_flush_mmu+0xfc/0x210 mm/mmu_gather.c:261
 tlb_finish_mmu+0xce/0x1f0 mm/mmu_gather.c:361
 exit_mmap+0x3c3/0x9f0 mm/mmap.c:3139
 __mmput+0x115/0x3c0 kernel/fork.c:1191
 exit_mm+0x226/0x300 kernel/exit.c:563
 do_exit+0x67e/0x2300 kernel/exit.c:856
 do_group_exit+0x202/0x2b0 kernel/exit.c:1019
 __do_sys_exit_group kernel/exit.c:1030 [inline]
 __se_sys_exit_group kernel/exit.c:1028 [inline]
 __x64_sys_exit_group+0x3b/0x40 kernel/exit.c:1028
 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

Memory state around the buggy address:
 ffff888021fc4080: fb fb fb fc fc fc fc fc fc fc fc fa fb fb fb fb
 ffff888021fc4100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc
>ffff888021fc4180: fc fc fc fc fc fc fa fb fb fb fb fb fb fb fb fb
                               ^
 ffff888021fc4200: fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc
 ffff888021fc4280: fc fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/05/23 13:56 linux-6.1.y fa74641fb6b9 4bce1a3e .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Read in ext4_convert_inline_data_nolock
2023/04/15 09:27 linux-6.1.y 0102425ac76b ec410564 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in ext4_convert_inline_data_nolock
* Struck through repros no longer work on HEAD.