From c3878eeed4600e5376766bd6c61d78b16da337e5 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 11 Jan 2024 11:46:55 +0100 Subject: [PATCH] 5.15-stable patches added patches: perf-inject-fix-gen_elf_text_offset-for-jit.patch --- ...ject-fix-gen_elf_text_offset-for-jit.patch | 49 +++++++++++++++++++ queue-5.15/series | 1 + 2 files changed, 50 insertions(+) create mode 100644 queue-5.15/perf-inject-fix-gen_elf_text_offset-for-jit.patch 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..3874ab28fc0 --- /dev/null +++ b/queue-5.15/perf-inject-fix-gen_elf_text_offset-for-jit.patch @@ -0,0 +1,49 @@ +From 89b15d00527b7825ff19130ed83478e80e3fae99 Mon Sep 17 00:00:00 2001 +From: Adrian Hunter +Date: Fri, 14 Oct 2022 20:09:04 +0300 +Subject: perf inject: Fix GEN_ELF_TEXT_OFFSET for jit + +From: Adrian Hunter + +commit 89b15d00527b7825ff19130ed83478e80e3fae99 upstream. + +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 +[namhyung: use "linux/kernel.h" instead to avoid build failure] +Signed-off-by: Namhyung Kim +Signed-off-by: Greg Kroah-Hartman +--- + tools/perf/util/genelf.h | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- 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 + #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 diff --git a/queue-5.15/series b/queue-5.15/series index 1139786f023..0974b511249 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -51,3 +51,4 @@ mmc-core-cancel-delayed-work-before-releasing-host.patch mmc-sdhci-sprd-fix-emmc-init-failure-after-hw-reset.patch net-tls-update-curr-on-splice-as-well.patch ipv6-remove-max_size-check-inline-with-ipv4.patch +perf-inject-fix-gen_elf_text_offset-for-jit.patch -- 2.47.3