Looks like we're almost there with the bpf syscall patches on the
linux-morello list[1][2]. So seems like a good time to update the
accompanying LTP tests.
Some of the bpf tests require either CAP_SYS_ADMIN or CAP_BPF, or
enabling unprivileged bpf with:
echo "0" > /proc/sys/kernel/unprivileged_bpf_disabled
Thanks,
Zach
Review branch: https://git.morello-project.org/zdleaf/morello-linux-test-project/-/tree/mo…
Kernel changes: https://git.morello-project.org/zdleaf/linux/-/tree/morello/bpf_v5
[1] https://op-lists.linaro.org/archives/list/linux-morello@op-lists.linaro.org…
[2] famous last words
Zachary Leaf (3):
bpf: align tests with PCuABI/uAPI
bpf: add bpf_check_attr test
runtest: add bpf to extended PCuABI syscall list
include/lapi/bpf.h | 354 +++++++++++++-----
runtest/morello_transitional_extended | 13 +
.../kernel/syscalls/bpf/bpf_check_attr.c | 62 +++
testcases/kernel/syscalls/bpf/bpf_common.c | 10 +-
testcases/kernel/syscalls/bpf/bpf_map01.c | 12 +-
testcases/kernel/syscalls/bpf/bpf_prog03.c | 4 +-
6 files changed, 352 insertions(+), 103 deletions(-)
create mode 100644 testcases/kernel/syscalls/bpf/bpf_check_attr.c
--
2.34.1
Hi,
This series fixes a number of issues that the switch to checked
(capability-based) uaccess [1] has revealed. These patches complete
those that I have posted upstream [2] (and are already merged); they
address issues that are likely to be too purecap-specific for upstream.
Review branch:
https://git.morello-project.org/kbrodsky-arm/morello-linux-ltp/-/commits/re…
Cheers,
Kevin
[1] https://op-lists.linaro.org/archives/list/linux-morello@op-lists.linaro.org…
[2] https://lore.kernel.org/ltp/20231023135647.2157030-1-kevin.brodsky@arm.com/
Kevin Brodsky (3):
syscalls/clone3: Avoid truncating pointers in purecap
syscalls/prctl: Fix invalid pointer cast in purecap
syscalls/sockioctl: Avoid out-of-bound uaccess in purecap
testcases/kernel/syscalls/clone3/clone301.c | 6 +++---
testcases/kernel/syscalls/prctl/prctl02.c | 15 +++++++++------
testcases/kernel/syscalls/sockioctl/sockioctl01.c | 2 +-
3 files changed, 13 insertions(+), 10 deletions(-)
--
2.38.1
Hi All,
Morello LTP 1.6.1 integration drop is now available [1]
Main changes:
- syscalls/io_cancel: proper asynchronous I/O context secured for relevant
tests so that an actual intended behaviour gets validated
- syscalls/bpf: unified size of used buffers across related tests
- syscalls/io_uring: support for capabilities with the updated version
of io_uring_sqe struct; activated testcase for purecap runs of io_uring
syscall test suite
Enjoy!
Contributions:
--------------
Shout out to all the contributors and reviewers for all the work behind getting
the changes in, much appreciated!
git shortlog -s -e -n --invert-grep --grep="cherry" morello-release-1.6.0..
3 Tudor Cretu <tudor.cretu(a)arm.com>
1 Beata Michalska <beata.michalska(a)arm.com>
1 Zachary Leaf <zachary.leaf(a)arm.com>
---
[1] https://git.morello-project.org/morello/morello-linux-ltp/-/tags/morello-re…
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