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] [day] [month] [year] [list]
Message-ID: <2be96cf8-39fe-4499-9e6b-97268c685698@linaro.org>
Date: Thu, 4 Sep 2025 18:38:33 +0100
From: James Clark <james.clark@...aro.org>
To: Ian Rogers <irogers@...gle.com>
Cc: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
 Arnaldo Carvalho de Melo <acme@...nel.org>,
 Namhyung Kim <namhyung@...nel.org>, Mark Rutland <mark.rutland@....com>,
 Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
 Jiri Olsa <jolsa@...nel.org>, Adrian Hunter <adrian.hunter@...el.com>,
 Kan Liang <kan.liang@...ux.intel.com>, Haibo Xu <haibo1.xu@...el.com>,
 Stephen Brennan <stephen.s.brennan@...cle.com>,
 linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
 Rémi Bernon <rbernon@...eweavers.com>,
 Sam James <sam@...too.org>
Subject: Re: [PATCH v1] perf symbol-elf: Add support for the block argument
 for libbfd



On 04/09/2025 5:17 pm, Ian Rogers wrote:
> James Clark caught that the BUILD_NONDISTRO=1 build with libbfd was
> broken due to an update to the read_build_id function adding a
> blocking argument. Add support for this argument by first opening the
> file blocking or non-blocking, then switching from bfd_openr to
> bfd_fdopenr and passing the opened fd. bfd_fdopenr closes the fd on
> error and when bfd_close are called.
> 
> Reported-by: James Clark <james.clark@...aro.org>
> Closes: https://lore.kernel.org/lkml/20250903-james-perf-read-build-id-fix-v1-2-6a694d0a980f@linaro.org/
> Fixes: 2c369d91d093 ("perf symbol: Add blocking argument to filename__read_build_id")
> Signed-off-by: Ian Rogers <irogers@...gle.com>
> ---
> This patch should be applied after:
> https://lore.kernel.org/lkml/20250903-james-perf-read-build-id-fix-v1-1-6a694d0a980f@linaro.org/
> ---
>   tools/perf/util/symbol-elf.c | 10 +++++++---
>   1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
> index 033c79231a54..1346fd180653 100644
> --- a/tools/perf/util/symbol-elf.c
> +++ b/tools/perf/util/symbol-elf.c
> @@ -873,13 +873,17 @@ static int elf_read_build_id(Elf *elf, void *bf, size_t size)
>   
>   #ifdef HAVE_LIBBFD_BUILDID_SUPPORT
>   
> -static int read_build_id(const char *filename, struct build_id *bid)
> +static int read_build_id(const char *filename, struct build_id *bid, bool block)
>   {
>   	size_t size = sizeof(bid->data);
> -	int err = -1;
> +	int err = -1, fd;
>   	bfd *abfd;
>   
> -	abfd = bfd_openr(filename, NULL);
> +	fd = open(filename, block ? O_RDONLY : (O_RDONLY | O_NONBLOCK));
> +	if (fd < 0)
> +		return -1;
> +
> +	abfd = bfd_fdopenr(filename, /*target=*/NULL, fd);
>   	if (!abfd)
>   		return -1;
>   

Oh that was less awkward than I thought then. Assuming it doesn't mind 
an fd opened with NONBLOCK?

Reviewed-by: James Clark <james.clark@...aro.org>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ