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-5-irogers@google.com>
Date:   Tue, 12 Apr 2022 08:48:17 -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 4/4] perf symbols: More specific architecture end fixing

Make the conditions used for symbol fixup closer to the comments. The
logic aims to combine the current conditions as last modified in:
https://lore.kernel.org/lkml/20220317135536.805-1-mpetlan@redhat.com/
---
 tools/perf/arch/arm64/util/machine.c   | 19 ++++++++++---------
 tools/perf/arch/powerpc/util/machine.c | 18 +++++++++---------
 tools/perf/arch/s390/util/machine.c    | 17 +++++++++--------
 3 files changed, 28 insertions(+), 26 deletions(-)

diff --git a/tools/perf/arch/arm64/util/machine.c b/tools/perf/arch/arm64/util/machine.c
index 54fb41de9931..f258c1ebac03 100644
--- a/tools/perf/arch/arm64/util/machine.c
+++ b/tools/perf/arch/arm64/util/machine.c
@@ -18,16 +18,17 @@
 
 #define SYMBOL_LIMIT (1 << 12) /* 4K */
 
-void arch__symbols__fixup_end(struct symbol *p, struct symbol *c,
-			      bool is_kernel __maybe_unused)
+void arch__symbols__fixup_end(struct symbol *p, struct symbol *c, bool is_kernel)
 {
-	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;
+	if (is_kernel && (p->end == p->start || p->end != c->start) &&
+	    ((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;
+		pr_debug4("%s sym:%s end:%#" PRIx64 "\n", __func__, p->name, p->end);
+	} else if (p->end == p->start) {
+		/* Expand empty symbols. */
+		p->end = c->start;
 		pr_debug4("%s sym:%s end:%#" PRIx64 "\n", __func__, p->name, p->end);
 	}
 }
diff --git a/tools/perf/arch/powerpc/util/machine.c b/tools/perf/arch/powerpc/util/machine.c
index a732601f951e..689a48040b64 100644
--- a/tools/perf/arch/powerpc/util/machine.c
+++ b/tools/perf/arch/powerpc/util/machine.c
@@ -14,16 +14,16 @@
  * Therefore do not fill this gap and do not assign it to the kernel dso map.
  */
 
-void arch__symbols__fixup_end(struct symbol *p, struct symbol *c,
-			      bool is_kernel __maybe_unused)
+void arch__symbols__fixup_end(struct symbol *p, struct symbol *c, bool is_kernel)
 )
 {
-	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);
+	if (is_kernel && (p->end == p->start || p->end != c->start) &&
+	    strchr(p->name, '[') == NULL && strchr(c->name, '[')) {
+		/* Limit the range of last kernel symbol */
+		p->end += page_size;
+	} else if (p->end == p->start) {
+		/* Expand empty symbols. */
+		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 8622a1b78748..790d98a39c83 100644
--- a/tools/perf/arch/s390/util/machine.c
+++ b/tools/perf/arch/s390/util/machine.c
@@ -42,15 +42,16 @@ int arch__fix_module_text_start(u64 *start, u64 *size, const char *name)
  * and beginning of first module's text segment is very big.
  * Therefore do not fill this gap and do not assign it to the kernel dso map.
  */
-void arch__symbols__fixup_end(struct symbol *p, struct symbol *c,
-			      bool is_kernel __maybe_unused)
+void arch__symbols__fixup_end(struct symbol *p, struct symbol *c, bool is_kernel)
 {
-	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;
+	if (is_kernel && (p->end == p->start || p->end != c->start) &&
+	    strchr(p->name, '[') == NULL && strchr(c->name, '[')) {
+		/* Last kernel symbol mapped to end of page */
+		p->end = roundup(p->end, page_size);
+		pr_debug4("%s sym:%s end:%#" PRIx64 "\n", __func__, p->name, p->end);
+	} else if (p->end == p->start) {
+		/* Expand empty symbols. */
+		p->end = c->start;
 		pr_debug4("%s sym:%s end:%#" PRIx64 "\n", __func__, p->name, p->end);
 	}
 }
-- 
2.35.1.1178.g4f1659d476-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ