[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20220427224439.23828-3-dossche.niels@gmail.com>
Date: Thu, 28 Apr 2022 00:44:39 +0200
From: Niels Dossche <dossche.niels@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Mina Almasry <almasrymina@...gle.com>,
Niels Dossche <dossche.niels@...il.com>
Subject: [PATCH 2/2] selftest/vm: test that mremap fails on non-existent vma
Add a regression test that validates that mremap fails for vma's that
don't exist.
Signed-off-by: Niels Dossche <dossche.niels@...il.com>
---
tools/testing/selftests/vm/hugepage-mremap.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tools/testing/selftests/vm/hugepage-mremap.c b/tools/testing/selftests/vm/hugepage-mremap.c
index 1d689084a54b..585978f181ed 100644
--- a/tools/testing/selftests/vm/hugepage-mremap.c
+++ b/tools/testing/selftests/vm/hugepage-mremap.c
@@ -178,6 +178,12 @@ int main(int argc, char *argv[])
munmap(addr, length);
+ addr = mremap(addr, length, length, 0);
+ if (addr != MAP_FAILED) {
+ printf("mremap: Expected failure, but call succeeded\n");
+ exit(1);
+ }
+
close(fd);
unlink(argv[argc-1]);
--
2.35.2
Powered by blists - more mailing lists