linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5] coresight: prevent deactivate active config while enabling the config
@ 2025-05-13 17:06 Yeoreum Yun
  2025-05-13 17:06 ` [PATCH v5 1/3] coresight/etm4: fix missing disable active config Yeoreum Yun
  0 siblings, 1 reply; 13+ messages in thread
From: Yeoreum Yun @ 2025-05-13 17:06 UTC (permalink / raw)
  To: suzuki.poulose, mike.leach, james.clark, alexander.shishkin,
	leo.yan
  Cc: coresight, linux-arm-kernel, linux-kernel, Yeoreum Yun

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.
cfs_csdev_enable_config

To address this,
  Patch #1 fix missing disable config when etm4 device is disabled via sysfs
  Patch #2 holding cscfg_csdev_lock while removing config from cscfg_csdsev_list
  Patch #3 add wrapper to prevent deactivation of config whlie enabling it

Patch History
==============
From v4 to v5
  - separate patch set (from Leo Yan)
  - https://lore.kernel.org/all/20250324191740.64964-1-yeoreum.yun@arm.com/


Yeoreum Yun (3):
  coresight/etm4: fix missing disable active config
  coresight: holding cscfg_csdev_lock while removing cscfg from csdev
  coresight: prevent deactivate active config while enabling the config

 .../hwtracing/coresight/coresight-config.h    |  2 +-
 .../coresight/coresight-etm4x-core.c          |  3 ++
 .../hwtracing/coresight/coresight-syscfg.c    | 52 +++++++++++++------
 3 files changed, 41 insertions(+), 16 deletions(-)

--
LEVI:{C3F47F37-75D8-414A-A8BA-3980EC8A46D7}



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2025-05-14 13:54 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-13 17:06 [PATCH v5] coresight: prevent deactivate active config while enabling the config Yeoreum Yun
2025-05-13 17:06 ` [PATCH v5 1/3] coresight/etm4: fix missing disable active config Yeoreum Yun
2025-05-13 17:06   ` [PATCH v5 2/3] coresight: holding cscfg_csdev_lock while removing cscfg from csdev Yeoreum Yun
2025-05-13 17:06     ` [PATCH v5 3/3] coresight: prevent deactivate active config while enabling the config Yeoreum Yun
2025-05-14  9:30       ` Leo Yan
2025-05-14  9:39         ` Leo Yan
2025-05-14 11:14           ` Yeoreum Yun
2025-05-14 11:04         ` Yeoreum Yun
2025-05-14 12:47           ` Leo Yan
2025-05-14  9:15     ` [PATCH v5 2/3] coresight: holding cscfg_csdev_lock while removing cscfg from csdev Leo Yan
2025-05-14 11:13       ` Yeoreum Yun
2025-05-14  9:05   ` [PATCH v5 1/3] coresight/etm4: fix missing disable active config Leo Yan
2025-05-14 11:16     ` Yeoreum Yun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).