diff options
| author | Hal Finkel <hfinkel@anl.gov> | 2015-01-17 03:31:43 +0000 |
|---|---|---|
| committer | Hal Finkel <hfinkel@anl.gov> | 2015-01-17 03:31:43 +0000 |
| commit | 0e39c55d229a5311751784705896f3dcdf8d8a11 (patch) | |
| tree | 471e02a3b45dbaed1edfeb32e0840d7fcde7e8b8 | |
| parent | 8888d5b32cf1bba746ff3e2fe8f04f53fc0368bc (diff) | |
| download | bcm5719-llvm-0e39c55d229a5311751784705896f3dcdf8d8a11.tar.gz bcm5719-llvm-0e39c55d229a5311751784705896f3dcdf8d8a11.zip | |
[sanitizer] Adjust max read size in FlagHandlerInclude
Setting the maximum read size in FlagHandlerInclude to 2^15 might be a good
default, but causes the read to fail on systems with a page size larger than
that (ReadFileToBuffer(...) will fail if the maximum allowed size is less than
the value returned by GetPageSizeCached()). For example, on my PPC64/Linux
system, GetPageSizeCached() returns 2^16. In case the page size is larger, use
that instead.
llvm-svn: 226368
| -rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_flags.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_flags.cc b/compiler-rt/lib/sanitizer_common/sanitizer_flags.cc index bc85a2a634d..8be50c39af5 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_flags.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_flags.cc @@ -56,7 +56,8 @@ class FlagHandlerInclude : public FlagHandlerBase { uptr data_mapped_size; int err; uptr len = - ReadFileToBuffer(value, &data, &data_mapped_size, kMaxIncludeSize, &err); + ReadFileToBuffer(value, &data, &data_mapped_size, + Max(kMaxIncludeSize, GetPageSizeCached()), &err); if (!len) { Printf("Failed to read options from '%s': error %d\n", value, err); return false; |

