Patch "perf symbol: correction while adjusting symbol" has been added to the 5.4-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 symbol: correction while adjusting symbol

to the 5.4-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-symbol-correction-while-adjusting-symbol.patch
and it can be found in the queue-5.4 subdirectory.

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



commit aa15c7e3c855e2c8b3d7051e7adde9854bc0a80e
Author: Ajay Kaher <akaher@xxxxxxxxxx>
Date:   Wed Nov 23 15:48:16 2022 +0530

    perf symbol: correction while adjusting symbol
    
    [ Upstream commit 6f520ce17920b3cdfbd2479b3ccf27f9706219d0 ]
    
    perf doesn't provide proper symbol information for specially crafted
    .debug files.
    
    Sometimes .debug file may not have similar program header as runtime
    ELF file. For example if we generate .debug file using objcopy
    --only-keep-debug resulting file will not contain .text, .data and
    other runtime sections. That means corresponding program headers will
    have zero FileSiz and modified Offset.
    
    Example: program header of text section of libxxx.so:
    
    Type           Offset             VirtAddr           PhysAddr
                   FileSiz            MemSiz              Flags  Align
    LOAD        0x00000000003d3000 0x00000000003d3000 0x00000000003d3000
                0x000000000055ae80 0x000000000055ae80  R E    0x1000
    
    Same program header after executing:
    objcopy --only-keep-debug libxxx.so libxxx.so.debug
    
    LOAD        0x0000000000001000 0x00000000003d3000 0x00000000003d3000
                0x0000000000000000 0x000000000055ae80  R E    0x1000
    
    Offset and FileSiz have been changed.
    
    Following formula will not provide correct value, if program header
    taken from .debug file (syms_ss):
    
        sym.st_value -= phdr.p_vaddr - phdr.p_offset;
    
    Correct program header information is located inside runtime ELF
    file (runtime_ss).
    
    Fixes: 2d86612aacb7805f ("perf symbol: Correct address for bss symbols")
    Signed-off-by: Ajay Kaher <akaher@xxxxxxxxxx>
    Cc: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>
    Cc: Alexey Makhalov <amakhalov@xxxxxxxxxx>
    Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
    Cc: Leo Yan <leo.yan@xxxxxxxxxx>
    Cc: Mark Rutland <mark.rutland@xxxxxxx>
    Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
    Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
    Cc: Srivatsa S. Bhat <srivatsab@xxxxxxxxxx>
    Cc: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>
    Cc: Vasavi Sirnapalli <vsirnapalli@xxxxxxxxxx>
    Link: http://lore.kernel.org/lkml/1669198696-50547-1-git-send-email-akaher@xxxxxxxxxx
    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 f15258fbe9db..4fef8d6bc225 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -1157,7 +1157,7 @@ int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *syms_ss,
 			   (!used_opd && syms_ss->adjust_symbols)) {
 			GElf_Phdr phdr;
 
-			if (elf_read_program_header(syms_ss->elf,
+			if (elf_read_program_header(runtime_ss->elf,
 						    (u64)sym.st_value, &phdr)) {
 				pr_debug4("%s: failed to find program header for "
 					   "symbol: %s st_value: %#" PRIx64 "\n",



[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