From: Greg KH <gregkh@linuxfoundation.org>
To: speck@linutronix.de
Subject: [MODERATED] Re: [PATCH v17.1 2/2] [PATCH v17.1 2/2] SSB Fix #2
Date: Fri, 18 May 2018 10:20:36 +0200 [thread overview]
Message-ID: <20180518082036.GA6330@kroah.com> (raw)
In-Reply-To: <20180517031815.016936086@localhost.localdomain>
On Wed, May 16, 2018 at 11:18:10PM -0400, speck for konrad.wilk_at_oracle.com wrote:
> xen: Don't call non-Xen routines early in the boot
>
> Commit 2cc42bac1c79 ("x86-64/Xen: eliminate W+X mappings") added a call
> to get_cpu_cap() to properly set boot_cpu_has(X86_FEATURE_NX) which is
> needed to correctly initialize __supported_pte_mask. Doing this so early
> in the boot can be dangerous --- while this currently works, there is no
> telling what get_cpu_cap() may decide to add in the future. For example,
> if it decides to do a printk (which is not something impossible to
> imagine) a PV guest will not be able to cope with it.
>
> To avoid these problems check CPUID explicitly for NX support and
> open-code setting __supported_pte_mask.
>
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Reviewed-by: Juergen Gross <jgross@suse.com>
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---
> arch/x86/xen/enlighten_pv.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c
> index c36d23aa6c35..f9f892488670 100644
> --- a/arch/x86/xen/enlighten_pv.c
> +++ b/arch/x86/xen/enlighten_pv.c
> @@ -88,8 +88,6 @@
> #include "multicalls.h"
> #include "pmu.h"
>
> -#include "../kernel/cpu/cpu.h" /* get_cpu_cap() */
> -
> void *xen_initial_gdt;
>
> static int xen_cpu_up_prepare_pv(unsigned int cpu);
> @@ -1253,6 +1251,13 @@ asmlinkage __visible void __init xen_start_kernel(void)
> /* Prevent unwanted bits from being set in PTEs. */
> __supported_pte_mask &= ~_PAGE_GLOBAL;
>
> + /* Work out if we support NX. */
> + if ((cpuid_eax(0x80000000) >= 0x80000001) &&
> + (cpuid_edx(0x80000001) & (1U << (X86_FEATURE_NX & 31))))
> + __supported_pte_mask |= _PAGE_NX;
> + else
> + __supported_pte_mask &= ~_PAGE_NX;
> +
> /*
> * Prevent page tables from being allocated in highmem, even
> * if CONFIG_HIGHPTE is enabled.
> @@ -1268,10 +1273,6 @@ asmlinkage __visible void __init xen_start_kernel(void)
> */
> xen_setup_gdt(0);
>
> - /* Work out if we support NX */
> - get_cpu_cap(&boot_cpu_data);
> - x86_configure_nx();
> -
> xen_init_irq_ops();
>
> /* Let's presume PV guests always boot on vCPU with id 0. */
> --
> 2.14.3
Why is this a part of this series? Shouldn't this just go into the tree
through the "normal" patch process if this really is an issue? And if
so, please cc: stable as the patch you are trying to "fix" here has been
backported already to stable kernel releases.
I really hate the "open coding" here though, it feels odd that the xen
developers feel that it is needed and they can't trust the fact that
since the kernel works fine today with this, it will continue to work ok
in the future (and if it breaks then, great, we can fix it...)
thanks,
greg k-h
next prev parent reply other threads:[~2018-05-18 8:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-17 3:18 [MODERATED] [PATCH v17.1 2/2] [PATCH v17.1 2/2] SSB Fix #2 konrad.wilk
2018-05-18 8:20 ` Greg KH [this message]
2018-05-18 9:02 ` Thomas Gleixner
2018-05-18 11:46 ` [MODERATED] " Konrad Rzeszutek Wilk
2018-05-18 9:14 ` Thomas Gleixner
2018-05-18 11:43 ` [MODERATED] " Konrad Rzeszutek Wilk
2018-05-18 12:03 ` Greg KH
2018-05-18 13:21 ` Greg KH
2018-05-18 18:22 ` Konrad Rzeszutek Wilk
2018-05-18 19:57 ` Thomas Gleixner
2018-05-18 20:34 ` [MODERATED] " Konrad Rzeszutek Wilk
2018-05-18 20:40 ` Linus Torvalds
2018-05-18 21:05 ` Konrad Rzeszutek Wilk
2018-05-18 21:10 ` Linus Torvalds
2018-05-19 8:33 ` Thomas Gleixner
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=20180518082036.GA6330@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=speck@linutronix.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.