[PATCH v4 13/20] arm64: reorganise PAGE_/PROT_ macros

Ard Biesheuvel ardb at kernel.org
Tue Aug 22 07:10:35 PDT 2023


On Tue, 6 Jun 2023 at 17:00, Joey Gouly <joey.gouly at arm.com> wrote:
>
> Make these macros available to assembly code, so they can be re-used by the
> PIE initialisation code.
>
> This involves adding some extra macros, prepended with _ that are the raw
> values not `pgprot` values.
>
> A dummy value for PTE_MAYBE_NG is also provided, for use in assembly.
>
...
> +
> +#ifdef __ASSEMBLY__
> +#define PTE_MAYBE_NG   0
> +#endif
> +

I am struggling a bit to understand why this is ok. I get that the PIE
index macros mask off the nG bit even if it is set, but this exposes a
definition of PROT_DEFAULT and everything based on it to asm code that
deviates from the one observed by C code.

I am running into this because I am adding PTE_MAYBE_SHARED for LPA2
support (which repurposes the shareability bits as output address
bits), and I could just #define it to 0x0 as well for assembly, but I
am not sure this is the right approach.



More information about the linux-arm-kernel mailing list