[compiler-rt] 0f9bfe0 - [Sanitizers][Atos] Remove null-ing of atos process pointer
Blue Gaston via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 7 14:56:43 PDT 2023
Author: Blue Gaston
Date: 2023-04-07T14:56:06-07:00
New Revision: 0f9bfe0a02ffff077a1a98065069b52744e31723
URL: https://github.com/llvm/llvm-project/commit/0f9bfe0a02ffff077a1a98065069b52744e31723
DIFF: https://github.com/llvm/llvm-project/commit/0f9bfe0a02ffff077a1a98065069b52744e31723.diff
LOG: [Sanitizers][Atos] Remove null-ing of atos process pointer
Currently, when we send an address to atos to be symbolized, it is
expected that atos returns with more than it was sent, i.e. symbol
information for that address. In the case where only the address is
returned, we currently null the pointer to the atos process. Typically,
for modules where no symbolication is expected, we do not send the
address to atos.
However, in new simulators there is an early call that atos does not
return any symbol information for. And in this case, because we have
gotten rid of the pointer to the process, no subsequent frames are
symbolicated, even tho atos is still working/running.
This patch removes the nulling of the pointer to the process. This
allows subsequent calls to atos even after an unexpected result.
It also now Reports what has happened and the address this occurred.
This will improve symbolication in cases where we get an unepxected
result, and will make it easier to diagnose atos if it is not
symbolicating as expected.
Filed a radar about the change of behavior 107621524
rdar://107169715
Differential Revision: https://reviews.llvm.org/D147725
Added:
compiler-rt/test/sanitizer_common/TestCases/Darwin/atos-symbolized-recover.cpp
Modified:
compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_mac.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_mac.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_mac.cpp
index f4f2a036a1e71..06c05a597d635 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_mac.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_mac.cpp
@@ -163,7 +163,7 @@ bool AtosSymbolizer::SymbolizePC(uptr addr, SymbolizedStack *stack) {
uptr start_address = AddressInfo::kUnknown;
if (!ParseCommandOutput(buf, addr, &stack->info.function, &stack->info.module,
&stack->info.file, &line, &start_address)) {
- process_ = nullptr;
+ Report("WARNING: atos failed to symbolize address \"0x%zx\"\n", addr);
return false;
}
stack->info.line = (int)line;
diff --git a/compiler-rt/test/sanitizer_common/TestCases/Darwin/atos-symbolized-recover.cpp b/compiler-rt/test/sanitizer_common/TestCases/Darwin/atos-symbolized-recover.cpp
new file mode 100644
index 0000000000000..3d1c112ec941e
--- /dev/null
+++ b/compiler-rt/test/sanitizer_common/TestCases/Darwin/atos-symbolized-recover.cpp
@@ -0,0 +1,18 @@
+// Check that there is a warning when atos fails to symbolize an address
+// and that atos continues symbolicating correctly after.
+
+// RUN: %clangxx -O0 %s -o %t
+// RUN: not %run %t 2>&1 | FileCheck %s
+
+void bar() {
+ void *invalid_addr = reinterpret_cast<void *>(0xDEADBEEF);
+ void (*func_ptr)() = reinterpret_cast<void (*)()>(invalid_addr);
+ func_ptr();
+}
+
+int main() {
+ bar();
+ return 0;
+ // CHECK: WARNING: atos failed to symbolize address{{.*}}
+ // CHECK: {{.*}}atos-symbolized-recover.cpp:[[@LINE-3]]{{.*}}
+}
More information about the llvm-commits
mailing list