[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e9cdb144-70c7-6596-2377-e675635c94e0@redhat.com>
Date: Mon, 7 Aug 2023 17:36:44 +0200
From: David Hildenbrand <david@...hat.com>
To: linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-mm@...ck.org, linux-fsdevel@...r.kernel.org,
kvm@...r.kernel.org, linux-kselftest@...r.kernel.org,
Linus Torvalds <torvalds@...ux-foundation.org>,
liubo <liubo254@...wei.com>, Peter Xu <peterx@...hat.com>,
Matthew Wilcox <willy@...radead.org>,
Hugh Dickins <hughd@...gle.com>,
Jason Gunthorpe <jgg@...pe.ca>,
John Hubbard <jhubbard@...dia.com>,
Mel Gorman <mgorman@...e.de>, Shuah Khan <shuah@...nel.org>,
Paolo Bonzini <pbonzini@...hat.com>
Subject: Re: [PATCH v3 7/7] selftest/mm: ksm_functional_tests: Add PROT_NONE
test
On 03.08.23 16:32, David Hildenbrand wrote:
> Let's test whether merging and unmerging in PROT_NONE areas works as
> expected.
>
> Pass a page protection to mmap_and_merge_range(), which will trigger
> an mprotect() after writing to the pages, but before enabling merging.
>
> Make sure that unsharing works as expected, by performing a ptrace write
> (using /proc/self/mem) and by setting MADV_UNMERGEABLE.
>
> Note that this implicitly tests that ptrace writes in an inaccessible
> (PROT_NONE) mapping work as expected.
>
> Signed-off-by: David Hildenbrand <david@...hat.com>
> ---
Andrew, can you squash the following?
From c2be7c02cb96b9189a52a5937821600ef4e259bd Mon Sep 17 00:00:00 2001
From: David Hildenbrand <david@...hat.com>
Date: Mon, 7 Aug 2023 17:33:54 +0200
Subject: [PATCH] Fixup: selftest/mm: ksm_functional_tests: Add PROT_NONE test
As noted by Peter, we should be using sizeof(i) in test_prot_none().
Signed-off-by: David Hildenbrand <david@...hat.com>
---
tools/testing/selftests/mm/ksm_functional_tests.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/mm/ksm_functional_tests.c b/tools/testing/selftests/mm/ksm_functional_tests.c
index 8fa4889ab4f3..901e950f9138 100644
--- a/tools/testing/selftests/mm/ksm_functional_tests.c
+++ b/tools/testing/selftests/mm/ksm_functional_tests.c
@@ -516,7 +516,7 @@ static void test_prot_none(void)
/* Store a unique value in each page on one half using ptrace */
for (i = 0; i < size / 2; i += pagesize) {
lseek(mem_fd, (uintptr_t) map + i, SEEK_SET);
- if (write(mem_fd, &i, sizeof(size)) != sizeof(size)) {
+ if (write(mem_fd, &i, sizeof(i)) != sizeof(i)) {
ksft_test_result_fail("ptrace write failed\n");
goto unmap;
}
--
2.41.0
--
Cheers,
David / dhildenb
Powered by blists - more mailing lists