From: Li Wang <liwang@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] mseal01: handle more possible errnos when pkey_alloc gets fail
Date: Sat, 3 Aug 2024 20:22:58 +0800 [thread overview]
Message-ID: <20240803122258.5479-1-liwang@redhat.com> (raw)
In-Reply-To: <CAEemH2c5uqD=x0OiPcH5aKJHCJ8vtQ0GdMoWZnZxXT4rLfCcYg@mail.gmail.com>
Signed-off-by: Li Wang <liwang@redhat.com>
---
testcases/kernel/syscalls/mseal/mseal01.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/testcases/kernel/syscalls/mseal/mseal01.c b/testcases/kernel/syscalls/mseal/mseal01.c
index eb2f4d588..2ff6ed119 100644
--- a/testcases/kernel/syscalls/mseal/mseal01.c
+++ b/testcases/kernel/syscalls/mseal/mseal01.c
@@ -25,6 +25,7 @@
#include "tst_test.h"
#include "lapi/syscalls.h"
+#include "../pkeys/pkey.h"
#define MEMPAGES 8
#define MEMSEAL 2
@@ -46,25 +47,19 @@ static void test_mprotect(void)
static void test_pkey_mprotect(void)
{
- int ret;
int pkey;
- pkey = tst_syscall(__NR_pkey_alloc, 0, 0);
- if (pkey == -1) {
- if (errno == EINVAL)
- tst_brk(TCONF, "pku is not supported on this CPU");
+ check_pkey_support();
- tst_brk(TBROK | TERRNO, "pkey_alloc() error");
- }
+ pkey = ltp_pkey_alloc( 0, 0);
- TST_EXP_FAIL(tst_syscall(__NR_pkey_mprotect,
+ TST_EXP_FAIL(ltp_pkey_mprotect(
mem_addr, mem_size,
PROT_NONE,
pkey),
EPERM);
- ret = tst_syscall(__NR_pkey_free, pkey);
- if (ret == -1)
+ if (ltp_pkey_free(pkey) == -1)
tst_brk(TBROK | TERRNO, "pkey_free() error");
}
@@ -150,7 +145,6 @@ static struct tst_test test = {
.test = run,
.tcnt = ARRAY_SIZE(tcases),
.setup = setup,
- .min_kver = "6.10",
.forks_child = 1,
};
--
2.45.2
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2024-08-03 12:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-01 12:43 [LTP] [PATCH v3 0/2] Add mseal() testing suite Andrea Cervesato
2024-08-01 12:43 ` [LTP] [PATCH v3 1/2] Add mseal() syscall declaration Andrea Cervesato
2024-08-01 12:43 ` [LTP] [PATCH v3 2/2] Add mseal01 test Andrea Cervesato
2024-08-01 14:54 ` Cyril Hrubis
2024-08-02 12:39 ` Andrea Cervesato via ltp
2024-08-03 3:27 ` Li Wang
2024-08-03 12:22 ` Li Wang [this message]
2024-08-05 6:38 ` [LTP] [PATCH] mseal01: handle more possible errnos when pkey_alloc gets fail Andrea Cervesato via ltp
2024-08-05 6:40 ` Li Wang
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=20240803122258.5479-1-liwang@redhat.com \
--to=liwang@redhat.com \
--cc=ltp@lists.linux.it \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox