-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
worker: file creation races with process.umask() #32321
Copy link
Copy link
Closed
Labels
fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.processIssues and PRs related to the process subsystem.Issues and PRs related to the process subsystem.workerIssues and PRs related to Worker support.Issues and PRs related to Worker support.
Metadata
Metadata
Assignees
Labels
fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.processIssues and PRs related to the process subsystem.Issues and PRs related to the process subsystem.workerIssues and PRs related to Worker support.Issues and PRs related to Worker support.
This code is unsafe when worker threads are active:
node/src/node_process_methods.cc
Lines 248 to 249 in 40b559a
The
umask(0)call temporarily changes the process-wide umask and races with fs operations from other threads.Test case:
Fails within a few iterations with
unexpected mode: 666process.umask()(no arg) is allowed in workers so this test case works both ways.This bug is potentially a security issue.