Description
In the Linux kernel, the following vulnerability has been resolved:

kthread: consolidate kthread exit paths to prevent use-after-free

Guillaume reported crashes via corrupted RCU callback function pointers
during KUnit testing. The crash was traced back to the pidfs rhashtable
conversion which replaced the 24-byte rb_node with an 8-byte rhash_head
in struct pid, shrinking it from 160 to 144 bytes.

struct kthread (without CONFIG_BLK_CGROUP) is also 144 bytes. With
CONFIG_SLAB_MERGE_DEFAULT and SLAB_HWCACHE_ALIGN both round up to
192 bytes and share the same slab cache. struct pid.rcu.func and
struct kthread.affinity_node both sit at offset 0x78.

When a kthread exits via make_task_dead() it bypasses kthread_exit() and
misses the affinity_node cleanup. free_kthread_struct() frees the memory
while the node is still linked into the global kthread_affinity_list. A
subsequent list_del() by another kthread writes through dangling list
pointers into the freed and reused memory, corrupting the pid's
rcu.func pointer.

Instead of patching free_kthread_struct() to handle the missed cleanup,
consolidate all kthread exit paths. Turn kthread_exit() into a macro
that calls do_exit() and add kthread_do_exit() which is called from
do_exit() for any task with PF_KTHREAD set. This guarantees that
kthread-specific cleanup always happens regardless of the exit path -
make_task_dead(), direct do_exit(), or kthread_exit().

Replace __to_kthread() with a new tsk_is_kthread() accessor in the
public header. Export do_exit() since module code using the
kthread_exit() macro now needs it directly.
Published: 2026-05-08
Score: 7.0 High
EPSS: < 1% Very Low
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

This vulnerability exposed a use‑after‑free bug in the Linux kernel’s kthread implementation. When a kernel thread exited via make_task_dead(), the kthread_exit() cleanup path was bypassed, leaving a kthread_affinity node linked to freed memory. Later list operations could overwrite the freed memory, corrupting rcu function pointers. This would likely trigger crashes or, in the worst case, allow execution of arbitrary code if an attacker could force the corrupted function pointer to point to malicious code. The likely attack vector is local kernel code execution or privilege escalation, inferred from the fact that the flaw involves kernel memory corruption and requires code to run in kernel context.

Affected Systems

The flaw exists in all publicly released versions of the Linux kernel prior to the patch being merged into the mainline repository. Any distribution whose kernel has not yet incorporated the changes remains vulnerable. The patch modifies behaviour for all kernel threads, regardless of CONFIG_BLK_CGROUP, and is tied to the mainline kernel source tree.

Risk and Exploitability

The CVSS score is 7.0. EPSS is not available, and the vulnerability is not listed in the CISA KEV catalog. Because the bug involves kernel memory corruption, exploiting it would require local code execution or privilege escalation. The patch consolidates exit paths, ensuring cleanup occurs on all exit routes, preventing the bypass that previously allowed dangling list references. Therefore the risk is primarily to systems that have not applied the patch; old kernels may still be vulnerable, requiring mitigation. The conditions for exploitation are not explicitly documented, but the description suggests that an attacker would need to trigger a kthread exit via make_task_dead() while another thread performs a list_del(), which could be arranged through local privilege escalation or compromised kernel code. The vulnerability was addressed in the standard kernel update cycle, and systems that have kept up with kernel updates are no longer affected.

Generated by OpenCVE AI on May 9, 2026 at 04:44 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade the operating system or kernel package to a release that includes the kthread exit path consolidation patch
  • Reboot the system so the new kernel takes effect
  • If the distribution does not provide the immediate updates, rebuild the kernel from the latest mainline source that incorporates the patch

Generated by OpenCVE AI on May 9, 2026 at 04:44 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Sat, 09 May 2026 03:15:00 +0000

Type Values Removed Values Added
Weaknesses CWE-416

Sat, 09 May 2026 00:15:00 +0000

Type Values Removed Values Added
Weaknesses CWE-825
References
Metrics threat_severity

None

cvssV3_1

{'score': 7.0, 'vector': 'CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H'}

threat_severity

Moderate


Fri, 08 May 2026 18:30:00 +0000

Type Values Removed Values Added
Weaknesses CWE-416

Fri, 08 May 2026 14:45:00 +0000

Type Values Removed Values Added
Description In the Linux kernel, the following vulnerability has been resolved: kthread: consolidate kthread exit paths to prevent use-after-free Guillaume reported crashes via corrupted RCU callback function pointers during KUnit testing. The crash was traced back to the pidfs rhashtable conversion which replaced the 24-byte rb_node with an 8-byte rhash_head in struct pid, shrinking it from 160 to 144 bytes. struct kthread (without CONFIG_BLK_CGROUP) is also 144 bytes. With CONFIG_SLAB_MERGE_DEFAULT and SLAB_HWCACHE_ALIGN both round up to 192 bytes and share the same slab cache. struct pid.rcu.func and struct kthread.affinity_node both sit at offset 0x78. When a kthread exits via make_task_dead() it bypasses kthread_exit() and misses the affinity_node cleanup. free_kthread_struct() frees the memory while the node is still linked into the global kthread_affinity_list. A subsequent list_del() by another kthread writes through dangling list pointers into the freed and reused memory, corrupting the pid's rcu.func pointer. Instead of patching free_kthread_struct() to handle the missed cleanup, consolidate all kthread exit paths. Turn kthread_exit() into a macro that calls do_exit() and add kthread_do_exit() which is called from do_exit() for any task with PF_KTHREAD set. This guarantees that kthread-specific cleanup always happens regardless of the exit path - make_task_dead(), direct do_exit(), or kthread_exit(). Replace __to_kthread() with a new tsk_is_kthread() accessor in the public header. Export do_exit() since module code using the kthread_exit() macro now needs it directly.
Title kthread: consolidate kthread exit paths to prevent use-after-free
First Time appeared Linux
Linux linux Kernel
CPEs cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
Vendors & Products Linux
Linux linux Kernel
References

Subscriptions

Linux Linux Kernel
cve-icon MITRE

Status: PUBLISHED

Assigner: Linux

Published:

Updated: 2026-05-08T14:21:43.550Z

Reserved: 2026-05-01T14:12:56.007Z

Link: CVE-2026-43402

cve-icon Vulnrichment

No data.

cve-icon NVD

Status : Received

Published: 2026-05-08T15:16:51.670

Modified: 2026-05-08T15:16:51.670

Link: CVE-2026-43402

cve-icon Redhat

Severity : Moderate

Publid Date: 2026-05-08T00:00:00Z

Links: CVE-2026-43402 - Bugzilla

cve-icon OpenCVE Enrichment

Updated: 2026-05-09T04:45:26Z

Weaknesses