diff mbox series

[RFC,v5,17/57] objtool: Make stack validation more generic

Message ID 20200109160300.26150-18-jthierry@redhat.com (mailing list archive)
State New, archived
Headers show
Series objtool: Add support for arm64 | expand

Commit Message

Julien Thierry Jan. 9, 2020, 4:02 p.m. UTC
On x86, when calling a function, the new call frame is alway placed at
the start of the stack space this function can freely use. So the frame
pointer is always saved at <function stack start> - 16.

This is not true for the calling convention of all architecture.

When validating the call frame before a call instruction, all that can
be done is check that a frame was created by the current function and
that the frame pointer is correctly pointing to it.

Signed-off-by: Julien Thierry <jthierry@redhat.com>
 tools/objtool/check.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series


diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 0a5c51e4e24c..04434cdbdab6 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -1176,7 +1176,7 @@  static bool has_modified_stack_frame(struct insn_state *state)
 static bool has_valid_stack_frame(struct insn_state *state)
 	if (state->cfa.base == CFI_BP && state->regs[CFI_BP].base == CFI_CFA &&
-	    state->regs[CFI_BP].offset == -16)
+	    state->regs[CFI_BP].offset == -state->cfa.offset)
 		return true;
 	if (state->drap && state->regs[CFI_BP].base == CFI_BP)