Giuseppe Scrivano
23afeaeff3
selftests: core: add tests for CLOSE_RANGE_CLOEXEC
...
check that close_range(initial_fd, last_fd, CLOSE_RANGE_CLOEXEC)
correctly sets the close-on-exec bit for the specified file
descriptors.
Open 100 file descriptors and set the close-on-exec flag for a subset
of them first, then set it for every file descriptor above 2. Make
sure RLIMIT_NOFILE doesn't affect the result.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com >
Link: https://lore.kernel.org/r/20201118104746.873084-3-gscrivan@redhat.com
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com >
2020-12-04 12:06:16 +01:00
Tommi Rantala
1d44d0dd61
selftests: core: use SKIP instead of XFAIL in close_range_test.c
...
XFAIL is gone since commit 9847d24af9 ("selftests/harness: Refactor XFAIL
into SKIP"), use SKIP instead.
Fixes: 9847d24af9 ("selftests/harness: Refactor XFAIL into SKIP")
Signed-off-by: Tommi Rantala <tommi.t.rantala@nokia.com >
Reviewed-by: Kees Cook <keescook@chromium.org >
Acked-by: Christian Brauner <christian.brauner@ubuntu.com >
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org >
2020-11-05 10:08:15 -07:00
Christian Brauner
a5161eeef9
tests: add CLOSE_RANGE_UNSHARE tests
...
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com >
2020-06-17 00:07:38 +02:00
Christian Brauner
2c5db60e46
tests: add close_range() tests
...
This adds basic tests for the new close_range() syscall.
- test that no invalid flags can be passed
- test that a range of file descriptors is correctly closed
- test that a range of file descriptors is correctly closed if there there
are already closed file descriptors in the range
- test that max_fd is correctly capped to the current fdtable maximum
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Jann Horn <jannh@google.com >
Cc: David Howells <dhowells@redhat.com >
Cc: Dmitry V. Levin <ldv@altlinux.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Florian Weimer <fweimer@redhat.com >
Cc: Shuah Khan <shuah@kernel.org >
Cc: linux-api@vger.kernel.org
Cc: linux-kselftest@vger.kernel.org
2020-06-17 00:07:38 +02:00