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]
Message-ID: <YysWVB724LBSFhII@kernel.org>
Date:   Wed, 21 Sep 2022 14:49:08 +0100
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Namhyung Kim <namhyung@...nel.org>
Cc:     Jiri Olsa <jolsa@...nel.org>, Ingo Molnar <mingo@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Ian Rogers <irogers@...gle.com>,
        Adrian Hunter <adrian.hunter@...el.com>,
        linux-perf-users@...r.kernel.org
Subject: Re: [PATCH v2 1/2] perf tools: Honor namespace when synthesizing
 build-id

Em Tue, Sep 20, 2022 at 03:28:21PM -0700, Namhyung Kim escreveu:
> It needs to go into a namespace before reading a file.
> 
> Fixes: 4183a8d70a28 ("perf tools: Allow synthesizing the build id for kernel/modules/tasks in PERF_RECORD_MMAP2")
> Signed-off-by: Namhyung Kim <namhyung@...nel.org>

Thanks, applied to perf/urgent.

- Arnaldo

> ---
>  tools/perf/util/synthetic-events.c | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/perf/util/synthetic-events.c b/tools/perf/util/synthetic-events.c
> index 0ff57ca24577..289ea17ac5f7 100644
> --- a/tools/perf/util/synthetic-events.c
> +++ b/tools/perf/util/synthetic-events.c
> @@ -367,13 +367,24 @@ static void perf_record_mmap2__read_build_id(struct perf_record_mmap2 *event,
>  					     bool is_kernel)
>  {
>  	struct build_id bid;
> +	struct nsinfo *nsi;
> +	struct nscookie nc;
>  	int rc;
>  
> -	if (is_kernel)
> +	if (is_kernel) {
>  		rc = sysfs__read_build_id("/sys/kernel/notes", &bid);
> -	else
> -		rc = filename__read_build_id(event->filename, &bid) > 0 ? 0 : -1;
> +		goto out;
> +	}
> +
> +	nsi = nsinfo__new(event->pid);
> +	nsinfo__mountns_enter(nsi, &nc);
>  
> +	rc = filename__read_build_id(event->filename, &bid) > 0 ? 0 : -1;
> +
> +	nsinfo__mountns_exit(&nc);
> +	nsinfo__put(nsi);
> +
> +out:
>  	if (rc == 0) {
>  		memcpy(event->build_id, bid.data, sizeof(bid.data));
>  		event->build_id_size = (u8) bid.size;
> -- 
> 2.37.3.968.ga6b4b080e4-goog

-- 

- Arnaldo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ