A mapping that has just been created at a new location by mmap() cannot generally be expanded in PCuABI, because it cannot exceed the bounds of its underlying reservation. To allow this test to pass in PCuABI, pass MREMAP_MAYMOVE to mremap().
Signed-off-by: Kevin Brodsky kevin.brodsky@arm.com --- testcases/kernel/syscalls/mmap/mmap16.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/testcases/kernel/syscalls/mmap/mmap16.c b/testcases/kernel/syscalls/mmap/mmap16.c index 64fb02fa4034..275f6461554b 100644 --- a/testcases/kernel/syscalls/mmap/mmap16.c +++ b/testcases/kernel/syscalls/mmap/mmap16.c @@ -43,6 +43,12 @@ static int parentfd = -1; static int childfd = -1;
+#ifdef __CHERI_PURE_CAPABILITY__ +#define MREMAP_FLAGS MREMAP_MAYMOVE +#else +#define MREMAP_FLAGS 0 +#endif + static void do_child(void) { int offset; @@ -74,7 +80,7 @@ static void do_child(void)
SAFE_FTRUNCATE(childfd, page_size * 2);
- addr = mremap(addr, FS_BLOCKSIZE, 2 * page_size, 0); + addr = mremap(addr, FS_BLOCKSIZE, 2 * page_size, MREMAP_FLAGS); if (addr == MAP_FAILED) tst_brk(TBROK | TERRNO, "mremap failed unexpectedly");