Port patch setting FD_CLOEXEC on curl sockets #858
Labels
No labels
Affects/CppNix
Affects/Nightly
Affects/Only nightly
Affects/Stable
Area/build-packaging
Area/cli
Area/evaluator
Area/fetching
Area/flakes
Area/language
Area/lix ci
Area/nix-eval-jobs
Area/profiles
Area/protocol
Area/releng
Area/remote-builds
Area/repl
Area/repl/debugger
Area/store
bug
Context
contributors
Context
drive-by
Context
maintainers
Context
RFD
crash 💥
Cross Compilation
devx
docs
Downstream Dependents
E/easy
E/hard
E/help wanted
E/reproducible
E/requires rearchitecture
imported
Language/Bash
Language/C++
Language/NixLang
Language/Python
Language/Rust
Needs Langver
OS/Linux
OS/macOS
performance
regression
release-blocker
stability
Status
blocked
Status
invalid
Status
postponed
Status
wontfix
testing
testing/flakey
Topic/Large Scale Installations
ux
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lix-project/lix#858
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Code here: https://github.com/NixOS/nix/pull/12439
Note that this patch looks wrong and may not pass review in Lix in its current state as it looks to need rewriting as it is calling fcntl to set the fd as cloexec which is racy (or at the very least requires that you open the curl at a point in the program where it is single threaded/guaranteed not to fork before it is done, which, umm, bad!). You can set SOCK_CLOEXEC while opening the socket instead which is much safer and AFAIK supported on the platforms we care about. I don't know how to set that up via the curl API but surely there is some way to control the socket creation options; I would advise grepping for
socket\(
in the curl source code.Oh no... okay their patch is correct on macOS because apparently you can't create a network socket safely on Mac. wat! Still ideally we should set it on socket creation on Linux, that's surprisingly goofy.
This is best done by hooking into
CURLOPT_OPENSOCKETFUNCTION
it looks like, so we either create it withSOCK_CLOEXEC
or setFD_CLOEXEC
with fcntl immediately after.I may implement it, but anyone else, feel free
This issue was mentioned on Gerrit on the following CLs: