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: <20241118225345.889810-2-irogers@google.com>
Date: Mon, 18 Nov 2024 14:53:39 -0800
From: Ian Rogers <irogers@...gle.com>
To: 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>, 
	Ian Rogers <irogers@...gle.com>, Adrian Hunter <adrian.hunter@...el.com>, 
	Kan Liang <kan.liang@...ux.intel.com>, Athira Jajeev <atrajeev@...ux.vnet.ibm.com>, 
	James Clark <james.clark@...aro.org>, Dominique Martinet <asmadeus@...ewreck.org>, 
	Yang Li <yang.lee@...ux.alibaba.com>, Colin Ian King <colin.i.king@...il.com>, 
	Yang Jihong <yangjihong@...edance.com>, "Steinar H. Gunderson" <sesse@...gle.com>, 
	Oliver Upton <oliver.upton@...ux.dev>, Ilkka Koskinen <ilkka@...amperecomputing.com>, 
	Ze Gao <zegao2021@...il.com>, Weilin Wang <weilin.wang@...el.com>, 
	Ben Gainey <ben.gainey@....com>, zhaimingbing <zhaimingbing@...s.chinamobile.com>, 
	Zixian Cai <fzczx123@...il.com>, Andi Kleen <ak@...ux.intel.com>, Paran Lee <p4ranlee@...il.com>, 
	Thomas Falcon <thomas.falcon@...el.com>, linux-kernel@...r.kernel.org, 
	linux-perf-users@...r.kernel.org, 
	"Steven Rostedt (Google)" <rostedt@...dmis.org>
Subject: [PATCH v5 1/7] perf env: Ensure failure broken topology file reads
 are always -1 encoded

get_core_id returns 0 on success and a negative errno value on
error. Currently the error can only be -1, but fixing this to be any
errno value breaks perf:
https://lore.kernel.org/lkml/Zzu4Sdebve-NXEMX@google.com/
To avoid this, make sure all error values are written as -1.

Signed-off-by: Ian Rogers <irogers@...gle.com>
---
 tools/perf/util/env.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/env.c b/tools/perf/util/env.c
index e2843ca2edd9..e890a52e01a6 100644
--- a/tools/perf/util/env.c
+++ b/tools/perf/util/env.c
@@ -326,10 +326,13 @@ int perf_env__read_cpu_topology_map(struct perf_env *env)
 
 	for (idx = 0; idx < nr_cpus; ++idx) {
 		struct perf_cpu cpu = { .cpu = idx };
+		int core_id   = cpu__get_core_id(cpu);
+		int socket_id = cpu__get_socket_id(cpu);
+		int die_id    = cpu__get_die_id(cpu);
 
-		env->cpu[idx].core_id	= cpu__get_core_id(cpu);
-		env->cpu[idx].socket_id	= cpu__get_socket_id(cpu);
-		env->cpu[idx].die_id	= cpu__get_die_id(cpu);
+		env->cpu[idx].core_id	= core_id >= 0 ? core_id : -1;
+		env->cpu[idx].socket_id	= socket_id >= 0 ? socket_id : -1;
+		env->cpu[idx].die_id	= die_id >= 0 ? die_id : -1;
 	}
 
 	env->nr_cpus_avail = nr_cpus;
-- 
2.47.0.338.g60cca15819-goog


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ