syzbot


KASAN: use-after-free Read in ext4_convert_inline_data_nolock

Status: upstream: reported C repro on 2024/04/30 15:29
Bug presence: origin:upstream
Labels: missing-backport
[Documentation on labels]
Reported-by: syzbot+7ffb92f4df72e7e5205e@syzkaller.appspotmail.com
First crash: 205d, last: 8d17h
Bug presence (4)
Date Name Commit Repro Result
2024/11/12 android14-6.1 (ToT) 38859a233e31 C [report] KASAN: use-after-free Read in ext4_convert_inline_data_nolock
2024/05/01 lts (merge base) 883d1a956208 C [report] KASAN: use-after-free Read in ext4_convert_inline_data_nolock
2024/05/01 upstream (ToT) 18daea77cca6 C [report] KASAN: use-after-free Read in ext4_read_inline_data
2024/11/12 upstream (ToT) 14b6320953a3 C Didn't crash
Similar bugs (6)
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 error 1 27d 550d 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 328d 605d 25/28 fixed on 2024/02/03 12:44
android-5-10 KASAN: use-after-free Read in ext4_convert_inline_data_nolock syz error 1 72d 205d 0/2 premoderation: reported syz repro on 2024/04/30 09:18
android-5-15 KASAN: use-after-free Read in ext4_convert_inline_data_nolock origin:upstream missing-backport C error 1 20d 176d 0/2 upstream: reported C repro on 2024/05/29 02:55
linux-6.1 KASAN: use-after-free Read in ext4_convert_inline_data_nolock origin:upstream C 2 28d 586d 0/3 upstream: reported C repro on 2023/04/15 09:27
android-54 KASAN: use-after-free Read in ext4_convert_inline_data_nolock C 1 39d 205d 0/2 upstream: reported C repro on 2024/04/30 09:11
Last patch testing requests (1)
Created Duration User Patch Repo Result
2024/05/14 16:30 6m retest repro android14-6.1 report log
Fix bisection attempts (4)
Created Duration User Patch Repo Result
2024/10/30 22:04 2h18m bisect fix android14-6.1 OK (0) job log log
2024/09/30 02:37 57m bisect fix android14-6.1 OK (0) job log log
2024/08/22 05:05 45m bisect fix android14-6.1 OK (0) job log log
2024/06/13 16:38 1h00m bisect fix android14-6.1 OK (0) job log log

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in ext4_read_inline_data fs/ext4/inline.c:210 [inline]
BUG: KASAN: use-after-free in ext4_convert_inline_data_nolock+0x311/0xa70 fs/ext4/inline.c:1216
Read of size 68 at addr ffff888122f650cf by task syz-executor296/309

CPU: 1 PID: 309 Comm: syz-executor296 Not tainted 6.1.75-syzkaller-00075-g6364d594125d #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:316 [inline]
 print_report+0x158/0x4e0 mm/kasan/report.c:427
 kasan_report+0x13c/0x170 mm/kasan/report.c:531
 kasan_check_range+0x294/0x2a0 mm/kasan/generic.c:189
 memcpy+0x2d/0x70 mm/kasan/shadow.c:65
 ext4_read_inline_data fs/ext4/inline.c:210 [inline]
 ext4_convert_inline_data_nolock+0x311/0xa70 fs/ext4/inline.c:1216
 ext4_try_add_inline_entry+0x7ff/0xb60 fs/ext4/inline.c:1342
 ext4_add_entry+0x5e4/0xed0 fs/ext4/namei.c:2409
 ext4_mkdir+0x54f/0xce0 fs/ext4/namei.c:3032
 vfs_mkdir+0x398/0x570 fs/namei.c:4113
 do_mkdirat+0x1eb/0x450 fs/namei.c:4138
 __do_sys_mkdir fs/namei.c:4158 [inline]
 __se_sys_mkdir fs/namei.c:4156 [inline]
 __x64_sys_mkdir+0x6e/0x80 fs/namei.c:4156
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f5c062c25a7
Code: ff ff 77 07 31 c0 c3 0f 1f 40 00 48 c7 c2 b0 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 b8 53 00 00 00 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:00007f5c06278038 EFLAGS: 00000246 ORIG_RAX: 0000000000000053
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f5c062c25a7
RDX: 0000000000000000 RSI: 00000000000001ff RDI: 0000000020000580
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000020000580
R13: 00007f5c062780d0 R14: 0000000000000000 R15: 0000000000000000
 </TASK>

The buggy address belongs to the physical page:
page:ffffea00048bd940 refcount:1 mapcount:0 mapping:ffff88811f312ba8 index:0xcd pfn:0x122f65
general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
CPU: 1 PID: 309 Comm: syz-executor296 Not tainted 6.1.75-syzkaller-00075-g6364d594125d #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
RIP: 0010:dentry_name+0x46a/0x6c0 lib/vsprintf.c:936
Code: fc 48 8b 1b 4c 89 6c 24 20 41 8d 45 ff 89 44 24 10 45 31 e4 4c 8b 6c 24 08 48 89 d8 48 c1 e8 03 48 b9 00 00 00 00 00 fc ff df <0f> b6 04 08 84 c0 0f 85 e7 00 00 00 44 0f b6 33 31 ff 44 89 f6 e8
RSP: 0018:ffffc90001026d40 EFLAGS: 00010046
RAX: 0000000000000000 RBX: 0000000000000000 RCX: dffffc0000000000
RDX: ffff88812366e540 RSI: 00000000ffffffff RDI: 0000000000000000
RBP: ffffc90001026e30 R08: ffffffff84f5b510 R09: ffffc90001026da0
R10: 0000000000000000 R11: dffffc0000000001 R12: 0000000000000000
R13: ffffc900010271b5 R14: 1ffff92000204db0 R15: 0000000000000000
FS:  00007f5c062786c0(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f5c0634557c CR3: 0000000120ac7000 CR4: 00000000003506a0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 pointer+0xfe/0x1000 lib/vsprintf.c:2446
 vsnprintf+0xe5b/0x1c70 lib/vsprintf.c:2809
 vprintk_store+0x3bb/0xff0 kernel/printk/printk.c:2156
 vprintk_emit+0x103/0x450 kernel/printk/printk.c:2253
 vprintk_default+0x26/0x30 kernel/printk/printk.c:2287
 vprintk+0x74/0x80 kernel/printk/printk_safe.c:45
 _printk+0xd1/0x111 kernel/printk/printk.c:2297
 dump_mapping+0x44f/0x460
 __dump_page mm/debug.c:112 [inline]
 dump_page+0x5e2/0x7f0 mm/debug.c:131
 print_address_description mm/kasan/report.c:355 [inline]
 print_report+0x3b0/0x4e0 mm/kasan/report.c:427
 kasan_report+0x13c/0x170 mm/kasan/report.c:531
 kasan_check_range+0x294/0x2a0 mm/kasan/generic.c:189
 memcpy+0x2d/0x70 mm/kasan/shadow.c:65
 ext4_read_inline_data fs/ext4/inline.c:210 [inline]
 ext4_convert_inline_data_nolock+0x311/0xa70 fs/ext4/inline.c:1216
 ext4_try_add_inline_entry+0x7ff/0xb60 fs/ext4/inline.c:1342
 ext4_add_entry+0x5e4/0xed0 fs/ext4/namei.c:2409
 ext4_mkdir+0x54f/0xce0 fs/ext4/namei.c:3032
 vfs_mkdir+0x398/0x570 fs/namei.c:4113
 do_mkdirat+0x1eb/0x450 fs/namei.c:4138
 __do_sys_mkdir fs/namei.c:4158 [inline]
 __se_sys_mkdir fs/namei.c:4156 [inline]
 __x64_sys_mkdir+0x6e/0x80 fs/namei.c:4156
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f5c062c25a7
Code: ff ff 77 07 31 c0 c3 0f 1f 40 00 48 c7 c2 b0 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 b8 53 00 00 00 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:00007f5c06278038 EFLAGS: 00000246 ORIG_RAX: 0000000000000053
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f5c062c25a7
RDX: 0000000000000000 RSI: 00000000000001ff RDI: 0000000020000580
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000020000580
R13: 00007f5c062780d0 R14: 0000000000000000 R15: 0000000000000000
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:dentry_name+0x46a/0x6c0 lib/vsprintf.c:936
Code: fc 48 8b 1b 4c 89 6c 24 20 41 8d 45 ff 89 44 24 10 45 31 e4 4c 8b 6c 24 08 48 89 d8 48 c1 e8 03 48 b9 00 00 00 00 00 fc ff df <0f> b6 04 08 84 c0 0f 85 e7 00 00 00 44 0f b6 33 31 ff 44 89 f6 e8
RSP: 0018:ffffc90001026d40 EFLAGS: 00010046
RAX: 0000000000000000 RBX: 0000000000000000 RCX: dffffc0000000000
RDX: ffff88812366e540 RSI: 00000000ffffffff RDI: 0000000000000000
RBP: ffffc90001026e30 R08: ffffffff84f5b510 R09: ffffc90001026da0
R10: 0000000000000000 R11: dffffc0000000001 R12: 0000000000000000
R13: ffffc900010271b5 R14: 1ffff92000204db0 R15: 0000000000000000
FS:  00007f5c062786c0(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f5c0634557c CR3: 0000000120ac7000 CR4: 00000000003506a0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
   0:	fc                   	cld
   1:	48 8b 1b             	mov    (%rbx),%rbx
   4:	4c 89 6c 24 20       	mov    %r13,0x20(%rsp)
   9:	41 8d 45 ff          	lea    -0x1(%r13),%eax
   d:	89 44 24 10          	mov    %eax,0x10(%rsp)
  11:	45 31 e4             	xor    %r12d,%r12d
  14:	4c 8b 6c 24 08       	mov    0x8(%rsp),%r13
  19:	48 89 d8             	mov    %rbx,%rax
  1c:	48 c1 e8 03          	shr    $0x3,%rax
  20:	48 b9 00 00 00 00 00 	movabs $0xdffffc0000000000,%rcx
  27:	fc ff df
* 2a:	0f b6 04 08          	movzbl (%rax,%rcx,1),%eax <-- trapping instruction
  2e:	84 c0                	test   %al,%al
  30:	0f 85 e7 00 00 00    	jne    0x11d
  36:	44 0f b6 33          	movzbl (%rbx),%r14d
  3a:	31 ff                	xor    %edi,%edi
  3c:	44 89 f6             	mov    %r14d,%esi
  3f:	e8                   	.byte 0xe8

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/04/30 15:28 android14-6.1 6364d594125d 3ce4924c .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro #1] [mounted in repro #2] ci2-android-6-1 KASAN: use-after-free Read in ext4_convert_inline_data_nolock
2024/07/15 03:10 android14-6.1 96d66062d076 eaeb5c15 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-6-1 KASAN: use-after-free Read in ext4_convert_inline_data_nolock
* Struck through repros no longer work on HEAD.