Commit 30173c60 authored by cjihrig's avatar cjihrig Committed by Rich Trott
Browse files

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: https://github.com/cjihrig/uvwasi/issues/88

PR-URL: https://github.com/nodejs/node/pull/31432


Reviewed-By: default avatarTobias Nießen <tniessen@tnie.de>
Reviewed-By: default avatarBen Noordhuis <info@bnoordhuis.nl>
Reviewed-By: default avatarDavid Carlier <devnexen@gmail.com>
Reviewed-By: default avatarRich Trott <rtrott@gmail.com>
Reviewed-By: default avatarJiawen Geng <technicalcute@gmail.com>
parent c150f9da
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment