]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.15-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 13 Jan 2024 09:32:03 +0000 (10:32 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 13 Jan 2024 09:32:03 +0000 (10:32 +0100)
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

queue-5.15/kallsyms-make-module_kallsyms_on_each_symbol-generally-available.patch [new file with mode: 0644]
queue-5.15/series
queue-5.15/tracing-kprobes-fix-symbol-counting-logic-by-looking-at-modules-as-well.patch [new file with mode: 0644]

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 (file)
index 0000000..552a9e9
--- /dev/null
@@ -0,0 +1,71 @@
+From stable+bounces-10540-greg=kroah.com@vger.kernel.org Thu Jan 11 22:45:01 2024
+From: Markus Boehme <markubo@amazon.com>
+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 <jolsa@kernel.org>, Christoph Hellwig <hch@lst.de>, Song Liu <song@kernel.org>, Alexei Starovoitov <ast@kernel.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Markus Boehme <markubo@amazon.com>
+Message-ID: <20240111214354.369299-2-markubo@amazon.com>
+
+From: Jiri Olsa <jolsa@kernel.org>
+
+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 <hch@lst.de>
+Acked-by: Song Liu <song@kernel.org>
+Signed-off-by: Jiri Olsa <jolsa@kernel.org>
+Link: https://lore.kernel.org/r/20221025134148.3300700-2-jolsa@kernel.org
+Signed-off-by: Alexei Starovoitov <ast@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Stable-dep-of: 926fe783c8a6 ("tracing/kprobes: Fix symbol counting logic by looking at modules as well")
+Signed-off-by: Markus Boehme <markubo@amazon.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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)
index 86480d4fbe9e012941b1cd7367fc68f7fdb9148a..ba1b15dce9bf52159071846d4dc6a7c8e94e4962 100644 (file)
@@ -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 (file)
index 0000000..d6ce792
--- /dev/null
@@ -0,0 +1,46 @@
+From stable+bounces-10541-greg=kroah.com@vger.kernel.org Thu Jan 11 22:53:55 2024
+From: Markus Boehme <markubo@amazon.com>
+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 <andrii@kernel.org>, Francis Laniel <flaniel@linux.microsoft.com>, Masami Hiramatsu <mhiramat@kernel.org>, Steven Rostedt <rostedt@goodmis.org>, Song Liu <song@kernel.org>, Markus Boehme <markubo@amazon.com>
+Message-ID: <20240111214354.369299-3-markubo@amazon.com>
+
+From: Andrii Nakryiko <andrii@kernel.org>
+
+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 <flaniel@linux.microsoft.com>
+Cc: stable@vger.kernel.org
+Cc: Masami Hiramatsu <mhiramat@kernel.org>
+Cc: Steven Rostedt <rostedt@goodmis.org>
+Fixes: b022f0c7e404 ("tracing/kprobes: Return EADDRNOTAVAIL when func matches several symbols")
+Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
+Acked-by: Song Liu <song@kernel.org>
+Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
+Signed-off-by: Markus Boehme <markubo@amazon.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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;
+ }