selftests/landlock: Add tests for pseudo filesystems
authorMickaël Salaün <mic@digikod.net>
Mon, 12 Jun 2023 19:14:29 +0000 (21:14 +0200)
committerMickaël Salaün <mic@digikod.net>
Mon, 12 Jun 2023 19:26:23 +0000 (21:26 +0200)
commit04f9070e99a4c5d60f05436f63e470c19b579e24
treed7a7e040ac6f175a9ba9b4a5294e1e5b6ed32fe8
parent55ab3fbe8333148e9c21477ffdc4edbe1f568f55
selftests/landlock: Add tests for pseudo filesystems

Add generic and read-only tests for 6 pseudo filesystems to make sure
they have a consistent inode management, which is required for
Landlock's file hierarchy identification:
- tmpfs
- ramfs
- cgroup2
- proc
- sysfs

Update related kernel configuration to support these new filesystems,
remove useless CONFIG_SECURITY_PATH, and sort all entries.  If these
filesystems are not supported by the kernel running tests, the related
tests are skipped.

Expanding variants, this adds 25 new tests for layout3_fs:
- tag_inode_dir_parent
- tag_inode_dir_mnt
- tag_inode_dir_child
- tag_inode_dir_file
- release_inodes

Test coverage for security/landlock with kernel debug code:
- 94.7% of 835 lines according to gcc/gcov-12
- 93.0% of 852 lines according to gcc/gcov-13

Test coverage for security/landlock without kernel debug code:
- 95.5% of 624 lines according to gcc/gcov-12
- 93.1% of 641 lines according to gcc/gcov-13

Link: https://lore.kernel.org/r/20230612191430.339153-6-mic@digikod.net
Signed-off-by: Mickaël Salaün <mic@digikod.net>
tools/testing/selftests/landlock/config
tools/testing/selftests/landlock/fs_test.c