Each function's PC is recorded in the ring buffer. From there we can access the function's local variables and reconstruct the tag of each one with the help of the information printed by llvm-symbolizer's new FRAME command. We can then find the variable that was likely being accessed by matching the pointer's tag against the reconstructed tag. Differential Revision: https://reviews.llvm.org/D63469 llvm-svn: 364607
21 lines
661 B
C
21 lines
661 B
C
// RUN: %clang_hwasan -g %s -o %t && not %run %t 2>&1 | FileCheck %s
|
|
|
|
// Dynamic stack realignment causes debug info locations to use non-FP-relative
|
|
// offsets because stack frames are realigned below FP, which means that we
|
|
// can't associate addresses with stack objects in this case. Ideally we should
|
|
// be able to handle this case somehow (e.g. by using a different register for
|
|
// DW_AT_frame_base) but at least we shouldn't get confused by it.
|
|
|
|
__attribute((noinline))
|
|
char *buggy() {
|
|
_Alignas(64) char c[64];
|
|
char *volatile p = c;
|
|
return p;
|
|
}
|
|
|
|
int main() {
|
|
char *p = buggy();
|
|
// CHECK-NOT: Potentially referenced stack objects:
|
|
p[0] = 0;
|
|
}
|