Commit 30173c6
deps: uvwasi: cherry-pick eea4508
Original commit message:
prevent race conditions with uvwasi_fd_close()
uvwasi_fd_close() performed the following operations:
- lock the file descriptor mutex
- close the file
- release the file descriptor mutex
- call the file table's remove() function
Once the fd's mutex is released, another thread could
acquire it before the fd is removed from the file
table. If this happens, remove() could destroy a held
mutex.
This commit updates uvwasi_fd_close() to perform the
entire sequence while holding the file table's lock,
preventing new acquisitions of the fd's mutex.
Fixes: nodejs/uvwasi#88
PR-URL: #31432
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: David Carlier <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Jiawen Geng <[email protected]>1 parent c150f9d commit 30173c6
3 files changed
+24
-26
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
60 | | - | |
61 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
306 | 306 | | |
307 | 307 | | |
308 | 308 | | |
309 | | - | |
310 | | - | |
311 | | - | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
312 | 312 | | |
313 | | - | |
314 | 313 | | |
315 | 314 | | |
316 | 315 | | |
317 | 316 | | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
| 317 | + | |
| 318 | + | |
324 | 319 | | |
325 | 320 | | |
326 | 321 | | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
| 322 | + | |
| 323 | + | |
331 | 324 | | |
332 | 325 | | |
333 | 326 | | |
334 | 327 | | |
335 | 328 | | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
| 329 | + | |
340 | 330 | | |
341 | 331 | | |
342 | 332 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
878 | 878 | | |
879 | 879 | | |
880 | 880 | | |
881 | | - | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
882 | 884 | | |
883 | | - | |
| 885 | + | |
884 | 886 | | |
885 | 887 | | |
886 | 888 | | |
887 | 889 | | |
888 | 890 | | |
889 | | - | |
890 | | - | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
891 | 897 | | |
892 | | - | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
893 | 901 | | |
894 | 902 | | |
895 | 903 | | |
| |||
0 commit comments