CVE-2026-89902: LoongArch: Avoid preempt count underflow without probe
In the Linux kernel, the following vulnerability has been resolved:
LoongArch: Avoid preempt count underflow without probe
LoongArch uses break 11 for the breakpoint placed after an instruction that Kprobes executes out of line. Since userspace can issue the same break instruction, dobp() can reach kprobesinglestephandler() when there is no current probe.
The handler actually returns false in this case, but it first calls preemptenablenoresched(). The corresponding preemptdisable() is done by kprobebreakpointhandler() on a real Kprobe hit, so it has not run here. As a result, an ordinary userspace breakpoint (code 11) underflows the current task's preempt count.
This also makes ininterrupt() return true until the task schedules. One visible consequence is the socket cgroup attribution: cgroupskalloc() treats the allocation as interrupt context and assigns the socket to the root cgroup. A socket opened from the SIGTRAP handler can then avoid a BPFCGROUPINETSOCKCREATE policy attached to the task's own cgroup.
Return as soon as kproberunning() reports no active probe.
The same check has appeared in [PATCH v10 2/4] of the original LoongArch Kprobes series, but was dropped before the feature reached mainline.
Affected Software
Event History
Frequently Asked Questions
Which systems are exposed to this issue?
The issue affects Linux kernel systems running on LoongArch. It is triggered when userspace executes breakpoint instruction code 11, which conflicts with the breakpoint value used by LoongArch Kprobes.
What does an attacker need to do to trigger the bug?
A userspace process must issue a break instruction with code 11. This can cause the breakpoint path to invoke the Kprobe single-step handler without an active probe and underflow the current task's preempt count.
What security impact can result from the preempt-count underflow?
Until the affected task schedules, the kernel can treat it as running in interrupt context. A socket opened from the resulting SIGTRAP handler can be assigned to the root cgroup, potentially bypassing a BPF_CGROUP_INET_SOCK_CREATE policy attached to the task's normal cgroup.
What is the fix?
The resolved change returns immediately when kprobe_running() indicates that no probe is active, before calling preempt_enable_no_resched(). This prevents a userspace breakpoint from reaching the unmatched preemption-enable path.