Patch "perf symbols: Fix unaligned access in get_x86_64_plt_disp()" 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 unaligned access in get_x86_64_plt_disp()

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-unaligned-access-in-get_x86_64_plt_.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 d842c5f1b6af4584ec2cdb813c7628d16e67703a
Author: Adrian Hunter <adrian.hunter@xxxxxxxxx>
Date:   Thu Mar 16 21:41:55 2023 +0200

    perf symbols: Fix unaligned access in get_x86_64_plt_disp()
    
    [ Upstream commit a2410b579c72242ac0f77b3768093d8c1b48012e ]
    
    Use memcpy() to avoid unaligned access.
    
    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 98a18fb854180..42b83bef67aaf 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -565,9 +565,12 @@ static u32 get_x86_64_plt_disp(const u8 *p)
 		n += 1;
 	/* jmp with 4-byte displacement */
 	if (p[n] == 0xff && p[n + 1] == 0x25) {
+		u32 disp;
+
 		n += 2;
 		/* Also add offset from start of entry to end of instruction */
-		return n + 4 + le32toh(*(const u32 *)(p + n));
+		memcpy(&disp, p + n, sizeof(disp));
+		return n + 4 + le32toh(disp);
 	}
 	return 0;
 }



[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