Add test for io_uring openat access control with Landlock rules
Subsystems (3)
PATCH v4 1/1 Add test for io_uring openat access control with Landlock rules
This v4 patch expands Landlock test coverage to include io_uring operations. It also introduces a test for IORING_OP_OPENAT with Landlock rules, verifying allowed and restricted O_RDONLY access. This makes sure that IORING_OP_OPENAT is well covered from security vulnerabilities by ensuring Landlock controls access through io_uring.
It also updates Makefile to include -luring in the LDLIBS variable. This ensures the test code has access to the necessary library for io_uring operations.
The previous implementation of tests for the io_uring operation IORING_OP_OPENAT in the Landlock fs_test suite was found to be incorrect and ineffective.
This patch removes the previous implementation and introduces a new set of tests that cover both allowed and denied access scenarios.
Changes since V1:
V2: - Consolidated two dependent patches in the V1 series into one patch
as suggested by Fabio.
- Updated The subject line to be more descriptive.
V3: - Added "selftests/landlock" subject prefix
- Revised wording in the commit message to accurately reflect the test functionality as suggested by Mickaël.
- Updated the Fixture set_up and tear_down to create and remove the necesssary files and folders for testing access.
- renamed allowed_ruleset_fd and disallowed_ruleset_fd to ruleset_fd as suggest by Mickaël.
- Moved all variable declarations to the top of the function.
- Refactored the code to test only one allowed and one restricted path instead of iterating through all the paths.
- Added comments to explain what is happening in different blocks of code
- Removed the clang-format markers.
- Removed unused arguments in the function definition.
- Added a final rule struct with a null path to the allowed_rule and disallowed_rule arrays as suggested by Fabio.
- CC'd the missing mailing lists as suggested by Shuah.
- All executables have been included in the .gitignore so no updates are necessary.
V4: - Removed the previous implementation of the tests as they were not
correctly implemented.
--- tools/testing/selftests/landlock/Makefile | 4 +- tools/testing/selftests/landlock/fs_test.c | 85 ++++++++++++++++++++++ 2 files changed, 87 insertions(+), 2 deletions(-)
tools/testing/selftests/landlock/Makefile +2 -2
@@ -13,11 +13,11 @@ TEST_GEN_PROGS := $(src_test:.c=) TEST_GEN_PROGS_EXTENDED := true # Short targets: -$(TEST_GEN_PROGS): LDLIBS += -lcap +$(TEST_GEN_PROGS): LDLIBS += -lcap -luring $(TEST_GEN_PROGS_EXTENDED): LDFLAGS += -static include ../lib.mk # Targets with $(OUTPUT)/ prefix: -$(TEST_GEN_PROGS): LDLIBS += -lcap +$(TEST_GEN_PROGS): LDLIBS += -lcap -luring $(TEST_GEN_PROGS_EXTENDED): LDFLAGS += -static
tools/testing/selftests/landlock/fs_test.c +85 -0
96 lines not on this page · raw message
--
2.25.1