bitVakt

Kernel Kit / Infix / v26.10.0latest

CVE-2026-98818

—unknown

linux6.18.60 · 6.18.54 · 6.18.8in 3 of 4 releases

Not yet analysed by NVD. Matched on the vendor's record; this may change when NVD has analysed it.

Reach linux · 6 builds in 3 of 4 releases

full reviewcross-check✓ a member decided

v25.03.1not in NVD's range
v26.01.06.18.8
v26.09.06.18.54
v26.10.0latest6.18.60
aarch64_minimal
x86_64
aarch64_minimal–
x86_64–
aarch64_minimalAAwaiting reviewx86_64AAwaiting reviewaarch64_minimalAAwaiting reviewx86_64AAwaiting reviewaarch64_minimalAAwaiting reviewx86_64AAwaiting review

Description · NVD

mm/slab: do not wake up kswapd in __kfree_rcu_sheaf()

Since kfree_rcu() can be called under pi_lock (a raw spinlock in the scheduler), kfree_rcu() itself should never allocate memory with __GFP_KSWAPD_RECLAIM as waking up kswapd ends up acquiring pi_lock, which leads to a deadlock.

Reproducing the issue even intentionally was not straightforward. The set_cpus_allowed_force() path that is called under pi_lock is exercised very rarely, and competing tasks that allocate memory will most likely wake kswapd up.

Therefore the existence of the deadlock was verified with a modified kernel that has a lockdep map for waking up kswapd:

WARNING: possible circular locking dependency detectedkernel log · 93 lines
  ======================================================
  WARNING: possible circular locking dependency detected
  7.2.0-rc1-slab-for-next+ #10 Not tainted
  ------------------------------------------------------
  git/6660 is trying to acquire lock:
  ffff8e524533c550 (&p->pi_lock){-.-.}-{2:2}, at: _raw_spin_lock_irqsave+0x12/0x20

  but task is already holding lock:
  ffff8e57bffff1a0 (&pgdat->kswapd_wait){....}-{3:3}, at: _raw_spin_lock_irqsave+0x12/0x20

  which lock already depends on the new lock.

  the existing dependency chain (in reverse order) is:

  -> #2 (&pgdat->kswapd_wait){....}-{3:3}:
         __lock_acquire+0x5a4/0xc50
         lock_acquire.part.0+0xb7/0x240
         lock_acquire+0x70/0x170
         __raw_spin_lock_irqsave+0x44/0x80
         _raw_spin_lock_irqsave+0x12/0x20
         __wake_up_common_lock+0x31/0xa0
         __wake_up+0x20/0x40
         kswapd_wakeup_wake+0x7e/0x110
         wakeup_kswapd+0x295/0x320
         wake_all_kswapds+0xac/0x1a0
         __alloc_pages_slowpath.constprop.0+0x282/0xf80
         __alloc_frozen_pages_noprof+0x32a/0x360
         alloc_slab_page+0x2e/0x160
         allocate_slab+0x82/0x420
         new_slab+0x52/0xb0
         refill_objects+0x13d/0x190
         refill_sheaf+0x5d/0xd0
         __pcs_replace_empty_main+0x230/0xb10
         [...]

  -> #1 (kswapd_wakeup){-.-.}-{0:0}:
         __lock_acquire+0x5a4/0xc50
         lock_sync.part.0+0x75/0x100
         lock_sync+0x36/0x70
         might_wakeup_kswapd+0x61/0xa0
         __kfree_rcu_sheaf+0x33/0xd90
         kvfree_call_rcu+0x1d4/0x3b0
         set_cpus_allowed_force+0x163/0x220
         cpuset_cpus_allowed_fallback+0x18b/0x240
         select_fallback_rq+0x1e6/0x250
	 [...]

  -> #0 (&p->pi_lock){-.-.}-{2:2}:
         check_prev_add+0xe6/0xe00
         validate_chain+0x51e/0x6e0
         __lock_acquire+0x5a4/0xc50
         lock_acquire.part.0+0xb7/0x240
         lock_acquire+0x70/0x170
         __raw_spin_lock_irqsave+0x44/0x80
         _raw_spin_lock_irqsave+0x12/0x20
         try_to_wake_up+0x77/0xa90
         default_wake_function+0x27/0x60
         autoremove_wake_function+0x23/0xb0
         __wake_up_common+0xb8/0x170
         __wake_up_common_lock+0x51/0xa0
         __wake_up+0x20/0x40
         kswapd_wakeup_wake+0x7e/0x110
         wakeup_kswapd+0x295/0x320
         wake_all_kswapds+0xac/0x1a0
         __alloc_pages_slowpath.constprop.0+0x282/0xf80
         __alloc_frozen_pages_noprof+0x32a/0x360
         alloc_slab_page+0x2e/0x160
         allocate_slab+0x82/0x420
         new_slab+0x52/0xb0
         refill_objects+0x13d/0x190
         refill_sheaf+0x5d/0xd0
         __pcs_replace_empty_main+0x230/0xb10
         [...]

  other info that might help us debug this:

  Chain exists of:
    &p->pi_lock --> kswapd_wakeup --> &pgdat->kswapd_wait

   Possible unsafe locking scenario:

         CPU0                    CPU1
         ----                    ----
    lock(&pgdat->kswapd_wait);
                                 lock(kswapd_wakeup);
                                 lock(&pgdat->kswapd_wait);
    lock(&p->pi_lock);

   *** DEADLOCK ***

  3 locks held by git/6660:
   #0: ffff8e519f0e9e20 (&type->i_mutex_dir_key#6){++++}-{4:4}, at: lookup_slow+0x2d/0x60
   #1: ffffffff8a31c460 (kswapd_wakeup){-.-.}-

---truncated---

Published 2026-10-18NVD

References 2
Review Av26.10.0x86_64Not exposedFable 5.2 · medium confidence · 2026-11-19

The unfixed code is in this build: __kfree_rcu_sheaf() in mm/slub.c still allocates its empty sheaf with GFP_NOWAIT, which includes __GFP_KSWAPD_RECLAIM, and no applied patch touches it.

The deadlock also needs kfree_rcu() to be called under pi_lock on an object from a sheaf-enabled cache, and no such caller was found in 6.18.60. The only pi_lock caller (do_set_cpus_allowed()) frees a kmalloc_node() cpumask, and kmalloc caches have no sheaves here; only vm_area_struct and maple_node do, so that free bypasses __kfree_rcu_sheaf().

Nothing in the YANG models, CLI or web UI can change this; reaching the deadlock would take a kernel code change (sheaves on kmalloc caches, as in later kernels).

Evidence 12
  1. `BR2_LINUX_KERNEL=y` with `BR2_LINUX_KERNEL_VERSION="6.18.60"` at line 455; the kernel is in the target image.

    output/.config:445

  2. `mm/slub.o` was built (and `mm/slab_common.o` at line 25157), so the affected file is compiled in.

    output/objects.txt:25107

  3. `CONFIG_SLUB=y`, `CONFIG_KVFREE_RCU_BATCHED=y` (939), `CONFIG_SMP=y` (339), `CONFIG_CPUSETS=y` (213); `CONFIG_SLUB_TINY` and `CONFIG_PREEMPT_RT` are not set, so the sheaf path is active.

    output/build/linux-6.18.60/.config:938

  4. `empty = alloc_empty_sheaf(s, GFP_NOWAIT);` inside `__kfree_rcu_sheaf()`; this is the unfixed line.

    output/build/linux-6.18.60/mm/slub.c:6323

  5. `GFP_NOWAIT` is `__GFP_KSWAPD_RECLAIM | __GFP_NOWARN`, so the allocation can wake kswapd.

    output/build/linux-6.18.60/include/linux/gfp_types.h:380

  6. `kfree_rcu_sheaf()` calls `__kfree_rcu_sheaf()` only when the object's cache has `s->cpu_sheaves`; it is called from `kvfree_call_rcu()` at line 2025.

    output/build/linux-6.18.60/mm/slab_common.c:1672

  7. `s->cpu_sheaves` is allocated only when the cache is created with `args->sheaf_capacity`.

    output/build/linux-6.18.60/mm/slub.c:8590

  8. `vm_area_struct` sets `.sheaf_capacity = 32`; together with `maple_node` at `output/build/linux-6.18.60/lib/maple_tree.c:5872` these are the only two caches that enable sheaves.

    output/build/linux-6.18.60/mm/vma_init.c:19

  9. `create_kmalloc_cache()` passes no sheaf capacity, so kmalloc caches have no sheaves in this kernel.

    output/build/linux-6.18.60/mm/slab_common.c:716

  10. The `kfree_rcu()` called under `pi_lock` in `do_set_cpus_allowed()` frees the user cpumask.

    output/build/linux-6.18.60/kernel/sched/core.c:2780

  11. That cpumask comes from `kmalloc_node()`, a cache without sheaves, so the free falls through to the non-sheaf path.

    output/build/linux-6.18.60/kernel/sched/sched.h:2631

  12. `ma_free_rcu()` is the only `kfree_rcu()` found on a sheaf-backed object; it runs by default on VMA changes but in maple-tree writer context, not under `pi_lock`.

    output/build/linux-6.18.60/lib/maple_tree.c:208

Version and patches

The fix is not in the 6.18.60 source: output/build/linux-6.18.60/mm/slub.c:6323 still uses GFP_NOWAIT (Makefile confirms 6.18.60). None of the 139 entries in output/build/linux-6.18.60/.applied_patches_list matches slab, slub, sheaf, kswapd or mm/.

The two upstream fix commits and the CNA affected range could not be read from this tree. The CVE's trace is from 7.2.0-rc1-slab-for-next+ and goes through set_cpus_allowed_force(), which does not appear in kernel/sched/core.c here.

Recommendation

Document as not exposed in this build; no urgent backport.

Pick up the fix through a normal 6.18.y stable bump if upstream backports it. Re-check when moving to a kernel where kmalloc caches use sheaves, because the pi_lock path in do_set_cpus_allowed() would then reach the vulnerable allocation.

If it were reachable, the impact would be a rare scheduler deadlock (local denial of service), not network-triggerable.

Open questions

Does the kernel CNA record list 6.18.y as affected? If its range starts at a later release, this becomes FALSE_POSITIVE.

The review covered the pi_lock caller named in the CVE and searched the scheduler core, VMA and maple-tree files for kfree_rcu() users. It did not audit every maple-tree user in the kernel for one that frees nodes while holding pi_lock or a runqueue lock.

Members of Kernel Kit decide. Sign in if you are one.