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: <20220412154817.2728324-2-irogers@google.com>
Date:   Tue, 12 Apr 2022 08:48:14 -0700
From:   Ian Rogers <irogers@...gle.com>
To:     John Garry <john.garry@...wei.com>, Will Deacon <will@...nel.org>,
        Mathieu Poirier <mathieu.poirier@...aro.org>,
        Leo Yan <leo.yan@...aro.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>,
        James Clark <james.clark@....com>,
        Alexandre Truong <alexandre.truong@....com>,
        German Gomez <german.gomez@....com>,
        Ian Rogers <irogers@...gle.com>,
        Dave Marchevsky <davemarchevsky@...com>,
        Song Liu <songliubraving@...com>,
        Ravi Bangoria <ravi.bangoria@....com>,
        Li Huafei <lihuafei1@...wei.com>,
        "Martin Liška" <mliska@...e.cz>,
        William Cohen <wcohen@...hat.com>,
        Riccardo Mancini <rickyman7@...il.com>,
        Masami Hiramatsu <mhiramat@...nel.org>,
        Thomas Richter <tmricht@...ux.ibm.com>,
        Lexi Shao <shaolexi@...wei.com>,
        Remi Bernon <rbernon@...eweavers.com>,
        Michael Petlan <mpetlan@...hat.com>,
        Denis Nikitin <denik@...omium.org>,
        linux-arm-kernel@...ts.infradead.org,
        linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:     Stephane Eranian <eranian@...gle.com>
Subject: [PATCH v2 1/4] perf symbols: Always do architecture specific fixups

The change:
https://lore.kernel.org/lkml/20220317135536.805-1-mpetlan@redhat.com/
modified the condition for architecture specific fixups motivated by a
PowerPC case. So that architectures can independently modify their
condition, move the if into the called architecture symbols__fixup_end
function and always call it.
---
 tools/perf/arch/arm64/util/machine.c   | 14 ++++++++------
 tools/perf/arch/powerpc/util/machine.c | 14 ++++++++------
 tools/perf/arch/s390/util/machine.c    | 14 ++++++++------
 tools/perf/util/symbol.c               |  6 +++---
 4 files changed, 27 insertions(+), 21 deletions(-)

diff --git a/tools/perf/arch/arm64/util/machine.c b/tools/perf/arch/arm64/util/machine.c
index d2ce31e28cd7..1cc33b323c3f 100644
--- a/tools/perf/arch/arm64/util/machine.c
+++ b/tools/perf/arch/arm64/util/machine.c
@@ -20,13 +20,15 @@
 
 void arch__symbols__fixup_end(struct symbol *p, struct symbol *c)
 {
-	if ((strchr(p->name, '[') && strchr(c->name, '[') == NULL) ||
+	if (p->end == p->start || p->end != c->start) {
+		if ((strchr(p->name, '[') && strchr(c->name, '[') == NULL) ||
 			(strchr(p->name, '[') == NULL && strchr(c->name, '[')))
-		/* Limit range of last symbol in module and kernel */
-		p->end += SYMBOL_LIMIT;
-	else
-		p->end = c->start;
-	pr_debug4("%s sym:%s end:%#" PRIx64 "\n", __func__, p->name, p->end);
+			/* Limit range of last symbol in module and kernel */
+			p->end += SYMBOL_LIMIT;
+		else
+			p->end = c->start;
+		pr_debug4("%s sym:%s end:%#" PRIx64 "\n", __func__, p->name, p->end);
+	}
 }
 
 void arch__add_leaf_frame_record_opts(struct record_opts *opts)
diff --git a/tools/perf/arch/powerpc/util/machine.c b/tools/perf/arch/powerpc/util/machine.c
index e652a1aa8132..88a8abf98a57 100644
--- a/tools/perf/arch/powerpc/util/machine.c
+++ b/tools/perf/arch/powerpc/util/machine.c
@@ -16,10 +16,12 @@
 
 void arch__symbols__fixup_end(struct symbol *p, struct symbol *c)
 {
-	if (strchr(p->name, '[') == NULL && strchr(c->name, '['))
-		/* Limit the range of last kernel symbol */
-		p->end += page_size;
-	else
-		p->end = c->start;
-	pr_debug4("%s sym:%s end:%#" PRIx64 "\n", __func__, p->name, p->end);
+	if (p->end == p->start || p->end != c->start) {
+		if (strchr(p->name, '[') == NULL && strchr(c->name, '['))
+			/* Limit the range of last kernel symbol */
+			p->end += page_size;
+		else
+			p->end = c->start;
+		pr_debug4("%s sym:%s end:%#" PRIx64 "\n", __func__, p->name, p->end);
+	}
 }
diff --git a/tools/perf/arch/s390/util/machine.c b/tools/perf/arch/s390/util/machine.c
index 7644a4f6d4a4..0b750738ec68 100644
--- a/tools/perf/arch/s390/util/machine.c
+++ b/tools/perf/arch/s390/util/machine.c
@@ -44,10 +44,12 @@ int arch__fix_module_text_start(u64 *start, u64 *size, const char *name)
  */
 void arch__symbols__fixup_end(struct symbol *p, struct symbol *c)
 {
-	if (strchr(p->name, '[') == NULL && strchr(c->name, '['))
-		/* Last kernel symbol mapped to end of page */
-		p->end = roundup(p->end, page_size);
-	else
-		p->end = c->start;
-	pr_debug4("%s sym:%s end:%#" PRIx64 "\n", __func__, p->name, p->end);
+	if (p->end == p->start || p->end != c->start) {
+		if (strchr(p->name, '[') == NULL && strchr(c->name, '['))
+			/* Last kernel symbol mapped to end of page */
+			p->end = roundup(p->end, page_size);
+		else
+			p->end = c->start;
+		pr_debug4("%s sym:%s end:%#" PRIx64 "\n", __func__, p->name, p->end);
+	}
 }
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index dea0fc495185..394ad493c343 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -103,7 +103,8 @@ static int prefix_underscores_count(const char *str)
 
 void __weak arch__symbols__fixup_end(struct symbol *p, struct symbol *c)
 {
-	p->end = c->start;
+	if (p->end == p->start || p->end != c->start)
+		p->end = c->start;
 }
 
 const char * __weak arch__normalize_symbol_name(const char *name)
@@ -231,8 +232,7 @@ void symbols__fixup_end(struct rb_root_cached *symbols)
 		prev = curr;
 		curr = rb_entry(nd, struct symbol, rb_node);
 
-		if (prev->end == prev->start || prev->end != curr->start)
-			arch__symbols__fixup_end(prev, curr);
+		arch__symbols__fixup_end(prev, curr);
 	}
 
 	/* Last entry */
-- 
2.35.1.1178.g4f1659d476-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ