This is an archive of the discontinued LLVM Phabricator instance.

s390x __tls_get_addr_internal vs. __tls_get_offset
ClosedPublic

Authored by jakubjelinek on Feb 8 2017, 3:40 PM.

Details

Summary

Symbol tls_get_addr_internal is a GLIBC_PRIVATE private symbol on s390{,x}, the glibc folks aren't very happy about asan using it.
Additionally, only recent glibc versions have it, older versions just have
tls_get_offset and nothing else.
The patch doesn't drop the tls_get_addr_internal interception altogether, but changes it so that it calls real tls_get_offset function instead (and much more importantly,
that tls_get_offset interception calls the real tls_get_offset function).
This way it should work also on glibc 2.18 and earlier. See http://gcc.gnu.org/PR79341 for further details.

Diff Detail

Event Timeline

jakubjelinek created this revision.Feb 8 2017, 3:40 PM
kcc accepted this revision.Feb 8 2017, 4:02 PM

LGTM
This seems to be a S390-only change, right?
Is there anyone else who can review S390 code?
(I don't even pretend to understand what's going on here)
LGTM-ing anyway.

(BTW, please upload patches with full context next time)

This revision is now accepted and ready to land.Feb 8 2017, 4:02 PM
In D29735#671362, @kcc wrote:

This seems to be a S390-only change, right?

Yes.

Is there anyone else who can review S390 code?

Maybe the IBM s390 GCC maintainers (I'll cross-link this page to the GCC PR).

(I don't even pretend to understand what's going on here)
LGTM-ing anyway.

koriakin added inline comments.Feb 9 2017, 12:27 AM
lib/sanitizer_common/sanitizer_common_interceptors.inc
4668

Should be OK to just br %r3 here and skip the load instructions above.

Otherwise LGTM.

Updated patch for that.

koriakin accepted this revision.Feb 9 2017, 2:26 AM

LGTM with a nit.

lib/sanitizer_common/sanitizer_common_interceptors.inc
4631

Nit: the symbol is now hidden.

Shall I upload a new patch with that? What is the process now, can somebody check it in for me?

jakubjelinek edited the summary of this revision. (Show Details)
jakubjelinek edited the summary of this revision. (Show Details)
kcc added a comment.Feb 9 2017, 3:07 PM

check-asan does not pass with this change due to lint"
/tmp/check_lint.XhMkOExnXU/tmp.TSPGZQsNod.sanitizer_common_interceptors.inc.cc:4611: Extra space before ( in function call [whitespace/parens] [4]
/tmp/check_lint.XhMkOExnXU/tmp.TSPGZQsNod.sanitizer_common_interceptors.inc.cc:4611: All parameters should be named in a function [readability/function] [3]
/tmp/check_lint.XhMkOExnXU/tmp.TSPGZQsNod.sanitizer_common_interceptors.inc.cc:4614: Extra space before ( in function call [whitespace/parens] [4]
/tmp/check_lint.XhMkOExnXU/tmp.TSPGZQsNod.sanitizer_common_interceptors.inc.cc:4615: Extra space before ( in function call [whitespace/parens] [4]

I can fix that of course, but I also want to ask one more thing: is this change testable?
Does it deserve an extra test, or the existing tests cover it?
Are there buildbots running these tests?

In D29735#672682, @kcc wrote:

check-asan does not pass with this change due to lint"
/tmp/check_lint.XhMkOExnXU/tmp.TSPGZQsNod.sanitizer_common_interceptors.inc.cc:4611: Extra space before ( in function call [whitespace/parens] [4]
/tmp/check_lint.XhMkOExnXU/tmp.TSPGZQsNod.sanitizer_common_interceptors.inc.cc:4611: All parameters should be named in a function [readability/function] [3]
/tmp/check_lint.XhMkOExnXU/tmp.TSPGZQsNod.sanitizer_common_interceptors.inc.cc:4614: Extra space before ( in function call [whitespace/parens] [4]
/tmp/check_lint.XhMkOExnXU/tmp.TSPGZQsNod.sanitizer_common_interceptors.inc.cc:4615: Extra space before ( in function call [whitespace/parens] [4]

Changed.

I can fix that of course, but I also want to ask one more thing: is this change testable?
Does it deserve an extra test, or the existing tests cover it?

Many existing tests cover it already (added a Report in there and it got printed many times during testing). So if the above would not work properly, you'd notice immediately.
If you want to see crashes without the patch, you'd need to have glibc 2.18 or older (one that doesn't provide __tls_get_offset_internal@@GLIBC_PRIVATE symbol).

Are there buildbots running these tests?

Yes.

kcc closed this revision.Feb 10 2017, 2:22 PM