• Mark Rutland's avatar
    arm64: mm: add code to safely replace TTBR1_EL1 · 50e1881d
    Mark Rutland authored
    
    
    If page tables are modified without suitable TLB maintenance, the ARM
    architecture permits multiple TLB entries to be allocated for the same
    VA. When this occurs, it is permitted that TLB conflict aborts are
    raised in response to synchronous data/instruction accesses, and/or and
    amalgamation of the TLB entries may be used as a result of a TLB lookup.
    
    The presence of conflicting TLB entries may result in a variety of
    behaviours detrimental to the system (e.g. erroneous physical addresses
    may be used by I-cache fetches and/or page table walks). Some of these
    cases may result in unexpected changes of hardware state, and/or result
    in the (asynchronous) delivery of SError.
    
    To avoid these issues, we must avoid situations where conflicting
    entries may be allocated into TLBs. For user and module mappings we can
    follow a strict break-before-make approach, but this cannot work for
    modifications to the swapper page tables that cover the kernel text and
    data.
    
    Instead, this patch adds code which is intended to be executed from the
    idmap, which can safely unmap the swapper page tables as it only
    requires the idmap to be active. This enables us to uninstall the active
    TTBR1_EL1 entry, invalidate TLBs, then install a new TTBR1_EL1 entry
    without potentially unmapping code or data required for the sequence.
    This avoids the risk of conflict, but requires that updates are staged
    in a copy of the swapper page tables prior to being installed.
    Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
    Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
    Tested-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
    Reviewed-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
    Tested-by: default avatarJeremy Linton <jeremy.linton@arm.com>
    Cc: Laura Abbott <labbott@fedoraproject.org>
    Cc: Will Deacon <will.deacon@arm.com>
    Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
    50e1881d
proc.S 6.03 KB