syzbot


WARNING in kvfree

Status: fixed on 2023/06/07 17:22
Reported-by: syzbot+403fcf14b61d7ef57dd1@syzkaller.appspotmail.com
Fix commit: c5fa4eedddd1 ext4: fix invalid free tracking in ext4_xattr_move_to_block()
First crash: 601d, last: 564d
Fix bisection: fixed by (bisect log) :
commit c5fa4eedddd1c8342ce533cb401c0e693e55b4e3
Author: Theodore Ts'o <tytso@mit.edu>
Date: Sun Apr 30 07:04:13 2023 +0000

  ext4: fix invalid free tracking in ext4_xattr_move_to_block()

  
Bug presence (1)
Date Name Commit Repro Result
2023/05/18 upstream (ToT) 4d6d4c7f541d C Didn't crash
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream WARNING in kvfree (2) ext4 C 47 564d 616d 22/28 fixed on 2023/07/01 16:05
upstream WARNING in kvfree nfs 1 1511d 1511d 0/28 auto-closed as invalid on 2021/01/29 15:55

Sample crash report:
EXT4-fs: Warning: mounting with an experimental mount option 'dioread_nolock' for blocksize < PAGE_SIZE
EXT4-fs (loop0): 1 truncate cleaned up
EXT4-fs (loop0): mounted filesystem without journal. Quota mode: writeback.
------------[ cut here ]------------
WARNING: CPU: 0 PID: 4217 at mm/slab_common.c:923 free_large_kmalloc+0x34/0x15c mm/slab_common.c:924
Modules linked in:
CPU: 0 PID: 4217 Comm: syz-executor366 Not tainted 6.1.27-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/14/2023
pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : free_large_kmalloc+0x34/0x15c mm/slab_common.c:924
lr : kfree+0x10c/0x1b8 mm/slab_common.c:1001
sp : ffff80001d9c74e0
x29: ffff80001d9c74e0 x28: ffff0000cb50dc00 x27: dfff800000000000
x26: 0000000000000020 x25: ffff0001b2e275a4 x24: 0000000000000020
x23: ffff0000cb50df00 x22: 0000000000000000 x21: ffff800008809f54
x20: ffff0001b2e275a4 x19: fffffc0006cb89c0 x18: ffff80001d9c69e0
x17: ffff80001558d000 x16: ffff8000120e6354 x15: ffff800008a69cdc
x14: ffff800008a698ac x13: ffff800008061bb4 x12: 0000000000000003
x11: ff80800008098054 x10: 0000000000000000 x9 : 0000000006cb89c0
x8 : ffff800017ea4000 x7 : ffff800008061ea0 x6 : ffff8000080620b0
x5 : ffff0000cc8d4178 x4 : ffff80001d9c72b0 x3 : 0000000000000000
x2 : 0000000000000006 x1 : ffff0001b2e275a4 x0 : fffffc0006cb89c0
Call trace:
 free_large_kmalloc+0x34/0x15c mm/slab_common.c:924
 kfree+0x10c/0x1b8 mm/slab_common.c:1001
 kvfree+0x40/0x50 mm/util.c:627
 ext4_xattr_move_to_block fs/ext4/xattr.c:2629 [inline]
 ext4_xattr_make_inode_space fs/ext4/xattr.c:2692 [inline]
 ext4_expand_extra_isize_ea+0xcbc/0x1688 fs/ext4/xattr.c:2784
 __ext4_expand_extra_isize+0x290/0x348 fs/ext4/inode.c:5890
 ext4_try_to_expand_extra_isize fs/ext4/inode.c:5933 [inline]
 __ext4_mark_inode_dirty+0x484/0x8fc fs/ext4/inode.c:6011
 __ext4_unlink+0x758/0x988 fs/ext4/namei.c:3255
 ext4_unlink+0x1d8/0x7d0 fs/ext4/namei.c:3298
 vfs_unlink+0x2f0/0x508 fs/namei.c:4252
 do_unlinkat+0x4c8/0x82c fs/namei.c:4320
 __do_sys_unlinkat fs/namei.c:4363 [inline]
 __se_sys_unlinkat fs/namei.c:4356 [inline]
 __arm64_sys_unlinkat+0xcc/0xfc fs/namei.c:4356
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581
irq event stamp: 19094
hardirqs last  enabled at (19093): [<ffff80000896b310>] kasan_quarantine_put+0xdc/0x204 mm/kasan/quarantine.c:242
hardirqs last disabled at (19094): [<ffff8000120e200c>] el1_dbg+0x24/0x80 arch/arm64/kernel/entry-common.c:405
softirqs last  enabled at (18910): [<ffff800008032b74>] local_bh_enable+0x10/0x34 include/linux/bottom_half.h:32
softirqs last disabled at (18908): [<ffff800008032b40>] local_bh_disable+0x10/0x34 include/linux/bottom_half.h:19
---[ end trace 0000000000000000 ]---
object pointer: 0x00000000d64fdf11
==================================================================
BUG: KASAN: invalid-free in kfree+0x10c/0x1b8 mm/slab_common.c:1001
Free of addr ffff0001b2e275a4 by task syz-executor366/4217

CPU: 0 PID: 4217 Comm: syz-executor366 Tainted: G        W          6.1.27-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/14/2023
Call trace:
 dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:284 [inline]
 print_report+0x174/0x4c0 mm/kasan/report.c:395
 kasan_report_invalid_free+0xc4/0x114 mm/kasan/report.c:460
 __kasan_kfree_large+0xa4/0xc0 mm/kasan/common.c:272
 kasan_kfree_large include/linux/kasan.h:185 [inline]
 free_large_kmalloc+0x70/0x15c mm/slab_common.c:927
 kfree+0x10c/0x1b8 mm/slab_common.c:1001
 kvfree+0x40/0x50 mm/util.c:627
 ext4_xattr_move_to_block fs/ext4/xattr.c:2629 [inline]
 ext4_xattr_make_inode_space fs/ext4/xattr.c:2692 [inline]
 ext4_expand_extra_isize_ea+0xcbc/0x1688 fs/ext4/xattr.c:2784
 __ext4_expand_extra_isize+0x290/0x348 fs/ext4/inode.c:5890
 ext4_try_to_expand_extra_isize fs/ext4/inode.c:5933 [inline]
 __ext4_mark_inode_dirty+0x484/0x8fc fs/ext4/inode.c:6011
 __ext4_unlink+0x758/0x988 fs/ext4/namei.c:3255
 ext4_unlink+0x1d8/0x7d0 fs/ext4/namei.c:3298
 vfs_unlink+0x2f0/0x508 fs/namei.c:4252
 do_unlinkat+0x4c8/0x82c fs/namei.c:4320
 __do_sys_unlinkat fs/namei.c:4363 [inline]
 __se_sys_unlinkat fs/namei.c:4356 [inline]
 __arm64_sys_unlinkat+0xcc/0xfc fs/namei.c:4356
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581

The buggy address belongs to the physical page:
page:000000009404f30f refcount:3 mapcount:0 mapping:00000000793fb8c4 index:0x1 pfn:0x1f2e27
memcg:ffff0000c0930000
aops:def_blk_aops ino:700000
flags: 0x5ffc6000002204e(referenced|uptodate|dirty|workingset|private|mappedtodisk|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc6000002204e 0000000000000000 dead000000000122 ffff0000c054bf10
raw: 0000000000000001 ffff0000e24443a0 00000003ffffffff ffff0000c0930000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff0001b2e27480: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff0001b2e27500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff0001b2e27580: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                               ^
 ffff0001b2e27600: 00 00 00 00 

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/05/07 12:03 linux-6.1.y ca48fc16c493 90c93c40 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan-arm64 WARNING in kvfree
2023/04/01 01:23 linux-6.1.y 3b29299e5f60 f325deb0 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 WARNING in kvfree
2023/03/31 14:04 linux-6.1.y 3b29299e5f60 f325deb0 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 WARNING in kvfree
* Struck through repros no longer work on HEAD.