lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 16 Nov 2021 09:46:20 +0000
From:   Suzuki K Poulose <suzuki.poulose@....com>
To:     Leo Yan <leo.yan@...aro.org>,
        Mathieu Poirier <mathieu.poirier@...aro.org>,
        Mike Leach <mike.leach@...aro.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        James Clark <james.clark@....com>, coresight@...ts.linaro.org,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 3/4] coresight: etm4x: Don't trace contextID for
 non-root namespace in perf mode

Hi Leo,

On 31/10/2021 14:42, Leo Yan wrote:
> When runs in perf mode, the driver always enables the contextID tracing.
> This can lead to confusion if the program runs in non-root PID namespace
> and potentially leak kernel information.
> 
> When programs running in perf mode, this patch changes to only enable
> contextID tracing for root PID namespace.
> 

The only concern with the patch here is we silently ignore the CTXTID
flag and the perf assumes the CTXTID is traced, when traced from a 
non-root namespace. Does the decoder handle this case gracefully ? We are
fine if that is the case.

Either way, we don't want to enforce the policy in the perf tool, if we
can transparently handle the missing CTXTID and allow the trace session
and decode complete. That said, your approach is the safe bet here.


> Signed-off-by: Leo Yan <leo.yan@...aro.org>
> ---
>   drivers/hwtracing/coresight/coresight-etm4x-core.c | 10 ++++++++--
>   1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
> index e24252eaf8e4..6e614bfb38c6 100644
> --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
> +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
> @@ -615,7 +615,9 @@ static int etm4_parse_event_config(struct coresight_device *csdev,
>   		config->cfg |= BIT(11);
>   	}
>   
> -	if (attr->config & BIT(ETM_OPT_CTXTID))
> +	/* Only trace contextID when runs in root PID namespace */
> +	if ((attr->config & BIT(ETM_OPT_CTXTID)) &&
> +	    (task_active_pid_ns(current) == &init_pid_ns))
>   		/* bit[6], Context ID tracing bit */
>   		config->cfg |= BIT(ETM4_CFG_BIT_CTXTID);
>   

As mentioned in the previous comment, please add a helper here, than 
open coding the check.

Kind regards
Suzuki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ