This is an archive of the discontinued LLVM Phabricator instance.

[LSan] Enable for SystemZ
ClosedPublic

Authored by iii on Apr 22 2020, 8:08 AM.

Details

Summary

Add runtime support, adjust the tests and enable LSan.

Diff Detail

Event Timeline

iii created this revision.Apr 22 2020, 8:08 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptApr 22 2020, 8:08 AM
Herald added subscribers: Restricted Project, cfe-commits, mgorny. · View Herald Transcript
iii updated this revision to Diff 270771.Jun 15 2020, 9:04 AM

Rebased.

uweigand accepted this revision.Jun 15 2020, 9:33 AM

This all looks good to me.

This revision is now accepted and ready to land.Jun 15 2020, 9:33 AM
This revision was automatically updated to reflect the committed changes.
MaskRay added inline comments.
compiler-rt/lib/lsan/lsan_allocator.h
76

Why is 0x40000000000ULL used?

Does 0x50000000000ULL or 0x60000000000ULL work as well?

Herald added a project: Restricted Project. · View Herald TranscriptApr 13 2023, 10:59 PM
Herald added a subscriber: Enna1. · View Herald Transcript
jonpa added a comment.Apr 14 2023, 2:03 AM

Update clang/docs/LeakSanitizer.rst (Supported Platforms).

iii added a comment.Apr 14 2023, 8:54 AM

That's where the mappings normally end. Example:

$ cat /proc/self/maps
2aa00000000-2aa00002000 r--p 00000000 5e:01 668061                       /usr/bin/cat
2aa00002000-2aa00006000 r-xp 00002000 5e:01 668061                       /usr/bin/cat
2aa00006000-2aa00008000 r--p 00006000 5e:01 668061                       /usr/bin/cat
2aa00008000-2aa00009000 r--p 00007000 5e:01 668061                       /usr/bin/cat
2aa00009000-2aa0000a000 rw-p 00008000 5e:01 668061                       /usr/bin/cat
2aa0000a000-2aa0002b000 rw-p 00000000 00:00 0                            [heap]
3fff7500000-3fff7557000 r--p 00000000 5e:01 926342                       /usr/lib/locale/C.utf8/LC_CTYPE
3fff7580000-3fff7581000 r--p 00000000 5e:01 658596                       /usr/lib/locale/en_US.utf8/LC_NUMERIC
3fff7600000-3fff7878000 r--p 00000000 5e:01 658592                       /usr/lib/locale/en_US.utf8/LC_COLLATE
3fff7880000-3fff7881000 r--p 00000000 5e:01 786499                       /usr/lib/locale/en_US.utf8/LC_TIME
3fff7900000-3fff7901000 r--p 00000000 5e:01 786497                       /usr/lib/locale/en_US.utf8/LC_MONETARY
3fff7980000-3fff7981000 r--p 00000000 5e:01 658594                       /usr/lib/locale/en_US.utf8/LC_MESSAGES/SYS_LC_MESSAGES
3fff7a00000-3fff7a01000 r--p 00000000 5e:01 658611                       /usr/lib/locale/en_US.utf8/LC_PAPER
3fff7a80000-3fff7a81000 r--p 00000000 5e:01 658595                       /usr/lib/locale/en_US.utf8/LC_NAME
3fff7b00000-3fff7b01000 r--p 00000000 5e:01 786493                       /usr/lib/locale/en_US.utf8/LC_ADDRESS
3fff7b80000-3fff7b81000 r--p 00000000 5e:01 786498                       /usr/lib/locale/en_US.utf8/LC_TELEPHONE
3fff7c00000-3fff7c34000 r--p 00000000 5e:01 655337                       /usr/lib64/libc.so.6
3fff7c34000-3fff7d6e000 r-xp 00034000 5e:01 655337                       /usr/lib64/libc.so.6
3fff7d6e000-3fff7dc5000 r--p 0016e000 5e:01 655337                       /usr/lib64/libc.so.6
3fff7dc5000-3fff7dc6000 ---p 001c5000 5e:01 655337                       /usr/lib64/libc.so.6
3fff7dc6000-3fff7dca000 r--p 001c5000 5e:01 655337                       /usr/lib64/libc.so.6
3fff7dca000-3fff7dcc000 rw-p 001c9000 5e:01 655337                       /usr/lib64/libc.so.6
3fff7dcc000-3fff7dd4000 rw-p 00000000 00:00 0 
3fff7e00000-3fff7e01000 r--p 00000000 5e:01 786496                       /usr/lib/locale/en_US.utf8/LC_MEASUREMENT
3fff7e80000-3fff7e87000 r--s 00000000 5e:01 654146                       /usr/lib64/gconv/gconv-modules.cache
3fff7f00000-3fff7f01000 r--p 00000000 5e:01 786495                       /usr/lib/locale/en_US.utf8/LC_IDENTIFICATION
3fff7f80000-3fff7f82000 r--p 00000000 5e:01 655334                       /usr/lib/ld64.so.1
3fff7f82000-3fff7fa2000 r-xp 00002000 5e:01 655334                       /usr/lib/ld64.so.1
3fff7fa2000-3fff7fad000 r--p 00022000 5e:01 655334                       /usr/lib/ld64.so.1
3fff7fad000-3fff7faf000 r--p 0002c000 5e:01 655334                       /usr/lib/ld64.so.1
3fff7faf000-3fff7fb1000 rw-p 0002e000 5e:01 655334                       /usr/lib/ld64.so.1
3fff7fd3000-3fff7ffb000 rw-p 00000000 00:00 0 
3fffffda000-3ffffffb000 rw-p 00000000 00:00 0                            [stack]
3ffffffc000-3ffffffe000 r--p 00000000 00:00 0                            [vvar]
3ffffffe000-40000000000 r-xp 00000000 00:00 0                            [vdso]

A higher address should work as well. I will test 0x50000000000ULL and 0x60000000000ULL and let you know the result.

iii added a comment.Apr 14 2023, 9:23 AM

I guess the intention is dropping the special case? The following patch passes regtests:

--- a/compiler-rt/lib/lsan/lsan_allocator.h
+++ b/compiler-rt/lib/lsan/lsan_allocator.h
@@ -68,9 +68,6 @@ using PrimaryAllocator = PrimaryAllocatorASVT<LocalAddressSpaceView>;
 # if SANITIZER_FUCHSIA || defined(__powerpc64__)
 const uptr kAllocatorSpace = ~(uptr)0;
 const uptr kAllocatorSize  =  0x40000000000ULL;  // 4T.
-#elif defined(__s390x__)
-const uptr kAllocatorSpace = 0x40000000000ULL;
-const uptr kAllocatorSize = 0x40000000000ULL;  // 4T.
 # else
 const uptr kAllocatorSpace = 0x600000000000ULL;
 const uptr kAllocatorSize  = 0x40000000000ULL;  // 4T.

0x50000000000ULL worked as well.

In D78644#4268685, @iii wrote:

I guess the intention is dropping the special case? The following patch passes regtests:

--- a/compiler-rt/lib/lsan/lsan_allocator.h
+++ b/compiler-rt/lib/lsan/lsan_allocator.h
@@ -68,9 +68,6 @@ using PrimaryAllocator = PrimaryAllocatorASVT<LocalAddressSpaceView>;
 # if SANITIZER_FUCHSIA || defined(__powerpc64__)
 const uptr kAllocatorSpace = ~(uptr)0;
 const uptr kAllocatorSize  =  0x40000000000ULL;  // 4T.
-#elif defined(__s390x__)
-const uptr kAllocatorSpace = 0x40000000000ULL;
-const uptr kAllocatorSize = 0x40000000000ULL;  // 4T.
 # else
 const uptr kAllocatorSpace = 0x600000000000ULL;
 const uptr kAllocatorSize  = 0x40000000000ULL;  // 4T.

0x50000000000ULL worked as well.

Thank you! I will try removing the special case in D148193