syzbot
BUG: unable to handle kernel NULL pointer dereference in refill_objects
Status:
moderation: reported on 2026/11/26 13:34
Subsystems:
kernfs
Labels:
prio:normal
[Documentation on labels]
Reported-by: syzbot+bcccfad021cba5779987@syzkaller.appspotmail.com
First crash: 4d00h, last: 4d00h
✨ AI cause bisection: inconclusive
(AI job)
✨ AI-generated root cause summary:
During USB device enumeration (hub_event -> device_add -> bus_add_device -> sysfs_create_link -> __kernfs_new_node), kmem_cache_zalloc(kernfs_node_cache, GFP_KERNEL) exhausted CPU 0's per-CPU sheaf and called __pcs_replace_empty_main() -> refill_sheaf() -> refill_objects() -> __refill_objects_node() in mm/slub.c. While walking the detached freelist of a partial 88-byte slab (objects=46, inuse=12, freelist=0x8a9d3420, s->offset=0x2c), get_freepointer() read a corrupted freepointer value 0x0000002a at offset +0x2c of the 9th popped object (p[44]), stored 0x2a into sheaf->objects[45], and faulted at virtual address 0x00000056 (0x2a + 0x2c) on the next get_freepointer() call. Because struct kernfs_node only stores pointers or unused union padding at offset +44 and SLUB's freelist/sheaf paths are sound, the 0x2a value resulted from a prior asynchronous Use-After-Free or Out-Of-Bounds write into free slab memory. With CONFIG_SLAB_MERGE_DEFAULT=y merging compatible ~88-byte caches into kernfs_node_cache and no KASAN/SLUB_DEBUG_ON enabled, the exact corrupting caller cannot be identified from the crash report alone.
▶
▼
✨ Full AI root cause analysis
Technical Root Cause Analysis
1. Verified Crash Site and Slab State
The Oops occurs in kworker/0:4 while enumerating USB device 1-1:
hub_event() (drivers/usb/core/hub.c) -> usb_new_device() -> device_add() (drivers/base/core.c:3720) -> bus_add_device() (drivers/base/bus.c:583) -> sysfs_create_link() -> kernfs_create_link() -> kernfs_new_node() -> __kernfs_new_node() (fs/kernfs/dir.c:667) calls kmem_cache_zalloc(kernfs_node_cache, GFP_KERNEL).
kmem_cache_alloc_noprof() -> slab_alloc_node() -> alloc_from_pcs() finds CPU 0's pcs->main sheaf empty (size == 0) and enters the slow path: __pcs_replace_empty_main() (mm/slub.c:4811) -> refill_sheaf() (mm/slub.c:2917) -> refill_objects() (mm/slub.c:7533) -> __refill_objects_node() (mm/slub.c:7420).
- In
__refill_objects_node(), get_freelist_nofreeze(s, slab, &count) (mm/slub.c:4479) detached the freelist of a partial slab belonging to kmem_cache *s (r2 = 0x83cf5000, kernfs_node_cache or an aliased cache).
- From the stack (
0xdf9adb20: 8a9d3420 002e000c 00000000 002e002e) and registers (r1 = 0x2c, r4 = 0x19, r5 = 0x2e, r6 = 0x2a, r7 = 0x84faec14, r9 = 0x2d, ip = 0x7b):
- The slab object size is 88 bytes (
4096 / 88 = 46 = 0x2e objects per 4 KiB page) with s->offset = ALIGN_DOWN(88 / 2, 4) = 44 = 0x2c (loaded from [r2, #28]).
old.freelist was 0x8a9d3420 with old.counters indicating objects = 46 (0x2e), inuse = 12 (0x0c), so count = 34 free objects on that slab's freelist.
p (r7 = 0x84faec14, &sheaf->objects[0] inside a kmalloc-512 struct slab_sheaf with sheaf_capacity = 123 = 0x7b) had filled 45 (r9 = 0x2d) slots.
- On the 9th object popped from this slab (
p[44], leaving count = 25 = 0x19 in r4), get_freepointer(s, p[44]) read 0x0000002a from offset +0x2c (44).
- On the next loop iteration (
refilled = 45), p[45] (0x84faecc8) was written with r6 = 0x0000002a, and get_freepointer(s, (void *)0x2a) -> freelist_ptr_decode() (mm/slub.c:584, with CONFIG_SLAB_FREELIST_HARDENED=n) executed ldr r0, [r6, r1], dereferencing 0x2a + 0x2c = 0x56 and faulting.
2. Object Lifecycle & Ruled-Out Hypotheses
- SLUB sheaf/freelist accounting (
mm/slub.c) ruled out as the corruptor:
get_freelist_nofreeze() atomically detaches slab->freelist and sets slab->inuse = slab->objects under slab_update_freelist() (__update_freelist_slow() via slab_lock() with IRQs disabled on 32-bit ARM).
__refill_objects_node() removes the slab from n->partial and clears node_partial under n->list_lock in get_partial_node_bulk() before detaching the freelist, preventing concurrent __slab_free() from corrupting slab_list.
- If
0x0000002a had been inserted into the freelist as a freed object pointer (e.g., via kmem_cache_free() -> build_detached_freelist() / __slab_free() -> set_freepointer()), set_freepointer() itself would have written to 0x2a + 0x2c = 0x56 and faulted immediately at free time. Thus, 0x0000002a was written to p[44] + 0x2c after the object was already placed on slab->freelist.
struct kernfs_node direct field write ruled out:
- On 32-bit ARM (
CONFIG_DEBUG_LOCK_ALLOC=n), sizeof(struct kernfs_node) is 88 bytes (include/linux/kernfs.h:199), with the dir/symlink/attr union spanning bytes 40..64:
kernfs_elem_dir: subdirs at +40, children.rb_node (pointer) at +44.
kernfs_elem_attr: ops at +40, open (pointer) at +44.
kernfs_elem_symlink: target_kn at +40, offset +44 unused.
- None of the
kernfs_node union layouts store a small integer like 0x2a (42) at offset +44, and struct kernfs_node has no variable-length buffer that could overflow into an adjacent object. device_add() -> __kernfs_new_node() is only the victim allocator.
3. Root Cause Assessment (Inconclusive Original Corruptor)
0x0000002a at offset +0x2c of a free slab object in 0x83cf5000 is the result of an earlier asynchronous Use-After-Free write or Out-Of-Bounds write into free slab memory.
- Because
CONFIG_SLAB_MERGE_DEFAULT=y is enabled and kernfs_node_cache is created in kernfs_init() (fs/kernfs/mount.c:472) with only SLAB_PANIC (no SLAB_NO_MERGE, SLAB_ACCOUNT, SLAB_RECLAIM_ACCOUNT, SLAB_TYPESAFE_BY_RCU, or constructor), find_mergeable() (mm/slab_common.c:194) merges any compatible ~85–88 byte slab cache into 0x83cf5000.
- Because
CONFIG_KASAN, CONFIG_SLUB_DEBUG_ON, and CONFIG_SLAB_FREELIST_HARDENED are all disabled (and per-CPU sheaves buffer up to 123 freed objects before flushing back to partial slabs), the crash report contains no allocation/free stacks or memory-access history for the corrupted object, so the exact offending caller cannot be identified from static inspection alone.
Sample crash report:
usb 1-1: SerialNumber: syz
device: '1-1': device_add
kobject: '1-1' (84556088): kobject_add_internal: parent: 'usb1', set: 'devices'
bus: 'usb': add device 1-1
8<--- cut here ---
Unable to handle kernel NULL pointer dereference at virtual address 00000056 when read
[00000056] *pgd=80000080004003, *pmd=00000000
Internal error: Oops: 205 [#1] SMP ARM
Modules linked in:
CPU: 0 UID: 0 PID: 10007 Comm: kworker/0:4 Not tainted syzkaller #0 PREEMPT
Hardware name: ARM-Versatile Express
Workqueue: usb_hub_wq hub_event
PC is at freelist_ptr_decode mm/slub.c:584 [inline]
PC is at get_freepointer mm/slub.c:597 [inline]
PC is at __refill_objects_node mm/slub.c:7420 [inline]
PC is at refill_objects+0x3a8/0x670 mm/slub.c:7533
LR is at bit_spin_unlock include/linux/bit_spinlock.h:80 [inline]
LR is at slab_unlock mm/slub.c:692 [inline]
LR is at __update_freelist_slow+0x88/0x114 mm/slub.c:722
pc : [<8057845c>] lr : [<80571508>] psr: 20000013
sp : df9adae8 ip : 0000007b fp : df9adb74
r10: 00000000 r9 : 0000002d r8 : ddf6ed6c
r7 : 84faec14 r6 : 0000002a r5 : 0000002e r4 : 00000019
r3 : 84faeccc r2 : 83cf5000 r1 : 0000002c r0 : 0000002a
Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
Control: 30c5387d Table: 86ed9700 DAC: fffffffd
Register r0 information: non-paged memory
Register r1 information: non-paged memory
Register r2 information: slab kmem_cache start 83cf5000 pointer offset 0 size 132
Register r3 information: slab kmalloc-512 start 84faec00 pointer offset 204 size 512
Register r4 information: non-paged memory
Register r5 information: non-paged memory
Register r6 information: non-paged memory
Register r7 information: slab kmalloc-512 start 84faec00 pointer offset 20 size 512
Register r8 information: non-slab/vmalloc memory
Register r9 information: non-paged memory
Register r10 information: NULL pointer
Register r11 information: 2-page vmalloc region starting at 0xdf9ac000 allocated at kernel_clone+0xc4/0x440 kernel/fork.c:2798
Register r12 information: non-paged memory
Process kworker/0:4 (pid: 10007, stack limit = 0xdf9ac000)
Stack: (0xdf9adae8 to 0xdf9ae000)
dae0: df9adb24 00000002 c003dc28 8256a07c 00082dc0 8057a688
db00: 0000007b 84faec14 83c00fc0 83613aae de013e80 ddf6ed74 84faec14 00000024
db20: 8a9d3420 002e000c 00000000 002e002e 00082dc0 0000007b 0000007b de013e88
db40: de00ab04 45e44c61 83cf5000 83cf5000 00000000 0000007b 00000001 83cf4240
db60: 84faec00 8340b4cc df9adbb4 df9adb78 8057a688 805780c0 0000007b 80571af8
db80: 853db300 00000dc0 83cf5000 83cf5000 00000dc0 806b5840 853db300 832e2904
dba0: 00000000 8340b4cc df9adc0c df9adbb8 8057ab2c 8057a488 00000003 805015bc
dbc0: 86bd7340 00000000 806b5840 00000058 00000000 00000000 8ef75f80 45e44c61
dbe0: 83f1b268 83f1b268 83c1d9c0 8ef75f80 83f1b268 82761a50 853db300 83c1d9c0
dc00: df9adcac df9adc10 806b5840 8057a7e0 df9adc44 df9adc20 00000100 45e44c61
dc20: 80293a0c 0000a1ff 825d92c0 83f7a900 84f4bc88 81fb7aa8 83563b78 852cc728
dc40: df9adc64 df9adc50 802ef5a4 802ef2f8 df9adc94 83c1da00 df9adc74 df9adc68
dc60: 802f069c 802ef588 df9adc8c df9adc78 df9adc9c df9adc80 8022cc30 45e44c61
dc80: 00000000 83f1b268 0000a1ff 00000000 86bd7340 00000004 00000000 83c1d9c0
dca0: df9adcec df9adcb0 806b71ac 806b57f8 00000000 00000000 00000004 df9adcc8
dcc0: 802da230 87384630 83c1da14 83f1b268 86bd7340 00000000 00000000 852cc728
dce0: df9add1c df9adcf0 806b9bf4 806b713c 00000000 00000004 83f1b268 86bd7340
dd00: 87384630 00000000 00000001 83563b78 df9add44 df9add20 806bb174 806b9b78
dd20: 84556088 00000000 83f7a900 83f7a90c 81fb7aa8 83563b78 df9add54 df9add48
dd40: 806bb328 806bb114 df9add84 df9add58 80c4c348 806bb304 df9add84 df9add68
dd60: 80c4439c 45e44c61 84556088 00000000 00000000 84f4bc88 df9addcc df9add88
dd80: 80c49380 80c4c2c8 df9adda4 df9add98 81c20eb8 80292300 df9addcc 45e44c61
dda0: 80b81730 84556000 84556088 8ad81800 ffffffff 84f89600 00000001 852cc728
ddc0: df9ade24 df9addd0 802147b8 80c49044 00000003 00000024 df9ade0c df9adde8
dde0: 80293a24 802daa7c 0000003c 00000025 00000000 45e44c61 84f4bc00 84556088
de00: 84f4bc00 00000001 84f89600 00000000 84556000 852cc728 df9adeec df9ade28
de20: 80fc9fb4 802143a4 00000000 82642418 00000000 45e44c61 802cb6c4 86c51204
de40: 00000064 84f5ba20 84556324 84f4bcd4 84f5bc00 84f5bc30 84f5b800 82642550
de60: 82642574 8363a060 00000001 00000000 00000025 852cc63c 84f5ba20 852cc634
de80: 84f5b808 84f5ba20 84f89600 852cc630 852cc685 00000000 84f4bc00 852cc600
dea0: 809ccf7c 00000000 00000101 00000000 00000005 00000000 852cc728 45e44c61
dec0: 86c51204 8ad13d80 852cc728 83fe3800 dddcf740 853db300 00800000 83fe3805
dee0: df9adf4c df9adef0 80279d64 80fc8d6c 852cc72c 852cc728 8ad13db0 8ad13db0
df00: df9adf34 df9adf10 802759f0 809cbca8 852cc728 00000000 00000000 45e44c61
df20: 853db300 8ad13d80 dddcf740 dddcf760 83403d80 853db300 8ad13db0 00000000
df40: df9adf84 df9adf50 8027ad10 80279b78 df9adf84 df9adf60 80283524 8ad09500
df60: 853db300 8027aba4 8ad13d80 8ef4ba00 df9a1e88 00000000 df9adfac df9adf88
df80: 80285958 8027abb0 8ad09500 8028583c 00000000 00000000 00000000 00000000
dfa0: 00000000 df9adfb0 80200114 80285848 00000000 00000000 00000000 00000000
dfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
dfe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
Call trace:
[<805780b4>] (refill_objects) from [<8057a688>] (refill_sheaf mm/slub.c:2917 [inline])
[<805780b4>] (refill_objects) from [<8057a688>] (__pcs_replace_empty_main+0x20c/0x358 mm/slub.c:4811)
r10:8340b4cc r9:84faec00 r8:83cf4240 r7:00000001 r6:0000007b r5:00000000
r4:83cf5000
[<8057a47c>] (__pcs_replace_empty_main) from [<8057ab2c>] (alloc_from_pcs mm/slub.c:4887 [inline])
[<8057a47c>] (__pcs_replace_empty_main) from [<8057ab2c>] (slab_alloc_node mm/slub.c:5021 [inline])
[<8057a47c>] (__pcs_replace_empty_main) from [<8057ab2c>] (kmem_cache_alloc_noprof+0x358/0x3e0 mm/slub.c:5047)
r10:8340b4cc r9:00000000 r8:832e2904 r7:853db300 r6:806b5840 r5:00000dc0
r4:83cf5000
[<8057a7d4>] (kmem_cache_alloc_noprof) from [<806b5840>] (__kernfs_new_node+0x54/0x25c fs/kernfs/dir.c:667)
r10:83c1d9c0 r9:853db300 r8:82761a50 r7:83f1b268 r6:8ef75f80 r5:83c1d9c0
r4:83f1b268
[<806b57ec>] (__kernfs_new_node) from [<806b71ac>] (kernfs_new_node+0x7c/0x84 fs/kernfs/dir.c:759)
r10:83c1d9c0 r9:00000000 r8:00000004 r7:86bd7340 r6:00000000 r5:0000a1ff
r4:83f1b268
[<806b7130>] (kernfs_new_node) from [<806b9bf4>] (kernfs_create_link+0x88/0xf0 fs/kernfs/symlink.c:50)
r10:852cc728 r9:00000000 r8:00000000 r7:86bd7340 r6:83f1b268 r5:83c1da14
r4:87384630
[<806b9b6c>] (kernfs_create_link) from [<806bb174>] (sysfs_do_create_link_sd+0x6c/0xec fs/sysfs/symlink.c:44)
r9:83563b78 r8:00000001 r7:00000000 r6:87384630 r5:86bd7340 r4:83f1b268
[<806bb108>] (sysfs_do_create_link_sd) from [<806bb328>] (sysfs_do_create_link fs/sysfs/symlink.c:80 [inline])
[<806bb108>] (sysfs_do_create_link_sd) from [<806bb328>] (sysfs_create_link+0x30/0x3c fs/sysfs/symlink.c:92)
r9:83563b78 r8:81fb7aa8 r7:83f7a90c r6:83f7a900 r5:00000000 r4:84556088
[<806bb2f8>] (sysfs_create_link) from [<80c4c348>] (bus_add_device+0x8c/0x1fc drivers/base/bus.c:583)
[<80c4c2bc>] (bus_add_device) from [<80c49380>] (device_add+0x348/0x834 drivers/base/core.c:3720)
r7:84f4bc88 r6:00000000 r5:00000000 r4:84556088
[<80c49038>] (device_add) from [<802147b8>] (usb_new_device.part.0+0x420/0x65c drivers/usb/core/hub.c:2713)
r10:852cc728 r9:00000001 r8:84f89600 r7:ffffffff r6:8ad81800 r5:84556088
r4:84556000
[<80214398>] (usb_new_device.part.0) from [<80fc9fb4>] (usb_new_device include/linux/pm_wakeup.h:242 [inline])
[<80214398>] (usb_new_device.part.0) from [<80fc9fb4>] (hub_port_connect drivers/usb/core/hub.c:5585 [inline])
[<80214398>] (usb_new_device.part.0) from [<80fc9fb4>] (hub_port_connect_change drivers/usb/core/hub.c:5725 [inline])
[<80214398>] (usb_new_device.part.0) from [<80fc9fb4>] (port_event drivers/usb/core/hub.c:5889 [inline])
[<80214398>] (usb_new_device.part.0) from [<80fc9fb4>] (hub_event+0x1254/0x1bac drivers/usb/core/hub.c:5971)
r10:852cc728 r9:84556000 r8:00000000 r7:84f89600 r6:00000001 r5:84f4bc00
r4:84556088
[<80fc8d60>] (hub_event) from [<80279d64>] (process_one_work+0x1f8/0x5cc kernel/workqueue.c:3495)
r10:83fe3805 r9:00800000 r8:853db300 r7:dddcf740 r6:83fe3800 r5:852cc728
r4:8ad13d80
[<80279b6c>] (process_one_work) from [<8027ad10>] (process_scheduled_works kernel/workqueue.c:3578 [inline])
[<80279b6c>] (process_one_work) from [<8027ad10>] (worker_thread+0x16c/0x318 kernel/workqueue.c:3659)
r10:00000000 r9:8ad13db0 r8:853db300 r7:83403d80 r6:dddcf760 r5:dddcf740
r4:8ad13d80
[<8027aba4>] (worker_thread) from [<80285958>] (kthread+0x11c/0x154 kernel/kthread.c:436)
r10:00000000 r9:df9a1e88 r8:8ef4ba00 r7:8ad13d80 r6:8027aba4 r5:853db300
r4:8ad09500
[<8028583c>] (kthread) from [<80200114>] (ret_from_fork+0x14/0x20 arch/arm/kernel/entry-common.S:137)
Exception stack(0xdf9adfb0 to 0xdf9adff8)
dfa0: 00000000 00000000 00000000 00000000
dfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
dfe0: 00000000 00000000 00000000 00000000 00000013 00000000
r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:8028583c r4:8ad09500
Code: e0873109 ea000007 e4836004 e592101c (e7960001)
---[ end trace 0000000000000000 ]---
----------------
Code disassembly (best guess):
0: e0873109 add r3, r7, r9, lsl #2
4: ea000007 b 0x28
8: e4836004 str r6, [r3], #4
c: e592101c ldr r1, [r2, #28]
* 10: e7960001 ldr r0, [r6, r1] <-- trapping instruction
* Struck through repros no longer work on HEAD.