Commit 36cd088
committed
fix(runtime): route macOS ARM64 TLS through pthread_self()
The Layer-1 and Layer-2 TLS helpers both grouped Linux aarch64 and
Darwin aarch64 under a single `mrs TPIDR_EL0` branch. That works
for glibc/musl — offset 0 of TPIDR_EL0 is the TCB self-pointer by
convention — but Apple reserves TPIDR_EL0 on Apple Silicon and the
userland mrs read returns a value whose offset-0 dereference lands
in unmapped or privileged memory. Apple-clang CI segfaulted on
TlsIntrinsic.{Read64ViaIntrinsic, Read32ViaIntrinsic,
ResolutionWithNonZeroDelta} the first time the VM touched
`vmpilot_tls_read64(0)`.
Split the arm64 arms:
- Linux aarch64 keeps the mrs fast path.
- Darwin aarch64 joins Darwin x86_64 in the pthread_self() branch,
which returns a real user-readable `_opaque_pthread_t*`; both
the runtime and the test compute the expected value through the
same path so the assertion still holds.
- Darwin aarch64 no longer matches any Layer-1 arm and transparently
falls through to Layer-2's fallback_read64/32 via
get_segment_base_fallback().
No Windows / Linux path is touched. Ships alongside the Stage 11/12
work; was flagged during CI review and kept out of those commits
because it's an unrelated pre-existing macOS bug.1 parent 7744092 commit 36cd088
1 file changed
Lines changed: 18 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
71 | | - | |
72 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
76 | 77 | | |
77 | 78 | | |
78 | 79 | | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
83 | 86 | | |
84 | 87 | | |
85 | 88 | | |
| |||
193 | 196 | | |
194 | 197 | | |
195 | 198 | | |
196 | | - | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
197 | 206 | | |
198 | | - | |
| 207 | + | |
199 | 208 | | |
200 | 209 | | |
201 | 210 | | |
| |||
0 commit comments