Skip to content

Potential uvwasi_fd_table_renumber() deadlock #89

@cjihrig

Description

@cjihrig

Refs: nodejs/node#31432 (comment)

uvwasi_fd_table_renumber() locks the file descriptor table, acquires the source and destination mutexes, performs the renumber operation, releases the mutexes, and unlocks the file descriptor table.

An operation that takes two file descriptors (such as uvwasi_path_rename()) could have acquired one of its fd mutex locks, but not the other. If uvwasi_fd_table_renumber() is called during this window of time, deadlock can occur (uvwasi_fd_table_renumber() waits for the mutex that uvwasi_path_rename() has, and uvwasi_path_rename() waits for the file descriptor table lock that uvwasi_fd_table_renumber() has).

The file descriptor table API could add lock and unlock APIs so that calls like uvwasi_path_rename() can acquire everything at once.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions