microsoft / microsoft/mimalloc
Segmentation fault on Apple Silicon / arm64
- Dominant language
- C
- Stars
- 13.4k
- Forks
- 1.2k
- Avg merge
- 4d 45m
- Merged PRs (30d)
- 13
Description
Building `mimalloc` fails in the TLS initialization with a segmentation fault:
```
% lldb ./mimalloc-test-api
(lldb) target create "./mimalloc-test-api"
Current executable set to '/Users/uwe/Development/mimalloc/build/mimalloc-test-api' (arm64).
(lldb) run
Process 17703 launched: '/Users/uwe/Development/mimalloc/build/mimalloc-test-api' (arm64)
mimalloc-test-api was compiled with optimization - stepping may behave oddly; variables may not be available.
Process 17703 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
frame #0: 0x000000010001f264 mimalloc-test-api`_mi_process_init [inlined] mi_tls_slot(slot=0) at mimalloc-internal.h:711:9 [opt]
708 #elif defined(__aarch64__)
709 void** tcb; UNUSED(ofs);
710 __asm__ volatile ("mrs %0, tpidr_el0" : "=r" (tcb));
-> 711 res = tcb[slot];
712 #endif
713 return res;
714 }
Target 0: (mimalloc-test-api) stopped.
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the failure by running the arm64 mimalloc-test-api under lldb, then inspect mi_tls_slot in mimalloc-internal.h around lines 708-713, where tpidr_el0 is read. Compare the TLS initialization path with the failing Apple Silicon execution; done means the test executable no longer stops with EXC_BAD_ACCESS during _mi_process_init.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100