File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -7004,7 +7004,6 @@ static int ftrace_process_locs(struct module *mod,
7004
7004
unsigned long count ;
7005
7005
unsigned long * p ;
7006
7006
unsigned long addr ;
7007
- unsigned long kaslr ;
7008
7007
unsigned long flags = 0 ; /* Shut up gcc */
7009
7008
unsigned long pages ;
7010
7009
int ret = - ENOMEM ;
@@ -7056,9 +7055,6 @@ static int ftrace_process_locs(struct module *mod,
7056
7055
ftrace_pages -> next = start_pg ;
7057
7056
}
7058
7057
7059
- /* For zeroed locations that were shifted for core kernel */
7060
- kaslr = !mod ? kaslr_offset () : 0 ;
7061
-
7062
7058
p = start ;
7063
7059
pg = start_pg ;
7064
7060
while (p < end ) {
@@ -7072,7 +7068,18 @@ static int ftrace_process_locs(struct module *mod,
7072
7068
* object files to satisfy alignments.
7073
7069
* Skip any NULL pointers.
7074
7070
*/
7075
- if (!addr || addr == kaslr ) {
7071
+ if (!addr ) {
7072
+ skipped ++ ;
7073
+ continue ;
7074
+ }
7075
+
7076
+ /*
7077
+ * If this is core kernel, make sure the address is in core
7078
+ * or inittext, as weak functions get zeroed and KASLR can
7079
+ * move them to something other than zero. It just will not
7080
+ * move it to an area where kernel text is.
7081
+ */
7082
+ if (!mod && !(is_kernel_text (addr ) || is_kernel_inittext (addr ))) {
7076
7083
skipped ++ ;
7077
7084
continue ;
7078
7085
}
You can’t perform that action at this time.
0 commit comments