Skip to content

hansei-bundle, exegesis, hansei-runtime: read std's pthread mutex - #22

Merged
wfchandler merged 2 commits into
mainfrom
wc/pthread-lock
Oct 24, 2026
Merged

wfchandler merged 2 commits into
mainfrom
wc/pthread-lock

Conversation

@wfchandler

Copy link
Copy Markdown
Collaborator

The wait assessment trusts a semaphore's, Notify's or io registration's wait list only after it checks that the list's lock was not held when the core was taken, and it can decode only parking_lot's raw mutex and std's futex mutex. A tokio built without its parking_lot feature
guards those lists with std's mutex, which on illumos is the pthread mutex, so every such wait is unknown: six of the ten tasks in a core of example/.

std's pthread mutex keeps its pthread_mutex_t in a heap block it allocates on first lock, so a lock word can now live in a block the lock points to. A null pointer reads as unlocked. The word is illumos libc's lock byte, which std's sources don't determine, so the binding requires the libc crate's solarish pthread_mutex_t; any other platform's declines.

With this change, all six tasks in that core show their waits. No fixture core waits behind a pthread mutex, since the fixtures' tokio uses parking_lot, so the runtime side is otherwise tested only on constructed bytes.

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com

wfchandler and others added 2 commits October 23, 2026 21:35
When the assessor cannot prove a task's wait, the task block prints
only the class of the reason, such as "the resource's state is not one
its protocol vouches for". The assessor also records what it found --
which word did not read, which lock it could not decode -- but the
block prints those notes only under a verified wait. In a core of the
repository's example program (`example/`) taken on illumos, six tasks
showed the class alone, and learning that all six failed on the same
undecodable lock took a temporary build that printed the notes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The wait assessment trusts a semaphore's, Notify's or io registration's
wait list only after it checks that the list's lock was not held when
the core was taken, and it can decode only parking_lot's raw mutex and
std's futex mutex. A tokio built without its `parking_lot` feature
guards those lists with std's mutex, which on illumos is the pthread
mutex, so every such wait is unknown: six of the ten tasks in a core of
`example/`.

std's pthread mutex keeps its `pthread_mutex_t` in a heap block it
allocates on first lock, so a lock word can now live in a block the
lock points to. A null pointer reads as unlocked. The word is illumos
libc's lock byte, which std's sources don't determine, so the binding
requires the libc crate's solarish `pthread_mutex_t`; any other
platform's declines.

With this change, all six tasks in that core show their waits. No
fixture core waits behind a pthread mutex, since the fixtures' tokio
uses parking_lot, so the runtime side is otherwise tested only on
constructed bytes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wfchandler
wfchandler merged commit 2f7defe into main Oct 24, 2026
4 checks passed
@wfchandler
wfchandler deleted the wc/pthread-lock branch October 24, 2026 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant