mirror of
https://github.com/torvalds/linux.git
synced 2024-12-04 18:13:04 +00:00
perf symbols: Fix use-after-free in get_plt_got_name()
Fix use-after-free in get_plt_got_name().
Discovered using EXTRA_CFLAGS="-fsanitize=undefined -fsanitize=address".
Fixes: ce4c8e7966
("perf symbols: Get symbols for .plt.got for x86-64")
Reported-by: kernel test robot <yujie.liu@intel.com>
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Acked-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/oe-lkp/202303061424.6ad43294-yujie.liu@intel.com
Link: https://lore.kernel.org/r/20230316194156.8320-2-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
5d9df8731c
commit
c8bb2d76a4
@ -557,6 +557,7 @@ static bool get_plt_got_name(GElf_Shdr *shdr, size_t i,
|
||||
const char *sym_name;
|
||||
char *demangled;
|
||||
GElf_Sym sym;
|
||||
bool result;
|
||||
u32 disp;
|
||||
|
||||
if (!di->sorted)
|
||||
@ -583,9 +584,11 @@ static bool get_plt_got_name(GElf_Shdr *shdr, size_t i,
|
||||
|
||||
snprintf(buf, buf_sz, "%s@plt", sym_name);
|
||||
|
||||
result = *sym_name;
|
||||
|
||||
free(demangled);
|
||||
|
||||
return *sym_name;
|
||||
return result;
|
||||
}
|
||||
|
||||
static int dso__synthesize_plt_got_symbols(struct dso *dso, Elf *elf,
|
||||
|
Loading…
Reference in New Issue
Block a user