Skip to main content

CVE-2023-52771: Vulnerability in Linux Linux

Medium
VulnerabilityCVE-2023-52771cvecve-2023-52771
Published: Tue May 21 2024 (05/21/2024, 15:30:53 UTC)
Source: CVE
Vendor/Project: Linux
Product: Linux

Description

In the Linux kernel, the following vulnerability has been resolved: cxl/port: Fix delete_endpoint() vs parent unregistration race The CXL subsystem, at cxl_mem ->probe() time, establishes a lineage of ports (struct cxl_port objects) between an endpoint and the root of a CXL topology. Each port including the endpoint port is attached to the cxl_port driver. Given that setup, it follows that when either any port in that lineage goes through a cxl_port ->remove() event, or the memdev goes through a cxl_mem ->remove() event. The hierarchy below the removed port, or the entire hierarchy if the memdev is removed needs to come down. The delete_endpoint() callback is careful to check whether it is being called to tear down the hierarchy, or if it is only being called to teardown the memdev because an ancestor port is going through ->remove(). That care needs to take the device_lock() of the endpoint's parent. Which requires 2 bugs to be fixed: 1/ A reference on the parent is needed to prevent use-after-free scenarios like this signature: BUG: spinlock bad magic on CPU#0, kworker/u56:0/11 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS edk2-20230524-3.fc38 05/24/2023 Workqueue: cxl_port detach_memdev [cxl_core] RIP: 0010:spin_bug+0x65/0xa0 Call Trace: do_raw_spin_lock+0x69/0xa0 __mutex_lock+0x695/0xb80 delete_endpoint+0xad/0x150 [cxl_core] devres_release_all+0xb8/0x110 device_unbind_cleanup+0xe/0x70 device_release_driver_internal+0x1d2/0x210 detach_memdev+0x15/0x20 [cxl_core] process_one_work+0x1e3/0x4c0 worker_thread+0x1dd/0x3d0 2/ In the case of RCH topologies, the parent device that needs to be locked is not always @port->dev as returned by cxl_mem_find_port(), use endpoint->dev.parent instead.

AI-Powered Analysis

AILast updated: 07/01/2025, 06:43:10 UTC

Technical Analysis

CVE-2023-52771 is a medium-severity vulnerability in the Linux kernel's CXL (Compute Express Link) subsystem, specifically related to the handling of device removal and endpoint deletion in the cxl_port driver. The vulnerability arises from a race condition between the delete_endpoint() callback and the unregistration of the parent device in the CXL topology. The CXL subsystem builds a hierarchy of ports representing the topology between an endpoint and the root device. When a port or memory device (memdev) is removed, the kernel must correctly teardown the entire hierarchy below the removed port or the entire hierarchy if the memdev is removed. The delete_endpoint() function is responsible for this teardown and must acquire the device_lock() of the endpoint's parent to avoid concurrency issues. However, two bugs were identified: (1) a missing reference on the parent device, which can lead to use-after-free conditions causing kernel crashes or spinlock corruption, and (2) incorrect locking of the parent device in RCH topologies, where the parent device is not always the one returned by cxl_mem_find_port(), but should be endpoint->dev.parent instead. These bugs can cause kernel instability and crashes due to improper synchronization and resource management during device removal. The vulnerability requires local privileges with high privileges (PR:H) and does not require user interaction. The CVSS score is 4.4 (medium), reflecting a local attack vector with low complexity but requiring privileges and resulting in availability impact (kernel crashes). No known exploits in the wild have been reported yet. The fix involves adding proper reference counting on the parent device and correcting the locking mechanism to prevent use-after-free and race conditions during device removal in the CXL subsystem.

Potential Impact

For European organizations, this vulnerability primarily impacts systems running Linux kernels with the affected CXL subsystem code, especially those using hardware or virtualized environments that leverage CXL for memory or device interconnects. The impact is mainly on system availability due to potential kernel crashes or instability caused by race conditions and use-after-free bugs. This can lead to denial of service on critical servers or infrastructure components. Organizations relying on Linux-based servers for cloud, virtualization, or high-performance computing that utilize CXL technology could experience unexpected downtime or require emergency patching. While confidentiality and integrity are not directly affected, the availability impact can disrupt business operations, especially in sectors with high uptime requirements such as finance, telecommunications, and critical infrastructure. The requirement for local privileged access limits the attack surface to insiders or attackers who have already gained elevated privileges, reducing the likelihood of remote exploitation but emphasizing the need for strict privilege management and patching.

Mitigation Recommendations

1. Apply the official Linux kernel patches that address CVE-2023-52771 as soon as they become available from trusted Linux distributions or kernel maintainers. 2. For organizations using custom or long-term support kernels, backport the fixes related to proper parent device referencing and locking in the cxl_port driver. 3. Restrict local privileged access to trusted administrators only, and monitor for any unusual privilege escalations or kernel-level anomalies. 4. Implement kernel crash monitoring and alerting to detect early signs of instability potentially related to this vulnerability. 5. In virtualized environments, ensure hypervisor and guest kernel versions are updated to avoid cascading failures. 6. Conduct thorough testing of CXL-related device removal scenarios in staging environments to verify stability post-patching. 7. Maintain strict control over kernel module loading and device driver updates to prevent untrusted code execution that could exploit this vulnerability.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
Linux
Date Reserved
2024-05-21T15:19:24.239Z
Cisa Enriched
true
Cvss Version
3.1
State
PUBLISHED

Threat ID: 682d9830c4522896dcbe74f5

Added to database: 5/21/2025, 9:09:04 AM

Last enriched: 7/1/2025, 6:43:10 AM

Last updated: 7/25/2025, 6:43:00 PM

Views: 10

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats