[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 11/14] target/arm: Implement gdbstub pauth extension
From: |
Peter Maydell |
Subject: |
Re: [PATCH 11/14] target/arm: Implement gdbstub pauth extension |
Date: |
Mon, 20 Feb 2023 16:58:26 +0000 |
On Tue, 14 Feb 2023 at 16:32, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> The extension is primarily defined by the Linux kernel NT_ARM_PAC_MASK
> ptrace register set.
>
> The original gdb feature consists of two masks, data and code, which are
> used to mask out the authentication code within a pointer. Following
> discussion with Luis Machado, add two more masks in order to support
> pointers within the high half of the address space (i.e. TTBR1 vs TTBR0).
>
> +int aarch64_gdb_get_pauth_reg(CPUARMState *env, GByteArray *buf, int reg)
> +{
> + switch (reg) {
> + case 0: /* pauth_dmask */
> + case 1: /* pauth_cmask */
> + case 2: /* pauth_dmask_high */
> + case 3: /* pauth_cmask_high */
> + /*
> + * Note that older versions of this feature only contained
> + * pauth_{d,c}mask, for use with Linux user processes, and
> + * thus exclusively in the low half of the address space.
> + *
> + * To support system mode, and to debug kernels, two new regs
> + * were added to cover the high half of the address space.
> + * For the purpose of pauth_ptr_mask, we can use any well-formed
> + * address within the address space half -- here, 0 and -2.
> + */
> + return gdb_get_reg64(buf, pauth_ptr_mask(env, -(reg & 2), ~reg & 1));
This seems pretty confusing to me. Is there a clearer way
we could write this? Pulling out a
bool is_data = !(reg & 1);
would help, for instance.
> + default:
> + return 0;
> + }
thanks
-- PMM
- [PATCH 10/14] target/arm: Create pauth_ptr_mask, (continued)
- [PATCH 10/14] target/arm: Create pauth_ptr_mask, Richard Henderson, 2023/02/14
- [PATCH 03/14] target/arm: Move arm_gen_dynamic_svereg_xml to gdbstub64.c, Richard Henderson, 2023/02/14
- [PATCH 05/14] target/arm: Simplify register counting in arm_gen_dynamic_svereg_xml, Richard Henderson, 2023/02/14
- [PATCH 06/14] target/arm: Hoist pred_width in arm_gen_dynamic_svereg_xml, Richard Henderson, 2023/02/14
- [PATCH 11/14] target/arm: Implement gdbstub pauth extension, Richard Henderson, 2023/02/14
- Re: [PATCH 11/14] target/arm: Implement gdbstub pauth extension,
Peter Maydell <=
- [PATCH 13/14] target/arm: Export arm_v7m_get_sp_ptr, Richard Henderson, 2023/02/14
- [PATCH 12/14] target/arm: Export arm_v7m_mrs_control, Richard Henderson, 2023/02/14
- [PATCH 08/14] target/arm: Add name argument to output_vector_union_type, Richard Henderson, 2023/02/14
- [PATCH 09/14] target/arm: Simplify iteration over bit widths, Richard Henderson, 2023/02/14
- [PATCH 14/14] target/arm: Support reading m-profile system registers from gdb, Richard Henderson, 2023/02/14