CVE-2026-99877: LoongArch: Only send SIGTRAP signal if necessary in do_watch()
In the Linux kernel, the following vulnerability has been resolved:
LoongArch: Only send SIGTRAP signal if necessary in dowatch()
In dowatch(), the kernel unconditionally forces a SIGTRAP signal at the end of the handler via forcesig(SIGTRAP). This is essential for ptrace operations, but it severely disrupts standard perfevent usage.
Under normal perf usage, it is not necessary to force a SIGTRAP signal on every hit. Forcing it unnecessarily aborts the target process if no user-space signal handler is registered, which violates performance monitoring behaviors and injects context switch overheads.
However, a conditional check using only 'current->ptrace' would block legitimate user-requested signals when a perfevent is configured with 'attr.sigtrap = 1' for asynchronous user-space tracking.
Fix this by refactoring breakpointhandler() and watchpointhandler() to return a boolean status indicating whether any triggered breakpoint explicitly requires a signal notification. Update dowatch() to enforce the SIGTRAP signal only when the process is actively being debugged via ptrace, or when the underlying perfevent infrastructure specifically demands it via 'attr.sigtrap'.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.6.163 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.12.117 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.18.63 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.3.4 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.12.117-1 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 7.3.4-1 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.12.117-1Fixed in 7.3.4-1 - Compensating control
Update do_watch() to send SIGTRAP only when the process is actively being debugged via ptrace or the perf_event explicitly requests signal notification via attr.sigtrap.
Event History
Frequently Asked Questions
Who is most likely to be affected by this issue?
LoongArch systems using Linux kernel watchpoints or hardware breakpoints through standard perf_event monitoring are affected by the erroneous behavior. Processes can be aborted when a watchpoint or breakpoint is hit and no user-space SIGTRAP handler is registered.
What conditions caused the unwanted SIGTRAP delivery?
Before the fix, do_watch() forced SIGTRAP after handling every watchpoint event, including ordinary perf_event hits. The signal is only needed for ptrace debugging or when the perf event explicitly requests it with attr.sigtrap set to 1.
How can an administrator recognize the issue in practice?
A monitored process may terminate or be interrupted when a perf_event watchpoint or breakpoint triggers, despite not being under ptrace debugging and not having a SIGTRAP handler. The behavior can also add avoidable context-switch overhead during performance monitoring.