-
Notifications
You must be signed in to change notification settings - Fork 566
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
i#5431: Support glibc's rseq support (#5711)
Fixes issues with DR's rseq handling in glibc 2.35+. Glibc 2.35 added support for the Linux rseq feature. See https://lwn.net/Articles/883104/ for details. TLDR; glibc registers its own struct rseq at init time, and stores its offset from the thread pointer in __rseq_offset. The glibc-registered struct rseq is present in the struct pthread. If glibc's rseq support isn't available, either due to some issue or because the user disabled it by exporting GLIBC_TUNABLES=glibc.pthread.rseq=0, it will set __rseq_size to zero. Improves the heuristic to find the registered struct rseq. For the glibc-support case: on AArch64, it is at a -ve offset from app lib seg base, whereas on x86 it's at a +ve offset. On both AArch64 and x86, the offset is of the opposite sign than what it would be if the app registered the struct rseq manually in its static TLS (which happens for older glibc and when glibc's rseq support is disabled). Detects whether the glibc rseq support is enabled by looking at the sign of the struct rseq offset. Removes the drrun -disable_rseq workaround added by #5695. Adjusts the linux.rseq test to get the struct rseq registered by glibc, when it's available. Also fixes some issues in the test. Adds the Ubuntu_22 tag to rseq tests so that they are enabled. Our Ubuntu-20 CI tests the case without rseq support in glibc, where the app registers the struct rseq. This also helps test the case where the app is not using glibc. Also, our Ubuntu-22 CI tests the case with Glibc rseq support. Manually tested the disabled rseq support case on glibc 2.35, but not adding a CI version of it. Fixes #5431
- Loading branch information
1 parent
0049ad2
commit 5ef7b9e
Showing
6 changed files
with
226 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.