From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org,
Boris Ostrovsky <boris.ostrovsky@oracle.com>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
"H. Peter Anvin" <hpa@linux.intel.com>
Subject: [PATCH 3.4 17/19] x86/espfix/xen: Fix allocation of pages for paravirt page tables
Date: Tue, 5 Aug 2014 11:29:41 -0700 [thread overview]
Message-ID: <20140805182934.561988855@linuxfoundation.org> (raw)
In-Reply-To: <20140805182934.022406678@linuxfoundation.org>
3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
commit 8762e5092828c4dc0f49da5a47a644c670df77f3 upstream.
init_espfix_ap() is currently off by one level when informing hypervisor
that allocated pages will be used for ministacks' page tables.
The most immediate effect of this on a PV guest is that if
'stack_page = __get_free_page()' returns a non-zeroed-out page the hypervisor
will refuse to use it for a page table (which it shouldn't be anyway). This will
result in warnings by both Xen and Linux.
More importantly, a subsequent write to that page (again, by a PV guest) is
likely to result in fatal page fault.
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Link: http://lkml.kernel.org/r/1404926298-5565-1-git-send-email-boris.ostrovsky@oracle.com
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/x86/kernel/espfix_64.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
--- a/arch/x86/kernel/espfix_64.c
+++ b/arch/x86/kernel/espfix_64.c
@@ -175,7 +175,7 @@ void init_espfix_ap(void)
if (!pud_present(pud)) {
pmd_p = (pmd_t *)__get_free_page(PGALLOC_GFP);
pud = __pud(__pa(pmd_p) | (PGTABLE_PROT & ptemask));
- paravirt_alloc_pud(&init_mm, __pa(pmd_p) >> PAGE_SHIFT);
+ paravirt_alloc_pmd(&init_mm, __pa(pmd_p) >> PAGE_SHIFT);
for (n = 0; n < ESPFIX_PUD_CLONES; n++)
set_pud(&pud_p[n], pud);
}
@@ -185,7 +185,7 @@ void init_espfix_ap(void)
if (!pmd_present(pmd)) {
pte_p = (pte_t *)__get_free_page(PGALLOC_GFP);
pmd = __pmd(__pa(pte_p) | (PGTABLE_PROT & ptemask));
- paravirt_alloc_pmd(&init_mm, __pa(pte_p) >> PAGE_SHIFT);
+ paravirt_alloc_pte(&init_mm, __pa(pte_p) >> PAGE_SHIFT);
for (n = 0; n < ESPFIX_PMD_CLONES; n++)
set_pmd(&pmd_p[n], pmd);
}
@@ -193,7 +193,6 @@ void init_espfix_ap(void)
pte_p = pte_offset_kernel(&pmd, addr);
stack_page = (void *)__get_free_page(GFP_KERNEL);
pte = __pte(__pa(stack_page) | (__PAGE_KERNEL_RO & ptemask));
- paravirt_alloc_pte(&init_mm, __pa(stack_page) >> PAGE_SHIFT);
for (n = 0; n < ESPFIX_PTE_CLONES; n++)
set_pte(&pte_p[n*PTE_STRIDE], pte);
next prev parent reply other threads:[~2014-08-05 18:29 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-05 18:29 [PATCH 3.4 00/19] 3.4.102-stable review Greg Kroah-Hartman
2014-08-05 18:29 ` [PATCH 3.4 01/19] crypto: af_alg - properly label AF_ALG socket Greg Kroah-Hartman
2014-08-05 18:29 ` [PATCH 3.4 02/19] ARM: 8115/1: LPAE: reduce damage caused by idmap to virtual memory layout Greg Kroah-Hartman
2014-08-05 18:29 ` [PATCH 3.4 03/19] scsi: handle flush errors properly Greg Kroah-Hartman
2014-08-05 18:29 ` [PATCH 3.4 04/19] mm, thp: do not allow thp faults to avoid cpuset restrictions Greg Kroah-Hartman
2014-08-05 18:29 ` [PATCH 3.4 05/19] printk: rename printk_sched to printk_deferred Greg Kroah-Hartman
2014-08-05 18:29 ` [PATCH 3.4 06/19] timer: Fix lock inversion between hrtimer_bases.lock and scheduler locks Greg Kroah-Hartman
2014-08-05 18:29 ` [PATCH 3.4 07/19] Revert "x86-64, modify_ldt: Make support for 16-bit segments a runtime option" Greg Kroah-Hartman
2014-08-05 18:29 ` [PATCH 3.4 08/19] x86-64, espfix: Dont leak bits 31:16 of %esp returning to 16-bit stack Greg Kroah-Hartman
2014-08-05 18:29 ` [PATCH 3.4 09/19] x86, espfix: Move espfix definitions into a separate header file Greg Kroah-Hartman
2014-08-05 18:29 ` [PATCH 3.4 10/19] x86, espfix: Fix broken header guard Greg Kroah-Hartman
2014-08-05 18:29 ` [PATCH 3.4 11/19] x86, espfix: Make espfix64 a Kconfig option, fix UML Greg Kroah-Hartman
2014-08-05 18:29 ` [PATCH 3.4 12/19] x86, espfix: Make it possible to disable 16-bit support Greg Kroah-Hartman
2014-08-05 18:29 ` [PATCH 3.4 13/19] x86_64/entry/xen: Do not invoke espfix64 on Xen Greg Kroah-Hartman
2014-08-05 18:29 ` [PATCH 3.4 14/19] Revert: "net: ip, ipv6: handle gso skbs in forwarding path" Greg Kroah-Hartman
2014-08-05 18:29 ` [PATCH 3.4 15/19] net/l2tp: dont fall back on UDP [get|set]sockopt Greg Kroah-Hartman
2014-08-05 18:29 ` [PATCH 3.4 16/19] lib/btree.c: fix leak of whole btree nodes Greg Kroah-Hartman
2014-08-05 18:29 ` Greg Kroah-Hartman [this message]
2014-08-05 18:29 ` [PATCH 3.4 18/19] mm: try_to_unmap_cluster() should lock_page() before mlocking Greg Kroah-Hartman
2014-08-05 18:29 ` [PATCH 3.4 19/19] ipv6: reallocate addrconf router for ipv6 address when lo device up Greg Kroah-Hartman
2014-08-06 8:03 ` chenweilong
2014-08-05 23:08 ` [PATCH 3.4 00/19] 3.4.102-stable review Shuah Khan
2014-08-06 2:33 ` Guenter Roeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140805182934.561988855@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=boris.ostrovsky@oracle.com \
--cc=hpa@linux.intel.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).