From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f52.google.com ([74.125.82.52]:37127 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932356AbcCHPga (ORCPT ); Tue, 8 Mar 2016 10:36:30 -0500 Received: by mail-wm0-f52.google.com with SMTP id p65so32895461wmp.0 for ; Tue, 08 Mar 2016 07:36:30 -0800 (PST) Received: from gmail.com (2E8B0CD5.catv.pool.telekom.hu. [46.139.12.213]) by smtp.gmail.com with ESMTPSA id u202sm19475856wmd.24.2016.03.08.07.36.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Mar 2016 07:36:22 -0800 (PST) Date: Tue, 8 Mar 2016 16:36:20 +0100 From: Ingo Molnar To: stable kernel team Subject: [tipbot@zytor.com: [tip:x86/urgent] x86/mm: Fix slow_virt_to_phys() for X86_PAE again] Message-ID: <20160308153620.GA14331@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Sender: stable-owner@vger.kernel.org List-ID: hi Greg, Please apply this fix (bf70e5513dfea) on top of v4.4. v4.3 does not have the bug. v4.5 and later has the fix already. Thanks, Ingo ----- Forwarded message from tip-bot for Dexuan Cui ----- Date: Thu, 25 Feb 2016 10:57:39 -0800 From: tip-bot for Dexuan Cui To: linux-tip-commits@vger.kernel.org Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org, kys@microsoft.com, toshi.kani@hpe.com, hpa@zytor.com, decui@microsoft.com, haiyangz@microsoft.com, mingo@kernel.org, akpm@linux-foundation.org Subject: [tip:x86/urgent] x86/mm: Fix slow_virt_to_phys() for X86_PAE again Commit-ID: bf70e5513dfea29c3682e7eb3dbb45f0723bac09 Gitweb: http://git.kernel.org/tip/bf70e5513dfea29c3682e7eb3dbb45f0723bac09 Author: Dexuan Cui AuthorDate: Thu, 25 Feb 2016 01:58:12 -0800 Committer: Thomas Gleixner CommitDate: Thu, 25 Feb 2016 19:53:15 +0100 x86/mm: Fix slow_virt_to_phys() for X86_PAE again "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 Reviewed-by: Toshi Kani Cc: olaf@aepfle.de Cc: gregkh@linuxfoundation.org Cc: jasowang@redhat.com Cc: driverdev-devel@linuxdriverproject.org Cc: linux-mm@kvack.org Cc: apw@canonical.com Cc: Andrew Morton Cc: K. Y. Srinivasan Cc: Haiyang Zhang Link: http://lkml.kernel.org/r/1456394292-9030-1-git-send-email-decui@microsoft.com Signed-off-by: Thomas Gleixner --- arch/x86/mm/pageattr.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index 2440814..9cf96d8 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c @@ -419,24 +419,30 @@ pmd_t *lookup_pmd_address(unsigned long address) phys_addr_t slow_virt_to_phys(void *__virt_addr) { unsigned long virt_addr = (unsigned long)__virt_addr; - unsigned long phys_addr, offset; + phys_addr_t phys_addr; + unsigned long offset; enum pg_level level; pte_t *pte; pte = lookup_address(virt_addr, &level); BUG_ON(!pte); + /* + * pXX_pfn() returns unsigned long, which must be cast to phys_addr_t + * before being left-shifted PAGE_SHIFT bits -- this trick is to + * make 32-PAE kernel work correctly. + */ switch (level) { case PG_LEVEL_1G: - phys_addr = pud_pfn(*(pud_t *)pte) << PAGE_SHIFT; + phys_addr = (phys_addr_t)pud_pfn(*(pud_t *)pte) << PAGE_SHIFT; offset = virt_addr & ~PUD_PAGE_MASK; break; case PG_LEVEL_2M: - phys_addr = pmd_pfn(*(pmd_t *)pte) << PAGE_SHIFT; + phys_addr = (phys_addr_t)pmd_pfn(*(pmd_t *)pte) << PAGE_SHIFT; offset = virt_addr & ~PMD_PAGE_MASK; break; default: - phys_addr = pte_pfn(*pte) << PAGE_SHIFT; + phys_addr = (phys_addr_t)pte_pfn(*pte) << PAGE_SHIFT; offset = virt_addr & ~PAGE_MASK; } ----- End forwarded message -----