• Dominik Dingel's avatar
    s390/mm: prevent and break zero page mappings in case of storage keys · 2faee8ff
    Dominik Dingel authored
    As soon as storage keys are enabled we need to stop working on zero page
    mappings to prevent inconsistencies between storage keys and pgste.
    
    Otherwise following data corruption could happen:
    1) guest enables storage key
    2) guest sets storage key for not mapped page X
       -> change goes to PGSTE
    3) guest reads from page X
       -> as X was not dirty before, the page will be zero page backed,
          storage key from PGSTE for X will go to storage key for zero page
    4) guest sets storage key for not mapped page Y (same logic as above
    5) guest reads from page Y
       -> as Y was not dirty before, the page will be zero page backed,
          storage key from PGSTE for Y will got to storage key for zero page
          overwriting storage key for X
    
    While holding the mmap sem, we are safe against changes on entries we
    already fixed, as every fault would need to take the mmap_sem (read).
    
    Other vCPUs executing storage key instructions will get a one time interception
    and be serialized also with mmap_sem.
    Signed-off-by: default avatarDominik Dingel <dingel@linux.vnet.ibm.com>
    Reviewed-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
    2faee8ff
pgtable.h 51.4 KB