Skip to content

Commit 20e5227

Browse files
Steven RostedtIngo Molnar
authored andcommitted
ftrace: allow NULL pointers in mcount_loc
Impact: make ftrace_convert_nops() more permissive Due to the way different architecture linkers combine the data sections of the mcount_loc (the section that lists all the locations that call mcount), there may be zeros added in that section. This is usually due to strange alignments that the linker performs, that pads in zeros. This patch makes the conversion code to nops skip any pointer in the mcount_loc section that is NULL. Signed-off-by: Steven Rostedt <srostedt@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
1 parent 31e8890 commit 20e5227

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎kernel/trace/ftrace.c‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,6 +1304,14 @@ static int ftrace_convert_nops(struct module *mod,
13041304
p = start;
13051305
while (p < end) {
13061306
addr = ftrace_call_adjust(*p++);
1307+
/*
1308+
* Some architecture linkers will pad between
1309+
* the different mcount_loc sections of different
1310+
* object files to satisfy alignments.
1311+
* Skip any NULL pointers.
1312+
*/
1313+
if (!addr)
1314+
continue;
13071315
ftrace_record_ip(addr);
13081316
}
13091317

0 commit comments

Comments
 (0)