[PATCH] D52802: [hwasan] Fix top PC in error stack trace being off by 1 instruction.
Evgenii Stepanov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 2 14:23:51 PDT 2018
eugenis created this revision.
eugenis added reviewers: kcc, vitalybuka.
Herald added a subscriber: kubamracek.
Herald added a reviewer: jfb.
GetStackTrace treats top PC as a return address from an error reporting
function, and adjusts it down by 1 instruction. This is not necessary in
a signal handler, so adjust PC up to compensate.
https://reviews.llvm.org/D52802
Files:
compiler-rt/lib/hwasan/hwasan_linux.cc
Index: compiler-rt/lib/hwasan/hwasan_linux.cc
===================================================================
--- compiler-rt/lib/hwasan/hwasan_linux.cc
+++ compiler-rt/lib/hwasan/hwasan_linux.cc
@@ -355,8 +355,8 @@
BufferedStackTrace *stack = stack_buffer.data();
stack->Reset();
SignalContext sig{info, uc};
- GetStackTrace(stack, kStackTraceMax, sig.pc, sig.bp, uc,
- common_flags()->fast_unwind_on_fatal);
+ GetStackTrace(stack, kStackTraceMax, StackTrace::GetNextInstructionPc(sig.pc),
+ sig.bp, uc, common_flags()->fast_unwind_on_fatal);
ReportTagMismatch(stack, ai.addr, ai.size, ai.is_store);
@@ -375,8 +375,8 @@
static void OnStackUnwind(const SignalContext &sig, const void *,
BufferedStackTrace *stack) {
- GetStackTrace(stack, kStackTraceMax, sig.pc, sig.bp, sig.context,
- common_flags()->fast_unwind_on_fatal);
+ GetStackTrace(stack, kStackTraceMax, StackTrace::GetNextInstructionPc(sig.pc),
+ sig.bp, sig.context, common_flags()->fast_unwind_on_fatal);
}
void HwasanOnDeadlySignal(int signo, void *info, void *context) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52802.168029.patch
Type: text/x-patch
Size: 1154 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181002/909d9fbc/attachment-0001.bin>
More information about the llvm-commits
mailing list