ITADN

copyFile opens the file without setting cloexec

#203Openjoeyh 创建于 2025-09-05
blocked: upstream
J
joeyhcommented
copyFile opens a temporary file without setting the close-on-exec flag. So if another thread execs a process at the same time, the process can inherit an open FD to a temp file. Specifically, in withReplacementFile, it uses OS.openBinaryTempFile. copyFileWithMetadata and copyFileToHandle had this same problem fixed in commit 0ff4e13f1f51234fe047b4bc1ca60e567afd0c36
2 条评论