-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed
Labels
Proposalcompiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Milestone
Description
Proposal Details
While working on fixing CVE-2024-21626, we had to implement a function that closes all file descriptors above a specific one (similar to what close_range(2) does). Once we did that, we found out that closing go's internal poll fds results in subsequent panic from go runtime, so we had to exclude those.
The only way possible way to do so was to use internal/poll.IsPollDescriptor
(via go:linkname
kludge). You can see the code doing this here (initially added by this commit).
We'd like this functionality as a part of public Go API. Perhaps something like this:
package runtime
// IsInternalDescriptor reports whether fd is a
// descriptor being used by Go runtime internally.
func IsInternalDescriptor(fd uintptr) bool
Cc @cyphar
thaJeztah, cyphar, lifubang, bjorndm, mauri870 and 3 more
Metadata
Metadata
Assignees
Labels
Proposalcompiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Type
Projects
Status
Done
Status
Declined