Patch "perf symbols: Fix use-after-free in get_plt_got_name()" has been added to the 6.3-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    perf symbols: Fix use-after-free in get_plt_got_name()

to the 6.3-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     perf-symbols-fix-use-after-free-in-get_plt_got_name.patch
and it can be found in the queue-6.3 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit ac0b63cd210b67bdad736c0bf4f7320b7ae6b4f0
Author: Adrian Hunter <adrian.hunter@xxxxxxxxx>
Date:   Thu Mar 16 21:41:54 2023 +0200

    perf symbols: Fix use-after-free in get_plt_got_name()
    
    [ Upstream commit c8bb2d76a40ac0ccf6303d369e536fddcde847fb ]
    
    Fix use-after-free in get_plt_got_name().
    
    Discovered using EXTRA_CFLAGS="-fsanitize=undefined -fsanitize=address".
    
    Fixes: ce4c8e7966f317ef ("perf symbols: Get symbols for .plt.got for x86-64")
    Reported-by: kernel test robot <yujie.liu@xxxxxxxxx>
    Signed-off-by: Adrian Hunter <adrian.hunter@xxxxxxxxx>
    Acked-by: Ian Rogers <irogers@xxxxxxxxxx>
    Cc: Adrian Hunter <adrian.hunter@xxxxxxxxx>
    Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
    Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
    Link: https://lore.kernel.org/oe-lkp/202303061424.6ad43294-yujie.liu@xxxxxxxxx
    Link: https://lore.kernel.org/r/20230316194156.8320-2-adrian.hunter@xxxxxxxxx
    Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index 41882ae8452e5..98a18fb854180 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -580,6 +580,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)
@@ -606,9 +607,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,



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux