A null pointer is not a valid capability in PCuABI, so the syscalls will fail early with -EINVAL.
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/mprotect/mprotect01.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/testcases/kernel/syscalls/mprotect/mprotect01.c b/testcases/kernel/syscalls/mprotect/mprotect01.c index 354b078b903f..35941cc3702c 100644 --- a/testcases/kernel/syscalls/mprotect/mprotect01.c +++ b/testcases/kernel/syscalls/mprotect/mprotect01.c @@ -55,6 +55,7 @@ struct test_case { int prot; int error; void (*setupfunc) (struct test_case *self); + int alt_error; };
static void cleanup(void); @@ -105,7 +106,7 @@ int main(int ac, char **av) continue; }
- if (TEST_ERRNO == TC[i].error) { + if (TEST_ERRNO == TC[i].error || TEST_ERRNO == TC[i].alt_error) { tst_resm(TPASS, "expected failure - " "errno = %d : %s", TEST_ERRNO, strerror(TEST_ERRNO)); @@ -157,6 +158,10 @@ static void setup(void) { tst_sig(FORK, DEF_HANDLER, cleanup);
+#ifdef __CHERI_PURE_CAPABILITY__ + TC[0].alt_error = EINVAL; +#endif + TEST_PAUSE; }