From: Sasha Levin Date: Sat, 14 Oct 2023 16:41:20 +0000 (-0400) Subject: Fixes for 5.15 X-Git-Tag: v6.1.58~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3de843e0df3c8ba62ebc20f182db42b173c39420;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.15 Signed-off-by: Sasha Levin --- diff --git a/queue-5.15/perf-inject-fix-gen_elf_text_offset-for-jit.patch b/queue-5.15/perf-inject-fix-gen_elf_text_offset-for-jit.patch new file mode 100644 index 00000000000..f465845b9be --- /dev/null +++ b/queue-5.15/perf-inject-fix-gen_elf_text_offset-for-jit.patch @@ -0,0 +1,52 @@ +From 9474d779678c71aaa84d0d863b81914213ef9ab0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 14 Oct 2022 20:09:04 +0300 +Subject: perf inject: Fix GEN_ELF_TEXT_OFFSET for jit + +From: Adrian Hunter + +[ Upstream commit 89b15d00527b7825ff19130ed83478e80e3fae99 ] + +When a program header was added, it moved the text section but +GEN_ELF_TEXT_OFFSET was not updated. + +Fix by adding the program header size and aligning. + +Fixes: babd04386b1df8c3 ("perf jit: Include program header in ELF files") +Signed-off-by: Adrian Hunter +Tested-by: Arnaldo Carvalho de Melo +Cc: Ian Rogers +Cc: Jiri Olsa +Cc: Lieven Hey +Cc: Namhyung Kim +Link: https://lore.kernel.org/r/20221014170905.64069-7-adrian.hunter@intel.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/util/genelf.h | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/tools/perf/util/genelf.h b/tools/perf/util/genelf.h +index ac638945b4cb0..159c69bcc33e6 100644 +--- a/tools/perf/util/genelf.h ++++ b/tools/perf/util/genelf.h +@@ -2,6 +2,8 @@ + #ifndef __GENELF_H__ + #define __GENELF_H__ + ++#include ++ + /* genelf.c */ + int jit_write_elf(int fd, uint64_t code_addr, const char *sym, + const void *code, int csize, void *debug, int nr_debug_entries, +@@ -73,6 +75,6 @@ int jit_add_debug_info(Elf *e, uint64_t code_addr, void *debug, int nr_debug_ent + #endif + + /* The .text section is directly after the ELF header */ +-#define GEN_ELF_TEXT_OFFSET sizeof(Elf_Ehdr) ++#define GEN_ELF_TEXT_OFFSET round_up(sizeof(Elf_Ehdr) + sizeof(Elf_Phdr), 16) + + #endif +-- +2.40.1 + diff --git a/queue-5.15/series b/queue-5.15/series index fa728ee54af..582e85cb153 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -39,3 +39,4 @@ net-smc-fix-pos-miscalculation-in-statistics.patch pinctrl-renesas-rzn1-enable-missing-pinmux.patch nfc-nci-assert-requested-protocol-is-valid.patch workqueue-override-implicit-ordered-attribute-in-wor.patch +perf-inject-fix-gen_elf_text_offset-for-jit.patch