mmap(ptr, ..., MAP_FIXED_NOREPLACE) is invalid in PCuABI, as passing an owning capability requires replacing existing mapping(s) fully, which is the opposite of what MAP_FIXED_NOREPLACE requests.
Expect EINVAL in PCuABI only, as it is probably inappropriate on other ABIs.
Signed-off-by: Kevin Brodsky kevin.brodsky@arm.com --- testcases/kernel/syscalls/mmap/mmap17.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/testcases/kernel/syscalls/mmap/mmap17.c b/testcases/kernel/syscalls/mmap/mmap17.c index 39703fbd397d..552b49f390b4 100644 --- a/testcases/kernel/syscalls/mmap/mmap17.c +++ b/testcases/kernel/syscalls/mmap/mmap17.c @@ -70,6 +70,10 @@ static void test_mmap(void) MAP_PRIVATE | MAP_FIXED_NOREPLACE, fd_file2, 0); if (address == MAP_FAILED && errno == EEXIST) tst_res(TPASS, "mmap set errno to EEXIST as expected"); +#ifdef __CHERI_PURE_CAPABILITY__ + else if (address == MAP_FAILED && errno == EINVAL) + tst_res(TPASS, "mmap set errno to EINVAL as expected"); +#endif else tst_res(TFAIL | TERRNO, "mmap failed, with unexpected error " "code, expected EEXIST");