summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRainer Orth <ro@gcc.gnu.org>2019-07-12 08:27:50 +0000
committerRainer Orth <ro@gcc.gnu.org>2019-07-12 08:27:50 +0000
commitcb14528ef6324f54a937359cbd96d303fbf1d199 (patch)
tree7023214f6c65ba051dc149936493ca975054501f
parentbf88fb18a0263e1640e701551f1d72f6e2581655 (diff)
downloadcompiler-rt-cb14528ef6324f54a937359cbd96d303fbf1d199.tar.gz
[Sanitizers] Fix SanitizerCommon-Unit :: ./Sanitizer-*-Test/MemoryMappingLayout.DumpListOfModules on Solaris
The MemoryMappingLayout.DumpListOfModules currently FAILs on Solaris: [ RUN ] MemoryMappingLayout.DumpListOfModules /vol/llvm/src/compiler-rt/local/lib/sanitizer_common/tests/sanitizer_procmaps_test.cc:52: Failure Value of: found Actual: false Expected: true [ FAILED ] MemoryMappingLayout.DumpListOfModules (22 ms) The problem is that the test expects the executable name from modules[i].full_name(), however the pr_mapname field of struct prmap is just the entry in /proc/<pid>/object, which is "a.out" instead of "Sanitizer-i386-Test". Fortunately, the real name can be determined by looking in proc/<pid>/path where "a.out" is a symlink to the real path. Tested on x86_64-pc-solaris2.11. Differential Revision: https://reviews.llvm.org/D64559 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@365879 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/sanitizer_common/sanitizer_procmaps_solaris.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/sanitizer_common/sanitizer_procmaps_solaris.cc b/lib/sanitizer_common/sanitizer_procmaps_solaris.cc
index 6e4c59c10..b5df6fe4c 100644
--- a/lib/sanitizer_common/sanitizer_procmaps_solaris.cc
+++ b/lib/sanitizer_common/sanitizer_procmaps_solaris.cc
@@ -50,9 +50,11 @@ bool MemoryMappingLayout::Next(MemoryMappedSegment *segment) {
segment->protection |= kProtectionExecute;
if (segment->filename != NULL && segment->filename_size > 0) {
- internal_snprintf(segment->filename,
- Min(segment->filename_size, (uptr)PATH_MAX), "%s",
+ char proc_path[PATH_MAX + 1];
+
+ internal_snprintf(proc_path, sizeof(proc_path), "/proc/self/path/%s",
xmapentry->pr_mapname);
+ internal_readlink(proc_path, segment->filename, segment->filename_size);
}
data_.current += sizeof(prxmap_t);