All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joey Gouly <joey.gouly@arm.com>
To: <linux-arm-kernel@lists.infradead.org>
Cc: <broonie@kernel.org>, <nd@arm.com>, <catalin.marinas@arm.com>,
	<joey.gouly@arm.com>, <will@kernel.org>
Subject: [PATCH v1 2/7] kselftest/arm64: mte: user_mem: add tests using tag_offset
Date: Tue, 25 Jan 2022 15:09:15 +0000	[thread overview]
Message-ID: <20220125150920.23955-3-joey.gouly@arm.com> (raw)
In-Reply-To: <20220125150920.23955-1-joey.gouly@arm.com>

Add some tests that place the different tag at MT_GRANULE_SIZE to check
that less than a full page can also be read.

Signed-off-by: Joey Gouly <joey.gouly@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
---
 .../selftests/arm64/mte/check_user_mem.c      | 38 ++++++++++++-------
 1 file changed, 25 insertions(+), 13 deletions(-)

diff --git a/tools/testing/selftests/arm64/mte/check_user_mem.c b/tools/testing/selftests/arm64/mte/check_user_mem.c
index 3ad9d85ca9b7..d33b262ccdb0 100644
--- a/tools/testing/selftests/arm64/mte/check_user_mem.c
+++ b/tools/testing/selftests/arm64/mte/check_user_mem.c
@@ -84,8 +84,10 @@ static int check_usermem_access_fault_helper(int mem_type, int mode, int mapping
 	return err;
 }
 
-static int check_usermem_access_fault(int mem_type, int mode, int mapping) {
-	return check_usermem_access_fault_helper(mem_type, mode, mapping, page_sz, 0);
+static int check_usermem_access_fault(int mem_type, int mode, int mapping,
+                                      int tag_offset) {
+	return check_usermem_access_fault_helper(mem_type, mode, mapping,
+	                                         tag_offset, 0);
 }
 
 int main(int argc, char *argv[])
@@ -105,17 +107,27 @@ int main(int argc, char *argv[])
 	mte_register_signal(SIGSEGV, mte_default_handler);
 
 	/* Set test plan */
-	ksft_set_plan(4);
-
-	evaluate_test(check_usermem_access_fault(USE_MMAP, MTE_SYNC_ERR, MAP_PRIVATE),
-		"Check memory access from kernel in sync mode, private mapping and mmap memory\n");
-	evaluate_test(check_usermem_access_fault(USE_MMAP, MTE_SYNC_ERR, MAP_SHARED),
-		"Check memory access from kernel in sync mode, shared mapping and mmap memory\n");
-
-	evaluate_test(check_usermem_access_fault(USE_MMAP, MTE_ASYNC_ERR, MAP_PRIVATE),
-		"Check memory access from kernel in async mode, private mapping and mmap memory\n");
-	evaluate_test(check_usermem_access_fault(USE_MMAP, MTE_ASYNC_ERR, MAP_SHARED),
-		"Check memory access from kernel in async mode, shared mapping and mmap memory\n");
+	ksft_set_plan(8);
+
+	evaluate_test(check_usermem_access_fault(USE_MMAP, MTE_SYNC_ERR, MAP_PRIVATE, page_sz),
+		"Check memory access from kernel in sync mode, private mapping and mmap memory (tag_offset: page_sz)\n");
+	evaluate_test(check_usermem_access_fault(USE_MMAP, MTE_SYNC_ERR, MAP_SHARED, page_sz),
+		"Check memory access from kernel in sync mode, shared mapping and mmap memory (tag_offset: page_sz)\n");
+
+	evaluate_test(check_usermem_access_fault(USE_MMAP, MTE_ASYNC_ERR, MAP_PRIVATE, page_sz),
+		"Check memory access from kernel in async mode, private mapping and mmap memory (tag_offset: page_sz)\n");
+	evaluate_test(check_usermem_access_fault(USE_MMAP, MTE_ASYNC_ERR, MAP_SHARED, page_sz),
+		"Check memory access from kernel in async mode, shared mapping and mmap memory (tag_offset: page_sz)\n");
+
+	evaluate_test(check_usermem_access_fault(USE_MMAP, MTE_SYNC_ERR, MAP_PRIVATE, MT_GRANULE_SIZE),
+		"Check memory access from kernel in sync mode, private mapping and mmap memory (tag_offset: MT_GRANULE_SIZE)\n");
+	evaluate_test(check_usermem_access_fault(USE_MMAP, MTE_SYNC_ERR, MAP_SHARED, MT_GRANULE_SIZE),
+		"Check memory access from kernel in sync mode, shared mapping and mmap memory (tag_offset: MT_GRANULE_SIZE)\n");
+
+	evaluate_test(check_usermem_access_fault(USE_MMAP, MTE_ASYNC_ERR, MAP_PRIVATE, MT_GRANULE_SIZE),
+		"Check memory access from kernel in async mode, private mapping and mmap memory (tag_offset: MT_GRANULE_SIZE)\n");
+	evaluate_test(check_usermem_access_fault(USE_MMAP, MTE_ASYNC_ERR, MAP_SHARED, MT_GRANULE_SIZE),
+		"Check memory access from kernel in async mode, shared mapping and mmap memory (tag_offset: MT_GRANULE_SIZE)\n");
 
 	mte_restore_setup();
 	ksft_print_cnts();
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2022-01-25 15:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-25 15:09 [PATCH v1 0/7] add more tests to MTE kselftests Joey Gouly
2022-01-25 15:09 ` [PATCH v1 1/7] kselftest/arm64: mte: user_mem: introduce tag_offset and tag_len Joey Gouly
2022-01-25 15:09 ` Joey Gouly [this message]
2022-01-25 15:09 ` [PATCH v1 3/7] kselftest/arm64: mte: user_mem: add test with mte tag inside a page Joey Gouly
2022-01-25 15:09 ` [PATCH v1 4/7] kselftest/arm64: mte: user_mem: rework error handling Joey Gouly
2022-01-25 15:09 ` [PATCH v1 5/7] kselftest/arm64: mte: user_mem: check different offsets and sizes Joey Gouly
2022-01-25 16:33   ` Mark Brown
2022-01-26 12:27     ` Joey Gouly
2022-01-25 15:09 ` [PATCH v1 6/7] kselftest/arm64: mte: add test type enum Joey Gouly
2022-01-26 16:33   ` Mark Brown
2022-01-25 15:09 ` [PATCH v1 7/7] kselftest/arm64: mte: add more test types Joey Gouly

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=20220125150920.23955-3-joey.gouly@arm.com \
    --to=joey.gouly@arm.com \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=nd@arm.com \
    --cc=will@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.