From: Greg Kroah-Hartman Date: Sat, 13 Jan 2024 09:32:03 +0000 (+0100) Subject: 5.15-stable patches X-Git-Tag: v4.19.305~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b4b6e70861193d61e287c35a3161fe9bff4ad494;p=thirdparty%2Fkernel%2Fstable-queue.git 5.15-stable patches added patches: kallsyms-make-module_kallsyms_on_each_symbol-generally-available.patch tracing-kprobes-fix-symbol-counting-logic-by-looking-at-modules-as-well.patch --- diff --git a/queue-5.15/kallsyms-make-module_kallsyms_on_each_symbol-generally-available.patch b/queue-5.15/kallsyms-make-module_kallsyms_on_each_symbol-generally-available.patch new file mode 100644 index 00000000000..552a9e969ad --- /dev/null +++ b/queue-5.15/kallsyms-make-module_kallsyms_on_each_symbol-generally-available.patch @@ -0,0 +1,71 @@ +From stable+bounces-10540-greg=kroah.com@vger.kernel.org Thu Jan 11 22:45:01 2024 +From: Markus Boehme +Date: Thu, 11 Jan 2024 22:43:53 +0100 +Subject: kallsyms: Make module_kallsyms_on_each_symbol generally available +To: stable@vger.kernel.org +Cc: Jiri Olsa , Christoph Hellwig , Song Liu , Alexei Starovoitov , Greg Kroah-Hartman , Markus Boehme +Message-ID: <20240111214354.369299-2-markubo@amazon.com> + +From: Jiri Olsa + +commit 73feb8d5fa3b755bb51077c0aabfb6aa556fd498 upstream. + +Making module_kallsyms_on_each_symbol generally available, so it +can be used outside CONFIG_LIVEPATCH option in following changes. + +Rather than adding another ifdef option let's make the function +generally available (when CONFIG_KALLSYMS and CONFIG_MODULES +options are defined). + +Cc: Christoph Hellwig +Acked-by: Song Liu +Signed-off-by: Jiri Olsa +Link: https://lore.kernel.org/r/20221025134148.3300700-2-jolsa@kernel.org +Signed-off-by: Alexei Starovoitov +Signed-off-by: Greg Kroah-Hartman +Stable-dep-of: 926fe783c8a6 ("tracing/kprobes: Fix symbol counting logic by looking at modules as well") +Signed-off-by: Markus Boehme +Signed-off-by: Greg Kroah-Hartman +--- + include/linux/module.h | 9 +++++++++ + kernel/module.c | 2 -- + 2 files changed, 9 insertions(+), 2 deletions(-) + +--- a/include/linux/module.h ++++ b/include/linux/module.h +@@ -867,8 +867,17 @@ static inline bool module_sig_ok(struct + } + #endif /* CONFIG_MODULE_SIG */ + ++#if defined(CONFIG_MODULES) && defined(CONFIG_KALLSYMS) + int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, + struct module *, unsigned long), + void *data); ++#else ++static inline int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, ++ struct module *, unsigned long), ++ void *data) ++{ ++ return -EOPNOTSUPP; ++} ++#endif /* CONFIG_MODULES && CONFIG_KALLSYMS */ + + #endif /* _LINUX_MODULE_H */ +--- a/kernel/module.c ++++ b/kernel/module.c +@@ -4482,7 +4482,6 @@ unsigned long module_kallsyms_lookup_nam + return ret; + } + +-#ifdef CONFIG_LIVEPATCH + int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, + struct module *, unsigned long), + void *data) +@@ -4514,7 +4513,6 @@ out: + mutex_unlock(&module_mutex); + return ret; + } +-#endif /* CONFIG_LIVEPATCH */ + #endif /* CONFIG_KALLSYMS */ + + static void cfi_init(struct module *mod) diff --git a/queue-5.15/series b/queue-5.15/series index 86480d4fbe9..ba1b15dce9b 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -53,3 +53,5 @@ 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 netfilter-nf_tables-reject-tables-of-unsupported-family.patch +kallsyms-make-module_kallsyms_on_each_symbol-generally-available.patch +tracing-kprobes-fix-symbol-counting-logic-by-looking-at-modules-as-well.patch diff --git a/queue-5.15/tracing-kprobes-fix-symbol-counting-logic-by-looking-at-modules-as-well.patch b/queue-5.15/tracing-kprobes-fix-symbol-counting-logic-by-looking-at-modules-as-well.patch new file mode 100644 index 00000000000..d6ce7927b6c --- /dev/null +++ b/queue-5.15/tracing-kprobes-fix-symbol-counting-logic-by-looking-at-modules-as-well.patch @@ -0,0 +1,46 @@ +From stable+bounces-10541-greg=kroah.com@vger.kernel.org Thu Jan 11 22:53:55 2024 +From: Markus Boehme +Date: Thu, 11 Jan 2024 22:43:54 +0100 +Subject: tracing/kprobes: Fix symbol counting logic by looking at modules as well +To: stable@vger.kernel.org +Cc: Andrii Nakryiko , Francis Laniel , Masami Hiramatsu , Steven Rostedt , Song Liu , Markus Boehme +Message-ID: <20240111214354.369299-3-markubo@amazon.com> + +From: Andrii Nakryiko + +commit 926fe783c8a64b33997fec405cf1af3e61aed441 upstream. + +Recent changes to count number of matching symbols when creating +a kprobe event failed to take into account kernel modules. As such, it +breaks kprobes on kernel module symbols, by assuming there is no match. + +Fix this my calling module_kallsyms_on_each_symbol() in addition to +kallsyms_on_each_match_symbol() to perform a proper counting. + +Link: https://lore.kernel.org/all/20231027233126.2073148-1-andrii@kernel.org/ + +Cc: Francis Laniel +Cc: stable@vger.kernel.org +Cc: Masami Hiramatsu +Cc: Steven Rostedt +Fixes: b022f0c7e404 ("tracing/kprobes: Return EADDRNOTAVAIL when func matches several symbols") +Signed-off-by: Andrii Nakryiko +Acked-by: Song Liu +Signed-off-by: Masami Hiramatsu (Google) +Signed-off-by: Markus Boehme +Signed-off-by: Greg Kroah-Hartman +--- + kernel/trace/trace_kprobe.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/kernel/trace/trace_kprobe.c ++++ b/kernel/trace/trace_kprobe.c +@@ -735,6 +735,8 @@ static unsigned int number_of_same_symbo + + kallsyms_on_each_symbol(count_symbols, &args); + ++ module_kallsyms_on_each_symbol(count_symbols, &args); ++ + return args.count; + } +