The mremap06 test relies on being able to move a mapping into the
unmapped space of an existing reservation (second call to mremap()
in do_test()). This is explicitly disallowed in PCuABI (for all
syscalls that can create mappings), and it is unclear if the
original bug can be reproduced if remapping to another adddress, so
let's just skip the test when running in purecap, at least for now.
Signed-off-by: Kevin Brodsky <kevin.brodsky(a)arm.com>
---
runtest/morello_transitional | 4 +++-
runtest/syscalls_morello_purecap_skip | 4 ++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/runtest/morello_transitional b/runtest/morello_transitional
index 702f62c0f42c..8d52fa1a2ec2 100644
--- a/runtest/morello_transitional
+++ b/runtest/morello_transitional
@@ -234,7 +234,9 @@ mremap02 mremap02
mremap03 mremap03
mremap04 mremap04
mremap05 mremap05
-mremap06 mremap06
+# This test is currently incompatible with the PCuABI specification
+# (mremap() into unmapped space in an existing reservation).
+#mremap06 mremap06
munmap01 munmap01
munmap02 munmap02
diff --git a/runtest/syscalls_morello_purecap_skip b/runtest/syscalls_morello_purecap_skip
index e4d66ee1b27f..4fa73ed9124c 100644
--- a/runtest/syscalls_morello_purecap_skip
+++ b/runtest/syscalls_morello_purecap_skip
@@ -6,3 +6,7 @@
process_vm_readv02
process_vm_readv03
process_vm_writev02
+
+# This test is currently incompatible with the PCuABI specification
+# (mremap() into unmapped space in an existing reservation).
+mremap06
--
2.43.0
The mremap06 test relies on being able to move a mapping into the
unmapped space of an existing reservation (second call to mremap()
in do_test()). This is explicitly disallowed in PCuABI (for all
syscalls that can create mappings), and it is unclear if the
original bug can be reproduced if remapping to another adddress, so
let's just skip the test in PCuABI.
Signed-off-by: Kevin Brodsky <kevin.brodsky(a)arm.com>
---
testcases/kernel/syscalls/mremap/mremap06.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/testcases/kernel/syscalls/mremap/mremap06.c b/testcases/kernel/syscalls/mremap/mremap06.c
index a19262750772..478840165cdc 100644
--- a/testcases/kernel/syscalls/mremap/mremap06.c
+++ b/testcases/kernel/syscalls/mremap/mremap06.c
@@ -96,6 +96,10 @@ static void setup(void)
{
int ret, i;
+#ifdef __CHERI_PURE_CAPABILITY__
+ tst_brk(TCONF, "Cannot test mremap() into unmapped space in purecap: not supported");
+#endif
+
page_size = getpagesize();
mmap_size = (NUM_PAGES+1) * page_size;
mremap_size = NUM_PAGES * page_size;
--
2.43.0
Hi,
This series fixes various issues in LTP that prevent tests from passing
when reservations / PCuABI address space management are implemented.
Patch 1-3 are generic, and arguably general improvements. The remainder
of the patches are PCuABI-specific, with appropriate #ifdef'ing where
necessary. The changes are meant to be backwards-compatible (e.g.
ERESERVATION is not assumed to be returned in PCuABI).
Review branch:
https://git.morello-project.org/kbrodsky-arm/morello-linux-ltp/-/commits/mo…
Thanks,
Kevin
Kevin Brodsky (10):
syscalls/munlock: Pass an appropriate length to munlock()
syscalls/m{,un}lock: Use mmap() to obtain an owning pointer
syscalls/m{,un}map: Pass a raw address when reusing an address range
syscalls: Use PROT_MAX() where needed
syscalls/mmap: Allow MREMAP_MAYMOVE in PCuABI
syscalls/mlock{,2}: Expect ERESERVATION on unmapped area
syscalls/mmap: Expect EINVAL on MAP_FIXED_NOREPLACE
syscalls/mprotect: Expect EINVAL on null pointer
syscalls/mremap: Expect EINVAL on narrow pointer
syscalls/mmap: Skip MAP_GROWSDOWN tests in PCuABI
.../syscalls/memfd_create/memfd_create_common.c | 3 ++-
testcases/kernel/syscalls/mlock/mlock01.c | 13 +++----------
testcases/kernel/syscalls/mlock/mlock02.c | 12 +++++++++++-
testcases/kernel/syscalls/mlock2/mlock202.c | 5 +++--
testcases/kernel/syscalls/mmap/mmap16.c | 11 +++++++++--
testcases/kernel/syscalls/mmap/mmap17.c | 4 ++++
testcases/kernel/syscalls/mmap/mmap18.c | 7 +++++++
testcases/kernel/syscalls/mmap/mmap19.c | 4 ++--
testcases/kernel/syscalls/mprotect/mprotect01.c | 11 +++++++++--
testcases/kernel/syscalls/mprotect/mprotect02.c | 3 ++-
testcases/kernel/syscalls/mprotect/mprotect04.c | 5 +++--
testcases/kernel/syscalls/mprotect/mprotect05.c | 4 +++-
testcases/kernel/syscalls/mremap/mremap03.c | 5 +++++
testcases/kernel/syscalls/mremap/mremap05.c | 4 +++-
testcases/kernel/syscalls/munlock/munlock01.c | 13 +++----------
testcases/kernel/syscalls/munlock/munlock02.c | 1 +
16 files changed, 70 insertions(+), 35 deletions(-)
--
2.43.0
Hi All,
The Morello LTP 1.8.0 integration drop is now available [1]
Main changes:
------------
- Merged upstream LTP 20230929 release
(see [2] for details)
- Number of small fixes aligning LTP testcases with capabilities and PCuABI
- Added support for capabilities to bpf testcases
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.7.0..
13 Kevin Brodsky <kevin.brodsky(a)arm.com>
5 Zachary Leaf <zachary.leaf(a)arm.com>
2 Teo Couprie Diaz <teo.coupriediaz(a)arm.com>
---
[1] https://git.morello-project.org/morello/morello-linux-ltp/-/tags/morello-re…
[2] https://github.com/linux-test-project/ltp/releases/tag/20230929
In order to avoid name collisions with current (and potentially future)
upstream changes, rename the epoll_wait05 test. The naming is definitely
far from being perfect but t leaves a lot of space for introducing new
tests without generating conflicts. Besides, there does not seem to be
any other established way of doing that with no clear guidelines on how
to specify test descriptor in such cases (even when considering tests
sub-grouping). So there it is ...
Signed-off-by: Beata Michalska <beata.michalska(a)arm.com>
---
runtest/morello_transitional_extended | 2 +-
runtest/syscalls | 2 +-
testcases/kernel/syscalls/epoll_wait/.gitignore | 2 +-
.../syscalls/epoll_wait/{epoll_wait05.c => epoll_wait99.c} | 0
4 files changed, 3 insertions(+), 3 deletions(-)
rename testcases/kernel/syscalls/epoll_wait/{epoll_wait05.c => epoll_wait99.c} (100%)
diff --git a/runtest/morello_transitional_extended b/runtest/morello_transitional_extended
index b145d4672..44641a33e 100644
--- a/runtest/morello_transitional_extended
+++ b/runtest/morello_transitional_extended
@@ -33,7 +33,7 @@ epoll_wait01 epoll_wait01
epoll_wait02 epoll_wait02
epoll_wait03 epoll_wait03
epoll_wait04 epoll_wait04
-epoll_wait05 epoll_wait05
+epoll_wait99 epoll_wait99
epoll_pwait01 epoll_pwait01
epoll_pwait02 epoll_pwait02
epoll_pwait03 epoll_pwait03
diff --git a/runtest/syscalls b/runtest/syscalls
index 921afe312..abb98b3d2 100644
--- a/runtest/syscalls
+++ b/runtest/syscalls
@@ -175,7 +175,7 @@ epoll_wait01 epoll_wait01
epoll_wait02 epoll_wait02
epoll_wait03 epoll_wait03
epoll_wait04 epoll_wait04
-epoll_wait05 epoll_wait05
+epoll_wait99 epoll_wait99
epoll_pwait01 epoll_pwait01
epoll_pwait02 epoll_pwait02
epoll_pwait03 epoll_pwait03
diff --git a/testcases/kernel/syscalls/epoll_wait/.gitignore b/testcases/kernel/syscalls/epoll_wait/.gitignore
index ab5a9c010..84387a306 100644
--- a/testcases/kernel/syscalls/epoll_wait/.gitignore
+++ b/testcases/kernel/syscalls/epoll_wait/.gitignore
@@ -2,4 +2,4 @@ epoll_wait01
epoll_wait02
epoll_wait03
epoll_wait04
-epoll_wait05
+epoll_wait99
diff --git a/testcases/kernel/syscalls/epoll_wait/epoll_wait05.c b/testcases/kernel/syscalls/epoll_wait/epoll_wait99.c
similarity index 100%
rename from testcases/kernel/syscalls/epoll_wait/epoll_wait05.c
rename to testcases/kernel/syscalls/epoll_wait/epoll_wait99.c
--
2.25.1
Tests which currently use the vDSO find it using getauxval(). However, in
purecap, the pointer to the vDSO in the auxiliary vector is a capability and
therefore cannot be returned as an unsigned long. Replace getauxval() with
getauxptr() when building for purecap to solve this issue.
This patch replicates changes made to the Morello kernel vDSO selftests to
enable testing in purecap. See Morello/Linux/Kernel: ("Add support for purecap
vDSO testing").
Signed-off-by: Aditya Deshpande <aditya.deshpande(a)arm.com>
---
include/parse_vdso.h | 20 ++++++++++++++++++++
libs/libltpvdso/vdso_helpers.c | 4 ++--
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/include/parse_vdso.h b/include/parse_vdso.h
index 5212fc659..643c773da 100644
--- a/include/parse_vdso.h
+++ b/include/parse_vdso.h
@@ -9,6 +9,10 @@
#include <stdint.h>
+#ifdef HAVE_GETAUXVAL
+# include <sys/auxv.h>
+#endif /* HAVE_GETAUXVAL */
+
/*
* To use this vDSO parser, first call one of the vdso_init_* functions.
* If you've already parsed auxv, then pass the value of AT_SYSINFO_EHDR
@@ -38,4 +42,20 @@ extern void *vdso_sym(const char *version, const char *name);
typedef int (*gettime_t)(clockid_t clk_id, void *ts);
void find_clock_gettime_vdso(gettime_t *ptr_vdso_gettime,
gettime_t *ptr_vdso_gettime64);
+
+/*
+ * Under PCuABI, pointers in the auxiliary vector can no longer be represented
+ * as unsigned long as they are now capabilities. Get the capability to the
+ * vDSO using getauxptr() instead, which returns a a capability instead of
+ * unsigned long.
+ */
+static inline uintptr_t get_sysinfo_ehdr()
+{
+#ifdef __CHERI_PURE_CAPABILITY__
+ return (uintptr_t)getauxptr(AT_SYSINFO_EHDR);
+#else
+ return getauxval(AT_SYSINFO_EHDR);
+#endif
+}
+
#endif /* PARSE_VDSO_H__ */
diff --git a/libs/libltpvdso/vdso_helpers.c b/libs/libltpvdso/vdso_helpers.c
index 208c12f65..cb5e01687 100644
--- a/libs/libltpvdso/vdso_helpers.c
+++ b/libs/libltpvdso/vdso_helpers.c
@@ -14,7 +14,7 @@
# include <sys/auxv.h>
#endif /* HAVE_GETAUXVAL */
-static unsigned long sysinfo_ehdr;
+static uintptr_t sysinfo_ehdr;
static void vdso_init(void)
{
@@ -22,7 +22,7 @@ static void vdso_init(void)
if (sysinfo_ehdr)
return;
- sysinfo_ehdr = getauxval(AT_SYSINFO_EHDR);
+ sysinfo_ehdr = get_sysinfo_ehdr();
if (!sysinfo_ehdr) {
tst_res(TINFO, "Couldn't find AT_SYSINFO_EHDR");
return;
--
2.25.1
Tests which currently use the vDSO find it using getauxval(). However, in
purecap, the pointer to the vDSO in the auxiliary vector is a capability and
therefore cannot be returned as an unsigned long. Replace getauxval() with
getauxptr() when building for purecap to solve this issue.
This patch replicates changes made to the Morello kernel vDSO selftests to
enable testing in purecap. See Morello/Linux/Kernel: ad001738e9c8
("Add support for purecap vDSO testing").
Signed-off-by: Aditya Deshpande <aditya.deshpande(a)arm.com>
---
include/parse_vdso.h | 28 ++++++++++++++++++++++++++++
libs/libltpvdso/vdso_helpers.c | 4 ++--
2 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/include/parse_vdso.h b/include/parse_vdso.h
index 5212fc659..43c865cc1 100644
--- a/include/parse_vdso.h
+++ b/include/parse_vdso.h
@@ -9,6 +9,10 @@
#include <stdint.h>
+#ifdef HAVE_GETAUXVAL
+# include <sys/auxv.h>
+#endif /* HAVE_GETAUXVAL */
+
/*
* To use this vDSO parser, first call one of the vdso_init_* functions.
* If you've already parsed auxv, then pass the value of AT_SYSINFO_EHDR
@@ -38,4 +42,28 @@ extern void *vdso_sym(const char *version, const char *name);
typedef int (*gettime_t)(clockid_t clk_id, void *ts);
void find_clock_gettime_vdso(gettime_t *ptr_vdso_gettime,
gettime_t *ptr_vdso_gettime64);
+
+/*
+ * Define uintptr_t as a capability in purecap.
+ * When not in purecap, uintptr_t will default to unsigned long.
+ */
+#ifdef __CHERI_PURE_CAPABILITY__
+typedef __uintcap_t uintptr_t;
+#endif
+
+/*
+ * Under PCuABI, pointers in the auxiliary vector can no longer be represented
+ * as unsigned long as they are now capabilities. Get the capability to the
+ * vDSO using getauxptr() instead, which returns a a capability instead of
+ * unsigned long.
+ */
+static inline uintptr_t get_sysinfo_ehdr()
+{
+#ifdef __CHERI_PURE_CAPABILITY__
+ return getauxptr(AT_SYSINFO_EHDR);
+#else
+ return (uintptr_t)getauxval(AT_SYSINFO_EHDR);
+#endif
+}
+
#endif /* PARSE_VDSO_H__ */
diff --git a/libs/libltpvdso/vdso_helpers.c b/libs/libltpvdso/vdso_helpers.c
index 208c12f65..cb5e01687 100644
--- a/libs/libltpvdso/vdso_helpers.c
+++ b/libs/libltpvdso/vdso_helpers.c
@@ -14,7 +14,7 @@
# include <sys/auxv.h>
#endif /* HAVE_GETAUXVAL */
-static unsigned long sysinfo_ehdr;
+static uintptr_t sysinfo_ehdr;
static void vdso_init(void)
{
@@ -22,7 +22,7 @@ static void vdso_init(void)
if (sysinfo_ehdr)
return;
- sysinfo_ehdr = getauxval(AT_SYSINFO_EHDR);
+ sysinfo_ehdr = get_sysinfo_ehdr();
if (!sysinfo_ehdr) {
tst_res(TINFO, "Couldn't find AT_SYSINFO_EHDR");
return;
--
2.25.1