BUG: unable to handle kernel NULL pointer dereference in strrchr

Status: moderation: reported on 2026/11/16 07:39
Subsystems: ext4
Labels: prio:normal
[Documentation on labels]
Reported-by: syzbot+be1ab2b32f842bbd479d@syzkaller.appspotmail.com
First crash: 34m, last: 34m
✨ AI-generated root cause summary:

In fs/ext2/super.c, ext2_msg_fc() formats log messages for filesystem context operations. When fc->purpose != FS_CONTEXT_FOR_RECONFIGURE, it unconditionally executes strrchr(fc->source, '/') without verifying that fc->source is non-NULL. During filesystem configuration via the new mount API (e.g., fsopen() followed by fsconfig()), fc->source starts as NULL and options can be parsed in any order. Specifying an option that triggers ext2_msg_fc() (such as "dax", "nobh", or "reservation") prior to supplying the "source" parameter passes a NULL pointer to strrchr(), causing a kernel NULL pointer dereference.

▶ ▼ ✨ Full AI root cause analysis
Based on kernel commit fa2933aac170:

Root Cause Analysis

1. Relevant Functions, Structs, and Files

2. Technical Mechanism and Lifecycle Violation

When a filesystem context is created for a new mount (via fsopen("ext2", ...)), fc->purpose is initialized to FS_CONTEXT_FOR_MOUNT, and fc->source is initially NULL. fc->source is only populated when userspace explicitly supplies the "source" parameter (handled by vfs_parse_fs_param_source()).

Under the mount API (fsconfig), userspace is permitted to configure filesystem mount parameters in arbitrary order before issuing FSCONFIG_CMD_CREATE. Furthermore, userspace may configure parameters without ever providing a "source" parameter.

In fs/ext2/super.c, ext2_msg_fc() formats and emits log messages during mount context processing:

static void ext2_msg_fc(struct fs_context *fc, const char *prefix,
			const char *fmt, ...)
{
	struct va_format vaf;
	va_list args;
	const char *s_id;

	if (fc->purpose == FS_CONTEXT_FOR_RECONFIGURE) {
		s_id = fc->root->d_sb->s_id;
	} else {
		/* get last path component of source */
		s_id = strrchr(fc->source, '/');
		if (s_id)
			s_id++;
		else
			s_id = fc->source;
	}
...

When fc->purpose != FS_CONTEXT_FOR_RECONFIGURE (e.g. for any new mount context):

  1. ext2_msg_fc() enters the else branch and unconditionally executes s_id = strrchr(fc->source, '/'); without verifying whether fc->source is NULL.
  2. Several options in ext2_parse_param() invoke ext2_msg_fc() to log informational or deprecation/warning messages:
    • Opt_dax: ext2_msg_fc(fc, KERN_WARNING, "DAX support has been removed. dax option ignored."); (line 598)
    • Opt_xip: ext2_msg_fc(fc, KERN_WARNING, "DAX support has been removed. xip option ignored."); (line 595)
    • Opt_nobh: ext2_msg_fc(fc, KERN_INFO, "nobh option not supported\n"); (line 568)
    • Opt_reservation: ext2_msg_fc(fc, KERN_INFO, "reservations ON/OFF"); (lines 620, 623)
    • Unsupported user_xattr, acl, or quota configurations (lines 579, 591, 614)
  3. If userspace sends an fsconfig() request for one of these options (such as "dax" via FSCONFIG_SET_FLAG) before "source" has been configured, fc->source is NULL.
  4. strrchr(NULL, '/') is invoked, immediately reading through r0 = 0x00000000 (ldrb r2, [r0], #1 in arch/arm/lib/strrchr.S:16), resulting in the reported kernel NULL pointer dereference crash.
▶ ▼ ✨ AI Jobs (1)
ID Workflow Result Correct Bug Created Started Finished Revision
0b714462 assessment-security DenialOfService: ✅ Exploitable: ❌ FilesystemTrigger: ❌ FuzzingArtifact: ❌ MemoryCorruption: ❌ NetworkNeedsSetup: ❌ NetworkTrigger: ❌ PeripheralTrigger: ❌ RemoteTrigger: ❌ Unprivileged: ❌ UserNamespace: ✅ VMGuestTrigger: ❌ VMHostTrigger: ❌ ❓ BUG: unable to handle kernel NULL pointer dereference in strrchr 2026/11/16 07:16 2026/11/16 07:16 2026/11/16 07:37 819ebe34
▶ ▼ Similar bugs (3)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-15 KASAN: use-after-free Read in strrchr 19 syz, C 5 14d 15d 0/2 upstream: reported C repro on 2026/10/31 08:26
android-5-10 KASAN: use-after-free Read in strrchr 19 syz, C 5 4d22h 23d 0/2 upstream: reported C repro on 2026/10/24 05:39
android-6-12 KASAN: slab-use-after-free Read in strrchr origin:lts 19 syz, C 4 10d 34d 0/1 premoderation: reported C repro on 2026/10/13 01:47

Sample crash report:
8<--- cut here ---
Unable to handle kernel NULL pointer dereference at virtual address 00000000 when read
[00000000] *pgd=88cbe003, *pmd=df622003
Internal error: Oops: 205 [#1] SMP ARM
Modules linked in:
CPU: 0 UID: 0 PID: 12950 Comm: syz.0.10296 Tainted: G             L      syzkaller #0 PREEMPT 
Tainted: [L]=SOFTLOCKUP
Hardware name: ARM-Versatile Express
PC is at strrchr+0x4/0x20 arch/arm/lib/strrchr.S:16
LR is at ext2_msg_fc+0x64/0xbc fs/ext2/super.c:94
pc : [<81be58c4>]    lr : [<80207988>]    psr: 80000013
sp : eca3ded0  ip : 00000000  fp : eca3defc
r10: 8692e180  r9 : 83cbb400  r8 : 8692e181
r7 : 00000000  r6 : 825891dc  r5 : 82532f20  r4 : 00000000
r3 : 00000000  r2 : 00000000  r1 : 0000002f  r0 : 00000000
Flags: Nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
Control: 30c5387d  Table: 88ffd940  DAC: fffffffd
Register r0 information: NULL pointer
Register r1 information: non-paged memory
Register r2 information: NULL pointer
Register r3 information: NULL pointer
Register r4 information: NULL pointer
Register r5 information: non-slab/vmalloc memory
Register r6 information: non-slab/vmalloc memory
Register r7 information: NULL pointer
Register r8 information: slab filp start 8692e180 pointer offset 1 size 128
Register r9 information: slab kmalloc-cg-128 start 83cbb400 pointer offset 0 size 128
Register r10 information: slab filp start 8692e180 pointer offset 0 size 128
Register r11 information: 2-page vmalloc region starting at 0xeca3c000 allocated at kernel_clone+0xc4/0x440 kernel/fork.c:2798
Register r12 information: NULL pointer
Process syz.0.10296 (pid: 12950, stack limit = 0xeca3c000)
Stack: (0xeca3ded0 to 0xeca3e000)
dec0:                                     00000000 00000000 00000000 3f9ddc2a
dee0: 87952980 83cbb400 87952980 fffffdf9 eca3df34 eca3df08 807903e4 80207934
df00: 825891dc 0000006a 00000000 00000000 00000001 00000000 fffffdf9 3f9ddc2a
df20: 83cbb400 eca3df60 eca3df5c eca3df38 80631d1c 807901bc 80501104 80500f6c
df40: 00000000 00000000 00000000 83cbb404 eca3dfa4 eca3df60 806340e8 80631c64
df60: 874a07c0 00000001 00000000 00000000 00000000 3f9ddc2a 00000000 00000000
df80: 00000000 00356318 000001af 8020029c 85b32640 000001af 00000000 eca3dfa8
dfa0: 80200060 80633dd8 00000000 00000000 00000003 00000000 200001c0 00000000
dfc0: 00000000 00000000 00356318 000001af 003562d8 00000000 00000001 76fc00dc
dfe0: 76fbfe88 76fbfe78 00019808 001381d0 60000010 00000003 00000000 00000000
Call trace: 
[<80207924>] (ext2_msg_fc) from [<807903e4>] (ext2_parse_param+0x234/0x2dc fs/ext2/super.c:598)
 r3:0000006a r2:825891dc
 r6:fffffdf9 r5:87952980 r4:83cbb400
[<807901b0>] (ext2_parse_param) from [<80631d1c>] (vfs_parse_fs_param+0xc4/0x13c fs/fs_context.c:132)
 r5:eca3df60 r4:83cbb400
[<80631c58>] (vfs_parse_fs_param) from [<806340e8>] (vfs_fsconfig_locked fs/fsopen.c:306 [inline])
[<80631c58>] (vfs_parse_fs_param) from [<806340e8>] (__do_sys_fsconfig fs/fsopen.c:466 [inline])
[<80631c58>] (vfs_parse_fs_param) from [<806340e8>] (sys_fsconfig+0x31c/0x514 fs/fsopen.c:353)
 r6:83cbb404 r5:00000000 r4:00000000
[<80633dcc>] (sys_fsconfig) from [<80200060>] (ret_fast_syscall+0x0/0x1c arch/arm/mm/proc-v7.S:67)
Exception stack(0xeca3dfa8 to 0xeca3dff0)
dfa0:                   00000000 00000000 00000003 00000000 200001c0 00000000
dfc0: 00000000 00000000 00356318 000001af 003562d8 00000000 00000001 76fc00dc
dfe0: 76fbfe88 76fbfe78 00019808 001381d0
 r10:000001af r9:85b32640 r8:8020029c r7:000001af r6:00356318 r5:00000000
 r4:00000000
Code: 00000000 00000000 00000000 e3a03000 (e4d02001) 
---[ end trace 0000000000000000 ]---
----------------
Code disassembly (best guess):
   c:	e3a03000 	mov	r3, #0
* 10:	e4d02001 	ldrb	r2, [r0], #1 <-- trapping instruction

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/11/16 07:16 https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux master fa2933aac170 819ebe34 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu2-arm32 BUG: unable to handle kernel NULL pointer dereference in strrchr
* Struck through repros no longer work on HEAD.