KernelScan.io

HIGH Introduced in 6.3

loongarch RethookTrampoline Corruption

CVE-2026-89903

CVSS 7.8 / 10.0 NVD

CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

KernelScan AI6.9MEDIUM

01

In the Linux kernel, the following vulnerability has been resolved: LoongArch: Do not save/restore percpu base register in rethook trampoline The rethook trampoline saves $r21 ($u0), the percpu base, into its frame at entry and restores it at exit. Inbetween rethook_trampoline_handler() may schedule via preempt_enable_notrace(). If the task migrates to another CPU, the frame's $r21 holds the old CPU's percpu base, and restoring it poisons $r21 on the new CPU. Until the next user->kernel transition heals $r21, all this_cpu_*() accesses (runqueues, RCU per-CPU data, timer tick programming, FPU ownership) hit the wrong CPU's percpu area. Under kretprobe-heavy preemptible load this can corrupt scheduler and timer state: scheduling-while-atomic splats, wrong-CPU RCU warnings, WARN_ON_ONCE(rq != this_rq()) in nohz_balance_exit_idle(), and CPUs parking in the idle loop with the constant timer never re-armed (hard lockup). Reproduces on a Loongson-3A6000 with kretprobes on VFS paths plus heavy file churn (OS install / unsquashfs). By convention $r21 always holds the current CPU's percpu base in kernel mode: SAVE_SOME() at exception entry reloads it only when coming from user mode, and RESTORE_SOME() restores it only when returning to user mode; the context-switch path never writes it. Therefore the live $r21 at trampoline exit is already correct, and nothing inbetween can change it legitimately (kernel C code cannot write a global register variable). The same flaw existed even in the pre-rethook kretprobe trampoline since v6.3; it was carried over when rethook replaced it. Drop both the save and the restore here. Drop the restore is enough to solve the issue, and drop the save is to keep the code tidy and no need to clear it.

02

Engine v0.6.0

Risk summary

A LoongArch-specific bug in the rethook (kretprobe) trampoline can corrupt the per-CPU base register after a task migrates between CPUs while being traced. This leads to scheduler and timer state corruption, causing hard lockups and kernel panics. It requires a local user with the ability to configure kretprobes on a preemptible LoongArch kernel.

Affectedarch/loongarch/kernel/rethook_trampoline.S (LoongArch rethook/kprobes)

Vulnerability analysis

The rethook trampoline on LoongArch saves and restores the per-CPU base register across a call to the handler, but the handler can schedule and the task may migrate to a different CPU. When the trampoline restores the stale register value, all subsequent per-CPU accesses on the new CPU target the wrong CPU's data, corrupting scheduler, RCU, and timer state until the next user-to-kernel transition. The fix removes the save and restore of this register entirely, relying on the architectural invariant that the register always holds the correct value in kernel mode. This issue is reachable by any local user who can set kretprobes, which typically requires CAP_SYS_ADMIN or equivalent tracing privileges, and only affects LoongArch systems running preemptible kernels with active kretprobe instrumentation.

03

BranchIntroducedFixed inPatch commit
6.126.36.12.1108f15e95b438b
6.186.36.18.51266ffc92e685
6.66.36.6.157a03b5e7483ad
7.26.37.2.5c048b0a3c083
mainline6.37.3c3f2feace5e4
cip/6.126.36.12.111-cip328f15e95b438b

04

State of the newest release of each Civil Infrastructure Platform SLTS tree, from CIP's own fix records.

CIP treeState
cip/6.12Fixed in 6.12.111-cip32