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] [day] [month] [year] [list]
Message-ID: <CAM9d7chBsVJ=_phHHn4gYcgj6Wn8Ua+gQ62K4rf-edA=8vL9Wg@mail.gmail.com>
Date:   Thu, 1 Jun 2023 10:19:13 -0700
From:   Namhyung Kim <namhyung@...nel.org>
To:     elisabeth <paniii94@...il.com>
Cc:     linux-kernel@...r.kernel.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>
Subject: Re: [PATCH] Subject: perf jit: Fix incorrect file name in DWARF line table

On Wed, May 31, 2023 at 7:35 AM elisabeth <paniii94@...il.com> wrote:
>
> Fix an issue where an incorrect file name was added in the DWARF line table
> due to not checking the filename against the repeated name marker (/xff/0).
> This can be seen with `objdump --dwarf=line` on the ELF file after perf inject.
>
> Signed-off-by: elisabeth <paniii94@...il.com>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Cc: Ingo Molnar <mingo@...hat.com>
> Cc: Arnaldo Carvalho de Melo <acme@...nel.org>
> Cc: Mark Rutland <mark.rutland@....com>
> Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
> Cc: Jiri Olsa <jolsa@...nel.org>
> Cc: Namhyung Kim <namhyung@...nel.org>
> ---
>  tools/perf/util/genelf_debug.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/genelf_debug.c b/tools/perf/util/genelf_debug.c
> index aa5dcc56b2ac..2928b59bb9a5 100644
> --- a/tools/perf/util/genelf_debug.c
> +++ b/tools/perf/util/genelf_debug.c
> @@ -349,6 +349,7 @@ static void emit_lineno_info(struct buffer_ext *be,
>          */
>
>         /* start state of the state machine we take care of */
> +       char const repeated_name_marker[] = {'\xff', '\0'};

Can you please mention that it's from the jitdump format
either by renaming or adding a comment?


>         unsigned long last_vma = 0;
>         char const  *cur_filename = NULL;
>         unsigned long cur_file_idx = 0;
> @@ -363,7 +364,8 @@ static void emit_lineno_info(struct buffer_ext *be,
>                 /*
>                  * check if filename changed, if so add it
>                  */
> -               if (!cur_filename || strcmp(cur_filename, ent->name)) {
> +               if ((!cur_filename || strcmp(cur_filename, ent->name)) &&
> +                       memcmp(repeated_name_marker, ent->name, sizeof(repeated_name_marker)) != 0) {

I think you can just use strcmp().

Thanks,
Namhyung


>                         emit_lne_define_filename(be, ent->name);
>                         cur_filename = ent->name;
>                         emit_set_file(be, ++cur_file_idx);
> --
> 2.34.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ