diff options
author | Niels Dossche <dossche.niels@gmail.com> | 2022-05-10 03:20:54 +0200 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2022-05-13 16:20:07 +0200 |
commit | 9994715333515e82865e533250e488496b9742f4 (patch) | |
tree | 38b45b57280fd42ac9af21e6d11178a4a7c46bd0 | |
parent | mm/rmap: Fix typos in comments (diff) | |
download | linux-9994715333515e82865e533250e488496b9742f4.tar.xz linux-9994715333515e82865e533250e488496b9742f4.zip |
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.
Link: https://lkml.kernel.org/r/20220427224439.23828-3-dossche.niels@gmail.com
Signed-off-by: Niels Dossche <dossche.niels@gmail.com>
Cc: Mina Almasry <almasrymina@google.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r-- | tools/testing/selftests/vm/hugepage-mremap.c | 6 |
1 files changed, 6 insertions, 0 deletions
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]); |