• Vlastimil Babka's avatar
    x86/speculation/l1tf: Protect PAE swap entries against L1TF · a7554af7
    Vlastimil Babka authored
    The PAE 3-level paging code currently doesn't mitigate L1TF by flipping the
    offset bits, and uses the high PTE word, thus bits 32-36 for type, 37-63 for
    offset. The lower word is zeroed, thus systems with less than 4GB memory are
    safe. With 4GB to 128GB the swap type selects the memory locations vulnerable
    to L1TF; with even more memory, also the swap offfset influences the address.
    This might be a problem with 32bit PAE guests running on large 64bit hosts.
    
    By continuing to keep the whole swap entry in either high or low 32bit word of
    PTE we would limit the swap size too much. Thus this patch uses the whole PAE
    PTE with the same layout as the 64bit version does. The macros just become a
    bit tricky since they assume the arch-dependent swp_entry_t to be 32bit.
    Signed-off-by: default avatarVlastimil Babka <vbabka@suse.cz>
    Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
    Acked-by: default avatarMichal Hocko <mhocko@suse.com>
    
    CVE-2018-3620
    CVE-2018-3646
    
    [smb: Minor context adjustments]
    Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
    a7554af7
init.c 22.6 KB