Skip to contentSkip to conversation

defconfig: add NF_TABLES dependency for netlink_socket tests to pass

PATCH In review Alan Wandke 3 participants 3 messages Nov 27, 2023 – Nov 28, 2023 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 defconfig: add NF_TABLES dependency for netlink_socket tests to pass

In order to support the NETFILTER_NETLINK protocol, either NF_TABLES or IP_SET must be enabled. Neither are strict dependencies in Kconfig. Fix this by enabling NF_TABLES in the defconfig.

Before:
./netlinkcreate: socket(AF_NETLINK, SOCK_DGRAM, netfilter/12): Protocol not supported not ok 3
# Test 3 got: "256" (./test at line 25)
# Expected: "0"
# ./test line 25 is: ok( $result, 0 );

After:
ok 3

---
 defconfig | 1 +
 1 file changed, 1 insertion(+)
defconfig +1 -0
index 2783c01..47938c1 100644
@@ -55,6 +55,7 @@ CONFIG_IPV6_GRE=m
 CONFIG_SCSI_ISCSI_ATTRS=m
 CONFIG_NETFILTER_NETLINK=m
 CONFIG_CRYPTO_USER=m
+CONFIG_NF_TABLES=m
 
 # Overlay fs.
 # This is enabled to test overlayfs SELinux integration.
Signature · 1 line
2.42.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Alan Wandke

In order to support the NETFILTER_NETLINK protocol, either NF_TABLES or IP_SET must be enabled. Neither are strict dependencies in Kconfig. Fix this by enabling NF_TABLES in the defconfig.

Before:
./netlinkcreate: socket(AF_NETLINK, SOCK_DGRAM, netfilter/12): Protocol not supported not ok 3
# Test 3 got: "256" (./test at line 25)
# Expected: "0"
# ./test line 25 is: ok( $result, 0 );

Quoted 4 lines

After:
ok 3

Looks like we could enable it via a number of different config options but we need NF_TABLES regardless for the secmark tests in inet_socket and sctp to run, so adding that to the defconfig makes the most sense.

Quoted 19 lines
---
 defconfig | 1 +
 1 file changed, 1 insertion(+)
defconfig +1 -1
index 2783c01..47938c1 100644
@@ -55,6 +55,7 @@ CONFIG_IPV6_GRE=m
 CONFIG_SCSI_ISCSI_ATTRS=m
 CONFIG_NETFILTER_NETLINK=m
 CONFIG_CRYPTO_USER=m
+CONFIG_NF_TABLES=m
 
 # Overlay fs.
 # This is enabled to test overlayfs SELinux integration.
--

2.42.0

#2 lore raw
Quoted 16 lines · Stephen Smalley
Quoted 14 lines · Alan Wandke

In order to support the NETFILTER_NETLINK protocol, either NF_TABLES or IP_SET must be enabled. Neither are strict dependencies in Kconfig. Fix this by enabling NF_TABLES in the defconfig.

Before:
./netlinkcreate: socket(AF_NETLINK, SOCK_DGRAM, netfilter/12): Protocol not supported not ok 3
# Test 3 got: "256" (./test at line 25)
# Expected: "0"
# ./test line 25 is: ok( $result, 0 );

After:
ok 3

Quoted 7 lines
Quoted 1 line

Looks like we could enable it via a number of different config options but we need NF_TABLES regardless for the secmark tests in inet_socket and sctp to run, so adding that to the defconfig makes the most sense.

Seems reasonable, thanks! The patch is now applied:
https://github.com/SELinuxProject/selinux-testsuite/commit/fa65d2f59c4d974ef736bc1cd3bfab75b78ac5f0

Signature · 3 lines
Ondrej Mosnacek
Senior Software Engineer, Linux Security - SELinux kernel
Red Hat, Inc.