hc
2024-05-10 9999e48639b3cecb08ffb37358bcba3b48161b29
kernel/kernel/extable.c
....@@ -1,19 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /* Rewritten by Rusty Russell, on the backs of many others...
23 Copyright (C) 2001 Rusty Russell, 2002 Rusty Russell IBM.
34
4
- This program is free software; you can redistribute it and/or modify
5
- it under the terms of the GNU General Public License as published by
6
- the Free Software Foundation; either version 2 of the License, or
7
- (at your option) any later version.
8
-
9
- This program is distributed in the hope that it will be useful,
10
- but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- GNU General Public License for more details.
13
-
14
- You should have received a copy of the GNU General Public License
15
- along with this program; if not, write to the Free Software
16
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
175 */
186 #include <linux/ftrace.h>
197 #include <linux/memory.h>
....@@ -46,10 +34,19 @@
4634 /* Sort the kernel's built-in exception table */
4735 void __init sort_main_extable(void)
4836 {
49
- if (main_extable_sort_needed && __stop___ex_table > __start___ex_table) {
37
+ if (main_extable_sort_needed &&
38
+ &__stop___ex_table > &__start___ex_table) {
5039 pr_notice("Sorting __ex_table...\n");
5140 sort_extable(__start___ex_table, __stop___ex_table);
5241 }
42
+}
43
+
44
+/* Given an address, look for it in the kernel exception table */
45
+const
46
+struct exception_table_entry *search_kernel_exception_table(unsigned long addr)
47
+{
48
+ return search_extable(__start___ex_table,
49
+ __stop___ex_table - __start___ex_table, addr);
5350 }
5451
5552 /* Given an address, look for it in the exception tables. */
....@@ -57,10 +54,11 @@
5754 {
5855 const struct exception_table_entry *e;
5956
60
- e = search_extable(__start___ex_table,
61
- __stop___ex_table - __start___ex_table, addr);
57
+ e = search_kernel_exception_table(addr);
6258 if (!e)
6359 e = search_module_extables(addr);
60
+ if (!e)
61
+ e = search_bpf_extables(addr);
6462 return e;
6563 }
6664
....@@ -134,8 +132,9 @@
134132 * triggers a stack trace, or a WARN() that happens during
135133 * coming back from idle, or cpu on or offlining.
136134 *
137
- * is_module_text_address() as well as the kprobe slots
138
- * and is_bpf_text_address() require RCU to be watching.
135
+ * is_module_text_address() as well as the kprobe slots,
136
+ * is_bpf_text_address() and is_bpf_image_address require
137
+ * RCU to be watching.
139138 */
140139 no_rcu = !rcu_is_watching();
141140