Repository navigation
libc: give make_absolute a thread-local join buffer - #142
Open
UnitBuilds wants to merge 1 commit into
Open
UnitBuilds wants to merge 1 commit into
UnitBuilds wants to merge 1 commit into
Conversation
make_absolute() resolved relative paths through one process-wide static buffer (make_absolute_buf/_len), so concurrent relative opens from different threads could bind a name to the wrong file. Make the buffer per-thread (__thread).
UnitBuilds
marked this pull request as ready for review
September 29, 2026 01:10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
make_absolute()resolved a relative path through one process-wide static buffer (make_absolute_buf/make_absolute_len). Under WASIX threads, concurrent relative opens from different threads could interleave on that shared buffer and bind a name to the wrong file — a data-corruption race, not just a wrong path.What this changes
libc-bottom-half/sources/chdir.c: givemake_absolutea per-thread join buffer (__thread), so each thread's relative-path resolution has its own storage.Test plan
chdir/relative-open behavior.