CVE-2026-31457 Overview
A NULL pointer dereference vulnerability has been discovered in the Linux kernel's DAMON (Data Access MONitor) subsystem within the sysfs interface. The vulnerability exists in the damon_sysfs_repeat_call_fn() function, which fails to verify that contexts->nr is non-zero before accessing array elements. This allows an attacker with local access to trigger a kernel crash by setting nr_contexts to 0 via sysfs while DAMON is actively running.
Critical Impact
Local attackers can cause a kernel panic and system crash by manipulating DAMON sysfs parameters during runtime, leading to denial of service conditions on affected Linux systems.
Affected Products
- Linux kernel versions with DAMON sysfs interface enabled
- Systems using DAMON for memory access monitoring
- Linux distributions with kernel memory management features active
Discovery Timeline
- 2026-04-22 - CVE-2026-31457 published to NVD
- 2026-04-23 - Last updated in NVD database
Technical Details for CVE-2026-31457
Vulnerability Analysis
The vulnerability resides in the DAMON (Data Access MONitor) sysfs interface within the Linux kernel's memory management subsystem. The damon_sysfs_repeat_call_fn() function calls three subordinate functions—damon_sysfs_upd_tuned_intervals(), damon_sysfs_upd_schemes_stats(), and damon_sysfs_upd_schemes_effective_quotas()—without first validating that the contexts->nr value is greater than zero.
When a user with appropriate privileges writes the value 0 to /sys/kernel/mm/damon/admin/kdamonds/0/contexts/nr_contexts while DAMON is actively running, the subsequent function calls attempt to dereference contexts_arr[0], which results in a NULL pointer dereference. This causes an immediate kernel panic, crashing the system.
Root Cause
The root cause is a missing bounds check in damon_sysfs_repeat_call_fn(). The function assumes that contexts->nr will always be at least 1 when DAMON is running, but the sysfs interface allows users to modify this value to 0 at runtime. The absence of validation before array access creates a race condition where legitimate runtime configuration changes can trigger undefined behavior.
Attack Vector
The vulnerability can be exploited by a local attacker with write access to the DAMON sysfs interface. The attacker must have sufficient privileges to write to /sys/kernel/mm/damon/admin/kdamonds/0/contexts/nr_contexts. As demonstrated in the CVE description, the attack can be reproduced using the DAMON user-space tool (damo) combined with direct sysfs manipulation:
- Start DAMON monitoring with a refresh interval using the damo tool
- Write the value 0 to the nr_contexts sysfs parameter
- The kernel attempts to access an uninitialized array element, triggering a NULL pointer dereference
The exploit requires local access and elevated privileges to the sysfs interface, but no authentication bypass is needed if the attacker already has appropriate system access.
Detection Methods for CVE-2026-31457
Indicators of Compromise
- Kernel panic messages referencing damon_sysfs_repeat_call_fn() or related DAMON functions
- System crashes immediately following writes to /sys/kernel/mm/damon/admin/kdamonds/*/contexts/nr_contexts
- Unexpected NULL pointer dereference oops messages in kernel logs involving memory management subsystems
- Repeated system reboots correlated with DAMON monitoring activity
Detection Strategies
- Monitor sysfs writes to DAMON configuration paths, particularly nr_contexts parameters being set to zero
- Implement kernel log monitoring for NULL pointer dereference messages in mm/damon/sysfs components
- Track process activity accessing /sys/kernel/mm/damon/admin/ directory structure
- Deploy auditd rules to log modifications to DAMON sysfs parameters
Monitoring Recommendations
- Configure centralized logging for kernel panic events and oops messages
- Implement real-time alerting on unexpected system restarts affecting systems with DAMON enabled
- Monitor for suspicious use of the damo user-space tool or direct sysfs manipulation scripts
- Enable kernel crashdump analysis to identify root causes of memory management-related crashes
How to Mitigate CVE-2026-31457
Immediate Actions Required
- Apply the official kernel patches from the Linux kernel stable branches immediately
- Restrict access to DAMON sysfs interfaces to only trusted administrators
- Monitor systems for attempted exploitation using the detection strategies outlined above
- Consider temporarily disabling DAMON if patching is not immediately possible and the feature is not critical
Patch Information
The Linux kernel maintainers have released patches to address this vulnerability by adding the missing contexts->nr check in damon_sysfs_repeat_call_fn(). The patches are available through the following commits:
Organizations should update to kernel versions containing these commits or apply the patches to their current kernel builds.
Workarounds
- Restrict write access to /sys/kernel/mm/damon/admin/ using filesystem permissions or mandatory access control (SELinux/AppArmor)
- Disable the DAMON sysfs interface if not required by setting CONFIG_DAMON_SYSFS=n during kernel compilation
- Use access control lists (ACLs) to limit which users and processes can modify DAMON parameters
- Implement runtime monitoring to detect and block writes of value 0 to nr_contexts parameters
# Restrict DAMON sysfs access to root only
chmod 700 /sys/kernel/mm/damon/admin/
# Alternative: Use ACL to restrict specific users
setfacl -R -m u:monitoring_user:r /sys/kernel/mm/damon/admin/
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

