This is an archive of the discontinued LLVM Phabricator instance.

[tsan] Derive the unmangled SP in longjmp with xor key on loongarch64
ClosedPublic

Authored by Ami-zhang on Mar 23 2023, 5:35 AM.

Details

Summary

Introducing xor key to derive unmangled sp is here to follow the way
that the glibc adds support for pointer mangling on loongarch in commit
1c9bc1b6e50293a1b7037a7bfbf835868a55baed.

Diff Detail

Event Timeline

Ami-zhang created this revision.Mar 23 2023, 5:35 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 23 2023, 5:35 AM
Herald added a subscriber: Enna1. · View Herald Transcript
Ami-zhang requested review of this revision.Mar 23 2023, 5:35 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 23 2023, 5:35 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript

Without this change, there are eight failed tests:

$ make check-tsan
Failed Tests (8):
  ThreadSanitizer-loongarch64 :: exceptions.cpp
  ThreadSanitizer-loongarch64 :: fiber_longjmp.cpp
  ThreadSanitizer-loongarch64 :: ignore_lib4.cpp
  ThreadSanitizer-loongarch64 :: longjmp.cpp
  ThreadSanitizer-loongarch64 :: longjmp2.cpp
  ThreadSanitizer-loongarch64 :: longjmp3.cpp
  ThreadSanitizer-loongarch64 :: longjmp4.cpp
  ThreadSanitizer-loongarch64 :: signal_longjmp.cpp

Testing Time: 151.22s
  Unsupported      :  91
  Passed           : 338
  Expectedly Failed:   2
  Failed           :   8

With this change, tests all pass:

$ make check-tsan
Testing Time: 238.30s
  Unsupported      :  91
  Passed           : 346
  Expectedly Failed:   2
SixWeining added inline comments.Mar 23 2023, 6:00 AM
compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp
69–70

Should be __loongarch_lp64 since we don't know whether loongarch32 needs it?

318

Ditto.

Ami-zhang updated this revision to Diff 507938.EditedMar 23 2023, 6:54 PM

use xor key on __loongarch_lp64 instead of __loongarch__ at present

Ami-zhang retitled this revision from [tsan] Derive the unmangled SP in longjmp with xor key on LoongArch to [tsan] Derive the unmangled SP in longjmp with xor key on loongarch64.Mar 23 2023, 6:56 PM
Ami-zhang marked an inline comment as done.Mar 23 2023, 6:58 PM
Ami-zhang added inline comments.
compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp
69–70

Yes.
Updated it. Thank you.

SixWeining accepted this revision.Mar 23 2023, 7:17 PM
This revision is now accepted and ready to land.Mar 23 2023, 7:17 PM
xen0n added inline comments.Mar 27 2023, 12:12 AM
compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp
390–391

Does this condition need to be changed to __loongarch_lp64?

Ami-zhang added inline comments.Mar 27 2023, 12:47 AM
compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp
390–391

Yes.
Thanks.

Ami-zhang updated this revision to Diff 508510.EditedMar 27 2023, 12:49 AM

__loongarch__ -> __loongarch_lp64

xen0n accepted this revision.Mar 27 2023, 12:58 AM
This revision was landed with ongoing or failed builds.Mar 28 2023, 1:24 AM
This revision was automatically updated to reflect the committed changes.