diff options
| author | Christian Brauner <brauner@kernel.org> | 2026-09-21 16:15:34 +0200 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2026-10-05 13:02:40 +0200 |
| commit | 6939539684ce6ee5cea49c9f2b22177a27c73c67 (patch) | |
| tree | c4a40b1d3a14b34638d38c8829f6ec06717eecd1 /tools/lib/python | |
| parent | 48629a611531379bc5b792dc6f63ac9bb56ca537 (diff) | |
| download | linux-next-6939539684ce6ee5cea49c9f2b22177a27c73c67.tar.gz linux-next-6939539684ce6ee5cea49c9f2b22177a27c73c67.zip | |
file: add CLOSE_RANGE_EXCEPT
close_range() operates on [fd, max_fd]. Add CLOSE_RANGE_EXCEPT. This new
flag instructs it to operate on all file descriptors outside of the
range instead.
Without any other flags that means it closes everything except the file
descriptors in the specified range. Together with CLOSE_RANGE_CLOEXEC it
marks every file descriptor except the ones in the range as
close-on-exec. With CLOSE_RANGE_UNSHARE dup_fd() never takes a reference
on what is dropped.
A task between clone(CLONE_FILES | CLONE_VM | CLONE_VFORK) and execve()
that has the descriptors for the child in one window can shed the rest
of the shared table in one call:
close_range(lo, hi, CLOSE_RANGE_UNSHARE | CLOSE_RANGE_EXCEPT)
Nothing outside of the window is referenced by the child at any point.
Link: https://patch.msgid.link/20260921-work-file-close_range_except-v1-6-c20d0b49270d@kernel.org
Reviewed-by: Jann Horn <jannh@google.com>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions
