On 17-07-2023 06:11, Chaitanya S Prakash wrote:
The mmap() system call is expected to fail with -EOPNOTSUPP when the MAP_GROWSDOWN flag is passed. A testcase to verify this behaviour has been added.
Signed-off-by: Chaitanya S Prakash chaitanyas.prakash@arm.com
tools/testing/selftests/arm64/morello/mmap.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
diff --git a/tools/testing/selftests/arm64/morello/mmap.c b/tools/testing/selftests/arm64/morello/mmap.c index 2dd4ccdb0d2a..00d4c5ea9703 100644 --- a/tools/testing/selftests/arm64/morello/mmap.c +++ b/tools/testing/selftests/arm64/morello/mmap.c @@ -117,6 +117,17 @@ void syscall_mmap2(void) close(fd); } +/* test to verify mmap() behaviour when MAP_GROWSDOWN flag is specified */ +static void purecap_map_growsdown(void)
These tests are under arm64/morello, so they're expected to be purecap. No need to add "purecap" in the function names.
Tudor
+{
- void *addr;
- int prot = PROT_READ | PROT_WRITE;
- int flags = MAP_PRIVATE | MAP_ANONYMOUS | MAP_GROWSDOWN;
- addr = mmap(NULL, MMAP_SIZE, prot, flags, -1, 0);
- ASSERT_EQ((unsigned long)addr, (unsigned long)-EOPNOTSUPP);
+}
- TEST(test_syscall_mmap) { syscall_mmap();
@@ -127,9 +138,15 @@ TEST(test_syscall_mmap2) syscall_mmap2(); } +TEST(test_purecap_map_growsdown) +{
- purecap_map_growsdown();
+}
- int main(void) { test_syscall_mmap(); test_syscall_mmap2();
- test_purecap_map_growsdown(); return 0; }