aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tools/testing/selftests/arm64/mte/mte_helper.S
diff options
context:
space:
mode:
authorAmit Daniel Kachhap <amit.kachhap@arm.com>2020-10-02 17:26:30 +0530
committerWill Deacon <will@kernel.org>2020-10-05 18:52:17 +0100
commit4dafc08d0ba4768e8540f49ab40c3ea26e40d554 (patch)
treeabd3c2e5031537bd67107a13d31e129546a39fab /tools/testing/selftests/arm64/mte/mte_helper.S
parentkselftest/arm64: Verify KSM page merge for MTE pages (diff)
downloadwireguard-linux-4dafc08d0ba4768e8540f49ab40c3ea26e40d554.tar.xz
wireguard-linux-4dafc08d0ba4768e8540f49ab40c3ea26e40d554.zip
kselftest/arm64: Check mte tagged user address in kernel
Add a testcase to check that user address with valid/invalid mte tag works in kernel mode. This test verifies that the kernel API's __arch_copy_from_user/__arch_copy_to_user works by considering if the user pointer has valid/invalid allocation tags. In MTE sync mode, file memory read/write and other similar interfaces fails if a user memory with invalid tag is accessed in kernel. In async mode no such failure occurs. Signed-off-by: Amit Daniel Kachhap <amit.kachhap@arm.com> Tested-by: Catalin Marinas <catalin.marinas@arm.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Cc: Shuah Khan <shuah@kernel.org> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will@kernel.org> Link: https://lore.kernel.org/r/20201002115630.24683-7-amit.kachhap@arm.com Signed-off-by: Will Deacon <will@kernel.org>
Diffstat (limited to '')
-rw-r--r--tools/testing/selftests/arm64/mte/mte_helper.S14
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/testing/selftests/arm64/mte/mte_helper.S b/tools/testing/selftests/arm64/mte/mte_helper.S
index 48e049fbad9a..a02c04cd0aac 100644
--- a/tools/testing/selftests/arm64/mte/mte_helper.S
+++ b/tools/testing/selftests/arm64/mte/mte_helper.S
@@ -27,6 +27,20 @@ ENTRY(mte_insert_random_tag)
ENDPROC(mte_insert_random_tag)
/*
+ * mte_insert_new_tag: Insert new tag and different from the source tag if
+ * source pointer has it.
+ * Input:
+ * x0 - source pointer with a tag/no-tag
+ * Return:
+ * x0 - pointer with random tag
+ */
+ENTRY(mte_insert_new_tag)
+ gmi x1, x0, xzr
+ irg x0, x0, x1
+ ret
+ENDPROC(mte_insert_new_tag)
+
+/*
* mte_get_tag_address: Get the tag from given address.
* Input:
* x0 - source pointer