-
Notifications
You must be signed in to change notification settings - Fork 154
privsep: Fix daemonising broken by RLIMIT_NOFILE of 0 #733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -159,10 +159,13 @@ ps_dropprivs(struct dhcpcd_ctx *ctx) | |
| struct rlimit rzero = { .rlim_cur = 0, .rlim_max = 0 }; | ||
|
|
||
| #ifndef __sun /* RLIMIT_NOFILE and ppoll don't mix */ | ||
| struct rlimit rnofile = { .rlim_cur = STDERR_FILENO + 1, | ||
| .rlim_max = STDERR_FILENO + 1 }; | ||
|
|
||
| /* Prohibit new files, sockets, etc | ||
| * The control proxy *does* need to create new fd's via accept(2). */ | ||
| if (ctx->ps_ctl == NULL || ctx->ps_ctl->psp_pid != getpid()) { | ||
| if (setrlimit(RLIMIT_NOFILE, &rzero) == -1) | ||
| if (setrlimit(RLIMIT_NOFILE, &rnofile) == -1) | ||
| logerr("setrlimit RLIMIT_NOFILE"); | ||
| } | ||
| #endif | ||
|
Comment on lines
159
to
171
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win Keep the manager's descriptor limit compatible with
🤖 Prompt for AI Agents |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth adding
__linux__back to this instead to say that this causes dup2 to fail.I need RLIMIT_NOFILE of zero for Dragonfly and NetBSD - that is not negotiable.