syzbot


KASAN: null-ptr-deref Write in mark_buffer_dirty_inode

Status: premoderation: reported on 2024/10/07 16:44
Reported-by: syzbot+4c6d6a17f46f7e57d069@syzkaller.appspotmail.com
First crash: 45d, last: 45d
Similar bugs (5)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-54 KASAN: null-ptr-deref Write in mark_buffer_dirty_inode fat 1 658d 658d 0/2 auto-obsoleted due to no activity on 2023/06/02 15:38
linux-6.1 general protection fault in mark_buffer_dirty_inode 1 216d 216d 0/3 auto-obsoleted due to no activity on 2024/07/28 10:58
linux-4.19 general protection fault in mark_buffer_dirty_inode (2) C error 1 724d 724d 0/1 upstream: reported C repro on 2022/11/28 03:52
upstream general protection fault in mark_buffer_dirty_inode (2) udf C 32 565d 723d 22/28 fixed on 2023/06/08 14:41
linux-5.15 BUG: unable to handle kernel paging request in mark_buffer_dirty_inode origin:lts-only C error 2 38d 177d 0/3 upstream: reported C repro on 2024/05/27 20:45

Sample crash report:
loop0: detected capacity change from 0 to 8192
FAT-fs (loop0): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
==================================================================
BUG: KASAN: null-ptr-deref in instrument_atomic_read_write include/linux/instrumented.h:102 [inline]
BUG: KASAN: null-ptr-deref in atomic_try_cmpxchg_acquire include/linux/atomic/atomic-instrumented.h:541 [inline]
BUG: KASAN: null-ptr-deref in queued_spin_lock include/asm-generic/qspinlock.h:111 [inline]
BUG: KASAN: null-ptr-deref in do_raw_spin_lock include/linux/spinlock.h:187 [inline]
BUG: KASAN: null-ptr-deref in __raw_spin_lock include/linux/spinlock_api_smp.h:134 [inline]
BUG: KASAN: null-ptr-deref in _raw_spin_lock+0x97/0x1b0 kernel/locking/spinlock.c:154
Write of size 4 at addr 00000000000000d4 by task syz.0.11480/24879

CPU: 0 PID: 24879 Comm: syz.0.11480 Not tainted 6.1.99-syzkaller-00109-g0e8b65e41ffd #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106
 print_report+0xe1/0x4e0 mm/kasan/report.c:430
 kasan_report+0x13c/0x170 mm/kasan/report.c:531
 kasan_check_range+0x294/0x2a0 mm/kasan/generic.c:189
 __kasan_check_write+0x14/0x20 mm/kasan/shadow.c:37
 instrument_atomic_read_write include/linux/instrumented.h:102 [inline]
 atomic_try_cmpxchg_acquire include/linux/atomic/atomic-instrumented.h:541 [inline]
 queued_spin_lock include/asm-generic/qspinlock.h:111 [inline]
 do_raw_spin_lock include/linux/spinlock.h:187 [inline]
 __raw_spin_lock include/linux/spinlock_api_smp.h:134 [inline]
 _raw_spin_lock+0x97/0x1b0 kernel/locking/spinlock.c:154
 spin_lock include/linux/spinlock.h:351 [inline]
 mark_buffer_dirty_inode+0x131/0x310 fs/buffer.c:625
 fat16_ent_put+0x97/0xc0 fs/fat/fatent.c:184
 fat_alloc_clusters+0x58b/0x1190 fs/fat/fatent.c:503
 fat_add_cluster fs/fat/inode.c:108 [inline]
 __fat_get_block fs/fat/inode.c:155 [inline]
 fat_get_block+0x4c0/0xcf0 fs/fat/inode.c:190
 __block_write_begin_int+0x49c/0x1440 fs/buffer.c:2034
 __block_write_begin fs/buffer.c:2084 [inline]
 block_write_begin fs/buffer.c:2145 [inline]
 cont_write_begin+0x68e/0x950 fs/buffer.c:2504
 fat_write_begin+0xa1/0x170 fs/fat/inode.c:235
 cont_expand_zero fs/buffer.c:2431 [inline]
 cont_write_begin+0x30e/0x950 fs/buffer.c:2494
 fat_write_begin+0xa1/0x170 fs/fat/inode.c:235
 generic_cont_expand_simple+0x187/0x2a0 fs/buffer.c:2395
 fat_cont_expand+0x6b/0x1f0 fs/fat/file.c:223
 fat_setattr+0x477/0x1070 fs/fat/file.c:513
 notify_change+0xd53/0x1010 fs/attr.c:499
 do_truncate fs/open.c:66 [inline]
 do_sys_ftruncate+0x5ab/0x820 fs/open.c:194
 __do_sys_ftruncate fs/open.c:205 [inline]
 __se_sys_ftruncate fs/open.c:203 [inline]
 __x64_sys_ftruncate+0x60/0x70 fs/open.c:203
 x64_sys_call+0x243/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:78
 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:0x7f5b3e97dff9
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:00007f5b3f7a6038 EFLAGS: 00000246 ORIG_RAX: 000000000000004d
RAX: ffffffffffffffda RBX: 00007f5b3eb35f80 RCX: 00007f5b3e97dff9
RDX: 0000000000000000 RSI: 000000000100c17a RDI: 0000000000000004
RBP: 00007f5b3e9f0296 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f5b3eb35f80 R15: 00007ffe12592ca8
 </TASK>
==================================================================
BUG: kernel NULL pointer dereference, address: 00000000000000d4
#PF: supervisor write access in kernel mode
#PF: error_code(0x0002) - not-present page
PGD 12f871067 P4D 12f871067 PUD 13b42d067 PMD 0 
Oops: 0002 [#1] PREEMPT SMP KASAN
CPU: 0 PID: 24879 Comm: syz.0.11480 Tainted: G    B              6.1.99-syzkaller-00109-g0e8b65e41ffd #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
RIP: 0010:atomic_try_cmpxchg_acquire include/linux/atomic/atomic-instrumented.h:543 [inline]
RIP: 0010:queued_spin_lock include/asm-generic/qspinlock.h:111 [inline]
RIP: 0010:do_raw_spin_lock include/linux/spinlock.h:187 [inline]
RIP: 0010:__raw_spin_lock include/linux/spinlock_api_smp.h:134 [inline]
RIP: 0010:_raw_spin_lock+0xba/0x1b0 kernel/locking/spinlock.c:154
Code: 00 00 e8 b9 b6 9c fc 4c 89 ff be 04 00 00 00 e8 ac b6 9c fc 43 0f b6 04 26 84 c0 0f 85 a9 00 00 00 8b 44 24 20 b9 01 00 00 00 <f0> 41 0f b1 4d 00 75 33 48 c7 04 24 0e 36 e0 45 49 c7 04 1c 00 00
RSP: 0018:ffffc900047a7100 EFLAGS: 00010297
RAX: 0000000000000000 RBX: 1ffff920008f4e20 RCX: 0000000000000001
RDX: 0000000000000001 RSI: 0000000000000004 RDI: ffffc900047a7120
RBP: ffffc900047a7198 R08: dffffc0000000000 R09: 0000000000000003
R10: ffffffffffffffff R11: dffffc0000000001 R12: dffffc0000000000
R13: 00000000000000d4 R14: 1ffff920008f4e24 R15: ffffc900047a7120
FS:  00007f5b3f7a66c0(0000) GS:ffff8881f6e00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000000000d4 CR3: 0000000133661000 CR4: 00000000003506b0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 spin_lock include/linux/spinlock.h:351 [inline]
 mark_buffer_dirty_inode+0x131/0x310 fs/buffer.c:625
 fat16_ent_put+0x97/0xc0 fs/fat/fatent.c:184
 fat_alloc_clusters+0x58b/0x1190 fs/fat/fatent.c:503
 fat_add_cluster fs/fat/inode.c:108 [inline]
 __fat_get_block fs/fat/inode.c:155 [inline]
 fat_get_block+0x4c0/0xcf0 fs/fat/inode.c:190
 __block_write_begin_int+0x49c/0x1440 fs/buffer.c:2034
 __block_write_begin fs/buffer.c:2084 [inline]
 block_write_begin fs/buffer.c:2145 [inline]
 cont_write_begin+0x68e/0x950 fs/buffer.c:2504
 fat_write_begin+0xa1/0x170 fs/fat/inode.c:235
 cont_expand_zero fs/buffer.c:2431 [inline]
 cont_write_begin+0x30e/0x950 fs/buffer.c:2494
 fat_write_begin+0xa1/0x170 fs/fat/inode.c:235
 generic_cont_expand_simple+0x187/0x2a0 fs/buffer.c:2395
 fat_cont_expand+0x6b/0x1f0 fs/fat/file.c:223
 fat_setattr+0x477/0x1070 fs/fat/file.c:513
 notify_change+0xd53/0x1010 fs/attr.c:499
 do_truncate fs/open.c:66 [inline]
 do_sys_ftruncate+0x5ab/0x820 fs/open.c:194
 __do_sys_ftruncate fs/open.c:205 [inline]
 __se_sys_ftruncate fs/open.c:203 [inline]
 __x64_sys_ftruncate+0x60/0x70 fs/open.c:203
 x64_sys_call+0x243/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:78
 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:0x7f5b3e97dff9
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:00007f5b3f7a6038 EFLAGS: 00000246 ORIG_RAX: 000000000000004d
RAX: ffffffffffffffda RBX: 00007f5b3eb35f80 RCX: 00007f5b3e97dff9
RDX: 0000000000000000 RSI: 000000000100c17a RDI: 0000000000000004
RBP: 00007f5b3e9f0296 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f5b3eb35f80 R15: 00007ffe12592ca8
 </TASK>
Modules linked in:
CR2: 00000000000000d4
---[ end trace 0000000000000000 ]---
RIP: 0010:atomic_try_cmpxchg_acquire include/linux/atomic/atomic-instrumented.h:543 [inline]
RIP: 0010:queued_spin_lock include/asm-generic/qspinlock.h:111 [inline]
RIP: 0010:do_raw_spin_lock include/linux/spinlock.h:187 [inline]
RIP: 0010:__raw_spin_lock include/linux/spinlock_api_smp.h:134 [inline]
RIP: 0010:_raw_spin_lock+0xba/0x1b0 kernel/locking/spinlock.c:154
Code: 00 00 e8 b9 b6 9c fc 4c 89 ff be 04 00 00 00 e8 ac b6 9c fc 43 0f b6 04 26 84 c0 0f 85 a9 00 00 00 8b 44 24 20 b9 01 00 00 00 <f0> 41 0f b1 4d 00 75 33 48 c7 04 24 0e 36 e0 45 49 c7 04 1c 00 00
RSP: 0018:ffffc900047a7100 EFLAGS: 00010297
RAX: 0000000000000000 RBX: 1ffff920008f4e20 RCX: 0000000000000001
RDX: 0000000000000001 RSI: 0000000000000004 RDI: ffffc900047a7120
RBP: ffffc900047a7198 R08: dffffc0000000000 R09: 0000000000000003
R10: ffffffffffffffff R11: dffffc0000000001 R12: dffffc0000000000
R13: 00000000000000d4 R14: 1ffff920008f4e24 R15: ffffc900047a7120
FS:  00007f5b3f7a66c0(0000) GS:ffff8881f6e00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000000000d4 CR3: 0000000133661000 CR4: 00000000003506b0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
   0:	00 00                	add    %al,(%rax)
   2:	e8 b9 b6 9c fc       	call   0xfc9cb6c0
   7:	4c 89 ff             	mov    %r15,%rdi
   a:	be 04 00 00 00       	mov    $0x4,%esi
   f:	e8 ac b6 9c fc       	call   0xfc9cb6c0
  14:	43 0f b6 04 26       	movzbl (%r14,%r12,1),%eax
  19:	84 c0                	test   %al,%al
  1b:	0f 85 a9 00 00 00    	jne    0xca
  21:	8b 44 24 20          	mov    0x20(%rsp),%eax
  25:	b9 01 00 00 00       	mov    $0x1,%ecx
* 2a:	f0 41 0f b1 4d 00    	lock cmpxchg %ecx,0x0(%r13) <-- trapping instruction
  30:	75 33                	jne    0x65
  32:	48 c7 04 24 0e 36 e0 	movq   $0x45e0360e,(%rsp)
  39:	45
  3a:	49                   	rex.WB
  3b:	c7                   	.byte 0xc7
  3c:	04 1c                	add    $0x1c,%al

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/10/07 16:43 android14-6.1 0e8b65e41ffd d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-6-1 KASAN: null-ptr-deref Write in mark_buffer_dirty_inode
* Struck through repros no longer work on HEAD.