Re: [PATCH] perf top: fix overflow in elf_sec__is_text

From: Arnaldo Carvalho de Melo
Date: Mon Jul 05 2021 - 13:56:16 EST


Em Tue, Jun 22, 2021 at 12:46:38PM -0700, Namhyung Kim escreveu:
> Hi Riccardo,
>
> On Mon, Jun 21, 2021 at 3:22 PM Riccardo Mancini <rickyman7@xxxxxxxxx> wrote:
> >
> > ASan reports a heap-buffer-overflow in elf_sec__is_text when using perf-top.
> > The bug is caused by the fact that secstrs is built from runtime_ss, while
> > shdr is built from syms_ss if shdr.sh_type != SHT_NOBITS. Therefore, they
> > point to two different ELF files.
> >
> > This patch renames secstrs to secstrs_run and adds secstrs_sym, so that
> > the correct secstrs is chosen depending on shdr.sh_type.

Thanks, applied.

- Arnaldo