aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndrew Turner <andrew@FreeBSD.org>2021-08-30 16:43:22 +0000
committerAndrew Turner <andrew@FreeBSD.org>2022-02-22 17:10:35 +0000
commit6713be3159000783f7aacf3ea90d6c6878c44da0 (patch)
tree1a0d3621c5aec85f5af349f8ebdab5a0c4ca2868 /tests
parentd5c0a7b6d3923d2a6967810d0aa3e148a39351c1 (diff)
downloadsrc-6713be3159000783f7aacf3ea90d6c6878c44da0.tar.gz
src-6713be3159000783f7aacf3ea90d6c6878c44da0.zip
Add NT_ARM_ADDR_MASK
This can be used by debuggers to find which bits in a virtual address should be masked off to get a canonical address. This is currently used by the Pointer Authentication Code support to get its mask. It could also be used if we support Top Byte Ignore for the same purpose. Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D34302
Diffstat (limited to 'tests')
-rw-r--r--tests/sys/kern/ptrace_test.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/sys/kern/ptrace_test.c b/tests/sys/kern/ptrace_test.c
index 3e3a445c6152..c62db66fd6f6 100644
--- a/tests/sys/kern/ptrace_test.c
+++ b/tests/sys/kern/ptrace_test.c
@@ -3204,6 +3204,9 @@ ATF_TC_BODY(ptrace__PT_CONTINUE_with_signal_thread_sigmask, tc)
ATF_TC_WITHOUT_HEAD(ptrace__PT_REGSET);
ATF_TC_BODY(ptrace__PT_REGSET, tc)
{
+#if defined(__aarch64__)
+ struct arm64_addr_mask addr_mask;
+#endif
struct prstatus prstatus;
struct iovec vec;
pid_t child, wpid;
@@ -3242,6 +3245,16 @@ ATF_TC_BODY(ptrace__PT_REGSET, tc)
ATF_REQUIRE(ptrace(PT_SETREGSET, wpid, (caddr_t)&vec, NT_PRSTATUS) !=
-1);
+#if defined(__aarch64__)
+ vec.iov_base = &addr_mask;
+ vec.iov_len = sizeof(addr_mask);
+ ATF_REQUIRE(ptrace(PT_GETREGSET, wpid, (caddr_t)&vec,
+ NT_ARM_ADDR_MASK) != -1);
+ REQUIRE_EQ(addr_mask.code, addr_mask.data);
+ ATF_REQUIRE(addr_mask.code == 0 ||
+ addr_mask.code == 0xff7f000000000000UL);
+#endif
+
REQUIRE_EQ(ptrace(PT_CONTINUE, child, (caddr_t)1, 0), 0);
/* The second wait() should report the exit status. */