skip inet_socket/mptcp when CONFIG_MPTCP is not enabled
PATCH 1/1 skip inet_socket/mptcp when CONFIG_MPTCP is not enabled
--- tests/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tests/Makefile +3 -1
@@ -148,10 +148,12 @@ endif endif # MPTCP is supported since kernel 5.6, but only works with SELinux -# since 6.5 +# since 6.5. Skip when the running kernel was built without MPTCP. ifneq ($(shell ./kvercmp $$(uname -r) 6.5),-1) +ifeq ($(shell grep -qE '^CONFIG_MPTCP=(y|m)' /lib/modules/$$(uname -r)/config 2>/dev/null && echo true),true) SUBDIRS += inet_socket/mptcp endif +endif # nlmsg test dependencies: policy >= 30, nlmsg permission, netlink_xperm capability ifeq ($(shell [ $(MOD_POL_VERS) -ge 18 -a $(MAX_KERNEL_POLICY) -ge 30 ] && [ -f /sys/fs/selinux/class/netlink_route_socket/perms/nlmsg ] && grep -q 1 $(SELINUXFS)/policy_capabilities/netlink_xperm && echo true),true)
Signature · 1 line
2.55.0
Stephen Smalley
maintainerQuoted 11 lines · Jan Onderka
Signed-off-by Jan Onderka <[email protected]>--- tests/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)tests/Makefile +0
-0
tests/Makefile endif · line 153
Quoted 7 lines
tests/Makefile +2
-1@@ -148,10 +148,12 @@ endif endif # MPTCP is supported since kernel 5.6, but only works with SELinux -# since 6.5 +# since 6.5. Skip when the running kernel was built without MPTCP. ifneq ($(shell ./kvercmp $$(uname -r) 6.5),-1) +ifeq ($(shell grep -qE '^CONFIG_MPTCP=(y|m)' /lib/modules/$$(uname -r)/config 2>/dev/null && echo true),true)
This test won't work when building and booting your own kernels by hand, which at least for me is the common pattern.
Quoted 10 lines
tests/Makefile +1
-1SUBDIRS += inet_socket/mptcp endif +endif # nlmsg test dependencies: policy >= 30, nlmsg permission, netlink_xperm capability ifeq ($(shell [ $(MOD_POL_VERS) -ge 18 -a $(MAX_KERNEL_POLICY) -ge 30 ] && [ -f /sys/fs/selinux/class/netlink_route_socket/perms/nlmsg ] && grep -q 1 $(SELINUXFS)/policy_capabilities/netlink_xperm && echo true),true) --2.55.0
PATCH 1/1 skip inet_socket/mptcp when MPTCP is not supported
In reply to Jan OnderkaMPTCP is supported since kernel 5.6, but only works with SELinux since 6.5. tests/Makefile currently adds inet_socket/mptcp whenever the kernel version is >= 6.5. That is not sufficient: some kernels meet the version requirement but are built without MPTCP.
Gate inclusion of inet_socket/mptcp on both:
1. kernel version >= 6.5 (existing check)
2. the net.mptcp.enabled sysctl existing under /proc/sys/net/mptcp
v2: use the net.mptcp.enabled sysctl instead of grepping CONFIG_MPTCP out of /lib/modules/$(uname -r)/config.
--- tests/Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
tests/Makefile +6 -1
@@ -157,10 +157,15 @@ endif endif # MPTCP is supported since kernel 5.6, but only works with SELinux -# since 6.5 +# since 6.5. Skip when the running kernel was built without MPTCP: the +# net.mptcp.enabled sysctl only exists when CONFIG_MPTCP is set, so this +# works for hand-built/booted kernels too, unlike checking +# /lib/modules/$(uname -r)/config directly. ifneq ($(shell ./kvercmp $$(uname -r) 6.5),-1) +ifeq ($(shell test -e /proc/sys/net/mptcp/enabled && echo true),true) SUBDIRS += inet_socket/mptcp endif +endif # nlmsg test dependencies: policy >= 30, nlmsg permission, netlink_xperm capability ifeq ($(shell [ $(MOD_POL_VERS) -ge 18 -a $(MAX_KERNEL_POLICY) -ge 30 ] && [ -f /sys/fs/selinux/class/netlink_route_socket/perms/nlmsg ] && grep -q 1 $(SELINUXFS)/policy_capabilities/netlink_xperm && echo true),true)
Signature · 1 line
2.55.0
Stephen Smalley
maintainerRe: [PATCH] skip inet_socket/mptcp when MPTCP is not supported
Quoted 10 lines · Brian Grech
MPTCP is supported since kernel 5.6, but only works with SELinux since 6.5. tests/Makefile currently adds inet_socket/mptcp whenever the kernel version is >= 6.5. That is not sufficient: some kernels meet the version requirement but are built without MPTCP.
Gate inclusion of inet_socket/mptcp on both:
1. kernel version >= 6.5 (existing check)
2. the net.mptcp.enabled sysctl existing under/proc/sys/net/mptcp
Quoted 7 lines
v2: use the net.mptcp.enabled sysctl instead of grepping
CONFIG_MPTCPout of /lib/modules/$(uname -r)/config.Signed-off-by Jan Onderka <[email protected]>Co-developed-by Jan Onderka <[email protected]>Signed-off-by Brian Grech <[email protected]>
I'm planning to take most of the patches from this series:
https://lore.kernel.org/selinux/[email protected]/
some of which may make this and other patches you have redundant (or break on conflicts).
Might want to wait until those are merged to re-spin. Or if you think yours are better, let me know
and I'll look closer.
Stephen Smalley
maintainerRe: [PATCH] skip inet_socket/mptcp when MPTCP is not supported
Quoted 17 lines · Stephen Smalley
Quoted 15 lines · Brian Grech
MPTCP is supported since kernel 5.6, but only works with SELinux since 6.5. tests/Makefile currently adds inet_socket/mptcp whenever the kernel version is >= 6.5. That is not sufficient: some kernels meet the version requirement but are built without MPTCP.
Gate inclusion of inet_socket/mptcp on both:
1. kernel version >= 6.5 (existing check)
2. the net.mptcp.enabled sysctl existing under/proc/sys/net/mptcpv2: use the net.mptcp.enabled sysctl instead of grepping
CONFIG_MPTCPout of /lib/modules/$(uname -r)/config.Signed-off-by Jan Onderka <[email protected]>
Quoted 7 lines
Quoted 2 lines
Co-developed-by Jan Onderka <[email protected]>Signed-off-by Brian Grech <[email protected]>I'm planning to take most of the patches from this series:
https://lore.kernel.org/selinux/[email protected]/
some of which may make this and other patches you have redundant (or break on conflicts).
I just merged the subset of that series I acked so you can now re-base and see what if any of yours are still relevant/applicable.
Quoted 3 lines
Might want to wait until those are merged to re-spin. Or if you think yours are better, let me know
and I'll look closer.
Stephen Smalley
maintainerRe: [PATCH] skip inet_socket/mptcp when MPTCP is not supported
Quoted 23 lines · Stephen Smalley
Quoted 20 lines · Stephen Smalley
Quoted 17 lines · Brian Grech
MPTCP is supported since kernel 5.6, but only works with SELinux since 6.5. tests/Makefile currently adds inet_socket/mptcp whenever the kernel version is >= 6.5. That is not sufficient: some kernels meet the version requirement but are built without MPTCP.
Gate inclusion of inet_socket/mptcp on both:
1. kernel version >= 6.5 (existing check)
2. the net.mptcp.enabled sysctl existing under/proc/sys/net/mptcpv2: use the net.mptcp.enabled sysctl instead of grepping
CONFIG_MPTCPout of /lib/modules/$(uname -r)/config.Signed-off-by Jan Onderka <[email protected]>Co-developed-by Jan Onderka <[email protected]>Signed-off-by Brian Grech <[email protected]>
Quoted 11 lines
Quoted 4 lines
I'm planning to take most of the patches from this series:
https://lore.kernel.org/selinux/[email protected]/
some of which may make this and other patches you have redundant (or break on conflicts).I just merged the subset of that series I acked so you can now re-base and see what if any of yours are still relevant/applicable.
Quoted 3 lines
Might want to wait until those are merged to re-spin. Or if you think yours are better, let me know
and I'll look closer.
I looked and I think cgzones' patch already addresses this just as effectively - his check is in the test script so we still descend the directory and run the script but nothing extra is built since the inet_socket tests all share the same test programs. So I'm going to just ignore this one.