.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* Rewritten by Rusty Russell, on the backs of many others... |
---|
2 | 3 | Copyright (C) 2001 Rusty Russell, 2002 Rusty Russell IBM. |
---|
3 | 4 | |
---|
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 |
---|
17 | 5 | */ |
---|
18 | 6 | #include <linux/ftrace.h> |
---|
19 | 7 | #include <linux/memory.h> |
---|
.. | .. |
---|
46 | 34 | /* Sort the kernel's built-in exception table */ |
---|
47 | 35 | void __init sort_main_extable(void) |
---|
48 | 36 | { |
---|
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) { |
---|
50 | 39 | pr_notice("Sorting __ex_table...\n"); |
---|
51 | 40 | sort_extable(__start___ex_table, __stop___ex_table); |
---|
52 | 41 | } |
---|
| 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); |
---|
53 | 50 | } |
---|
54 | 51 | |
---|
55 | 52 | /* Given an address, look for it in the exception tables. */ |
---|
.. | .. |
---|
57 | 54 | { |
---|
58 | 55 | const struct exception_table_entry *e; |
---|
59 | 56 | |
---|
60 | | - e = search_extable(__start___ex_table, |
---|
61 | | - __stop___ex_table - __start___ex_table, addr); |
---|
| 57 | + e = search_kernel_exception_table(addr); |
---|
62 | 58 | if (!e) |
---|
63 | 59 | e = search_module_extables(addr); |
---|
| 60 | + if (!e) |
---|
| 61 | + e = search_bpf_extables(addr); |
---|
64 | 62 | return e; |
---|
65 | 63 | } |
---|
66 | 64 | |
---|
.. | .. |
---|
134 | 132 | * triggers a stack trace, or a WARN() that happens during |
---|
135 | 133 | * coming back from idle, or cpu on or offlining. |
---|
136 | 134 | * |
---|
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. |
---|
139 | 138 | */ |
---|
140 | 139 | no_rcu = !rcu_is_watching(); |
---|
141 | 140 | |
---|