mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] selftests/seccomp: Add SKIP for failed unshare()
@ 2022-03-29  6:03 davidcomponentone
  2022-03-29 15:28 ` Shuah Khan
  0 siblings, 1 reply; 2+ messages in thread
From: davidcomponentone @ 2022-03-29  6:03 UTC (permalink / raw)
  To: keescook
  Cc: davidcomponentone, luto, wad, shuah, ast, daniel, andrii, kafai,
	songliubraving, yhs, john.fastabend, kpsingh, linux-kselftest,
	netdev, bpf, linux-kernel, Yang Guang

From: Yang Guang <yang.guang5@zte.com.cn>

Running the seccomp tests under the kernel with "defconfig"
shouldn't fail. Because the CONFIG_USER_NS is not support
in "defconfig". So skip this test case is better.

Signed-off-by: Yang Guang <yang.guang5@zte.com.cn>
Signed-off-by: David Yang <davidcomponentone@gmail.com>
---
 tools/testing/selftests/seccomp/seccomp_bpf.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
index 313bb0cbfb1e..e9a61cb2eb88 100644
--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
@@ -3742,7 +3742,10 @@ TEST(user_notification_fault_recv)
 	struct seccomp_notif req = {};
 	struct seccomp_notif_resp resp = {};
 
-	ASSERT_EQ(unshare(CLONE_NEWUSER), 0);
+	ASSERT_EQ(unshare(CLONE_NEWUSER), 0) {
+		if (errno == EINVAL)
+			SKIP(return, "kernel missing CLONE_NEWUSER support");
+	}
 
 	listener = user_notif_syscall(__NR_getppid,
 				      SECCOMP_FILTER_FLAG_NEW_LISTENER);
-- 
2.30.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] selftests/seccomp: Add SKIP for failed unshare()
  2022-03-29  6:03 [PATCH] selftests/seccomp: Add SKIP for failed unshare() davidcomponentone
@ 2022-03-29 15:28 ` Shuah Khan
  0 siblings, 0 replies; 2+ messages in thread
From: Shuah Khan @ 2022-03-29 15:28 UTC (permalink / raw)
  To: davidcomponentone, keescook
  Cc: luto, wad, shuah, ast, daniel, andrii, kafai, songliubraving,
	yhs, john.fastabend, kpsingh, linux-kselftest, netdev, bpf,
	linux-kernel, Yang Guang, Shuah Khan

On 3/29/22 12:03 AM, davidcomponentone@gmail.com wrote:
> From: Yang Guang <yang.guang5@zte.com.cn>
> 
> Running the seccomp tests under the kernel with "defconfig"
> shouldn't fail. Because the CONFIG_USER_NS is not support

Nit - supported

> in "defconfig". So skip this test case is better.

Nit: "skipping this case instead if failing it."
> 
> Signed-off-by: Yang Guang <yang.guang5@zte.com.cn>
> Signed-off-by: David Yang <davidcomponentone@gmail.com>
> ---
>   tools/testing/selftests/seccomp/seccomp_bpf.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
> index 313bb0cbfb1e..e9a61cb2eb88 100644
> --- a/tools/testing/selftests/seccomp/seccomp_bpf.c
> +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
> @@ -3742,7 +3742,10 @@ TEST(user_notification_fault_recv)
>   	struct seccomp_notif req = {};
>   	struct seccomp_notif_resp resp = {};
>   
> -	ASSERT_EQ(unshare(CLONE_NEWUSER), 0);
> +	ASSERT_EQ(unshare(CLONE_NEWUSER), 0) {
> +		if (errno == EINVAL)
> +			SKIP(return, "kernel missing CLONE_NEWUSER support");> +	}
>   
>   	listener = user_notif_syscall(__NR_getppid,
>   				      SECCOMP_FILTER_FLAG_NEW_LISTENER);
> 
Looks good to me. Looks like this patch is for Linux 5.18 repo.
With the requested changes to commit log

Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>

thanks,
-- Shuah

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-29 15:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-29  6:03 [PATCH] selftests/seccomp: Add SKIP for failed unshare() davidcomponentone
2022-03-29 15:28 ` Shuah Khan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®