* [PATCH] objtool: Fix objtool fallthrough detection with function padding
@ 2017-08-11 17:24 Josh Poimboeuf
2017-08-21 13:05 ` Josh Poimboeuf
2017-08-21 14:10 ` [tip:x86/asm] " tip-bot for Josh Poimboeuf
0 siblings, 2 replies; 3+ messages in thread
From: Josh Poimboeuf @ 2017-08-11 17:24 UTC (permalink / raw)
To: x86; +Cc: linux-kernel
When GCC adds NOP padding between functions, those NOPs aren't
associated with a function symbol, which breaks objtool's detection of a
function falling through to another function. Instead it shows
confusing errors like:
drivers/mtd/chips/cfi_util.o: warning: objtool: cfi_qry_mode_on()+0x8b: return with modified stack frame
drivers/mtd/chips/cfi_util.o: warning: objtool: cfi_qry_mode_on()+0x0: stack state mismatch: cfa1=-4-32 cfa2=7+8
drivers/mtd/chips/cfi_cmdset_0002.o: warning: objtool: fixup_use_fwh_lock()+0x8: unknown stack-related register move
drivers/mtd/chips/cfi_cmdset_0002.o: warning: objtool: fixup_use_fwh_lock()+0x0: stack state mismatch: cfa1=6+16 cfa2=7+8
drivers/mtd/chips/cfi_cmdset_0002.o: warning: objtool: do_otp_write()+0xa: unsupported stack pointer realignment
drivers/mtd/chips/cfi_cmdset_0002.o: warning: objtool: do_otp_write()+0x0: stack state mismatch: cfa1=-4-40 cfa2=7+8
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
tools/objtool/check.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 17375925e7aa..3dffeb944523 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -1536,15 +1536,15 @@ static int validate_branch(struct objtool_file *file, struct instruction *first,
while (1) {
next_insn = next_insn_same_sec(file, insn);
- if (file->c_file && insn->func) {
- if (func && func != insn->func) {
- WARN("%s() falls through to next function %s()",
- func->name, insn->func->name);
- return 1;
- }
+
+ if (file->c_file && func && insn->func && func != insn->func) {
+ WARN("%s() falls through to next function %s()",
+ func->name, insn->func->name);
+ return 1;
}
- func = insn->func;
+ if (insn->func)
+ func = insn->func;
if (func && insn->ignore) {
WARN_FUNC("BUG: why am I validating an ignored function?",
--
2.13.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] objtool: Fix objtool fallthrough detection with function padding
2017-08-11 17:24 [PATCH] objtool: Fix objtool fallthrough detection with function padding Josh Poimboeuf
@ 2017-08-21 13:05 ` Josh Poimboeuf
2017-08-21 14:10 ` [tip:x86/asm] " tip-bot for Josh Poimboeuf
1 sibling, 0 replies; 3+ messages in thread
From: Josh Poimboeuf @ 2017-08-21 13:05 UTC (permalink / raw)
To: x86, Ingo Molnar; +Cc: linux-kernel
On Fri, Aug 11, 2017 at 12:24:15PM -0500, Josh Poimboeuf wrote:
> When GCC adds NOP padding between functions, those NOPs aren't
> associated with a function symbol, which breaks objtool's detection of a
> function falling through to another function. Instead it shows
> confusing errors like:
>
> drivers/mtd/chips/cfi_util.o: warning: objtool: cfi_qry_mode_on()+0x8b: return with modified stack frame
> drivers/mtd/chips/cfi_util.o: warning: objtool: cfi_qry_mode_on()+0x0: stack state mismatch: cfa1=-4-32 cfa2=7+8
> drivers/mtd/chips/cfi_cmdset_0002.o: warning: objtool: fixup_use_fwh_lock()+0x8: unknown stack-related register move
> drivers/mtd/chips/cfi_cmdset_0002.o: warning: objtool: fixup_use_fwh_lock()+0x0: stack state mismatch: cfa1=6+16 cfa2=7+8
> drivers/mtd/chips/cfi_cmdset_0002.o: warning: objtool: do_otp_write()+0xa: unsupported stack pointer realignment
> drivers/mtd/chips/cfi_cmdset_0002.o: warning: objtool: do_otp_write()+0x0: stack state mismatch: cfa1=-4-40 cfa2=7+8
>
> Reported-by: kbuild test robot <fengguang.wu@intel.com>
> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Ping?
--
Josh
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip:x86/asm] objtool: Fix objtool fallthrough detection with function padding
2017-08-11 17:24 [PATCH] objtool: Fix objtool fallthrough detection with function padding Josh Poimboeuf
2017-08-21 13:05 ` Josh Poimboeuf
@ 2017-08-21 14:10 ` tip-bot for Josh Poimboeuf
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Josh Poimboeuf @ 2017-08-21 14:10 UTC (permalink / raw)
To: linux-tip-commits
Cc: hpa, torvalds, tglx, linux-kernel, fengguang.wu, peterz, jpoimboe,
mingo
Commit-ID: ee97638b5737cc0dba2f12a3bdcda761656b7c01
Gitweb: http://git.kernel.org/tip/ee97638b5737cc0dba2f12a3bdcda761656b7c01
Author: Josh Poimboeuf <jpoimboe@redhat.com>
AuthorDate: Fri, 11 Aug 2017 12:24:15 -0500
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 21 Aug 2017 16:06:05 +0200
objtool: Fix objtool fallthrough detection with function padding
When GCC adds NOP padding between functions, those NOPs aren't
associated with a function symbol, which breaks objtool's detection of a
function falling through to another function. Instead it shows
confusing errors like:
drivers/mtd/chips/cfi_util.o: warning: objtool: cfi_qry_mode_on()+0x8b: return with modified stack frame
drivers/mtd/chips/cfi_util.o: warning: objtool: cfi_qry_mode_on()+0x0: stack state mismatch: cfa1=-4-32 cfa2=7+8
drivers/mtd/chips/cfi_cmdset_0002.o: warning: objtool: fixup_use_fwh_lock()+0x8: unknown stack-related register move
drivers/mtd/chips/cfi_cmdset_0002.o: warning: objtool: fixup_use_fwh_lock()+0x0: stack state mismatch: cfa1=6+16 cfa2=7+8
drivers/mtd/chips/cfi_cmdset_0002.o: warning: objtool: do_otp_write()+0xa: unsupported stack pointer realignment
drivers/mtd/chips/cfi_cmdset_0002.o: warning: objtool: do_otp_write()+0x0: stack state mismatch: cfa1=-4-40 cfa2=7+8
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/43e7aae9a7a7710cd6df597fa9dc501da4ba0602.1502472193.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
tools/objtool/check.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 1737592..3dffeb9 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -1536,15 +1536,15 @@ static int validate_branch(struct objtool_file *file, struct instruction *first,
while (1) {
next_insn = next_insn_same_sec(file, insn);
- if (file->c_file && insn->func) {
- if (func && func != insn->func) {
- WARN("%s() falls through to next function %s()",
- func->name, insn->func->name);
- return 1;
- }
+
+ if (file->c_file && func && insn->func && func != insn->func) {
+ WARN("%s() falls through to next function %s()",
+ func->name, insn->func->name);
+ return 1;
}
- func = insn->func;
+ if (insn->func)
+ func = insn->func;
if (func && insn->ignore) {
WARN_FUNC("BUG: why am I validating an ignored function?",
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-08-21 14:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-11 17:24 [PATCH] objtool: Fix objtool fallthrough detection with function padding Josh Poimboeuf
2017-08-21 13:05 ` Josh Poimboeuf
2017-08-21 14:10 ` [tip:x86/asm] " tip-bot for Josh Poimboeuf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox