[PATCH] coresight: configfs: restrict address parameter value to root

Leo Yan leo.yan at arm.com
Wed Aug 12 07:12:57 PDT 2026


On Wed, Aug 12, 2026 at 05:13:14PM +0800, Junrui Luo via B4 Relay wrote:

> Mark parameters that can hold a kernel address, and give those a
> config_item_type whose 'value' attribute is 0600. Parameters holding
> plain numbers, such as the strobing 'window' and 'period' counts, keep
> the existing mode.

Thanks for reporting the issue.

The patch seems overly complex to me. I'd suggest:

--- a/drivers/hwtracing/coresight/coresight-syscfg-configfs.c
+++ b/drivers/hwtracing/coresight/coresight-syscfg-configfs.c
@@ -281,9 +281,16 @@ static ssize_t cscfg_param_value_show(struct config_item *item, char *page)
 {
        struct cscfg_fs_param *param_item = container_of(to_config_group(item),
                                                         struct cscfg_fs_param, group);
-       u64 value = param_item->feat_desc->params_desc[param_item->param_idx].value;
-
-       return scnprintf(page, PAGE_SIZE, "0x%llx\n", value);
+       struct cscfg_parameter_desc *param_desc =
+               param_item->feat_desc->params_desc + param_item->param_idx;
+       const char *name = param_desc->name;
+       u64 value = param_desc->value;
+
+       /* The kernel address should print with the "%pK" specifier */
+       if (!strncmp(name, "address"))
+               return scnprintf(page, PAGE_SIZE, "0x%pK\n", value);
+       else
+               return scnprintf(page, PAGE_SIZE, "0x%llx\n", value);
 }

We can add a flag (e.g., is_addr) in cscfg_parameter_desc to indicate
a parameter presents an address. Since currently only pstop's "address"
parameter has this issue, adding a general flag can be deferred until
it is actually needed.

Thanks,
Leo



More information about the linux-arm-kernel mailing list