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: <aM21BtgwBRBWrEEs@x1>
Date: Fri, 19 Sep 2025 16:54:46 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Ian Rogers <irogers@...gle.com>
Cc: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
	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>,
	James Clark <james.clark@...aro.org>,
	Howard Chu <howardchu95@...il.com>,
	linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 1/2] perf evsel: Ensure the fallback message is always
 written to

On Thu, Sep 18, 2025 at 10:24:15AM -0700, Ian Rogers wrote:
> The fallback message is unconditionally printed in places like
> record__open. If no fallback is attempted this can lead to printing
> uninitialized data, crashes, etc.
> 
> Fixes: c0a54341c0e8 ("perf evsel: Introduce event fallback method")
> Signed-off-by: Ian Rogers <irogers@...gle.com>

Thanks, applied to perf-tools-next,

- Arnaldo

> ---
>  tools/perf/util/evsel.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> index 477cddf08c5c..814ef6f6b32a 100644
> --- a/tools/perf/util/evsel.c
> +++ b/tools/perf/util/evsel.c
> @@ -3565,7 +3565,7 @@ bool evsel__fallback(struct evsel *evsel, struct target *target, int err,
>  
>  		/* If event has exclude user then don't exclude kernel. */
>  		if (evsel->core.attr.exclude_user)
> -			return false;
> +			goto no_fallback;
>  
>  		/* Is there already the separator in the name. */
>  		if (strchr(name, '/') ||
> @@ -3573,7 +3573,7 @@ bool evsel__fallback(struct evsel *evsel, struct target *target, int err,
>  			sep = "";
>  
>  		if (asprintf(&new_name, "%s%su", name, sep) < 0)
> -			return false;
> +			goto no_fallback;
>  
>  		free(evsel->name);
>  		evsel->name = new_name;
> @@ -3596,17 +3596,19 @@ bool evsel__fallback(struct evsel *evsel, struct target *target, int err,
>  			sep = "";
>  
>  		if (asprintf(&new_name, "%s%sH", name, sep) < 0)
> -			return false;
> +			goto no_fallback;
>  
>  		free(evsel->name);
>  		evsel->name = new_name;
>  		/* Apple M1 requires exclude_guest */
> -		scnprintf(msg, msgsize, "trying to fall back to excluding guest samples");
> +		scnprintf(msg, msgsize, "Trying to fall back to excluding guest samples");
>  		evsel->core.attr.exclude_guest = 1;
>  
>  		return true;
>  	}
> -
> +no_fallback:
> +	scnprintf(msg, msgsize, "No fallback found for '%s' for error %d",
> +		  evsel__name(evsel), err);
>  	return false;
>  }
>  
> -- 
> 2.51.0.470.ga7dc726c21-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ