syzbot


KASAN: null-ptr-deref Write in f2fs_stop_gc_thread

Status: upstream: reported C repro on 2025/07/15 15:45
Bug presence: origin:lts
[Documentation on labels]
Reported-by: syzbot+e4c4edd532c533b6bb49@syzkaller.appspotmail.com
First crash: 3d06h, last: 1d00h
Bug presence (2)
Date Name Commit Repro Result
2025/07/16 lts (merge base) 58485ff1a74f C [report] KASAN: null-ptr-deref Write in f2fs_stop_gc_thread
2025/07/16 upstream (ToT) 155a3c003e55 C Didn't crash
Similar bugs (4)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-15 KASAN: null-ptr-deref Write in f2fs_stop_gc_thread origin:lts 12 C 4 1d14h 3d00h 0/2 upstream: reported C repro on 2025/07/15 08:24
android-5-10 KASAN: null-ptr-deref Write in f2fs_stop_gc_thread 12 C 5 14d 107d 0/2 upstream: reported C repro on 2025/04/02 05:33
upstream KASAN: null-ptr-deref Write in f2fs_stop_gc_thread f2fs 24 C done 5 311d 358d 28/29 fixed on 2024/10/22 11:56
linux-6.1 KASAN: null-ptr-deref Write in f2fs_stop_gc_thread origin:lts-only 12 C error 10 193d 201d 0/3 upstream: reported C repro on 2024/12/29 01:22

Sample crash report:
==================================================================
BUG: KASAN: null-ptr-deref in instrument_atomic_read_write include/linux/instrumented.h:102 [inline]
BUG: KASAN: null-ptr-deref in atomic_fetch_add_relaxed include/linux/atomic/atomic-instrumented.h:116 [inline]
BUG: KASAN: null-ptr-deref in __refcount_add include/linux/refcount.h:193 [inline]
BUG: KASAN: null-ptr-deref in __refcount_inc include/linux/refcount.h:250 [inline]
BUG: KASAN: null-ptr-deref in refcount_inc include/linux/refcount.h:267 [inline]
BUG: KASAN: null-ptr-deref in get_task_struct include/linux/sched/task.h:110 [inline]
BUG: KASAN: null-ptr-deref in kthread_stop+0x3a/0x3f0 kernel/kthread.c:717
Write of size 4 at addr 0000000000000028 by task syz-executor382/1574

CPU: 0 PID: 1574 Comm: syz-executor382 Not tainted 6.1.141-syzkaller-00039-g145c7fad733f #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Call Trace:
 <TASK>
 __dump_stack+0x21/0x24 lib/dump_stack.c:88
 dump_stack_lvl+0xee/0x150 lib/dump_stack.c:106
 print_report+0x3d/0x60 mm/kasan/report.c:430
 kasan_report+0x122/0x150 mm/kasan/report.c:531
 check_region_inline mm/kasan/generic.c:-1 [inline]
 kasan_check_range+0x280/0x290 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_fetch_add_relaxed include/linux/atomic/atomic-instrumented.h:116 [inline]
 __refcount_add include/linux/refcount.h:193 [inline]
 __refcount_inc include/linux/refcount.h:250 [inline]
 refcount_inc include/linux/refcount.h:267 [inline]
 get_task_struct include/linux/sched/task.h:110 [inline]
 kthread_stop+0x3a/0x3f0 kernel/kthread.c:717
 f2fs_stop_gc_thread+0x65/0xb0 fs/f2fs/gc.c:210
 f2fs_ioc_shutdown fs/f2fs/file.c:2403 [inline]
 __f2fs_ioctl+0x5e7f/0xbd60 fs/f2fs/file.c:4386
 f2fs_ioctl+0x149/0x240 fs/f2fs/file.c:4467
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:870 [inline]
 __se_sys_ioctl+0x12f/0x1b0 fs/ioctl.c:856
 __x64_sys_ioctl+0x7b/0x90 fs/ioctl.c:856
 x64_sys_call+0x58b/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:17
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f6463873e89
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 41 1e 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f6463804218 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f6463900498 RCX: 00007f6463873e89
RDX: 0000200000000140 RSI: 000000008004587d RDI: 0000000000000005
RBP: 00007f6463900490 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f64638c5d9c
R13: 0000200000000168 R14: 3505e258dcaaa166 R15: 0000200000000140
 </TASK>
==================================================================
BUG: kernel NULL pointer dereference, address: 0000000000000028
#PF: supervisor write access in kernel mode
#PF: error_code(0x0002) - not-present page
PGD 0 P4D 0 
Oops: 0002 [#1] PREEMPT SMP KASAN
CPU: 0 PID: 1574 Comm: syz-executor382 Tainted: G    B              6.1.141-syzkaller-00039-g145c7fad733f #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
RIP: 0010:arch_atomic_fetch_add arch/x86/include/asm/atomic.h:184 [inline]
RIP: 0010:atomic_fetch_add_relaxed include/linux/atomic/atomic-instrumented.h:117 [inline]
RIP: 0010:__refcount_add include/linux/refcount.h:193 [inline]
RIP: 0010:__refcount_inc include/linux/refcount.h:250 [inline]
RIP: 0010:refcount_inc include/linux/refcount.h:267 [inline]
RIP: 0010:get_task_struct include/linux/sched/task.h:110 [inline]
RIP: 0010:kthread_stop+0x40/0x3f0 kernel/kthread.c:717
Code: 00 fc ff df e8 91 c8 26 00 0f 1f 44 00 00 e8 87 c8 26 00 4c 8d 73 28 4c 89 f7 be 04 00 00 00 e8 e6 24 6b 00 41 bf 01 00 00 00 <f0> 44 0f c1 7b 28 31 ff 44 89 fe e8 80 cc 26 00 45 85 ff 0f 84 3e
RSP: 0018:ffffc900037e78b8 EFLAGS: 00010246
RAX: ffff88811c1c8000 RBX: 0000000000000000 RCX: ffff88811c1c8000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffffc900037e78e0 R08: dffffc0000000000 R09: fffffbfff0f2ccfd
R10: fffffbfff0f2ccfd R11: 1ffffffff0f2ccfc R12: 1ffff11023b13935
R13: dffffc0000000000 R14: 0000000000000028 R15: 0000000000000001
FS:  00007f64638046c0(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000028 CR3: 0000000115193000 CR4: 00000000003506b0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 f2fs_stop_gc_thread+0x65/0xb0 fs/f2fs/gc.c:210
 f2fs_ioc_shutdown fs/f2fs/file.c:2403 [inline]
 __f2fs_ioctl+0x5e7f/0xbd60 fs/f2fs/file.c:4386
 f2fs_ioctl+0x149/0x240 fs/f2fs/file.c:4467
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:870 [inline]
 __se_sys_ioctl+0x12f/0x1b0 fs/ioctl.c:856
 __x64_sys_ioctl+0x7b/0x90 fs/ioctl.c:856
 x64_sys_call+0x58b/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:17
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f6463873e89
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 41 1e 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f6463804218 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f6463900498 RCX: 00007f6463873e89
RDX: 0000200000000140 RSI: 000000008004587d RDI: 0000000000000005
RBP: 00007f6463900490 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f64638c5d9c
R13: 0000200000000168 R14: 3505e258dcaaa166 R15: 0000200000000140
 </TASK>
Modules linked in:
CR2: 0000000000000028
---[ end trace 0000000000000000 ]---
RIP: 0010:arch_atomic_fetch_add arch/x86/include/asm/atomic.h:184 [inline]
RIP: 0010:atomic_fetch_add_relaxed include/linux/atomic/atomic-instrumented.h:117 [inline]
RIP: 0010:__refcount_add include/linux/refcount.h:193 [inline]
RIP: 0010:__refcount_inc include/linux/refcount.h:250 [inline]
RIP: 0010:refcount_inc include/linux/refcount.h:267 [inline]
RIP: 0010:get_task_struct include/linux/sched/task.h:110 [inline]
RIP: 0010:kthread_stop+0x40/0x3f0 kernel/kthread.c:717
Code: 00 fc ff df e8 91 c8 26 00 0f 1f 44 00 00 e8 87 c8 26 00 4c 8d 73 28 4c 89 f7 be 04 00 00 00 e8 e6 24 6b 00 41 bf 01 00 00 00 <f0> 44 0f c1 7b 28 31 ff 44 89 fe e8 80 cc 26 00 45 85 ff 0f 84 3e
RSP: 0018:ffffc900037e78b8 EFLAGS: 00010246
RAX: ffff88811c1c8000 RBX: 0000000000000000 RCX: ffff88811c1c8000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffffc900037e78e0 R08: dffffc0000000000 R09: fffffbfff0f2ccfd
R10: fffffbfff0f2ccfd R11: 1ffffffff0f2ccfc R12: 1ffff11023b13935
R13: dffffc0000000000 R14: 0000000000000028 R15: 0000000000000001
FS:  00007f64638046c0(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000028 CR3: 0000000115193000 CR4: 00000000003506b0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess), 4 bytes skipped:
   0:	e8 91 c8 26 00       	call   0x26c896
   5:	0f 1f 44 00 00       	nopl   0x0(%rax,%rax,1)
   a:	e8 87 c8 26 00       	call   0x26c896
   f:	4c 8d 73 28          	lea    0x28(%rbx),%r14
  13:	4c 89 f7             	mov    %r14,%rdi
  16:	be 04 00 00 00       	mov    $0x4,%esi
  1b:	e8 e6 24 6b 00       	call   0x6b2506
  20:	41 bf 01 00 00 00    	mov    $0x1,%r15d
* 26:	f0 44 0f c1 7b 28    	lock xadd %r15d,0x28(%rbx) <-- trapping instruction
  2c:	31 ff                	xor    %edi,%edi
  2e:	44 89 fe             	mov    %r15d,%esi
  31:	e8 80 cc 26 00       	call   0x26ccb6
  36:	45 85 ff             	test   %r15d,%r15d
  39:	0f                   	.byte 0xf
  3a:	84 3e                	test   %bh,(%rsi)

Crashes (5):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/07/17 08:30 android14-6.1 145c7fad733f 44f8051e .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (corrupt fs)] ci2-android-6-1 KASAN: null-ptr-deref Write in f2fs_stop_gc_thread
2025/07/17 03:30 android14-6.1 145c7fad733f 44f8051e .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (corrupt fs)] ci2-android-6-1 KASAN: null-ptr-deref Write in f2fs_stop_gc_thread
2025/07/15 17:18 android14-6.1 e2deb0b42a3a 03fcfc4b .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (corrupt fs)] ci2-android-6-1 KASAN: null-ptr-deref Write in f2fs_stop_gc_thread
2025/07/15 15:34 android14-6.1 e2deb0b42a3a 03fcfc4b .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (corrupt fs)] ci2-android-6-1 KASAN: null-ptr-deref Write in f2fs_stop_gc_thread
2025/07/15 02:50 android14-6.1 e2deb0b42a3a d8fc7335 .config console log report syz / log [disk image] [vmlinux] [kernel image] [mounted in repro (corrupt fs)] ci2-android-6-1 KASAN: null-ptr-deref Write in f2fs_stop_gc_thread
* Struck through repros no longer work on HEAD.