From: Cyril Hrubis <chrubis@suse.cz>
To: He Zhe <zhe.he@windriver.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] syscalls/prctl04: Fix false positive report when SECCOMP_MODE_FILTER is not supported
Date: Fri, 18 Nov 2022 14:33:07 +0100 [thread overview]
Message-ID: <Y3eJk1ugDSv+TC70@yuki> (raw)
In-Reply-To: <20221116102334.741189-1-zhe.he@windriver.com>
Hi!
I did reply to the github issue already with:
Looking at the patch, maybe it would be cleaner if we did a test if
SECCOMP_MODE_FILTER is supported in the test setup and set up a global
variable based on that, something as:
diff --git a/testcases/kernel/syscalls/prctl/prctl04.c b/testcases/kernel/syscalls/prctl/prctl04.c
index b9f4c2a10..d4e44cb1b 100644
--- a/testcases/kernel/syscalls/prctl/prctl04.c
+++ b/testcases/kernel/syscalls/prctl/prctl04.c
@@ -61,6 +61,8 @@ static const struct sock_fprog strict = {
.filter = (struct sock_filter *)strict_filter
};
+static int mode_filter_supported;
+
static void check_strict_mode(int);
static void check_filter_mode(int);
@@ -219,6 +221,16 @@ static void setup(void)
TEST(prctl(PR_GET_SECCOMP));
if (TST_RET == 0) {
tst_res(TINFO, "kernel support PR_GET/SET_SECCOMP");
+
+ TEST(prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, NULL));
+
+ if (TST_ERR == EFAULT) {
+ mode_filter_supported = 1;
+ tst_res(TINFO, "kernel support SECCOMP_MODE_FILTER");
+ return;
+ }
+
+ tst_res(TINFO, "kernel doesn't support SECCOMP_MODE_FILTER");
return;
}
Then we can simply use the mode_filter_supported either not to print the
failure or even to skip the test to begin with.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2022-11-18 13:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-16 10:23 [LTP] [PATCH] syscalls/prctl04: Fix false positive report when SECCOMP_MODE_FILTER is not supported He Zhe
2022-11-18 13:33 ` Cyril Hrubis [this message]
2022-11-19 13:05 ` He Zhe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y3eJk1ugDSv+TC70@yuki \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
--cc=zhe.he@windriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.