about summary refs log tree commit diff
path: root/src/unistd/ftruncate.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2014-08-16 19:52:04 -0400
committerRich Felker <dalias@aerifal.cx>2014-08-16 19:52:04 -0400
commitd338b506e39b1e2c68366b12be90704c635602ce (patch)
treea73ff388f254f21d4f6be5b9985b37ae8309679e /src/unistd/ftruncate.c
parentfffc5cda10e0c5c910b40f7be0d4fa4e15bb3f48 (diff)
downloadmusl-d338b506e39b1e2c68366b12be90704c635602ce.tar.gz
musl-d338b506e39b1e2c68366b12be90704c635602ce.tar.xz
musl-d338b506e39b1e2c68366b12be90704c635602ce.zip
fix robust mutex unrecoverable status, and related clean-up
a robust mutex should not enter the unrecoverable status until it's
unlocked without marking it consistent. previously, flag 8 in the type
was used as an indication of unrecoverable, but only honored after
successful locking; this resulted in a race window where the
unrecoverable mutex could appear to a second thread as locked/busy
again while the first thread was in the process of observing it as
unrecoverable.

now, flag 8 is used to mean that the mutex is in the process of being
recovered, but not yet marked consistent. the flag only takes effect
in pthread_mutex_unlock, where it causes the value 0x40000000 (owner
dead flag, with old owner tid 0, an otherwise impossible state) to be
stored in the lock. subsequent lock attempts will interpret this state
as unrecoverable.
Diffstat (limited to 'src/unistd/ftruncate.c')
0 files changed, 0 insertions, 0 deletions