Commit ffdd1bb5 authored by Stefan Bader's avatar Stefan Bader

UBUNTU: SAUCE: Add pfn_pud() and pud_mkhuge()

Both were introduced when pud size transparent hugepage support was
added and that would be too complex and dangerous to backport. The
pfn_pud() function was extended in "x86/speculation/l1tf: Protect
PROT_NONE PTEs against speculation" but not backported then since it
was not present, yet (so no users).
For the following patch, though, we will need both.

CVE-2018-3620
CVE-2018-3646
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
parent 319f01bb
...@@ -320,6 +320,14 @@ static inline pmd_t pmd_mkwrite(pmd_t pmd) ...@@ -320,6 +320,14 @@ static inline pmd_t pmd_mkwrite(pmd_t pmd)
return pmd_set_flags(pmd, _PAGE_RW); return pmd_set_flags(pmd, _PAGE_RW);
} }
/* Only used by arch/x86/mm/pageattr.c: populate_pmd() */
static inline pud_t pud_mkhuge(pud_t pud)
{
pudval_t v = native_pud_val(pud);
return __pud(v | _PAGE_PSE);
}
#ifdef CONFIG_HAVE_ARCH_SOFT_DIRTY #ifdef CONFIG_HAVE_ARCH_SOFT_DIRTY
static inline int pte_soft_dirty(pte_t pte) static inline int pte_soft_dirty(pte_t pte)
{ {
...@@ -383,6 +391,14 @@ static inline pmd_t pfn_pmd(unsigned long page_nr, pgprot_t pgprot) ...@@ -383,6 +391,14 @@ static inline pmd_t pfn_pmd(unsigned long page_nr, pgprot_t pgprot)
return __pmd(pfn | massage_pgprot(pgprot)); return __pmd(pfn | massage_pgprot(pgprot));
} }
static inline pud_t pfn_pud(unsigned long page_nr, pgprot_t pgprot)
{
phys_addr_t pfn = (phys_addr_t)page_nr << PAGE_SHIFT;
pfn ^= protnone_mask(pgprot_val(pgprot));
pfn &= PHYSICAL_PUD_PAGE_MASK;
return __pud(pfn | massage_pgprot(pgprot));
}
static inline pmd_t pmd_mknotpresent(pmd_t pmd) static inline pmd_t pmd_mknotpresent(pmd_t pmd)
{ {
return pfn_pmd(pmd_pfn(pmd), return pfn_pmd(pmd_pfn(pmd),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment