lkml.org 
[lkml]   [2018]   [Mar]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[RFC, PATCH 16/22] x86/mm: Preserve KeyID on pte_modify() and pgprot_modify()
    Date
    Encrypted VMA would have KeyID stored in vma->vm_page_prot. This way we
    don't need to do anything special to setup encrypted page table entries
    and don't need to reserve space for KeyID in a VMA.

    This patch changes _PAGE_CHG_MASK to include KeyID bits. Otherwise they
    are going to be stripped from vm_page_prot on the first pgprot_modify().

    Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    ---
    arch/x86/include/asm/pgtable_types.h | 7 ++++++-
    1 file changed, 6 insertions(+), 1 deletion(-)

    diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h
    index 246f15b4e64c..800f66770163 100644
    --- a/arch/x86/include/asm/pgtable_types.h
    +++ b/arch/x86/include/asm/pgtable_types.h
    @@ -121,8 +121,13 @@
    * protection key is treated like _PAGE_RW, for
    * instance, and is *not* included in this mask since
    * pte_modify() does modify it.
    + *
    + * It includes full range of PFN bits regardless if they were claimed for KeyID
    + * or not: we want to preserve KeyID on pte_modify() and pgprot_modify().
    */
    -#define _PAGE_CHG_MASK (PTE_PFN_MASK | _PAGE_PCD | _PAGE_PWT | \
    +#define PTE_PFN_MASK_MAX \
    + (((signed long)PAGE_MASK) & ((1UL << __PHYSICAL_MASK_SHIFT) - 1))
    +#define _PAGE_CHG_MASK (PTE_PFN_MASK_MAX | _PAGE_PCD | _PAGE_PWT | \
    _PAGE_SPECIAL | _PAGE_ACCESSED | _PAGE_DIRTY | \
    _PAGE_SOFT_DIRTY)
    #define _HPAGE_CHG_MASK (_PAGE_CHG_MASK | _PAGE_PSE)
    --
    2.16.1
    \
     
     \ /
      Last update: 2018-03-05 17:30    [W:4.097 / U:0.128 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site