The prctl02 testcases represent the third argument as unsigned long. In purecap, this is not appropriate for operations that take a pointer, such as PR_SET_SECCOMP.
Changing the struct to represent the third argument as uintptr_t would be invasive, due to the pointer indirection. Instead, special-case PR_SET_SECCOMP and use uintptr_t to represent its argument.
Signed-off-by: Kevin Brodsky kevin.brodsky@arm.com --- testcases/kernel/syscalls/prctl/prctl02.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/testcases/kernel/syscalls/prctl/prctl02.c b/testcases/kernel/syscalls/prctl/prctl02.c index 1cd33f88ca55..d8b96a91fec7 100644 --- a/testcases/kernel/syscalls/prctl/prctl02.c +++ b/testcases/kernel/syscalls/prctl/prctl02.c @@ -67,9 +67,9 @@ static const struct sock_fprog strict = { .filter = (struct sock_filter *)strict_filter };
-static unsigned long strict_addr = (unsigned long)&strict; +static uintptr_t strict_addr = (uintptr_t)&strict; +static uintptr_t bad_addr;
-static unsigned long bad_addr; static unsigned long num_0; static unsigned long num_1 = 1; static unsigned long num_2 = 2; @@ -93,8 +93,8 @@ static struct tcase { {PR_SET_PDEATHSIG, &num_invalid, &num_0, EINVAL, "PR_SET_PDEATHSIG"}, {PR_SET_DUMPABLE, &num_2, &num_0, EINVAL, "PR_SET_DUMPABLE"}, {PR_SET_NAME, &bad_addr, &num_0, EFAULT, "PR_SET_NAME"}, - {PR_SET_SECCOMP, &num_2, &bad_addr, EFAULT, "PR_SET_SECCOMP"}, - {PR_SET_SECCOMP, &num_2, &strict_addr, EACCES, "PR_SET_SECCOMP"}, + {PR_SET_SECCOMP, &num_2, (unsigned long *)&bad_addr, EFAULT, "PR_SET_SECCOMP"}, + {PR_SET_SECCOMP, &num_2, (unsigned long *)&strict_addr, EACCES, "PR_SET_SECCOMP"}, {PR_SET_TIMING, &num_1, &num_0, EINVAL, "PR_SET_TIMING"}, {PR_SET_NO_NEW_PRIVS, &num_0, &num_0, EINVAL, "PR_SET_NO_NEW_PRIVS"}, {PR_SET_NO_NEW_PRIVS, &num_1, &num_1, EINVAL, "PR_SET_NO_NEW_PRIVS"}, @@ -152,7 +152,10 @@ static void verify_prctl(unsigned int n) break; }
- TEST(prctl(tc->option, *tc->arg2, *tc->arg3, 0, 0)); + if (tc->option == PR_SET_SECCOMP) + TEST(prctl(tc->option, *tc->arg2, *(uintptr_t *)tc->arg3, 0, 0)); + else + TEST(prctl(tc->option, *tc->arg2, *tc->arg3, 0, 0)); if (TST_RET == 0) { tst_res(TFAIL, "prctl() succeeded unexpectedly"); return; @@ -171,7 +174,7 @@ static void verify_prctl(unsigned int n)
static void setup(void) { - bad_addr = (unsigned long)tst_get_bad_addr(NULL); + bad_addr = (uintptr_t)tst_get_bad_addr(NULL);
TEST(prctl(PR_GET_SECCOMP)); if (TST_ERR == EINVAL)