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, do_bp() can reach kprobe_singlestep_handler() when
there is no current probe.
The handler actually returns false in this case, but it first calls
preempt_enable_no_resched(). The corresponding preempt_disable() is done
by kprobe_breakpoint_handler() 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 in_interrupt() return true until the task schedules. One
visible consequence is the socket cgroup attribution: cgroup_sk_alloc()
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
BPF_CGROUP_INET_SOCK_CREATE policy attached to the task's own cgroup.
Return as soon as kprobe_running() 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.
CVSS Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
CVSS Score: 7.8
AV:L - An unprivileged LoongArch process reaches do_bp() then kprobe_singlestep_handler() by executing break 11 (BRK_KPROBE_SSTEPBP). That is a local CPU exception path, not a network protocol, adjacent wireless/Bluetooth frame, or physical device interface.
AC:L - With no kprobe running on the CPU (the normal case), break 11 always takes the unmatched preempt_enable_no_resched() path and underflows preempt_count. The attacker then calls socket() from their own SIGTRAP handler; no race or victim-controlled state is required.
PR:L - do_bp() applies no capability or credential check before dispatching BRK_KPROBE_SSTEPBP. Any unprivileged local user who can run code can issue the instruction; init-namespace root and user-namespace capabilities are not required.
UI:N - The attacker executes break 11 in their own process and, for the cgroup bypass, installs their own SIGTRAP handler that creates sockets. No other user must mount a filesystem, open a device, or otherwise cooperate.
S:U - Preempt-count corruption and the resulting socket cgroup/BPF misattribution stay inside the host kernel's security authority. This is not a KVM/Xen guest-to-host escape or an IOMMU/DMA boundary bypass.
C:H - cgroup_sk_alloc() treats the underflow as interrupt context and pins the new socket to the root cgroup, so BPF_CGROUP_INET_SOCK_CREATE and later cgroup bind/connect/egress programs on the task's cgroup do not run. In a container or Cilium-style deployment this bypasses network isolation and can expose protected services.
I:H - Root-cgroup attribution skips the container's cgroup BPF socket and traffic hooks for that socket, fully bypassing that access-control policy, while the unmatched preempt_enable corrupts kernel preempt_count used for interrupt and atomic accounting.
A:H - The underflow makes in_atomic() true, so the next schedule (default SIGTRAP teardown or any blocking syscall) hits BUG: scheduling while atomic and can panic the host, especially with panic_on_warn. mem_cgroup_sk_alloc() also skips container socket charging, allowing host memory exhaustion.
| Attack Vector |
Local |
Scope |
Unchanged |
| Attack Complexity |
Low |
Confidentiality Impact |
High |
| Privileges Required |
Low |
Integrity Impact |
High |
| User Interaction |
None |
Availability Impact |
High |
AV:L - An unprivileged LoongArch process reaches do_bp() then kprobe_singlestep_handler() by executing break 11 (BRK_KPROBE_SSTEPBP). That is a local CPU exception path, not a network protocol, adjacent wireless/Bluetooth frame, or physical device interface.
AC:L - With no kprobe running on the CPU (the normal case), break 11 always takes the unmatched preempt_enable_no_resched() path and underflows preempt_count. The attacker then calls socket() from their own SIGTRAP handler; no race or victim-controlled state is required.
PR:L - do_bp() applies no capability or credential check before dispatching BRK_KPROBE_SSTEPBP. Any unprivileged local user who can run code can issue the instruction; init-namespace root and user-namespace capabilities are not required.
UI:N - The attacker executes break 11 in their own process and, for the cgroup bypass, installs their own SIGTRAP handler that creates sockets. No other user must mount a filesystem, open a device, or otherwise cooperate.
S:U - Preempt-count corruption and the resulting socket cgroup/BPF misattribution stay inside the host kernel's security authority. This is not a KVM/Xen guest-to-host escape or an IOMMU/DMA boundary bypass.
C:H - cgroup_sk_alloc() treats the underflow as interrupt context and pins the new socket to the root cgroup, so BPF_CGROUP_INET_SOCK_CREATE and later cgroup bind/connect/egress programs on the task's cgroup do not run. In a container or Cilium-style deployment this bypasses network isolation and can expose protected services.
I:H - Root-cgroup attribution skips the container's cgroup BPF socket and traffic hooks for that socket, fully bypassing that access-control policy, while the unmatched preempt_enable corrupts kernel preempt_count used for interrupt and atomic accounting.
A:H - The underflow makes in_atomic() true, so the next schedule (default SIGTRAP teardown or any blocking syscall) hits BUG: scheduling while atomic and can panic the host, especially with panic_on_warn. mem_cgroup_sk_alloc() also skips container socket charging, allowing host memory exhaustion.
CVSS 3.1