BUG: unable to handle kernel paging request in kernfs_unlink_sibling

Status: upstream: reported syz repro on 2026/11/13 06:10
Subsystems: kernfs
Labels: prio:normal
[Documentation on labels]
Reported-by: syzbot+02ab1258b7fa66eb1f7f@syzkaller.appspotmail.com
First crash: 4d01h, last: 4d01h
✨ AI-generated root cause summary:

The crash manifests during network namespace teardown (cleanup_net -> rdma_dev_exit_net -> ib_free_port_attrs -> destroy_gid_attrs -> kernfs_unlink_sibling -> rb_erase) when ____rb_erase_color encounters a NULL sibling pointer and dereferences address 0x0 (detected by KASAN at shadow address dfff800000000000). In a valid red-black tree, ____rb_erase_color is only entered after deleting a black node, so the sibling subtree must contain at least one black node and sibling can never be NULL; furthermore, all kernfs directory operations are strictly protected by root->kernfs_rwsem. This rbtree corruption is induced externally: userspace mmaps the PCI BAR0 MMIO window exposed via sysfs (/sys/bus/pci/devices/.../resource0 in drivers/pci/pci-sysfs.c) and writes arbitrary data into device MMIO space, reprogramming hardware DMA queues and causing device DMA to overwrite kernel memory structures.

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

Bug Mechanism and Technical Root Cause

1. Manifestation Site and Mechanism

The crash occurs at lib/rbtree.c:354 in ____rb_erase_color() (inlined into rb_erase()):

sibling = parent->rb_left;
if (rb_is_red(sibling)) { ... }

rb_is_red(sibling) dereferences sibling->__rb_parent_color. Because sibling is NULL, the instruction attempts to access offset 0 (0x0000000000000000), which traps under KASAN shadow address check at 0xdfff800000000000 (or causes an immediate fatal paging request / page fault on systems without KASAN).

Under red-black tree invariants, ____rb_erase_color() is reached only after deleting a black node, which requires the sibling subtree to have a black-height of at least 1; therefore, sibling can never be NULL in an uncorrupted red-black tree. Furthermore, within fs/kernfs/dir.c, all directory operations manipulating kn_parent->dir.children (kernfs_link_sibling, kernfs_unlink_sibling, and lookup routines) are strictly serialized under exclusive lock root->kernfs_rwsem. The presence of a NULL sibling demonstrates that the in-memory rbtree structure of kernfs_node was corrupted.

2. Triggering Sequence and Deferred Manifestation

The crash is triggered during network namespace teardown:

  1. When a network namespace exits, cleanup_net() invokes ops_exit_list(), which executes rdma_dev_exit_net() (drivers/infiniband/core/device.c).
  2. rdma_dev_exit_net() calls remove_one_compat_dev(), which calls ib_free_port_attrs() (drivers/infiniband/core/sysfs.c).
  3. ib_free_port_attrs() calls destroy_gid_attrs(), which calls sysfs_remove_groups(), iterating over the attribute group and invoking sysfs_remove_group() -> remove_files() -> kernfs_remove_by_name().
  4. kernfs_remove_by_name() invokes kernfs_unlink_sibling() to detach the attribute node from its parent kernfs directory rbtree (&kn_parent->dir.children) using rb_erase().
  5. Due to prior memory corruption of the kernfs_node pointers/children, rb_erase() attempts to rebalance using ____rb_erase_color(), encountering parent->rb_left == NULL and dereferencing NULL.

3. Underlying Root Cause

The root cause is external physical memory corruption enabled via drivers/pci/pci-sysfs.c:

  1. Userspace mounts sysfs and opens the PCI device BAR0 MMIO resource /sys/bus/pci/devices/0000:00:02.0/resource0 with O_RDWR.
  2. Userspace mmaps the device MMIO BAR into its address space and writes directly into it (in the reproducer, via read() from /proc/thread-self/cmdline into the mmap'd MMIO range).
  3. Directly writing arbitrary data into a PCI device's MMIO control and DMA registers reprograms the hardware (e.g., ring buffers, base addresses, descriptor queues), causing the device to initiate DMA transfers into arbitrary physical memory addresses.
  4. The rogue DMA overwrites kernel heap memory containing kernfs_node rbtree structures. The corrupted rbtree is only encountered later when the network namespace worker asynchronously tears down sysfs nodes in cleanup_net.
▶ ▼ ✨ AI Jobs (2)
ID Workflow Result Correct Bug Created Started Finished Revision
b002c8ea repro-c 💥 BUG: unable to handle kernel paging request in kernfs_unlink_sibling 2026/11/12 15:09 2026/11/12 15:09 2026/11/12 22:47 c0087d7f
33c6eb33 assessment-security DenialOfService: ✅ Exploitable: ✅ FilesystemTrigger: ❌ FuzzingArtifact: ❌ MemoryCorruption: ✅ NetworkNeedsSetup: ❌ NetworkTrigger: ❌ PeripheralTrigger: ❌ RemoteTrigger: ❌ Unprivileged: ❌ UserNamespace: ❌ VMGuestTrigger: ❌ VMHostTrigger: ❌ ❓ BUG: unable to handle kernel paging request in kernfs_unlink_sibling 2026/11/09 05:58 2026/11/09 05:58 2026/11/09 06:04 5cecaf1f

Sample crash report:
Unable to handle kernel paging request at virtual address dfff800000000000
KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
Mem abort info:
  ESR = 0x0000000096000005
  EC = 0x25: DABT (current EL), IL = 32 bits
  SET = 0, FnV = 0
  EA = 0, S1PTW = 0
  FSC = 0x05: level 1 translation fault
Data abort info:
  ISV = 0, ISS = 0x00000005, ISS2 = 0x00000000
  CM = 0, WnR = 0, TnD = 0, TagAccess = 0
  GCS = 0, Overlay = 0, DirtyBit = 0
[dfff800000000000] address between user and kernel address ranges
Internal error: Oops: 0000000096000005 [#1]  SMP
Modules linked in:
CPU: 1 UID: 0 PID: 1195 Comm: kworker/u8:6 Not tainted syzkaller #0 PREEMPT 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
Workqueue: netns cleanup_net
pstate: 63400005 (nZCv daif +PAN -UAO +TCO +DIT -SSBS BTYPE=--)
pc : ____rb_erase_color lib/rbtree.c:354 [inline]
pc : rb_erase+0x4e4/0xba0 lib/rbtree.c:445
lr : kernfs_unlink_sibling+0x190/0x218 fs/kernfs/dir.c:449
sp : ffff800094d775f0
x29: ffff800094d77600 x28: ffff0000d985c408 x27: ffff0000d985c410
x26: 1fffe0001b30b882 x25: dfff800000000000 x24: ffff0000c6b58ca0
x23: 0000000000000000 x22: 0000000000000000 x21: ffff0000d98545e0
x20: ffff0000d985c400 x19: 0000000000000000 x18: 1fffe000359d3e28
x17: 0000000000000003 x16: ffff8000898b7000 x15: 0000000000000000
x14: 0000000000287419 x13: 0000000000000001 x12: 0000000000000003
x11: 0000000000000000 x10: 0000000000000001 x9 : 0000000000000000
x8 : 0000000000000000 x7 : ffff800080f6a0dc x6 : 0000000000000000
x5 : 0000000000000000 x4 : 0000000000000000 x3 : ffff80008046e414
x2 : 0000000000000001 x1 : ffff0000c6b58ca0 x0 : ffff0000d98545e0
Call trace:
 ____rb_erase_color lib/rbtree.c:354 [inline] (P)
 rb_erase+0x4e4/0xba0 lib/rbtree.c:445 (P)
 kernfs_unlink_sibling+0x190/0x218 fs/kernfs/dir.c:449
 __kernfs_remove+0x36c/0x748 fs/kernfs/dir.c:1584
 kernfs_remove_by_name_ns+0x70/0xd0 fs/kernfs/dir.c:1796
 kernfs_remove_by_name include/linux/kernfs.h:644 [inline]
 remove_files+0x90/0x184 fs/sysfs/group.c:28
 sysfs_remove_group+0x98/0x160 fs/sysfs/group.c:328
 sysfs_remove_groups+0x5c/0xb4 fs/sysfs/group.c:352
 destroy_gid_attrs drivers/infiniband/core/sysfs.c:1143 [inline]
 ib_free_port_attrs+0xa8/0x340 drivers/infiniband/core/sysfs.c:1367
 remove_one_compat_dev+0x54/0x7c drivers/infiniband/core/device.c:1035
 rdma_dev_exit_net+0x188/0x388 drivers/infiniband/core/device.c:1173
 ops_exit_list net/core/net_namespace.c:200 [inline]
 ops_undo_list+0x3cc/0x81c net/core/net_namespace.c:253
 cleanup_net+0x474/0x6c4 net/core/net_namespace.c:708
 process_one_work kernel/workqueue.c:3495 [inline]
 process_scheduled_works+0x91c/0x1250 kernel/workqueue.c:3578
 worker_thread+0x798/0xbd0 kernel/workqueue.c:3659
 kthread+0x304/0x3d4 kernel/kthread.c:436
 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:854
Code: 91004280 968b3531 f9400376 d343fed7 (38796ae8) 
---[ end trace 0000000000000000 ]---
----------------
Code disassembly (best guess):
   0:	91004280 	add	x0, x20, #0x10
   4:	968b3531 	bl	0xfffffffffa2cd4c8
   8:	f9400376 	ldr	x22, [x27]
   c:	d343fed7 	lsr	x23, x22, #3
* 10:	38796ae8 	ldrb	w8, [x23, x25] <-- trapping instruction

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/11/09 05:51 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 58c1eb84e977 5cecaf1f .config console log report syz / log [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 BUG: unable to handle kernel paging request in kernfs_unlink_sibling
* Struck through repros no longer work on HEAD.