linux/tools
Christian Brauner 0a0f88fcb4
selftests/core: test CLOSE_RANGE_CLOEXEC_ONLY
Cover closing what is marked:

- close-on-exec descriptors in the range go, the ones outside stay, and
  a range above the table closes nothing

- with CLOSE_RANGE_EXCEPT it is the other way around, and the kept ones
  keep their flag, for a window in the middle, at the top and at the
  bottom

- descriptors without close-on-exec are never touched, in or out of the
  range

- a range that cannot hold an open descriptor keeps nothing, one that
  covers everything keeps everything, in place and in a clone

- the unshare form leaves the table it was cloned from alone, with and
  without CLOSE_RANGE_EXCEPT

- the unshare form keeps the descriptors without the flag that sit in
  the range it drops from, and hands the dropped slots out again

- a kept range above the last descriptor without close-on-exec still
  comes back, so the clone is sized off the range too

Also check that asking for CLOSE_RANGE_CLOEXEC at the same time is
refused, whatever else is asked for, and that the bounds are still
checked.

The extra cases came out of the same walk with the close-on-exec mask
on top: a marked and an unmarked descriptor on each side of every window
position, and the size of the clone when only unmarked ones are left in
the range it drops from.

Link: https://patch.msgid.link/20260921-work-file-close_range_except-v1-10-c20d0b49270d@kernel.org
Reviewed-by: Jann Horn <jannh@google.com>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
2026-10-05 13:02:41 +02:00
..
accounting tools/accounting: fix macro typos in getdelays 2026-08-03 21:10:17 -07:00
arch - Remove the smp_locks alternatives machinery which was used to patch out lock 2026-08-18 18:11:25 -07:00
bootconfig tools/bootconfig: Fix integer overflow and truncation in size checks 2026-09-11 23:05:38 +09:00
bpf perf tools updates for v7.3 2026-08-22 08:47:50 -07:00
build perf build: Remove leftover feature tests for removed cxx and clang support 2026-08-12 06:17:49 -07:00
certs
cgroup
counter
crypto
debugging
dma
docs doc tools: fix 'path' typos 2026-08-11 10:43:16 -06:00
firewire
firmware
gpio
hv
iio iio: types: add IIO_VOLUMEFLOW channel type 2026-08-05 00:02:55 +01:00
include Including fixes from Bluetooth, IPSec and Netfilter. 2026-08-27 13:53:43 -07:00
kvm/kvm_stat
laptop
leds
lib More thermal control updates for 7.3-rc1 2026-08-26 14:21:30 -07:00
memory-model
mm mm.git review status for master..mm-nonmm-stable 2026-08-23 08:07:11 -07:00
net Including fixes from Bluetooth, IPSec and Netfilter. 2026-08-27 13:53:43 -07:00
objtool objtool/klp: Fix checksums for constant pool references 2026-08-31 17:50:16 -07:00
pcmcia
perf perf-tools fixes for v7.3-rc3 2026-09-07 10:26:56 -07:00
platform/x86/amd
power linux-cpupower-7.3-rc1 2026-08-05 13:53:51 +02:00
rcu
sched
sched_ext sched_ext: Check bpf_timer_start return values in scx_qmap 2026-08-31 06:47:39 -10:00
scripts perf tools updates for v7.3 2026-08-22 08:47:50 -07:00
sound
spi
testing selftests/core: test CLOSE_RANGE_CLOEXEC_ONLY 2026-10-05 13:02:41 +02:00
thermal
time
tracing rtla/cli: Unify and improve handling of invalid option arguments 2026-08-05 10:14:40 +02:00
unittests
usb
verification verification/rvgen: Use .old instead of .bak for kunit backup files 2026-08-25 13:56:53 +02:00
virtio tools/virtio: Fix control typo in trace agent comment 2026-08-19 06:38:48 -04:00
wmi
workqueue tools/workqueue/wq_dump.py: Support backward compatibility for wq->attrs rename 2026-08-31 10:17:08 -10:00
writeback
Makefile