diff options
| author | Francis Ricci <francisjricci@gmail.com> | 2017-07-11 18:54:00 +0000 |
|---|---|---|
| committer | Francis Ricci <francisjricci@gmail.com> | 2017-07-11 18:54:00 +0000 |
| commit | f6a4329b7d7cc646c65bb5543d5d69913e8c5a11 (patch) | |
| tree | 6369896943e7ee613341bca0eacb697dd4b48126 /compiler-rt/lib/asan/asan_errors.cc | |
| parent | 368d8a7351fed33ce4e53ae3906c12d483384db8 (diff) | |
| download | bcm5719-llvm-f6a4329b7d7cc646c65bb5543d5d69913e8c5a11.tar.gz bcm5719-llvm-f6a4329b7d7cc646c65bb5543d5d69913e8c5a11.zip | |
Refactor MemoryMappingLayout::Next to use a single struct instead of output parameters. NFC.
Summary:
This is the first in a series of patches to refactor sanitizer_procmaps
to allow MachO section information to be exposed on darwin.
In addition, grouping all segment information in a single struct is
cleaner than passing it through a large set of output parameters, and
avoids the need for annotations of NULL parameters for unneeded
information.
The filename string is optional and must be managed and supplied by the
calling function. This is to allow the MemoryMappedSegment struct to be
stored on the stack without causing overly large stack sizes.
Reviewers: alekseyshl, kubamracek, glider
Subscribers: emaste, llvm-commits
Differential Revision: https://reviews.llvm.org/D35135
llvm-svn: 307688
Diffstat (limited to 'compiler-rt/lib/asan/asan_errors.cc')
| -rw-r--r-- | compiler-rt/lib/asan/asan_errors.cc | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/compiler-rt/lib/asan/asan_errors.cc b/compiler-rt/lib/asan/asan_errors.cc index 57490ad180b..b7a38eb7cec 100644 --- a/compiler-rt/lib/asan/asan_errors.cc +++ b/compiler-rt/lib/asan/asan_errors.cc @@ -61,10 +61,9 @@ static void MaybeDumpRegisters(void *context) { static void MaybeReportNonExecRegion(uptr pc) { #if SANITIZER_FREEBSD || SANITIZER_LINUX MemoryMappingLayout proc_maps(/*cache_enabled*/ true); - uptr start, end, protection; - while (proc_maps.Next(&start, &end, nullptr, nullptr, 0, &protection)) { - if (pc >= start && pc < end && - !(protection & MemoryMappingLayout::kProtectionExecute)) + MemoryMappedSegment segment; + while (proc_maps.Next(&segment)) { + if (pc >= segment.start && pc < segment.end && !segment.IsExecutable()) Report("Hint: PC is at a non-executable region. Maybe a wild jump?\n"); } #endif |

