Skip to contentSkip to conversation

CVE-2025-38131: coresight: prevent deactivate active config while enabling the config

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Jul 3, 2025

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

Description
===========

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

coresight: prevent deactivate active config while enabling the config

While enable active config via cscfg_csdev_enable_active_config(), active config could be deactivated via configfs' sysfs interface. This could make UAF issue in below scenario:

CPU0 CPU1
(sysfs enable) load module
cscfg_load_config_sets() activate config. // sysfs (sys_active_cnt == 1)
...
cscfg_csdev_enable_active_config() lock(csdev->cscfg_csdev_lock)
// here load config activate by CPU1 unlock(csdev->cscfg_csdev_lock)

deactivate config // sysfs (sys_activec_cnt == 0) cscfg_unload_config_sets() unload module

// access to config_desc which freed
// while unloading module.
cscfg_csdev_enable_config

To address this, use cscfg_config_desc's active_cnt as a reference count
which will be holded when
- activate the config.
- enable the activated config.
and put the module reference when config_active_cnt == 0.

The Linux kernel CVE team has assigned CVE-2025-38131 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 5.15 with commit f8cce2ff3c04361b8843d8489620fda8880f668b and fixed in 6.1.142 with commit dfe8224c9c7a43d356eb9f74b06868aa05f90223
	Issue introduced in 5.15 with commit f8cce2ff3c04361b8843d8489620fda8880f668b and fixed in 6.6.94 with commit b3b4efa2e623aecaebd7c9b9e4171f5c659e9724
	Issue introduced in 5.15 with commit f8cce2ff3c04361b8843d8489620fda8880f668b and fixed in 6.12.34 with commit 31028812724cef7bd57a51525ce58a32a6d73b22
	Issue introduced in 5.15 with commit f8cce2ff3c04361b8843d8489620fda8880f668b and fixed in 6.15.3 with commit ed42ee1ed05ff2f4c36938379057413a40c56680
	Issue introduced in 5.15 with commit f8cce2ff3c04361b8843d8489620fda8880f668b and fixed in 6.16-rc1 with commit 408c97c4a5e0b634dcd15bf8b8808b382e888164

Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at

	https://cve.org/CVERecord/?id=CVE-2025-38131

will be updated if fixes are backported, please check that for the most up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
drivers/hwtracing/coresight/coresight-config.h drivers/hwtracing/coresight/coresight-syscfg.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:

	https://git.kernel.org/stable/c/dfe8224c9c7a43d356eb9f74b06868aa05f90223
	https://git.kernel.org/stable/c/b3b4efa2e623aecaebd7c9b9e4171f5c659e9724
	https://git.kernel.org/stable/c/31028812724cef7bd57a51525ce58a32a6d73b22
	https://git.kernel.org/stable/c/ed42ee1ed05ff2f4c36938379057413a40c56680
	https://git.kernel.org/stable/c/408c97c4a5e0b634dcd15bf8b8808b382e888164