forked from OSchip/llvm-project
[hwasan] Fix top PC in error stack trace being off by 1 instruction.
Summary: 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. Reviewers: kcc, vitalybuka, jfb Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D52802 llvm-svn: 343638
This commit is contained in:
parent
16922d0718
commit
edede5daff
|
@ -355,8 +355,8 @@ static bool HwasanOnSIGTRAP(int signo, siginfo_t *info, ucontext_t *uc) {
|
|||
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 bool HwasanOnSIGTRAP(int signo, siginfo_t *info, ucontext_t *uc) {
|
|||
|
||||
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) {
|
||||
|
|
Loading…
Reference in New Issue