[PATCH v1 02/11] perf annotate: Fix args leak of map_symbol

Suchit Karunakaran suchitkarunakaran at gmail.com
Thu Jan 22 03:46:52 PST 2026


> @@ -1119,7 +1121,7 @@ static int symbol__parse_objdump_line(struct symbol *sym,
>                                       struct annotate_args *args,
>                                       char *parsed_line, int *line_nr, char **fileloc)
>  {
> -       struct map *map = args->ms.map;
> +       struct map *map = args->ms->map;
>         struct annotation *notes = symbol__annotation(sym);
>         struct disasm_line *dl;
>         char *tmp;
> @@ -1151,7 +1153,7 @@ static int symbol__parse_objdump_line(struct symbol *sym,
>         args->line    = parsed_line;
>         args->line_nr = *line_nr;
>         args->fileloc = *fileloc;
> -       args->ms.sym  = sym;
> +       args->ms->sym  = sym;
>
>         dl = disasm_line__new(args);
>         (*line_nr)++;
> @@ -1172,7 +1174,7 @@ static int symbol__parse_objdump_line(struct symbol *sym,
>                         .ms = { .map = map, },
>                 };
>
> -               if (!maps__find_ams(args->ms.maps, &target) &&
> +               if (!maps__find_ams(args->ms->maps, &target) &&
>                     target.ms.sym->start == target.al_addr)
>                         dl->ops.target.sym = target.ms.sym;
>         }

Hi, a noob here so please correct me if I'm wrong.
Looking at symbol__parse_objdump_line(), shouldn't we be calling
map__get() when initializing the target struct? Since maps__find_ams()
now calls map__put() (after patch 1).
struct addr_map_symbol target = {
    .addr = dl->ops.target.addr,
    .ms = { .map = map__get(map), },
};
This would match the pattern used in call__parse() and jump__parse()
that were fixed in patch 2.



More information about the linux-riscv mailing list