• Ard Biesheuvel's avatar
    arm64: idreg-override: Prepare for place relative reloc patching · 01fd2909
    Ard Biesheuvel authored
    The ID reg override handling code uses a rather elaborate data structure
    that relies on statically initialized absolute address values in pointer
    fields. This means that this code cannot run until relocation fixups
    have been applied, and this is unfortunate, because it means we cannot
    discover overrides for KASLR or LVA/LPA without creating the kernel
    mapping and performing the relocations first.
    
    This can be solved by switching to place-relative relocations, which can
    be applied by the linker at build time. This means some additional
    arithmetic is required when dereferencing these pointers, as we can no
    longer dereference the pointer members directly.
    
    So let's implement this for idreg-override.c in a preliminary way, i.e.,
    convert all the references in code to use a special accessor that
    produces the correct absolute value at runtime.
    Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
    Link: https://lore.kernel.org/r/20231129111555.3594833-58-ardb@google.comSigned-off-by: default avatarWill Deacon <will@kernel.org>
    01fd2909
idreg-override.c 8.22 KB