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: <CAH5fLggW1i+eO1hhuHrX-LX7B4=M5a0-dZw4En990fD2biJU1A@mail.gmail.com>
Date: Thu, 30 Jan 2025 09:40:10 +0100
From: Alice Ryhl <aliceryhl@...gle.com>
To: Ian Rogers <irogers@...gle.com>
Cc: 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>, 
	Adrian Hunter <adrian.hunter@...el.com>, Kan Liang <kan.liang@...ux.intel.com>, 
	Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>, 
	Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>, 
	Björn Roy Baron <bjorn3_gh@...tonmail.com>, 
	Benno Lossin <benno.lossin@...ton.me>, Andreas Hindborg <a.hindborg@...nel.org>, 
	Trevor Gross <tmgross@...ch.edu>, James Clark <james.clark@...aro.org>, 
	Howard Chu <howardchu95@...il.com>, Ravi Bangoria <ravi.bangoria@....com>, 
	"Masami Hiramatsu (Google)" <mhiramat@...nel.org>, linux-kernel@...r.kernel.org, 
	linux-perf-users@...r.kernel.org, rust-for-linux@...r.kernel.org, 
	Daniel Xu <dxu@...uu.xyz>
Subject: Re: [PATCH v1] perf symbol: Add rust v0 demangling support

On Wed, Jan 29, 2025 at 8:30 PM Ian Rogers <irogers@...gle.com> wrote:
>
> Implement symbol demangling based on:
> https://doc.rust-lang.org/rustc/symbol-mangling/index.html
>
> Ensure recommended demangling examples match the expectations in the
> documentation.
>
> This was requested by Daniel Xu <dxu@...uu.xyz> in:
> https://lore.kernel.org/lkml/jgxfnphfo3nzlfipnuuzdlfc4ehbr2tnh2evz3mdhynd6wvrsu@fcz6vrvepybb/
>
> Signed-off-by: Ian Rogers <irogers@...gle.com>
> ---
> This change is on top of the 18 patch v3 series:
> https://lore.kernel.org/lkml/20250122174308.350350-1-irogers@google.com/
> ---
>  tools/perf/tests/Build                   |   1 +
>  tools/perf/tests/builtin-test.c          |   1 +
>  tools/perf/tests/demangle-rust-v0-test.c |  82 +++
>  tools/perf/tests/tests.h                 |   1 +
>  tools/perf/util/Build                    |   1 +
>  tools/perf/util/demangle-rust-v0.c       | 661 +++++++++++++++++++++++
>  tools/perf/util/demangle-rust-v0.h       |   7 +
>  tools/perf/util/symbol-elf.c             |  31 +-
>  8 files changed, 771 insertions(+), 14 deletions(-)
>  create mode 100644 tools/perf/tests/demangle-rust-v0-test.c
>  create mode 100644 tools/perf/util/demangle-rust-v0.c
>  create mode 100644 tools/perf/util/demangle-rust-v0.h
>
> diff --git a/tools/perf/tests/Build b/tools/perf/tests/Build
> index 165ba84dc93f..d59d88abf0da 100644
> --- a/tools/perf/tests/Build
> +++ b/tools/perf/tests/Build
> @@ -56,6 +56,7 @@ perf-test-y += genelf.o
>  perf-test-y += api-io.o
>  perf-test-y += demangle-java-test.o
>  perf-test-y += demangle-ocaml-test.o
> +perf-test-y += demangle-rust-v0-test.o
>  perf-test-y += pfm.o
>  perf-test-y += parse-metric.o
>  perf-test-y += expand-cgroup.o
> diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
> index e77bf446e821..16937e7e313a 100644
> --- a/tools/perf/tests/builtin-test.c
> +++ b/tools/perf/tests/builtin-test.c
> @@ -126,6 +126,7 @@ static struct test_suite *generic_tests[] = {
>         &suite__maps__merge_in,
>         &suite__demangle_java,
>         &suite__demangle_ocaml,
> +       &suite__demangle_rust,
>         &suite__parse_metric,
>         &suite__expand_cgroup_events,
>         &suite__perf_time_to_tsc,
> diff --git a/tools/perf/tests/demangle-rust-v0-test.c b/tools/perf/tests/demangle-rust-v0-test.c
> new file mode 100644
> index 000000000000..ab6613e02c94
> --- /dev/null
> +++ b/tools/perf/tests/demangle-rust-v0-test.c
> @@ -0,0 +1,82 @@
> +// SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
> +#include "tests.h"
> +#include "debug.h"
> +#include "demangle-rust-v0.h"
> +#include <linux/kernel.h>
> +#include <stdlib.h>
> +#include <string.h>
> +
> +static int test__demangle_rust(struct test_suite *test __maybe_unused, int subtest __maybe_unused)
> +{
> +       int ret = TEST_OK;
> +       char *buf = NULL;
> +       size_t i;
> +
> +       struct {
> +               const char *mangled, *demangled;
> +       } test_cases[] = {
> +               { "_RNvMsr_NtCs3ssYzQotkvD_3std4pathNtB5_7PathBuf3newCs15kBYyAo9fc_7mycrate",
> +                 "<std::path::PathBuf>::new" },

I think you would normally not have the < and > here? I usually only
see that when you do <type as trait>.

Alice

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ