From: Niels Dossche <dossche.niels@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Mina Almasry <almasrymina@google.com>,
Niels Dossche <dossche.niels@gmail.com>
Subject: [PATCH 2/2] selftest/vm: test that mremap fails on non-existent vma
Date: Thu, 28 Apr 2022 00:44:39 +0200 [thread overview]
Message-ID: <20220427224439.23828-3-dossche.niels@gmail.com> (raw)
In-Reply-To: <20220427224439.23828-1-dossche.niels@gmail.com>
Add a regression test that validates that mremap fails for vma's that
don't exist.
Signed-off-by: Niels Dossche <dossche.niels@gmail.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
prev parent reply other threads:[~2022-04-27 22:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-27 22:44 [PATCH 0/2] mm: mremap: fix sign for EFAULT error return value Niels Dossche
2022-04-27 22:44 ` [PATCH 1/2] " Niels Dossche
2022-04-27 22:44 ` Niels Dossche [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220427224439.23828-3-dossche.niels@gmail.com \
--to=dossche.niels@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=almasrymina@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).