Skip to contentSkip to conversation

test coverage for dup_fd() failure handling in unshare_fd()

PATCH In review Al Viro 2 participants 2 messages Aug 22, 2024 Kselftest

lore
Share & tools
lore

Al Viro

author
#0 lore raw

PATCH 1/1 test coverage for dup_fd() failure handling in unshare_fd()

At some point there'd been a dumb braino during the dup_fd()
calling conventions change; caught by smatch and immediately fixed. The trouble is, there had been no test coverage for the dup_fd() failure handling - neither in kselftests nor in LTP. Fortunately, it can be triggered on stock kernel - ENOMEM would require fault injection, but EMFILE can be had with sysctl alone (fs.nr_open).

---

tools/testing/selftests/core/Makefile +1 -1
index ce262d097269..8e99f87f5d7c 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 CFLAGS += -g $(KHDR_INCLUDES)
 
-TEST_GEN_PROGS := close_range_test
+TEST_GEN_PROGS := close_range_test unshare_test
 
 include ../lib.mk
 
tools/testing/selftests/core/unshare_test.c new file +94 -0

94 lines not on this page · raw message

maintainer
#1 lore raw
Quoted 9 lines · Al Viro

At some point there'd been a dumb braino during the dup_fd()
calling conventions change; caught by smatch and immediately fixed. The trouble is, there had been no test coverage for the dup_fd() failure handling - neither in kselftests nor in LTP. Fortunately, it can be triggered on stock kernel - ENOMEM would require fault injection, but EMFILE can be had with sysctl alone (fs.nr_open).

---

Applied to linux-kselftest next for Linux 6.12-rc1 after fixing up the short log to reflect the right test.

Thank you.

thanks,
-- Shuah