@@ -61,6 +61,7 @@ similar dependencies):
* e2fsprogs _(used by the ext4 filesystem tests)_
* jfsutils _(used by the jfs filesystem tests)_
* dosfstools _(used by the vfat filesystem tests)_
+* btrfs-progs _(used by the btrfs filesystem tests)_
* nftables _(used by inet_socket and sctp tests if ver >= 9.3 for secmark testing )_
On a modern Fedora system you can install these dependencies with the
@@ -87,6 +88,7 @@ following command (NOTE: On Fedora 32 and below you need to remove
e2fsprogs \
jfsutils \
dosfstools \
+ btrfs-progs \
nftables \
kernel-devel-$(uname -r) \
kernel-modules-$(uname -r)
@@ -134,6 +136,7 @@ command:
e2fsprogs \
jfsutils \
dosfstools \
+ btrfs-progs \
nftables
On Debian, you need to build and install netlabel_tools manually since
@@ -117,3 +117,7 @@ CONFIG_VFAT_FS=m
# They are not required for SELinux operation itself.
CONFIG_WATCH_QUEUE=y
CONFIG_KEY_NOTIFICATIONS=y
+
+# Test BTRFS filesystem.
+# This is not required for SELinux operation itself.
+CONFIG_BTRFS_FS=y
@@ -4,7 +4,7 @@ SBINDIR ?= $(PREFIX)/sbin
POLDEV ?= $(PREFIX)/share/selinux/devel
INCLUDEDIR ?= $(PREFIX)/include
SELINUXFS ?= /sys/fs/selinux
-FILESYSTEMS ?= ext4 xfs jfs vfat
+FILESYSTEMS ?= ext4 xfs jfs vfat btrfs
export CFLAGS+=-g -O0 -Wall -D_GNU_SOURCE
@@ -122,10 +122,18 @@ sub attach_dev {
sub make_fs {
my ( $mk_type, $mk_dev, $mk_dir ) = @_;
+
+ # BTRFS requires a larger minimum size that takes >2x longer to generate
+ if ( $mk_type eq "btrfs" ) {
+ $count = "28000";
+ }
+ else {
+ $count = "4096";
+ }
print "Create $mk_dir/fstest with dd\n";
$result =
system(
- "dd if=/dev/zero of=$mk_dir/fstest bs=4096 count=4096 2>/dev/null");
+ "dd if=/dev/zero of=$mk_dir/fstest bs=4096 count=$count 2>/dev/null");
if ( $result != 0 ) {
print "dd failed to create $mk_dir/fstest\n";
}
new file mode 120000
@@ -0,0 +1 @@
+.
\ No newline at end of file
@@ -78,6 +78,12 @@ BEGIN {
$test_count = 55;
$quota_checks = 0;
}
+
+ # BTRFS uses internal quotas requiring no security hooks
+ elsif ( $fs_type eq "btrfs" ) {
+ $test_count = 55;
+ $quota_checks = 0;
+ }
else {
$test_count = 69;
}
new file mode 120000
@@ -0,0 +1 @@
+.
\ No newline at end of file
@@ -81,6 +81,12 @@ BEGIN {
$test_count = 54;
$quota_checks = 0;
}
+
+ # BTRFS uses internal quotas requiring no security hooks
+ elsif ( $fs_type eq "btrfs" ) {
+ $test_count = 54;
+ $quota_checks = 0;
+ }
else {
$test_count = 68;
}
@@ -41,6 +41,7 @@ dnf install -y \
e2fsprogs \
jfsutils \
dosfstools \
+ btrfs-progs \
kernel-devel-"$(uname -r)" \
kernel-modules-"$(uname -r)"
This allows btrfs filesystems to be created to support the filesystem mount(2) type calls and the fs_filesystem fsmount(2) type calls. Signed-off-by: Richard Haines <richard_c_haines@btinternet.com> --- README.md | 3 +++ defconfig | 4 ++++ tests/Makefile | 2 +- tests/filesystem/Filesystem.pm | 10 +++++++++- tests/filesystem/btrfs | 1 + tests/filesystem/test | 6 ++++++ tests/fs_filesystem/btrfs | 1 + tests/fs_filesystem/test | 6 ++++++ travis-ci/run-testsuite.sh | 1 + 9 files changed, 32 insertions(+), 2 deletions(-) create mode 120000 tests/filesystem/btrfs create mode 120000 tests/fs_filesystem/btrfs