[compiler-rt] af0a8b8 - sanitizer_common: bump default file max size to 256MB

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 29 05:03:29 PDT 2021


Author: Dmitry Vyukov
Date: 2021-10-29T14:03:26+02:00
New Revision: af0a8b83172af67d65edd04ee18f864db9867d47

URL: https://github.com/llvm/llvm-project/commit/af0a8b83172af67d65edd04ee18f864db9867d47
DIFF: https://github.com/llvm/llvm-project/commit/af0a8b83172af67d65edd04ee18f864db9867d47.diff

LOG: sanitizer_common: bump default file max size to 256MB

I am hitting some cases where /proc/self/maps does not fit into 64MB.
256MB is lots of memory, but it's not radically more than the current 64MB.
Ideally we should read/parse these huge files incrementally,
but that's lots of work for a debugging/introspection interface.
So for now just bump the limit.

Depends on D112793.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D112794

Added: 
    

Modified: 
    compiler-rt/lib/sanitizer_common/sanitizer_common.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/sanitizer_common/sanitizer_common.h b/compiler-rt/lib/sanitizer_common/sanitizer_common.h
index 8b4d2e8b93bd..065154496eb5 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common.h
@@ -721,12 +721,15 @@ void SortAndDedup(Container &v, Compare comp = {}) {
   v.resize(last + 1);
 }
 
+constexpr uptr kDefaultFileMaxSize = FIRST_32_SECOND_64(1 << 26, 1 << 28);
+
 // Opens the file 'file_name" and reads up to 'max_len' bytes.
 // The resulting buffer is mmaped and stored in '*buff'.
 // Returns true if file was successfully opened and read.
 bool ReadFileToVector(const char *file_name,
                       InternalMmapVectorNoCtor<char> *buff,
-                      uptr max_len = 1 << 26, error_t *errno_p = nullptr);
+                      uptr max_len = kDefaultFileMaxSize,
+                      error_t *errno_p = nullptr);
 
 // Opens the file 'file_name" and reads up to 'max_len' bytes.
 // This function is less I/O efficient than ReadFileToVector as it may reread
@@ -737,7 +740,7 @@ bool ReadFileToVector(const char *file_name,
 // The total number of read bytes is stored in '*read_len'.
 // Returns true if file was successfully opened and read.
 bool ReadFileToBuffer(const char *file_name, char **buff, uptr *buff_size,
-                      uptr *read_len, uptr max_len = 1 << 26,
+                      uptr *read_len, uptr max_len = kDefaultFileMaxSize,
                       error_t *errno_p = nullptr);
 
 // When adding a new architecture, don't forget to also update


        


More information about the llvm-commits mailing list