Re: [PATCH 2/2] coresight: etm-perf: reject events that exclude both kernel and user space

From: Wong Steve

Date: Wed Nov 18 2026 - 07:43:53 EST


Hi Junrui,

Nice catch, and thanks for the detailed analysis. We ran into the same
issue independently while auditing privilege checks, and I can confirm
it is real: in etm4_parse_event_config(), and in the same place in
etm3x,

if (attr->exclude_kernel)
curr_config->mode = ETM_MODE_EXCL_KERN;
if (attr->exclude_user)
curr_config->mode = ETM_MODE_EXCL_USER;

the second assignment overwrites ETM_MODE_EXCL_KERN, so an event that
sets both exclude_kernel and exclude_user excludes only user space and
still traces the kernel. perf_event_open() skips perf_allow_kernel()
when exclude_kernel is set, so the privilege check is bypassed and an
unprivileged user can trace the kernel.

Rejecting the combination in etm_event_init(), as your patch does, is
the right place to fix it and covers both etm3x and etm4x. I went
through the patch and it looks correct to me.

Reviewed-by: Suyuan Wang <stevewong@xxxxxxxxxxx>

Suzuki, Mike, James, Leo: this still applies to next-20261117 and the
hole is still open. The patch has been out since August without a reply
-- could you let us know its status? Happy to help if anything is needed
to get it picked up.

Thanks,
Suyuan