CVE-2023-52860 in Linuxinfo

Summary

by MITRE • 05/21/2024

In the Linux kernel, the following vulnerability has been resolved:

drivers/perf: hisi: use cpuhp_state_remove_instance_nocalls() for hisi_hns3_pmu uninit process

When tearing down a 'hisi_hns3' PMU, we mistakenly run the CPU hotplug callbacks after the device has been unregistered, leading to fireworks when we try to execute empty function callbacks within the driver:

| Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000 | CPU: 0 PID: 15 Comm: cpuhp/0 Tainted: G W O 5.12.0-rc4+ #1 | Hardware name: , BIOS KpxxxFPGA 1P B600 V143 04/22/2021 | pstate: 80400009 (Nzcv daif +PAN -UAO -TCO BTYPE=--) | pc : perf_pmu_migrate_context+0x98/0x38c | lr : perf_pmu_migrate_context+0x94/0x38c | | Call trace: | perf_pmu_migrate_context+0x98/0x38c | hisi_hns3_pmu_offline_cpu+0x104/0x12c [hisi_hns3_pmu]

Use cpuhp_state_remove_instance_nocalls() instead of cpuhp_state_remove_instance() so that the notifiers don't execute after the PMU device has been unregistered.

[will: Rewrote commit message]

Be aware that VulDB is the high quality source for vulnerability data.

Analysis

by VulDB Data Team • 05/21/2024

The vulnerability described in CVE-2023-52860 represents a critical issue within the Linux kernel's performance monitoring unit implementation for the hisi_hns3 driver. This flaw manifests during the device teardown process when the kernel attempts to manage CPU hotplug callbacks in an improper sequence, leading to potential system instability and crashes. The vulnerability specifically affects systems utilizing Huawei's hisi_hns3 network interface controllers that implement performance monitoring units, making it particularly relevant for data center and high-performance computing environments where these devices are commonly deployed.

The technical root cause of this vulnerability lies in the improper ordering of cleanup operations during the hisi_hns3 PMU uninitialization process. When the driver attempts to offline CPU cores during device teardown, it mistakenly executes CPU hotplug callbacks after the device has already been unregistered from the system's device framework. This sequence error creates a race condition where the kernel attempts to access freed memory structures, resulting in NULL pointer dereferences and kernel oops conditions. The specific error trace shows the perf_pmu_migrate_context function attempting to access virtual address zero, indicating that the callback mechanism is trying to execute against a null or invalid PMU context.

This vulnerability directly maps to CWE-476 which describes NULL pointer dereference conditions in software systems. The issue demonstrates a classic improper cleanup sequence problem where the kernel's device management subsystem fails to properly coordinate between device registration/unregistration phases and CPU hotplug notification mechanisms. The flaw enables an attacker to potentially trigger system crashes or, in more sophisticated scenarios, could be leveraged to execute arbitrary code through controlled memory access patterns. The vulnerability affects the broader ATT&CK technique of privilege escalation through kernel exploitation, as it represents an opportunity for malicious actors to disrupt system operations or gain elevated privileges through kernel memory corruption.

The operational impact of this vulnerability extends beyond simple system crashes, potentially affecting the reliability of performance monitoring data collection and system stability in production environments. Organizations deploying Huawei hisi_hns3 network controllers in mission-critical applications face risks of unexpected system downtime, performance degradation, or data corruption during normal device operation cycles. The vulnerability is particularly concerning in virtualized environments where CPU hotplug events are frequent and performance monitoring is critical for resource allocation and system optimization. The risk is amplified in high-availability systems where such crashes could trigger unnecessary failover mechanisms or service disruptions.

Mitigation strategies for this vulnerability require immediate kernel updates from vendors to apply the patched implementation that correctly uses cpuhp_state_remove_instance_nocalls() instead of the problematic cpuhp_state_remove_instance() function. System administrators should prioritize patching affected systems, particularly in environments where performance monitoring is actively utilized. The fix ensures proper ordering of cleanup operations by preventing CPU hotplug notifiers from executing after device unregistration, thereby eliminating the NULL pointer dereference conditions. Organizations should also implement monitoring solutions to detect potential system instability or performance degradation that might indicate exploitation attempts, while maintaining regular kernel update schedules to address similar issues in the future.

Disclosure

05/21/2024

Moderation

accepted

CPE

ready

EPSS

0.00239

KEV

no

Activities

very low

Sources

Want to know what is going to be exploited?

We predict KEV entries!