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: <YlX5U+Qelf/rBdau@google.com>
Date:   Tue, 12 Apr 2022 15:12:35 -0700
From:   Namhyung Kim <namhyung@...nel.org>
To:     Ian Rogers <irogers@...gle.com>
Cc:     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>,
        James Clark <james.clark@....com>,
        Alexandre Truong <alexandre.truong@....com>,
        German Gomez <german.gomez@....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,
        Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH v2 0/4] Tidy up symbol end fixup

Hi Ian,

On Tue, Apr 12, 2022 at 08:48:13AM -0700, Ian Rogers wrote:
> Fixing up more symbol ends as introduced in:
> https://lore.kernel.org/lkml/20220317135536.805-1-mpetlan@redhat.com/
> caused perf annotate to run into memory limits - every symbol holds
> all the disassembled code in the annotation, and so making symbols
> ends further away dramatically increased memory usage (40MB to
>  >1GB). Modify the symbol end logic so that special kernel cases aren't
> applied in the common case.
> 
> v2. Drops a merged patch. Fixes a build issue with libbfd enabled.

How about just like this?  We can get rid of arch functions as they
mostly do the same thing (kernel vs module boundary check).

Not tested. ;-)

Thanks,
Namhyung

--------------8<-------------

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index dea0fc495185..df41d7266d91 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -35,6 +35,7 @@
 #include "path.h"
 #include <linux/ctype.h>
 #include <linux/zalloc.h>
+#include <internal/lib.h>  // page_size
 
 #include <elf.h>
 #include <limits.h>
@@ -231,8 +226,16 @@ 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);
+               if (prev->end == prev->start) {
+                       /* Last kernel symbol mapped to end of page */
+                       if (!strchr(prev->name, '[') != !strchr(curr->name, '['))
+                               prev->end = roundup(prev->end + 1, page_size);
+                       else
+                               prev->end = curr->start;
+
+                       pr_debug4("%s sym:%s end:%#" PRIx64 "\n",
+                                 __func__, prev->name, prev->end);
+               }
        }
 
        /* Last entry */

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ