• Claudio Imbrenda's avatar
    KVM: s390: pv: leak the topmost page table when destroy fails · faa2f72c
    Claudio Imbrenda authored
    Each secure guest must have a unique ASCE (address space control
    element); we must avoid that new guests use the same page for their
    ASCE, to avoid errors.
    
    Since the ASCE mostly consists of the address of the topmost page table
    (plus some flags), we must not return that memory to the pool unless
    the ASCE is no longer in use.
    
    Only a successful Destroy Secure Configuration UVC will make the ASCE
    reusable again.
    
    If the Destroy Configuration UVC fails, the ASCE cannot be reused for a
    secure guest (either for the ASCE or for other memory areas). To avoid
    a collision, it must not be used again. This is a permanent error and
    the page becomes in practice unusable, so we set it aside and leak it.
    On failure we already leak other memory that belongs to the ultravisor
    (i.e. the variable and base storage for a guest) and not leaking the
    topmost page table was an oversight.
    
    This error (and thus the leakage) should not happen unless the hardware
    is broken or KVM has some unknown serious bug.
    Signed-off-by: default avatarClaudio Imbrenda <imbrenda@linux.ibm.com>
    Fixes: 29b40f10 ("KVM: s390: protvirt: Add initial vm and cpu lifecycle handling")
    Reviewed-by: default avatarJanosch Frank <frankja@linux.ibm.com>
    Link: https://lore.kernel.org/r/20220628135619.32410-2-imbrenda@linux.ibm.com
    Message-Id: <20220628135619.32410-2-imbrenda@linux.ibm.com>
    Signed-off-by: default avatarJanosch Frank <frankja@linux.ibm.com>
    faa2f72c
gmap.c 80.9 KB