[SRU][Trusty][PATCH 1/1] x86/mm: Fix slow_virt_to_phys() for X86_PAE again
Tim Gardner
tim.gardner at canonical.com
Thu Mar 10 12:36:18 UTC 2016
On 03/09/2016 10:50 AM, Joseph Salisbury wrote:
> From: Dexuan Cui <decui at microsoft.com>
>
> BugLink: http://bugs.launchpad.net/bugs/1549601
>
> "d1cd12108346: x86, pageattr: Prevent overflow in slow_virt_to_phys() for
> X86_PAE" was unintentionally removed by the recent "34437e67a672: x86/mm: Fix
> slow_virt_to_phys() to handle large PAT bit".
>
> And, the variable 'phys_addr' was defined as "unsigned long" by mistake -- it should
> be "phys_addr_t".
>
> As a result, Hyper-V network driver in 32-PAE Linux guest can't work again.
>
> Fixes: commit 34437e67a672: "x86/mm: Fix slow_virt_to_phys() to handle large PAT bit"
> Signed-off-by: Dexuan Cui <decui at microsoft.com>
> Reviewed-by: Toshi Kani <toshi.kani at hpe.com>
> Cc: olaf at aepfle.de
> Cc: gregkh at linuxfoundation.org
> Cc: jasowang at redhat.com
> Cc: driverdev-devel at linuxdriverproject.org
> Cc: linux-mm at kvack.org
> Cc: apw at canonical.com
> Cc: Andrew Morton <akpm at linux-foundation.org>
> Cc: K. Y. Srinivasan <kys at microsoft.com>
> Cc: Haiyang Zhang <haiyangz at microsoft.com>
> Link: http://lkml.kernel.org/r/1456394292-9030-1-git-send-email-decui@microsoft.com
> Signed-off-by: Thomas Gleixner <tglx at linutronix.de>
> (backported from commit bf70e5513dfea29c3682e7eb3dbb45f0723bac09)
> Signed-off-by: Joseph Salisbury <joseph.salisbury at canonical.com>
> ---
> arch/x86/include/asm/page_types.h | 9 ++++++---
> arch/x86/mm/pageattr.c | 26 +++++++++++++++++++++-----
> 2 files changed, 27 insertions(+), 8 deletions(-)
>
> diff --git a/arch/x86/include/asm/page_types.h b/arch/x86/include/asm/page_types.h
> index f97fbe3..53193b7 100644
> --- a/arch/x86/include/asm/page_types.h
> +++ b/arch/x86/include/asm/page_types.h
> @@ -9,6 +9,12 @@
> #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
> #define PAGE_MASK (~(PAGE_SIZE-1))
>
> +#define PMD_PAGE_SIZE (_AC(1, UL) << PMD_SHIFT)
> +#define PMD_PAGE_MASK (~(PMD_PAGE_SIZE-1))
> +
> +#define PUD_PAGE_SIZE (_AC(1, UL) << PUD_SHIFT)
> +#define PUD_PAGE_MASK (~(PUD_PAGE_SIZE-1))
> +
> #define __PHYSICAL_MASK ((phys_addr_t)((1ULL << __PHYSICAL_MASK_SHIFT) - 1))
> #define __VIRTUAL_MASK ((1UL << __VIRTUAL_MASK_SHIFT) - 1)
>
> @@ -17,9 +23,6 @@
> (ie, 32-bit PAE). */
> #define PHYSICAL_PAGE_MASK (((signed long)PAGE_MASK) & __PHYSICAL_MASK)
>
> -#define PMD_PAGE_SIZE (_AC(1, UL) << PMD_SHIFT)
> -#define PMD_PAGE_MASK (~(PMD_PAGE_SIZE-1))
> -
> #define HPAGE_SHIFT PMD_SHIFT
> #define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT)
> #define HPAGE_MASK (~(HPAGE_SIZE - 1))
Why the changes to these macros ? They are not part of the upstream
commit, which is an otherwise clean cherry-pick except for some minor
whitespace differences.
rtg
--
Tim Gardner tim.gardner at canonical.com
More information about the kernel-team
mailing list