• Will Deacon's avatar
    KVM: arm64: Make hyp_panic() more robust when protected mode is enabled · ccac9697
    Will Deacon authored
    When protected mode is enabled, the host is unable to access most parts
    of the EL2 hypervisor image, including 'hyp_physvirt_offset' and the
    contents of the hypervisor's '.rodata.str' section. Unfortunately,
    nvhe_hyp_panic_handler() tries to read from both of these locations when
    handling a BUG() triggered at EL2; the former for converting the ELR to
    a physical address and the latter for displaying the name of the source
    file where the BUG() occurred.
    
    Hack the EL2 panic asm to pass both physical and virtual ELR values to
    the host and utilise the newly introduced CONFIG_NVHE_EL2_DEBUG so that
    we disable stage-2 protection for the host before returning to the EL1
    panic handler. If the debug option is not enabled, display the address
    instead of the source file:line information.
    
    Cc: Andrew Scull <ascull@google.com>
    Cc: Quentin Perret <qperret@google.com>
    Signed-off-by: default avatarWill Deacon <will@kernel.org>
    Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
    Link: https://lore.kernel.org/r/20210813130336.8139-1-will@kernel.org
    ccac9697
handle_exit.c 9.15 KB