[PATCH] D45296: [sanitizer] Allow BackgroundThread to not depend on StackDepot
Kostya Kortchinsky via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 9 10:06:43 PDT 2018
cryptoad updated this revision to Diff 141675.
cryptoad added a comment.
I had to change from a weak default implementation to a weak definition
otherwise Android would fail with:
==19013==AddressSanitizer: libc interceptors initialized
|| `[0xb27a8000, 0xbfffffff]` || HighMem ||
|| `[0xb0c9d000, 0xb27a7fff]` || HighShadow ||
|| `[0xadc9d000, 0xb0c9cfff]` || ShadowGap ||
|| `[0x9a7a8000, 0xadc9cfff]` || LowShadow ||
|| `[0x00000000, 0x9a7a7fff]` || LowMem ||
MemToShadow(shadow): 0xadc9d000 0xb033b9ff 0xb093ba00 0xb0c9cfff
redzone=16
max_redzone=2048
quarantine_size_mb=10M
thread_local_quarantine_size_kb=64K
malloc_context_size=30
SHADOW_SCALE: 3
SHADOW_GRANULARITY: 8
SHADOW_OFFSET: 0x9a7a8000
==19013==Installed the sigaction for signal 11
==19013==Installed the sigaction for signal 7
==19013==Installed the sigaction for signal 8
==19013==T0: stack [0xbf157000,0xbf957000) size 0x800000; local=0xbf953808
==19013==AddressSanitizer Init done
stack corruption detected (-fstack-protector)
Aborted
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D45296
Files:
lib/sanitizer_common/sanitizer_common_libcdep.cc
Index: lib/sanitizer_common/sanitizer_common_libcdep.cc
===================================================================
--- lib/sanitizer_common/sanitizer_common_libcdep.cc
+++ lib/sanitizer_common/sanitizer_common_libcdep.cc
@@ -18,7 +18,6 @@
#include "sanitizer_flags.h"
#include "sanitizer_procmaps.h"
#include "sanitizer_report_decorator.h"
-#include "sanitizer_stackdepot.h"
#include "sanitizer_stacktrace.h"
#include "sanitizer_symbolizer.h"
@@ -113,6 +112,9 @@
}
#if SANITIZER_LINUX && !SANITIZER_GO
+// Weak definition for when sanitizer_stackdepot is not linked in.
+SANITIZER_WEAK_ATTRIBUTE StackDepotStats *StackDepotGetStats();
+
void BackgroundThread(void *arg) {
uptr hard_rss_limit_mb = common_flags()->hard_rss_limit_mb;
uptr soft_rss_limit_mb = common_flags()->soft_rss_limit_mb;
@@ -130,15 +132,17 @@
Printf("%s: RSS: %zdMb\n", SanitizerToolName, current_rss_mb);
prev_reported_rss = current_rss_mb;
}
- // If stack depot has grown 10% since last time, print it too.
- StackDepotStats *stack_depot_stats = StackDepotGetStats();
- if (prev_reported_stack_depot_size * 11 / 10 <
- stack_depot_stats->allocated) {
- Printf("%s: StackDepot: %zd ids; %zdM allocated\n",
- SanitizerToolName,
- stack_depot_stats->n_uniq_ids,
- stack_depot_stats->allocated >> 20);
- prev_reported_stack_depot_size = stack_depot_stats->allocated;
+ if (&StackDepotGetStats) {
+ // If stack depot has grown 10% since last time, print it too.
+ StackDepotStats *stack_depot_stats = StackDepotGetStats();
+ if (prev_reported_stack_depot_size * 11 / 10 <
+ stack_depot_stats->allocated) {
+ Printf("%s: StackDepot: %zd ids; %zdM allocated\n",
+ SanitizerToolName,
+ stack_depot_stats->n_uniq_ids,
+ stack_depot_stats->allocated >> 20);
+ prev_reported_stack_depot_size = stack_depot_stats->allocated;
+ }
}
}
// Check RSS against the limit.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45296.141675.patch
Type: text/x-patch
Size: 2085 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180409/483887aa/attachment.bin>
More information about the llvm-commits
mailing list