diff options
author | Josh Poimboeuf <jpoimboe@redhat.com> | 2017-08-10 16:37:26 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2017-08-11 14:06:15 +0200 |
commit | bf4d1a83758368c842c94cab9661a75ca98bc848 (patch) | |
tree | 8e6787d0a5c44d6c997f849efde293dea00aeee6 /tools/objtool/check.h | |
parent | 12b25729a194198e3c4289adaddc4115b10b094e (diff) | |
download | linux-bf4d1a83758368c842c94cab9661a75ca98bc848.tar.bz2 |
objtool: Track DRAP separately from callee-saved registers
When GCC realigns a function's stack, it sometimes uses %r13 as the DRAP
register, like:
push %r13
lea 0x10(%rsp), %r13
and $0xfffffffffffffff0, %rsp
pushq -0x8(%r13)
push %rbp
mov %rsp, %rbp
push %r13
...
mov -0x8(%rbp),%r13
leaveq
lea -0x10(%r13), %rsp
pop %r13
retq
Since %r13 was pushed onto the stack twice, its two stack locations need
to be stored separately. The first push of %r13 is its original value,
and the second push of %r13 is the caller's stack frame address.
Since %r13 is a callee-saved register, we need to track the stack
location of its original value separately from the DRAP register.
This fixes the following false positive warning:
lib/ubsan.o: warning: objtool: val_to_string.constprop.7()+0x97: leave instruction with modified stack frame
Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: baa41469a7b9 ("objtool: Implement stack validation 2.0")
Link: http://lkml.kernel.org/r/3da23a6d4c5b3c1e21fc2ccc21a73941b97ff20a.1502401017.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/objtool/check.h')
-rw-r--r-- | tools/objtool/check.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/objtool/check.h b/tools/objtool/check.h index c9af11f0c8af..9f113016bf8c 100644 --- a/tools/objtool/check.h +++ b/tools/objtool/check.h @@ -32,7 +32,7 @@ struct insn_state { unsigned char type; bool bp_scratch; bool drap; - int drap_reg; + int drap_reg, drap_offset; }; struct instruction { |