<div dir="ltr">Windows bot barks:<pre style="font-family:'Courier New',courier,monotype,monospace;color:rgb(0,0,0);font-size:medium"><span class="">../sanitizer_common/sanitizer_stacktrace.cc(67) : error C2664: '__sanitizer::MemoryMappingLayout::MemoryMappingLayout(const __sanitizer::MemoryMappingLayout &)' : cannot convert parameter 1 from 'bool' to 'const __sanitizer::MemoryMappingLayout &'
Reason: cannot convert from 'bool' to 'const __sanitizer::MemoryMappingLayout'
No constructor could take the source type, or constructor overload resolution was ambiguous</span></pre></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Mar 26, 2013 at 2:34 PM, Alexander Potapenko <span dir="ltr"><<a href="mailto:glider@google.com" target="_blank">glider@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: glider<br>
Date: Tue Mar 26 05:34:37 2013<br>
New Revision: 178000<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=178000&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=178000&view=rev</a><br>
Log:<br>
[libsanitizer] Unmapping the old cache partially invalidates the memory layout, so add<br>
a flag to skip cache update for cases when that's unacceptable (e.g. lsan).<br>
<br>
Patch by Sergey Matveev (<a href="mailto:earthdok@google.com">earthdok@google.com</a>)<br>
<br>
<br>
Modified:<br>
compiler-rt/trunk/lib/msan/msan.cc<br>
compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc<br>
compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc<br>
compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.cc<br>
compiler-rt/trunk/lib/sanitizer_common/sanitizer_procmaps.h<br>
compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc<br>
compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc<br>
<br>
Modified: compiler-rt/trunk/lib/msan/msan.cc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan.cc?rev=178000&r1=177999&r2=178000&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan.cc?rev=178000&r1=177999&r2=178000&view=diff</a><br>
==============================================================================<br>
--- compiler-rt/trunk/lib/msan/msan.cc (original)<br>
+++ compiler-rt/trunk/lib/msan/msan.cc Tue Mar 26 05:34:37 2013<br>
@@ -70,7 +70,7 @@ namespace __msan {<br>
<br>
static bool IsRunningUnderDr() {<br>
bool result = false;<br>
- MemoryMappingLayout proc_maps;<br>
+ MemoryMappingLayout proc_maps(/*cache_enabled*/true);<br>
const sptr kBufSize = 4095;<br>
char *filename = (char*)MmapOrDie(kBufSize, __FUNCTION__);<br>
while (proc_maps.Next(/* start */0, /* end */0, /* file_offset */0,<br>
<br>
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc?rev=178000&r1=177999&r2=178000&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc?rev=178000&r1=177999&r2=178000&view=diff</a><br>
==============================================================================<br>
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc (original)<br>
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc Tue Mar 26 05:34:37 2013<br>
@@ -200,7 +200,7 @@ void GetThreadStackTopAndBottom(bool at_<br>
CHECK_EQ(getrlimit(RLIMIT_STACK, &rl), 0);<br>
<br>
// Find the mapping that contains a stack variable.<br>
- MemoryMappingLayout proc_maps;<br>
+ MemoryMappingLayout proc_maps(/*cache_enabled*/true);<br>
uptr start, end, offset;<br>
uptr prev_end = 0;<br>
while (proc_maps.Next(&start, &end, &offset, 0, 0, /* protection */0)) {<br>
@@ -341,18 +341,22 @@ void PrepareForSandboxing() {<br>
ProcSelfMapsBuff MemoryMappingLayout::cached_proc_self_maps_;<br>
StaticSpinMutex MemoryMappingLayout::cache_lock_; // Linker initialized.<br>
<br>
-MemoryMappingLayout::MemoryMappingLayout() {<br>
+MemoryMappingLayout::MemoryMappingLayout(bool cache_enabled) {<br>
proc_self_maps_.len =<br>
ReadFileToBuffer("/proc/self/maps", &proc_self_maps_.data,<br>
&proc_self_maps_.mmaped_size, 1 << 26);<br>
- if (proc_self_maps_.mmaped_size == 0) {<br>
- LoadFromCache();<br>
- CHECK_GT(proc_self_maps_.len, 0);<br>
+ if (cache_enabled) {<br>
+ if (proc_self_maps_.mmaped_size == 0) {<br>
+ LoadFromCache();<br>
+ CHECK_GT(proc_self_maps_.len, 0);<br>
+ }<br>
+ } else {<br>
+ CHECK_GT(proc_self_maps_.mmaped_size, 0);<br>
}<br>
- // internal_write(2, proc_self_maps_.data, proc_self_maps_.len);<br>
Reset();<br>
// FIXME: in the future we may want to cache the mappings on demand only.<br>
- CacheMemoryMappings();<br>
+ if (cache_enabled)<br>
+ CacheMemoryMappings();<br>
}<br>
<br>
MemoryMappingLayout::~MemoryMappingLayout() {<br>
@@ -643,7 +647,6 @@ int internal_sigaltstack(const struct si<br>
return syscall(__NR_sigaltstack, ss, oss);<br>
}<br>
<br>
-<br>
// ThreadLister implementation.<br>
ThreadLister::ThreadLister(int pid)<br>
: pid_(pid),<br>
<br>
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc?rev=178000&r1=177999&r2=178000&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc?rev=178000&r1=177999&r2=178000&view=diff</a><br>
==============================================================================<br>
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc (original)<br>
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc Tue Mar 26 05:34:37 2013<br>
@@ -165,7 +165,7 @@ void PrepareForSandboxing() {<br>
<br>
// ----------------- sanitizer_procmaps.h<br>
<br>
-MemoryMappingLayout::MemoryMappingLayout() {<br>
+MemoryMappingLayout::MemoryMappingLayout(bool cache_enabled) {<br>
Reset();<br>
}<br>
<br>
<br>
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.cc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.cc?rev=178000&r1=177999&r2=178000&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.cc?rev=178000&r1=177999&r2=178000&view=diff</a><br>
==============================================================================<br>
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.cc (original)<br>
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.cc Tue Mar 26 05:34:37 2013<br>
@@ -151,11 +151,11 @@ static inline bool IntervalsAreSeparate(<br>
// several worker threads on Mac, which aren't expected to map big chunks of<br>
// memory).<br>
bool MemoryRangeIsAvailable(uptr range_start, uptr range_end) {<br>
- MemoryMappingLayout procmaps;<br>
+ MemoryMappingLayout proc_maps(/*cache_enabled*/true);<br>
uptr start, end;<br>
- while (procmaps.Next(&start, &end,<br>
- /*offset*/0, /*filename*/0, /*filename_size*/0,<br>
- /*protection*/0)) {<br>
+ while (proc_maps.Next(&start, &end,<br>
+ /*offset*/0, /*filename*/0, /*filename_size*/0,<br>
+ /*protection*/0)) {<br>
if (!IntervalsAreSeparate(start, end, range_start, range_end))<br>
return false;<br>
}<br>
@@ -163,7 +163,7 @@ bool MemoryRangeIsAvailable(uptr range_s<br>
}<br>
<br>
void DumpProcessMap() {<br>
- MemoryMappingLayout proc_maps;<br>
+ MemoryMappingLayout proc_maps(/*cache_enabled*/true);<br>
uptr start, end;<br>
const sptr kBufSize = 4095;<br>
char *filename = (char*)MmapOrDie(kBufSize, __FUNCTION__);<br>
<br>
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_procmaps.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_procmaps.h?rev=178000&r1=177999&r2=178000&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_procmaps.h?rev=178000&r1=177999&r2=178000&view=diff</a><br>
==============================================================================<br>
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_procmaps.h (original)<br>
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_procmaps.h Tue Mar 26 05:34:37 2013<br>
@@ -41,7 +41,7 @@ struct ProcSelfMapsBuff {<br>
<br>
class MemoryMappingLayout {<br>
public:<br>
- MemoryMappingLayout();<br>
+ explicit MemoryMappingLayout(bool cache_enabled);<br>
bool Next(uptr *start, uptr *end, uptr *offset,<br>
char filename[], uptr filename_size, uptr *protection);<br>
void Reset();<br>
<br>
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc?rev=178000&r1=177999&r2=178000&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc?rev=178000&r1=177999&r2=178000&view=diff</a><br>
==============================================================================<br>
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc (original)<br>
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc Tue Mar 26 05:34:37 2013<br>
@@ -64,7 +64,7 @@ static void PrintModuleAndOffset(const c<br>
void StackTrace::PrintStack(const uptr *addr, uptr size,<br>
bool symbolize, const char *strip_file_prefix,<br>
SymbolizeCallback symbolize_callback ) {<br>
- MemoryMappingLayout proc_maps;<br>
+ MemoryMappingLayout proc_maps(/*cache_enabled*/true);<br>
InternalScopedBuffer<char> buff(GetPageSizeCached() * 2);<br>
InternalScopedBuffer<AddressInfo> addr_frames(64);<br>
uptr frame_num = 0;<br>
<br>
Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc?rev=178000&r1=177999&r2=178000&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc?rev=178000&r1=177999&r2=178000&view=diff</a><br>
==============================================================================<br>
--- compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc (original)<br>
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc Tue Mar 26 05:34:37 2013<br>
@@ -198,7 +198,7 @@ static void MapRodata() {<br>
return;<br>
}<br>
// Map the file into shadow of .rodata sections.<br>
- MemoryMappingLayout proc_maps;<br>
+ MemoryMappingLayout proc_maps(/*cache_enabled*/true);<br>
uptr start, end, offset, prot;<br>
char name[128];<br>
while (proc_maps.Next(&start, &end, &offset, name, ARRAY_SIZE(name), &prot)) {<br>
@@ -257,7 +257,7 @@ static uptr g_data_end;<br>
#ifndef TSAN_GO<br>
static void CheckPIE() {<br>
// Ensure that the binary is indeed compiled with -pie.<br>
- MemoryMappingLayout proc_maps;<br>
+ MemoryMappingLayout proc_maps(true);<br>
uptr start, end;<br>
if (proc_maps.Next(&start, &end,<br>
/*offset*/0, /*filename*/0, /*filename_size*/0,<br>
@@ -274,7 +274,7 @@ static void CheckPIE() {<br>
}<br>
<br>
static void InitDataSeg() {<br>
- MemoryMappingLayout proc_maps;<br>
+ MemoryMappingLayout proc_maps(true);<br>
uptr start, end, offset;<br>
char name[128];<br>
bool prev_is_data = false;<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div>Alexey Samsonov, MSK</div>
</div>