syzbot


BUG: unable to handle kernel NULL pointer dereference in f2fs_stop_discard_thread

Status: fixed on 2023/02/24 13:50
Subsystems: f2fs
[Documentation on labels]
Reported-by: syzbot+035a381ea1afb63f098d@syzkaller.appspotmail.com
Fix commit: 91586ce0d39a f2fs: fix to invalidate dcc->f2fs_issue_discard in error path
First crash: 559d, last: 493d
Cause bisection: introduced by (bisect log) :
commit 4d67490498acb4ffcef5ba7bc44990d46e66a44c
Author: Fengnan Chang <changfengnan@vivo.com>
Date: Thu Aug 19 08:02:37 2021 +0000

  f2fs: Don't create discard thread when device doesn't support realtime discard

Crash: KASAN: null-ptr-deref Write in kill_f2fs_super (log)
Repro: C syz .config
  
Discussions (3)
Title Replies (including bot) Last reply
[syzbot] BUG: unable to handle kernel NULL pointer dereference in f2fs_stop_discard_thread 1 (3) 2022/10/28 03:49
[PATCH v2] f2fs: fix to invalidate dcc->f2fs_issue_discard in error path 1 (1) 2022/10/21 02:34
[PATCH] fs: f2fs: fix kernel discard_thread NULL dereference 2 (2) 2022/10/17 12:23
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-15 KASAN: null-ptr-deref Write in f2fs_stop_discard_thread f2fs C error 10 453d 555d 2/2 fixed on 2023/02/02 00:40

Sample crash report:
loop0: detected capacity change from 0 to 264192
F2FS-fs (loop0): invalid crc_offset: 0
F2FS-fs (loop0): Found nat_bits in checkpoint
F2FS-fs (loop0): Mounted with checkpoint version = 3651456e
Unable to handle kernel NULL pointer dereference at virtual address 000000000000001c
Mem abort info:
  ESR = 0x0000000096000004
  EC = 0x25: DABT (current EL), IL = 32 bits
  SET = 0, FnV = 0
  EA = 0, S1PTW = 0
  FSC = 0x04: level 0 translation fault
Data abort info:
  ISV = 0, ISS = 0x00000004
  CM = 0, WnR = 0
user pgtable: 4k pages, 48-bit VAs, pgdp=000000010899a000
[000000000000001c] pgd=0000000000000000, p4d=0000000000000000
Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
Modules linked in:
CPU: 1 PID: 3029 Comm: syz-executor654 Not tainted 6.0.0-rc7-syzkaller-18095-gbbed346d5a96 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/30/2022
pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : __lse_atomic_fetch_add_relaxed arch/arm64/include/asm/atomic_lse.h:62 [inline]
pc : arch_atomic_fetch_add_relaxed arch/arm64/include/asm/atomic.h:49 [inline]
pc : atomic_fetch_add_relaxed include/linux/atomic/atomic-instrumented.h:117 [inline]
pc : __refcount_add include/linux/refcount.h:193 [inline]
pc : __refcount_inc include/linux/refcount.h:250 [inline]
pc : refcount_inc include/linux/refcount.h:267 [inline]
pc : get_task_struct include/linux/sched/task.h:110 [inline]
pc : kthread_stop+0x34/0x1c0 kernel/kthread.c:703
lr : __refcount_add include/linux/refcount.h:193 [inline]
lr : __refcount_inc include/linux/refcount.h:250 [inline]
lr : refcount_inc include/linux/refcount.h:267 [inline]
lr : get_task_struct include/linux/sched/task.h:110 [inline]
lr : kthread_stop+0x30/0x1c0 kernel/kthread.c:703
sp : ffff8000128abb60
x29: ffff8000128abb60 x28: 0000000000000000 x27: 000000000000007e
x26: ffff80000d30cf28 x25: ffff80000d309000 x24: 0000000000000008
x23: ffffffffffffffff x22: 0000000000000000 x21: 0000000000000000
x20: fffffffffffffff4 x19: 000000000000001c x18: 00000000000000c0
x17: ffff80000dd0b198 x16: ffff80000db49158 x15: ffff0000c665cf80
x14: 0000000000000000 x13: 00000000ffffffff x12: ffff0000c665cf80
x11: ff808000081403c0 x10: 0000000000000000 x9 : ffff8000081403c0
x8 : 0000000000000001 x7 : ffff8000095d331c x6 : 0000000000000000
x5 : 000000008010000f x4 : fffffc00032f6a20 x3 : 000000008010000f
x2 : ffff0000cbda8100 x1 : 0000000100000000 x0 : 0000000000000000
Call trace:
 __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+0x34/0x1c0 kernel/kthread.c:703
 f2fs_stop_discard_thread+0x3c/0x5c fs/f2fs/segment.c:1638
 kill_f2fs_super+0x5c/0x194 fs/f2fs/super.c:4522
 deactivate_locked_super+0x70/0xe8 fs/super.c:332
 deactivate_super+0xd0/0xd4 fs/super.c:363
 cleanup_mnt+0x1f8/0x234 fs/namespace.c:1186
 __cleanup_mnt+0x20/0x30 fs/namespace.c:1193
 task_work_run+0xc4/0x14c kernel/task_work.c:177
 exit_task_work include/linux/task_work.h:38 [inline]
 do_exit+0x26c/0xbe0 kernel/exit.c:795
 do_group_exit+0x60/0xe8 kernel/exit.c:925
 __do_sys_exit_group kernel/exit.c:936 [inline]
 __se_sys_exit_group kernel/exit.c:934 [inline]
 __wake_up_parent+0x0/0x40 kernel/exit.c:934
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall arch/arm64/kernel/syscall.c:52 [inline]
 el0_svc_common+0x138/0x220 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x48/0x164 arch/arm64/kernel/syscall.c:206
 el0_svc+0x58/0x150 arch/arm64/kernel/entry-common.c:636
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:654
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581
Code: 9100a293 d503201f 94057e16 52800028 (b8280275) 
---[ end trace 0000000000000000 ]---
----------------
Code disassembly (best guess):
   0:	9100a293 	add	x19, x20, #0x28
   4:	d503201f 	nop
   8:	94057e16 	bl	0x15f860
   c:	52800028 	mov	w8, #0x1                   	// #1
* 10:	b8280275 	ldadd	w8, w21, [x19] <-- trapping instruction

Crashes (23):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/10/13 07:06 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci bbed346d5a96 3f6b40a1 .config console log report syz C [mounted in repro] ci-upstream-gce-arm64 BUG: unable to handle kernel NULL pointer dereference in f2fs_stop_discard_thread
2022/10/13 06:52 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci bbed346d5a96 3f6b40a1 .config console log report syz C [mounted in repro] ci-upstream-gce-arm64 BUG: unable to handle kernel NULL pointer dereference in f2fs_stop_discard_thread
2022/10/24 23:51 upstream 247f34f7b803 ff2fe65d .config strace log report syz C [disk image] [vmlinux] [mounted in repro] ci-upstream-kasan-gce-root KASAN: null-ptr-deref Write in f2fs_stop_discard_thread
2022/10/24 23:27 upstream 247f34f7b803 ff2fe65d .config strace log report syz C [disk image] [vmlinux] [mounted in repro] ci-upstream-kasan-gce-root KASAN: null-ptr-deref Write in f2fs_stop_discard_thread
2022/12/18 02:47 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci a5541c0811a0 05494336 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 BUG: unable to handle kernel NULL pointer dereference in f2fs_stop_discard_thread
2022/11/08 21:12 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 56751c56c2a2 060f945e .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 BUG: unable to handle kernel NULL pointer dereference in f2fs_stop_discard_thread
2022/11/08 19:30 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 56751c56c2a2 060f945e .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 BUG: unable to handle kernel NULL pointer dereference in f2fs_stop_discard_thread
2022/11/05 23:57 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci bbed346d5a96 6d752409 .config console log report info [disk image] [vmlinux] ci-upstream-gce-arm64 BUG: unable to handle kernel NULL pointer dereference in f2fs_stop_discard_thread
2022/11/04 00:46 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci bbed346d5a96 6d752409 .config console log report info [disk image] [vmlinux] ci-upstream-gce-arm64 BUG: unable to handle kernel NULL pointer dereference in f2fs_stop_discard_thread
2022/11/03 05:10 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci bbed346d5a96 08977f5d .config console log report info [disk image] [vmlinux] ci-upstream-gce-arm64 BUG: unable to handle kernel NULL pointer dereference in f2fs_stop_discard_thread
2022/10/30 15:06 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci bbed346d5a96 2a71366b .config console log report info [disk image] [vmlinux] ci-upstream-gce-arm64 BUG: unable to handle kernel NULL pointer dereference in f2fs_stop_discard_thread
2022/10/30 08:15 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci bbed346d5a96 2a71366b .config console log report info [disk image] [vmlinux] ci-upstream-gce-arm64 BUG: unable to handle kernel NULL pointer dereference in f2fs_stop_discard_thread
2022/10/28 20:08 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci bbed346d5a96 ea12ae9b .config console log report info ci-upstream-gce-arm64 BUG: unable to handle kernel NULL pointer dereference in f2fs_stop_discard_thread
2022/10/28 17:15 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci bbed346d5a96 ea12ae9b .config console log report info ci-upstream-gce-arm64 BUG: unable to handle kernel NULL pointer dereference in f2fs_stop_discard_thread
2022/10/28 06:48 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci bbed346d5a96 86777b7f .config console log report info [disk image] [vmlinux] ci-upstream-gce-arm64 BUG: unable to handle kernel NULL pointer dereference in f2fs_stop_discard_thread
2022/10/28 05:09 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci bbed346d5a96 86777b7f .config console log report info [disk image] [vmlinux] ci-upstream-gce-arm64 BUG: unable to handle kernel NULL pointer dereference in f2fs_stop_discard_thread
2022/10/13 06:39 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci bbed346d5a96 3f6b40a1 .config console log report info ci-upstream-gce-arm64 BUG: unable to handle kernel NULL pointer dereference in f2fs_stop_discard_thread
2022/10/13 04:57 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci bbed346d5a96 3f6b40a1 .config console log report info ci-upstream-gce-arm64 BUG: unable to handle kernel NULL pointer dereference in f2fs_stop_discard_thread
2022/10/31 10:14 upstream b229b6ca5abb 2a71366b .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root KASAN: null-ptr-deref Write in f2fs_stop_discard_thread
2022/10/30 15:29 upstream 200204f56f3b 2a71366b .config console log report info ci-qemu-upstream-386 KASAN: null-ptr-deref Write in f2fs_stop_discard_thread
2022/10/24 20:25 linux-next 4d48f589d294 ff2fe65d .config console log report info [disk image] [vmlinux] ci-upstream-linux-next-kasan-gce-root KASAN: null-ptr-deref Write in f2fs_stop_discard_thread
2022/10/23 23:29 linux-next 4d48f589d294 23bf86af .config console log report info [disk image] [vmlinux] ci-upstream-linux-next-kasan-gce-root KASAN: null-ptr-deref Write in f2fs_stop_discard_thread
2022/10/20 08:06 linux-next acee3e83b493 b31320fc .config console log report info [disk image] [vmlinux] ci-upstream-linux-next-kasan-gce-root KASAN: null-ptr-deref Write in f2fs_stop_discard_thread
* Struck through repros no longer work on HEAD.