* [PATCH] selftests/landlock: Skip scoped_signal subtest with MSG_OOB if not available
@ 2026-07-10 8:16 Thomas Huth
2026-07-10 11:10 ` Mickaël Salaün
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Huth @ 2026-07-10 8:16 UTC (permalink / raw)
To: Mickaël Salaün, Günther Noack,
linux-security-module
Cc: Shuah Khan, linux-kselftest, linux-kernel
From: Thomas Huth <thuth@redhat.com>
MSG_OOB might be disabled in the kernel for unix sockets (by not
selecting CONFIG_AF_UNIX_OOB), and in this case the related tests
of the scoped_signal_test are currently failing. Add a runtime
probe using socketpair() to detect MSG_OOB support and skip the
test gracefully if it is unavailable.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
.../selftests/landlock/scoped_signal_test.c | 21 +++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/tools/testing/selftests/landlock/scoped_signal_test.c b/tools/testing/selftests/landlock/scoped_signal_test.c
index 58d25157fe781..3cf20d769f2bc 100644
--- a/tools/testing/selftests/landlock/scoped_signal_test.c
+++ b/tools/testing/selftests/landlock/scoped_signal_test.c
@@ -398,6 +398,24 @@ static int setup_signal_handler(int signal)
return sigaction(SIGURG, &sa, NULL);
}
+/*
+ * MSG_OOB might be disabled in the kernel via the CONFIG_AF_UNIX_OOB
+ * switch, so this function can be used for probing for its availability.
+ */
+static bool has_af_unix_oob(void)
+{
+ bool available = false;
+ int sp[2];
+
+ if (socketpair(AF_UNIX, SOCK_STREAM, 0, sp) == 0) {
+ available = (send(sp[0], ".", 1, MSG_OOB) == 1);
+ close(sp[0]);
+ close(sp[1]);
+ }
+
+ return available;
+}
+
/* clang-format off */
FIXTURE(fown) {};
/* clang-format on */
@@ -460,6 +478,9 @@ TEST_F(fown, sigurg_socket)
int pipe_parent[2], pipe_child[2];
pid_t child;
+ if (!has_af_unix_oob())
+ SKIP(return, "CONFIG_AF_UNIX_OOB / MSG_OOB not available");
+
memset(&server_address, 0, sizeof(server_address));
set_unix_address(&server_address, 0);
--
2.55.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] selftests/landlock: Skip scoped_signal subtest with MSG_OOB if not available
2026-07-10 8:16 [PATCH] selftests/landlock: Skip scoped_signal subtest with MSG_OOB if not available Thomas Huth
@ 2026-07-10 11:10 ` Mickaël Salaün
0 siblings, 0 replies; 2+ messages in thread
From: Mickaël Salaün @ 2026-07-10 11:10 UTC (permalink / raw)
To: Thomas Huth
Cc: Günther Noack, linux-security-module, Shuah Khan,
linux-kselftest, linux-kernel
Applied (with a Fixes tag), thanks!
On Fri, Jul 10, 2026 at 10:16:42AM +0200, Thomas Huth wrote:
> From: Thomas Huth <thuth@redhat.com>
>
> MSG_OOB might be disabled in the kernel for unix sockets (by not
> selecting CONFIG_AF_UNIX_OOB), and in this case the related tests
> of the scoped_signal_test are currently failing. Add a runtime
> probe using socketpair() to detect MSG_OOB support and skip the
> test gracefully if it is unavailable.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> .../selftests/landlock/scoped_signal_test.c | 21 +++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/tools/testing/selftests/landlock/scoped_signal_test.c b/tools/testing/selftests/landlock/scoped_signal_test.c
> index 58d25157fe781..3cf20d769f2bc 100644
> --- a/tools/testing/selftests/landlock/scoped_signal_test.c
> +++ b/tools/testing/selftests/landlock/scoped_signal_test.c
> @@ -398,6 +398,24 @@ static int setup_signal_handler(int signal)
> return sigaction(SIGURG, &sa, NULL);
> }
>
> +/*
> + * MSG_OOB might be disabled in the kernel via the CONFIG_AF_UNIX_OOB
> + * switch, so this function can be used for probing for its availability.
> + */
> +static bool has_af_unix_oob(void)
> +{
> + bool available = false;
> + int sp[2];
> +
> + if (socketpair(AF_UNIX, SOCK_STREAM, 0, sp) == 0) {
> + available = (send(sp[0], ".", 1, MSG_OOB) == 1);
> + close(sp[0]);
> + close(sp[1]);
> + }
> +
> + return available;
> +}
> +
> /* clang-format off */
> FIXTURE(fown) {};
> /* clang-format on */
> @@ -460,6 +478,9 @@ TEST_F(fown, sigurg_socket)
> int pipe_parent[2], pipe_child[2];
> pid_t child;
>
> + if (!has_af_unix_oob())
> + SKIP(return, "CONFIG_AF_UNIX_OOB / MSG_OOB not available");
> +
> memset(&server_address, 0, sizeof(server_address));
> set_unix_address(&server_address, 0);
>
> --
> 2.55.0
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-10 11:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-10 8:16 [PATCH] selftests/landlock: Skip scoped_signal subtest with MSG_OOB if not available Thomas Huth
2026-07-10 11:10 ` Mickaël Salaün
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox