qemu-devel
[Top][All Lists]
Advanced

[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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]