aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/arm64/pauth/pac_corruptor.S
diff options
context:
space:
mode:
Diffstat (limited to 'tools/testing/selftests/arm64/pauth/pac_corruptor.S')
-rw-r--r--tools/testing/selftests/arm64/pauth/pac_corruptor.S19
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/testing/selftests/arm64/pauth/pac_corruptor.S b/tools/testing/selftests/arm64/pauth/pac_corruptor.S
new file mode 100644
index 000000000000..aa6588050752
--- /dev/null
+++ b/tools/testing/selftests/arm64/pauth/pac_corruptor.S
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/* Copyright (C) 2020 ARM Limited */
+
+.global pac_corruptor
+
+.text
+/*
+ * Corrupting a single bit of the PAC ensures the authentication will fail. It
+ * also guarantees no possible collision. TCR_EL1.TBI0 is set by default so no
+ * top byte PAC is tested
+ */
+ pac_corruptor:
+ paciasp
+
+ /* corrupt the top bit of the PAC */
+ eor lr, lr, #1 << 53
+
+ autiasp
+ ret