Closed
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
Metadata
Metadata
Assignees
Type
Projects
Status
Done
Status
Declined