Skip to content

Commit 0cc9ac8

Browse files
KAGA-KOKOIngo Molnar
authored andcommitted
objtool: Also consider .entry.text as noinstr
Consider all of .entry.text as noinstr. This gets us coverage across the PTI boundary. While we could add everything .noinstr.text into .entry.text that would bloat the amount of code in the user mapping. Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Miroslav Benes <[email protected]> Reviewed-by: Alexandre Chartre <[email protected]> Acked-by: Josh Poimboeuf <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 932f8e9 commit 0cc9ac8

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

tools/objtool/check.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,8 @@ static int decode_instructions(struct objtool_file *file)
266266
strncmp(sec->name, ".discard.", 9))
267267
sec->text = true;
268268

269-
if (!strcmp(sec->name, ".noinstr.text"))
269+
if (!strcmp(sec->name, ".noinstr.text") ||
270+
!strcmp(sec->name, ".entry.text"))
270271
sec->noinstr = true;
271272

272273
for (offset = 0; offset < sec->len; offset += insn->len) {
@@ -2071,7 +2072,7 @@ static inline const char *call_dest_name(struct instruction *insn)
20712072
static int validate_call(struct instruction *insn, struct insn_state *state)
20722073
{
20732074
if (state->noinstr && state->instr <= 0 &&
2074-
(!insn->call_dest || insn->call_dest->sec != insn->sec)) {
2075+
(!insn->call_dest || !insn->call_dest->sec->noinstr)) {
20752076
WARN_FUNC("call to %s() leaves .noinstr.text section",
20762077
insn->sec, insn->offset, call_dest_name(insn));
20772078
return 1;
@@ -2558,11 +2559,16 @@ static int validate_vmlinux_functions(struct objtool_file *file)
25582559
int warnings = 0;
25592560

25602561
sec = find_section_by_name(file->elf, ".noinstr.text");
2561-
if (!sec)
2562-
return 0;
2562+
if (sec) {
2563+
warnings += validate_section(file, sec);
2564+
warnings += validate_unwind_hints(file, sec);
2565+
}
25632566

2564-
warnings += validate_section(file, sec);
2565-
warnings += validate_unwind_hints(file, sec);
2567+
sec = find_section_by_name(file->elf, ".entry.text");
2568+
if (sec) {
2569+
warnings += validate_section(file, sec);
2570+
warnings += validate_unwind_hints(file, sec);
2571+
}
25662572

25672573
return warnings;
25682574
}

0 commit comments

Comments
 (0)