lkml.org 
[lkml]   [2020]   [Apr]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[tip: objtool/core] objtool: Also consider .entry.text as noinstr
The following commit has been merged into the objtool/core branch of tip:

Commit-ID: b164b813e866b98387815eec40c6653a2edbc38a
Gitweb: https://git.kernel.org/tip/b164b813e866b98387815eec40c6653a2edbc38a
Author: Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Wed, 25 Mar 2020 17:18:17 +01:00
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Wed, 22 Apr 2020 23:10:08 +02:00

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 <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Miroslav Benes <mbenes@suse.cz>
Reviewed-by: Alexandre Chartre <alexandre.chartre@oracle.com>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://lkml.kernel.org/r/20200416115119.525037514@infradead.org
---
tools/objtool/check.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index f51c325..89b208c 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -266,7 +266,8 @@ static int decode_instructions(struct objtool_file *file)
strncmp(sec->name, ".discard.", 9))
sec->text = true;

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

for (offset = 0; offset < sec->len; offset += insn->len) {
@@ -2087,7 +2088,7 @@ static inline const char *call_dest_name(struct instruction *insn)
static int validate_call(struct instruction *insn, struct insn_state *state)
{
if (state->noinstr && state->instr <= 0 &&
- (!insn->call_dest || insn->call_dest->sec != insn->sec)) {
+ (!insn->call_dest || !insn->call_dest->sec->noinstr)) {
WARN_FUNC("call to %s() leaves .noinstr.text section",
insn->sec, insn->offset, call_dest_name(insn));
return 1;
@@ -2574,11 +2575,16 @@ static int validate_vmlinux_functions(struct objtool_file *file)
int warnings = 0;

sec = find_section_by_name(file->elf, ".noinstr.text");
- if (!sec)
- return 0;
+ if (sec) {
+ warnings += validate_section(file, sec);
+ warnings += validate_unwind_hints(file, sec);
+ }

- warnings += validate_section(file, sec);
- warnings += validate_unwind_hints(file, sec);
+ sec = find_section_by_name(file->elf, ".entry.text");
+ if (sec) {
+ warnings += validate_section(file, sec);
+ warnings += validate_unwind_hints(file, sec);
+ }

return warnings;
}
\
 
 \ /
  Last update: 2020-04-23 00:25    [W:0.614 / U:0.448 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site