pthread's synchronization primitives must not be moved to a different location once they were initialized. However, Miri does currently not catch that kind of UB. We probably want a fundamentally different implementation of these primitives to detect such bugs -- instead of storing data in the memory that is occupied by pthread_mutex_t et al, we use the address of the pthread_mutex_t as the key into some table for managing the lock.
This would also avoid having to figure out which "offsets" inside pthread_mutex_t to use on which OS to do what... we'd entirely stop caring about the layout of pthread_mutex_t. So this is a better way to achieve FreeBSD support for the pthread primitives as well.
pthread's synchronization primitives must not be moved to a different location once they were initialized. However, Miri does currently not catch that kind of UB. We probably want a fundamentally different implementation of these primitives to detect such bugs -- instead of storing data in the memory that is occupied by
pthread_mutex_tet al, we use the address of thepthread_mutex_tas the key into some table for managing the lock.This would also avoid having to figure out which "offsets" inside
pthread_mutex_tto use on which OS to do what... we'd entirely stop caring about the layout ofpthread_mutex_t. So this is a better way to achieve FreeBSD support for the pthread primitives as well.