mirror of
https://github.com/DynamoRIO/dynamorio.git
synced 2026-10-12 02:02:04 +00:00
When DynamoRIO attaches to a running application, it must locate the application’s previously registered `struct rseq` in static TLS. Naming TLS pages or changing their memory attributes can split the allocation into multiple VMAs. Searching only the VMA containing the thread pointer can therefore miss valid registrations. This PR extends attach-time discovery to neighboring mappings to handle split TLS allocations. - Search adjacent read-write mappings, stopping at gaps or non-writable mappings. Limit extensions to 1 MB from the thread pointer while preserving the full search of its containing mapping. - Search outward from the thread pointer on both sides together so both static TLS and struct pthread are checked before reaching the stack. - Fix an off-by-one in `try_struct_rseq()` so re-registration uses the matched registration size. - Add a new test `api.rseq_splitvma` which places the registered `struct rseq` in a separate VMA using `PR_SET_VMA_ANON_NAME` (with a `MADV_DONTFORK` fallback), reproducing the original attach failure without this fix and passing with it. Fixes #8174