[compiler-rt] r222803 - [Sanitizer] Bump kMaxPathLength to 4096 and use it more extensively instead of hardcoded constants

Alexey Samsonov vonosmas at gmail.com
Tue Nov 25 17:48:40 PST 2014


Author: samsonov
Date: Tue Nov 25 19:48:39 2014
New Revision: 222803

URL: http://llvm.org/viewvc/llvm-project?rev=222803&view=rev
Log:
[Sanitizer] Bump kMaxPathLength to 4096 and use it more extensively instead of hardcoded constants

Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_libignore.cc
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.cc

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h?rev=222803&r1=222802&r2=222803&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h Tue Nov 25 19:48:39 2014
@@ -34,7 +34,7 @@ const uptr kWordSizeInBits = 8 * kWordSi
   const uptr kCacheLineSize = 64;
 #endif
 
-const uptr kMaxPathLength = 512;
+const uptr kMaxPathLength = 4096;
 
 const uptr kMaxThreadStackSize = 1 << 30;  // 1Gb
 
@@ -149,7 +149,7 @@ extern StaticSpinMutex CommonSanitizerRe
 void MaybeOpenReportFile();
 extern fd_t report_fd;
 extern bool log_to_file;
-extern char report_path_prefix[4096];
+extern char report_path_prefix[kMaxPathLength];
 extern uptr report_fd_pid;
 extern uptr stoptheworld_tracer_pid;
 extern uptr stoptheworld_tracer_ppid;

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc?rev=222803&r1=222802&r2=222803&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc Tue Nov 25 19:48:39 2014
@@ -132,7 +132,7 @@ class CoverageData {
 static CoverageData coverage_data;
 
 void CoverageData::DirectOpen() {
-  InternalScopedString path(1024);
+  InternalScopedString path(kMaxPathLength);
   internal_snprintf((char *)path.data(), path.size(), "%s/%zd.sancov.raw",
                     common_flags()->coverage_dir, internal_getpid());
   pc_fd = OpenFile(path.data(), true);
@@ -339,7 +339,7 @@ static void CovWritePacked(int pid, cons
 // If packed = true and name != 0: <name>.<sancov>.<packed> (name is
 // user-supplied).
 static int CovOpenFile(bool packed, const char* name) {
-  InternalScopedBuffer<char> path(1024);
+  InternalScopedBuffer<char> path(kMaxPathLength);
   if (!packed) {
     CHECK(name);
     internal_snprintf((char *)path.data(), path.size(), "%s/%s.%zd.sancov",
@@ -465,8 +465,8 @@ static void CovDump() {
   SortArray(vb, size);
   MemoryMappingLayout proc_maps(/*cache_enabled*/true);
   uptr mb, me, off, prot;
-  InternalScopedBuffer<char> module(4096);
-  InternalScopedBuffer<char> path(4096 * 2);
+  InternalScopedBuffer<char> module(kMaxPathLength);
+  InternalScopedBuffer<char> path(kMaxPathLength);
   for (int i = 0;
        proc_maps.Next(&mb, &me, &off, module.data(), module.size(), &prot);
        i++) {

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_libignore.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_libignore.cc?rev=222803&r1=222802&r2=222803&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_libignore.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_libignore.cc Tue Nov 25 19:48:39 2014
@@ -42,7 +42,7 @@ void LibIgnore::Init(const SuppressionCo
 void LibIgnore::OnLibraryLoaded(const char *name) {
   BlockingMutexLock lock(&mutex_);
   // Try to match suppressions with symlink target.
-  InternalScopedBuffer<char> buf(4096);
+  InternalScopedBuffer<char> buf(kMaxPathLength);
   if (name != 0 && internal_readlink(name, buf.data(), buf.size() - 1) > 0 &&
       buf.data()[0]) {
     for (uptr i = 0; i < count_; i++) {
@@ -55,7 +55,7 @@ void LibIgnore::OnLibraryLoaded(const ch
 
   // Scan suppressions list and find newly loaded and unloaded libraries.
   MemoryMappingLayout proc_maps(/*cache_enabled*/false);
-  InternalScopedBuffer<char> module(4096);
+  InternalScopedBuffer<char> module(kMaxPathLength);
   for (uptr i = 0; i < count_; i++) {
     Lib *lib = &libs_[i];
     bool loaded = false;

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.cc?rev=222803&r1=222802&r2=222803&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.cc Tue Nov 25 19:48:39 2014
@@ -293,7 +293,7 @@ void MaybeOpenReportFile() {
   if (pid == stoptheworld_tracer_pid)
     pid = stoptheworld_tracer_ppid;
   if (report_fd_pid == pid) return;
-  InternalScopedBuffer<char> report_path_full(4096);
+  InternalScopedBuffer<char> report_path_full(kMaxPathLength);
   internal_snprintf(report_path_full.data(), report_path_full.size(),
                     "%s.%zu", report_path_prefix, pid);
   uptr openrv = OpenFile(report_path_full.data(), true);
@@ -324,7 +324,7 @@ void RawWrite(const char *buffer) {
 
 bool GetCodeRangeForFile(const char *module, uptr *start, uptr *end) {
   uptr s, e, off, prot;
-  InternalScopedString buff(4096);
+  InternalScopedString buff(kMaxPathLength);
   MemoryMappingLayout proc_maps(/*cache_enabled*/false);
   while (proc_maps.Next(&s, &e, &off, buff.data(), buff.size(), &prot)) {
     if ((prot & MemoryMappingLayout::kProtectionExecute) != 0





More information about the llvm-commits mailing list