Make make_absolute thread-local in chdir.c#781
Make make_absolute thread-local in chdir.c#781alexcrichton merged 2 commits intoWebAssembly:mainfrom
make_absolute thread-local in chdir.c#781Conversation
|
Thanks for the PR! I think though this might be something that's more appropriate to use synchronization for rather than thread-local storage. These are malloc'd buffers which means that if it were thread-local then a thread exiting would leak the buffer information. As a |
|
I've updated the code to use synchronization instead of thread-local storage. I ended up protecting the whole |
|
I think that the locking needs to be in the callers of |
The mutex in
If you mean the caller-managed The two reasonable options for
|
|
Ah right yeah good points, I misread! Ok in that case I'm going to go ahead and merge this as it handles Would you be interested in making PRs to fix the other callers? Personally I think they should all switch to synchronization instead of thread-local buffers for the same reason that I don't think thread-local buffers are appropriate here. Or, alternatively, if the thread-local buffers are cleaned up at some point then I think it's reasonable to use thread-local buffers. |
|
Yeah thanks for your trust. I'm willing to continue, and I'll also consider the best approach. |
make_absolutepreviously used a process-wide static buffer to assemble absolute paths for relative path resolution. In_REENTRANTbuilds, concurrent calls could overwrite or reallocate that shared buffer while another thread was still using it, leading to races and potentially invalid pointers.Related #474