[PATCH] D131415: Remove variable names from sanitize-memory-track-origins binary.
Kevin Athey via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 8 13:41:36 PDT 2022
kda updated this revision to Diff 450927.
kda added a comment.
removed those changes found in https://reviews.llvm.org/D131205
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131415/new/
https://reviews.llvm.org/D131415
Files:
compiler-rt/lib/msan/msan.cpp
compiler-rt/lib/msan/msan_report.cpp
llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
Index: llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
===================================================================
--- llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -3875,7 +3875,7 @@
// It will be printed by the run-time if stack-originated UMR is found.
// The first 4 bytes of the string are set to '----' and will be replaced
// by __msan_va_arg_overflow_size_tls at the first call.
- StackDescription << "----" << I.getName() << "@" << F.getName();
+ StackDescription << "----";
return createPrivateNonConstGlobalForString(*F.getParent(),
StackDescription.str());
}
Index: compiler-rt/lib/msan/msan_report.cpp
===================================================================
--- compiler-rt/lib/msan/msan_report.cpp
+++ compiler-rt/lib/msan/msan_report.cpp
@@ -35,23 +35,24 @@
};
static void DescribeStackOrigin(const char *so, uptr pc) {
+ const char* function_name = "kUNKNOWN_FUNCTIONk";
+ if (pc) {
+ // For some reason function address in LLVM IR is 1 less then the address
+ // of the first instruction.
+ pc = StackTrace::GetNextInstructionPc(pc);
+ SymbolizedStack *frame = Symbolizer::GetOrInit()->SymbolizePC(pc);
+ // TODO: Does not work for SANITIZER_NETBSD
+ function_name = frame->info.function;
+ }
Decorator d;
- char *s = internal_strdup(so);
- char *sep = internal_strchr(s, '@');
- CHECK(sep);
- *sep = '\0';
Printf("%s", d.Origin());
Printf(
" %sUninitialized value was created by an allocation of '%s%s%s'"
" in the stack frame of function '%s%s%s'%s\n",
- d.Origin(), d.Name(), s, d.Origin(), d.Name(), sep + 1, d.Origin(),
- d.Default());
- InternalFree(s);
+ d.Origin(), d.Name(), "kUNKNOWN_VARIABLEk", d.Origin(), d.Name(),
+ function_name, d.Origin(), d.Default());
if (pc) {
- // For some reason function address in LLVM IR is 1 less then the address
- // of the first instruction.
- pc = StackTrace::GetNextInstructionPc(pc);
StackTrace(&pc, 1).Print();
}
}
Index: compiler-rt/lib/msan/msan.cpp
===================================================================
--- compiler-rt/lib/msan/msan.cpp
+++ compiler-rt/lib/msan/msan.cpp
@@ -101,7 +101,6 @@
// Array of stack origins.
// FIXME: make it resizable.
static const uptr kNumStackOriginDescrs = 1024 * 1024;
-static const char *StackOriginDescr[kNumStackOriginDescrs];
static uptr StackOriginPC[kNumStackOriginDescrs];
static atomic_uint32_t NumStackOriginDescrs;
@@ -289,7 +288,7 @@
const char *GetStackOriginDescr(u32 id, uptr *pc) {
CHECK_LT(id, kNumStackOriginDescrs);
if (pc) *pc = StackOriginPC[id];
- return StackOriginDescr[id];
+ return nullptr;
}
u32 ChainOrigin(u32 id, StackTrace *stack) {
@@ -601,7 +600,6 @@
if (id == first_timer) {
u32 idx = atomic_fetch_add(&NumStackOriginDescrs, 1, memory_order_relaxed);
CHECK_LT(idx, kNumStackOriginDescrs);
- StackOriginDescr[idx] = descr + 4;
#if SANITIZER_PPC64V1
// On PowerPC64 ELFv1, the address of a function actually points to a
// three-doubleword data structure with the first field containing
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131415.450927.patch
Type: text/x-patch
Size: 3258 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220808/d4173f22/attachment.bin>
More information about the llvm-commits
mailing list