This small series updates the io_uring tests and adds them to the
morello_transitional_extended list.
This series depends on the following Morello Linux series:
"Support io_uring for Purecap apps"
v2:
- Remove changes to unused io_uring_sqe struct from the lapi header, and
add a comment on why it's left unmodified
- Remove the io_uring01 from relevant skip file
- Update the io_uring dependency tag to "> morello-release-1.6.0" as it
missed the boat
Review branch:
https://git.morello-project.org/tudcre01/morello-linux-ltp/-/commits/morell…
Tudor Cretu (2):
syscalls/io_uring: Align struct io_uring_sqe with new uABI
runtest: Add io_uring tests to the extended PCuABI syscall list
include/lapi/io_uring.h | 4 ++++
runtest/morello_transitional_extended | 4 ++++
runtest/syscalls_morello_purecap_skip | 4 ----
testcases/kernel/syscalls/io_uring/io_uring01.c | 4 ++--
testcases/kernel/syscalls/io_uring/io_uring02.c | 6 +++---
5 files changed, 13 insertions(+), 9 deletions(-)
--
2.34.1
The kernel might check for a valid context before checking the access
of the pointers. In such a case, it will return EINVAL instead of
EFAULT. Add an io_setup step to the test to ensure the io_cancel
syscall fails because of the intended cause.
Signed-off-by: Tudor Cretu <tudor.cretu(a)arm.com>
---
This patch doesn't have any dependency, but it's a dependency to the
following Morello Linux series:
"Support aio shared memory usage in the Purecap apps"
v2..v3:
- Applied a similar change to io_cancel02.c as well
Review branch:
https://git.morello-project.org/tudcre01/morello-linux-ltp/-/commits/morell…
---
The kernel might check for a valid context before checking the access
of the pointers. In such a case, it will return EINVAL instead of
EFAULT. Add an io_setup step to the test to ensure the io_cancel
syscall fails because of the intended cause.
Signed-off-by: Tudor Cretu <tudor.cretu(a)arm.com>
---
.../kernel/syscalls/io_cancel/io_cancel01.c | 18 +++++++++++++++---
.../kernel/syscalls/io_cancel/io_cancel02.c | 17 +++++++++++++++--
2 files changed, 30 insertions(+), 5 deletions(-)
diff --git a/testcases/kernel/syscalls/io_cancel/io_cancel01.c b/testcases/kernel/syscalls/io_cancel/io_cancel01.c
index f7e8bd061ed7..18c73845cfd3 100644
--- a/testcases/kernel/syscalls/io_cancel/io_cancel01.c
+++ b/testcases/kernel/syscalls/io_cancel/io_cancel01.c
@@ -18,11 +18,21 @@
#include "tst_test.h"
#include "lapi/syscalls.h"
-static void run(void)
+static aio_context_t ctx;
+
+static void setup(void)
+{
+ TST_EXP_PASS_SILENT(tst_syscall(__NR_io_setup, 1, &ctx));
+}
+
+static void cleanup(void)
{
- aio_context_t ctx;
+ if (ctx)
+ TST_EXP_PASS_SILENT(tst_syscall(__NR_io_destroy, ctx));
+}
- memset(&ctx, 0, sizeof(ctx));
+static void run(void)
+{
TST_EXP_FAIL(tst_syscall(__NR_io_cancel, ctx, NULL, NULL), EFAULT);
}
@@ -31,5 +41,7 @@ static struct tst_test test = {
"CONFIG_AIO=y",
NULL
},
+ .setup = setup,
+ .cleanup = cleanup,
.test_all = run,
};
diff --git a/testcases/kernel/syscalls/io_cancel/io_cancel02.c b/testcases/kernel/syscalls/io_cancel/io_cancel02.c
index 92ec65119202..5feb627753e3 100644
--- a/testcases/kernel/syscalls/io_cancel/io_cancel02.c
+++ b/testcases/kernel/syscalls/io_cancel/io_cancel02.c
@@ -20,10 +20,21 @@
#include <libaio.h>
-static void run(void)
+static io_context_t ctx;
+
+static void setup(void)
+{
+ TST_EXP_PASS_SILENT(io_setup(1, &ctx));
+}
+
+static void cleanup(void)
{
- io_context_t ctx;
+ if (ctx)
+ TST_EXP_PASS_SILENT(io_destroy(ctx));
+}
+static void run(void)
+{
memset(&ctx, 0, sizeof(ctx));
TEST(io_cancel(ctx, NULL, NULL));
@@ -46,6 +57,8 @@ static struct tst_test test = {
"CONFIG_AIO=y",
NULL
},
+ .setup = setup,
+ .cleanup = cleanup,
.test_all = run,
};
--
2.34.1
Currently log size is set to BUFSIZ which is defined by the libc in
stdio.h. In glibc, this is set to the constant 8196. In other libc's
this value can vary, e.g. in Musl this is set to 1024 which is not large
enough to store the verifier log, resulting in the following test
breakage:
[...] bpf_common.c:123: TBROK: Failed verification: ENOSPC (28)
This error is returned from kernel/bpf/verifier.c when the verifier log
exceeds the user supplied buffer.
Align bpf_prog02 with other bpf tests and set the buffer size
explicitly to 8196 in a #define at the top of the file.
Signed-off-by: Zachary Leaf <zachary.leaf(a)arm.com>
---
Note: this fix is not dependent on any Morello kernel bpf syscall changes, so
has been split out from those. Can be merged/reviewed independently of those.
Looks to be upstreamable.
Branch at: https://git.morello-project.org/zdleaf/morello-linux-test-project/-/tree/re…
testcases/kernel/syscalls/bpf/bpf_prog02.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/testcases/kernel/syscalls/bpf/bpf_prog02.c b/testcases/kernel/syscalls/bpf/bpf_prog02.c
index b40ea0f1d..927263a33 100644
--- a/testcases/kernel/syscalls/bpf/bpf_prog02.c
+++ b/testcases/kernel/syscalls/bpf/bpf_prog02.c
@@ -24,6 +24,7 @@
#include "bpf_common.h"
#define A64INT (((uint64_t)1) << 60)
+#define BUFSIZE 8196
const char MSG[] = "Ahoj!";
static char *msg;
@@ -64,7 +65,7 @@ static int load_prog(int fd)
BPF_EXIT_INSN(), /* 26: return r0 */
};
- bpf_init_prog_attr(attr, insn, sizeof(insn), log, BUFSIZ);
+ bpf_init_prog_attr(attr, insn, sizeof(insn), log, BUFSIZE);
return bpf_load_prog(attr, log);
}
@@ -117,7 +118,7 @@ static struct tst_test test = {
.bufs = (struct tst_buffers []) {
{&key, .size = sizeof(*key)},
{&val, .size = sizeof(*val)},
- {&log, .size = BUFSIZ},
+ {&log, .size = BUFSIZE},
{&attr, .size = sizeof(*attr)},
{&msg, .size = sizeof(MSG)},
{},
--
2.34.1