Correct 4.9 stable commit 944e0fc51a89c98
Subsystems (3)
Juergen Gross
maintainercover Correct 4.9 stable commit 944e0fc51a89c98
Above commit is a wrong backport, as it is based on a missing prerequisite patch. Correct that by reverting said commit, include the missing patch, and do the backport correctly.
Juergen Gross (3):
x86/amd: revert commit 944e0fc51a89c9827b98813d65dc083274777c7f
xen: set cpu capabilities from xen_start_kernel() x86/amd: don't set X86_BUG_SYSRET_SS_ATTRS when running under Xen
arch/x86/xen/enlighten.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
Signature · 1 line
2.13.6
Juergen Gross
maintainerPATCH 1/3 x86/amd: revert commit 944e0fc51a89c9827b9
Revert commit 944e0fc51a89c9827b98813d65dc083274777c7f ("x86/amd: don't set X86_BUG_SYSRET_SS_ATTRS when running under Xen") as it is lacking a prerequisite patch and is making things worse.
--- arch/x86/kernel/cpu/amd.c | 5 ++--- arch/x86/xen/enlighten.c | 4 +++- 2 files changed, 5 insertions(+), 4 deletions(-)
arch/x86/kernel/cpu/amd.c +2 -3
@@ -857,9 +857,8 @@ static void init_amd(struct cpuinfo_x86 *c)if (cpu_has (c,X86_FEATURE_3DNOW ) ||cpu_has (c,X86_FEATURE_LM ))set_cpu_cap (c,X86_FEATURE_3DNOWPREFETCH ); -/* AMD CPUs don't reset SS attributes on SYSRET, Xen does. */ -if (!cpu_has (c,X86_FEATURE_XENPV )) -set_cpu_bug (c,X86_BUG_SYSRET_SS_ATTRS ); +/* AMD CPUs don't reset SS attributes on SYSRET */ +set_cpu_bug (c,X86_BUG_SYSRET_SS_ATTRS ); }#ifdef CONFIG_X86_32
arch/x86/xen/enlighten.c +3 -1
@@ -1977,8 +1977,10 @@ EXPORT_SYMBOL_GPL(xen_hvm_need_lapic);static void xen_set_cpu_features (struct cpuinfo_x86 *c) { -if (xen_pv_domain ()) +if (xen_pv_domain ()) { +clear_cpu_bug (c,X86_BUG_SYSRET_SS_ATTRS );set_cpu_cap (c,X86_FEATURE_XENPV ); + } }static void xen_pin_vcpu (int cpu)
Signature · 1 line
2.13.6
Patch "x86/amd: revert commit 944e0fc51a89c9827b9" has been added to the 4.9-stable tree
This is a note to let you know that I've just added the patch titled
x86/amd: revert commit 944e0fc51a89c9827b9
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
x86-amd-revert-commit-944e0fc51a89c9827b9.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
From foo@baz Sat Jun 2 15:10:07 CEST 2018
From: Juergen Gross <[email protected]>
Date: Wed, 30 May 2018 13:09:56 +0200
Subject: x86/amd: revert commit 944e0fc51a89c9827b9
To: [email protected], [email protected]
Cc: [email protected], [email protected], Juergen Gross <[email protected]>
Message-ID: <[email protected]>
From: Juergen Gross <[email protected]>
Revert commit 944e0fc51a89c9827b98813d65dc083274777c7f ("x86/amd: don't set X86_BUG_SYSRET_SS_ATTRS when running under Xen") as it is lacking a prerequisite patch and is making things worse.
--- arch/x86/kernel/cpu/amd.c | 5 ++--- arch/x86/xen/enlighten.c | 4 +++- 2 files changed, 5 insertions(+), 4 deletions(-)
arch/x86/kernel/cpu/amd.c +2 -3
@@ -857,9 +857,8 @@ static void init_amd(struct cpuinfo_x86if (cpu_has (c,X86_FEATURE_3DNOW ) ||cpu_has (c,X86_FEATURE_LM ))set_cpu_cap (c,X86_FEATURE_3DNOWPREFETCH ); -/* AMD CPUs don't reset SS attributes on SYSRET, Xen does. */ -if (!cpu_has (c,X86_FEATURE_XENPV )) -set_cpu_bug (c,X86_BUG_SYSRET_SS_ATTRS ); +/* AMD CPUs don't reset SS attributes on SYSRET */ +set_cpu_bug (c,X86_BUG_SYSRET_SS_ATTRS ); }#ifdef CONFIG_X86_32
arch/x86/xen/enlighten.c +3 -1
@@ -1977,8 +1977,10 @@ EXPORT_SYMBOL_GPL(xen_hvm_need_lapic);static void xen_set_cpu_features (struct cpuinfo_x86 *c) { -if (xen_pv_domain ()) +if (xen_pv_domain ()) { +clear_cpu_bug (c,X86_BUG_SYSRET_SS_ATTRS );set_cpu_cap (c,X86_FEATURE_XENPV ); + } }static void xen_pin_vcpu (int cpu)
Patches currently in stable-queue which might be from [email protected] are
queue-4.9/x86-amd-don-t-set-x86_bug_sysret_ss_attrs-when-running-under-xen.patch queue-4.9/x86-amd-revert-commit-944e0fc51a89c9827b9.patch queue-4.9/xen-set-cpu-capabilities-from-xen_start_kernel.patch
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerPATCH 1/3 x86/amd: revert commit 944e0fc51a89c9827b9
In reply to Juergen GrossRevert commit 944e0fc51a89c9827b98813d65dc083274777c7f ("x86/amd: don't set X86_BUG_SYSRET_SS_ATTRS when running under Xen") as it is lacking a prerequisite patch and is making things worse.
--- arch/x86/kernel/cpu/amd.c | 5 ++--- arch/x86/xen/enlighten.c | 4 +++- 2 files changed, 5 insertions(+), 4 deletions(-)
arch/x86/kernel/cpu/amd.c +2 -3
@@ -857,9 +857,8 @@ static void init_amd(struct cpuinfo_x86 *c)if (cpu_has (c,X86_FEATURE_3DNOW ) ||cpu_has (c,X86_FEATURE_LM ))set_cpu_cap (c,X86_FEATURE_3DNOWPREFETCH ); -/* AMD CPUs don't reset SS attributes on SYSRET, Xen does. */ -if (!cpu_has (c,X86_FEATURE_XENPV )) -set_cpu_bug (c,X86_BUG_SYSRET_SS_ATTRS ); +/* AMD CPUs don't reset SS attributes on SYSRET */ +set_cpu_bug (c,X86_BUG_SYSRET_SS_ATTRS ); }#ifdef CONFIG_X86_32
arch/x86/xen/enlighten.c +3 -1
@@ -1977,8 +1977,10 @@ EXPORT_SYMBOL_GPL(xen_hvm_need_lapic);static void xen_set_cpu_features (struct cpuinfo_x86 *c) { -if (xen_pv_domain ()) +if (xen_pv_domain ()) { +clear_cpu_bug (c,X86_BUG_SYSRET_SS_ATTRS );set_cpu_cap (c,X86_FEATURE_XENPV ); + } }static void xen_pin_vcpu (int cpu)
Signature · 7 lines
2.13.6 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerPATCH 2/3 xen: set cpu capabilities from xen_start_kernel()
In reply to Juergen GrossThere is no need to set the same capabilities for each cpu individually. This can easily be done for all cpus when starting the kernel.
Upstream commit: 0808e80cb760de2733c0527d2090ed2205a1eef8 ("xen: set cpu capabilities from xen_start_kernel()")
--- arch/x86/xen/enlighten.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
arch/x86/xen/enlighten.c +9 -9
@@ -471,6 +471,14 @@ static void __init xen_init_cpuid_mask(void) cpuid_leaf1_ecx_set_mask = (1 << (X86_FEATURE_MWAIT %32 )); } +static void __init xen_init_capabilities (void ) +{ +if (xen_pv_domain ()) { +setup_clear_cpu_cap (X86_BUG_SYSRET_SS_ATTRS ); +setup_force_cpu_cap (X86_FEATURE_XENPV ); + } +} +static void xen_set_debugreg (int reg,unsigned long val) {HYPERVISOR_set_debugreg (reg, val);
@@ -1631,6 +1639,7 @@ asmlinkage __visible void __init xen_start_kernel(void)xen_init_irq_ops ();xen_init_cpuid_mask (); +xen_init_capabilities ();#ifdef CONFIG_X86_LOCAL_APIC /*
@@ -1975,14 +1984,6 @@ bool xen_hvm_need_lapic(void) }EXPORT_SYMBOL_GPL (xen_hvm_need_lapic); -static void xen_set_cpu_features (struct cpuinfo_x86 *c) -{ -if (xen_pv_domain ()) { -clear_cpu_bug (c,X86_BUG_SYSRET_SS_ATTRS ); -set_cpu_cap (c,X86_FEATURE_XENPV ); - } -} -static void xen_pin_vcpu (int cpu) {static bool disable_pinning;
@@ -2029,7 +2030,6 @@ const struct hypervisor_x86 x86_hyper_xen = { .init_platform = xen_hvm_guest_init, #endif .x2apic_available = xen_x2apic_para_available, - .set_cpu_features = xen_set_cpu_features, .pin_vcpu = xen_pin_vcpu, };EXPORT_SYMBOL (x86_hyper_xen);
Signature · 1 line
2.13.6
Patch "xen: set cpu capabilities from xen_start_kernel()" has been added to the 4.9-stable tree
This is a note to let you know that I've just added the patch titled
xen: set cpu capabilities from xen_start_kernel()
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
xen-set-cpu-capabilities-from-xen_start_kernel.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
From foo@baz Sat Jun 2 15:10:07 CEST 2018
From: Juergen Gross <[email protected]>
Date: Wed, 30 May 2018 13:09:57 +0200
Subject: xen: set cpu capabilities from xen_start_kernel()
To: [email protected], [email protected]
Cc: [email protected], [email protected], Juergen Gross <[email protected]>
Message-ID: <[email protected]>
From: Juergen Gross <[email protected]>
Upstream commit: 0808e80cb760de2733c0527d2090ed2205a1eef8 ("xen: set cpu capabilities from xen_start_kernel()")
There is no need to set the same capabilities for each cpu individually. This can easily be done for all cpus when starting the kernel.
--- arch/x86/xen/enlighten.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
arch/x86/xen/enlighten.c +9 -9
@@ -471,6 +471,14 @@ static void __init xen_init_cpuid_mask(v cpuid_leaf1_ecx_set_mask = (1 << (X86_FEATURE_MWAIT %32 )); } +static void __init xen_init_capabilities (void ) +{ +if (xen_pv_domain ()) { +setup_clear_cpu_cap (X86_BUG_SYSRET_SS_ATTRS ); +setup_force_cpu_cap (X86_FEATURE_XENPV ); + } +} +static void xen_set_debugreg (int reg,unsigned long val) {HYPERVISOR_set_debugreg (reg, val);
@@ -1631,6 +1639,7 @@ asmlinkage __visible void __init xen_staxen_init_irq_ops ();xen_init_cpuid_mask (); +xen_init_capabilities ();#ifdef CONFIG_X86_LOCAL_APIC /*
@@ -1975,14 +1984,6 @@ bool xen_hvm_need_lapic(void) }EXPORT_SYMBOL_GPL (xen_hvm_need_lapic); -static void xen_set_cpu_features (struct cpuinfo_x86 *c) -{ -if (xen_pv_domain ()) { -clear_cpu_bug (c,X86_BUG_SYSRET_SS_ATTRS ); -set_cpu_cap (c,X86_FEATURE_XENPV ); - } -} -static void xen_pin_vcpu (int cpu) {static bool disable_pinning;
@@ -2029,7 +2030,6 @@ const struct hypervisor_x86 x86_hyper_xe .init_platform = xen_hvm_guest_init, #endif .x2apic_available = xen_x2apic_para_available, - .set_cpu_features = xen_set_cpu_features, .pin_vcpu = xen_pin_vcpu, };EXPORT_SYMBOL (x86_hyper_xen);
Patches currently in stable-queue which might be from [email protected] are
queue-4.9/x86-amd-don-t-set-x86_bug_sysret_ss_attrs-when-running-under-xen.patch queue-4.9/x86-amd-revert-commit-944e0fc51a89c9827b9.patch queue-4.9/xen-set-cpu-capabilities-from-xen_start_kernel.patch
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH 2/3] xen: set cpu capabilities from xen_start_kernel()
In reply to Juergen GrossQuoted 9 lines · Juergen Gross
There is no need to set the same capabilities for each cpu individually. This can easily be done for all cpus when starting the kernel.
Upstream commit:
0808e80cb760de2733c0527d2090ed2205a1eef8("xen: set cpu capabilities fromxen_start_kernel()")Signed-off-by Juergen Gross <[email protected]>Reviewed-by Boris Ostrovsky <[email protected]>
That breaks PV guests because they get KAISER enabled — when kaiser_check_boottime_disable() runs, X86_FEATURE_XENPV isn't set.
Simon is testing, and about to send a fix...
Amazon Development Centre (London) Ltd. Registered in England and Wales with registration number 04543232 with its registered office at 1 Principal Place, Worship Street, London EC2A 2FA, United Kingdom.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerRe: [PATCH 2/3] xen: set cpu capabilities from xen_start_kernel()
Quoted 5 lines · David
Quoted 4 lines · Juergen Gross
There is no need to set the same capabilities for each cpu individually. This can easily be done for all cpus when starting the kernel.
Quoted 8 lines
Quoted 5 lines
Upstream commit:
0808e80cb760de2733c0527d2090ed2205a1eef8("xen: set cpu capabilities fromxen_start_kernel()")Signed-off-by Juergen Gross <[email protected]>Reviewed-by Boris Ostrovsky <[email protected]>That breaks PV guests because they get KAISER enabled — when
kaiser_check_boottime_disable()runs,X86_FEATURE_XENPVisn't set.
Which kernel version are you talking about?
With upstream commit 60d3450167433f2d099ce2869dc52dd9e7dc9b29 which will be part of next stable-4.9 everything is fine.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerRe: [PATCH 2/3] xen: set cpu capabilities from xen_start_kernel()
In reply to Woodhouse, DavidQuoted 5 lines · David
Quoted 4 lines · Juergen Gross
There is no need to set the same capabilities for each cpu individually. This can easily be done for all cpus when starting the kernel.
Quoted 8 lines
Quoted 5 lines
Upstream commit:
0808e80cb760de2733c0527d2090ed2205a1eef8("xen: set cpu capabilities fromxen_start_kernel()")Signed-off-by Juergen Gross <[email protected]>Reviewed-by Boris Ostrovsky <[email protected]>That breaks PV guests because they get KAISER enabled — when
kaiser_check_boottime_disable()runs,X86_FEATURE_XENPVisn't set.
Which kernel version are you talking about?
With upstream commit 60d3450167433f2d099ce2869dc52dd9e7dc9b29 which will be part of next stable-4.9 everything is fine.
Juergen
Re: [PATCH 2/3] xen: set cpu capabilities from xen_start_kernel()
Quoted 13 lines · Juergen Gross
Quoted 12 lines · David
Quoted 10 lines · Juergen Gross
There is no need to set the same capabilities for each cpu individually. This can easily be done for all cpus when starting the kernel.
Upstream commit:
0808e80cb760de2733c0527d2090ed2205a1eef8("xen: set cpu capabilities fromxen_start_kernel()")Signed-off-by Juergen Gross <[email protected]>Reviewed-by Boris Ostrovsky <[email protected]>
Quoted 7 lines
Quoted 2 lines
That breaks PV guests because they get KAISER enabled — when
kaiser_check_boottime_disable()runs,X86_FEATURE_XENPVisn't set.Which kernel version are you talking about?
With upstream commit
60d3450167433f2d099ce2869dc52dd9e7dc9b29which will be part of next stable-4.9 everything is fine.
Right. That's what Simon had also backported. We hadn't spotted it was already lined up.
Amazon Development Centre (London) Ltd. Registered in England and Wales with registration number 04543232 with its registered office at 1 Principal Place, Worship Street, London EC2A 2FA, United Kingdom.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerPATCH 2/3 xen: set cpu capabilities from xen_start_kernel()
In reply to Juergen GrossThere is no need to set the same capabilities for each cpu individually. This can easily be done for all cpus when starting the kernel.
Upstream commit: 0808e80cb760de2733c0527d2090ed2205a1eef8 ("xen: set cpu capabilities from xen_start_kernel()")
--- arch/x86/xen/enlighten.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
arch/x86/xen/enlighten.c +9 -9
@@ -471,6 +471,14 @@ static void __init xen_init_cpuid_mask(void) cpuid_leaf1_ecx_set_mask = (1 << (X86_FEATURE_MWAIT %32 )); } +static void __init xen_init_capabilities (void ) +{ +if (xen_pv_domain ()) { +setup_clear_cpu_cap (X86_BUG_SYSRET_SS_ATTRS ); +setup_force_cpu_cap (X86_FEATURE_XENPV ); + } +} +static void xen_set_debugreg (int reg,unsigned long val) {HYPERVISOR_set_debugreg (reg, val);
@@ -1631,6 +1639,7 @@ asmlinkage __visible void __init xen_start_kernel(void)xen_init_irq_ops ();xen_init_cpuid_mask (); +xen_init_capabilities ();#ifdef CONFIG_X86_LOCAL_APIC /*
@@ -1975,14 +1984,6 @@ bool xen_hvm_need_lapic(void) }EXPORT_SYMBOL_GPL (xen_hvm_need_lapic); -static void xen_set_cpu_features (struct cpuinfo_x86 *c) -{ -if (xen_pv_domain ()) { -clear_cpu_bug (c,X86_BUG_SYSRET_SS_ATTRS ); -set_cpu_cap (c,X86_FEATURE_XENPV ); - } -} -static void xen_pin_vcpu (int cpu) {static bool disable_pinning;
@@ -2029,7 +2030,6 @@ const struct hypervisor_x86 x86_hyper_xen = { .init_platform = xen_hvm_guest_init, #endif .x2apic_available = xen_x2apic_para_available, - .set_cpu_features = xen_set_cpu_features, .pin_vcpu = xen_pin_vcpu, };EXPORT_SYMBOL (x86_hyper_xen);
Signature · 7 lines
2.13.6 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerPATCH 3/3 x86/amd: don't set X86_BUG_SYSRET_SS_ATTRS when running under Xen
In reply to Juergen GrossWhen running as Xen pv guest X86_BUG_SYSRET_SS_ATTRS must not be set on AMD cpus.
This bug/feature bit is kind of special as it will be used very early when switching threads. Setting the bit and clearing it a little bit later leaves a critical window where things can go wrong. This time window has enlarged a little bit by using setup_clear_cpu_cap() instead of the hypervisor's set_cpu_features callback. It seems this larger window now makes it rather easy to hit the problem.
The proper solution is to never set the bit in case of Xen.
Upstream commit: def9331a12977770cc6132d79f8e6565871e8e38 ("x86/amd:
don't set X86_BUG_SYSRET_SS_ATTRS when running under Xen")
--- arch/x86/kernel/cpu/amd.c | 5 +++-- arch/x86/xen/enlighten.c | 4 +--- 2 files changed, 4 insertions(+), 5 deletions(-)
arch/x86/kernel/cpu/amd.c +3 -2
@@ -857,8 +857,9 @@ static void init_amd(struct cpuinfo_x86 *c)if (cpu_has (c,X86_FEATURE_3DNOW ) ||cpu_has (c,X86_FEATURE_LM ))set_cpu_cap (c,X86_FEATURE_3DNOWPREFETCH ); -/* AMD CPUs don't reset SS attributes on SYSRET */ -set_cpu_bug (c,X86_BUG_SYSRET_SS_ATTRS ); +/* AMD CPUs don't reset SS attributes on SYSRET, Xen does. */ +if (!cpu_has (c,X86_FEATURE_XENPV )) +set_cpu_bug (c,X86_BUG_SYSRET_SS_ATTRS ); }#ifdef CONFIG_X86_32
arch/x86/xen/enlighten.c +1 -3
@@ -473,10 +473,8 @@ static void __init xen_init_cpuid_mask(void)static void __init xen_init_capabilities (void ) { -if (xen_pv_domain ()) { -setup_clear_cpu_cap (X86_BUG_SYSRET_SS_ATTRS ); +if (xen_pv_domain ())setup_force_cpu_cap (X86_FEATURE_XENPV ); - } }static void xen_set_debugreg (int reg,unsigned long val)
Signature · 1 line
2.13.6
Patch "x86/amd: don't set X86_BUG_SYSRET_SS_ATTRS when running under Xen" has been added to the 4.9-stable tree
This is a note to let you know that I've just added the patch titled
x86/amd: don't set X86_BUG_SYSRET_SS_ATTRS when running under Xen
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
x86-amd-don-t-set-x86_bug_sysret_ss_attrs-when-running-under-xen.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
From foo@baz Sat Jun 2 15:10:07 CEST 2018
From: Juergen Gross <[email protected]>
Date: Wed, 30 May 2018 13:09:58 +0200
Subject: x86/amd: don't set X86_BUG_SYSRET_SS_ATTRS when running under Xen
To: [email protected], [email protected]
Cc: [email protected], [email protected], Juergen Gross <[email protected]>
Message-ID: <[email protected]>
From: Juergen Gross <[email protected]>
Upstream commit: def9331a12977770cc6132d79f8e6565871e8e38 ("x86/amd:
don't set X86_BUG_SYSRET_SS_ATTRS when running under Xen")
When running as Xen pv guest X86_BUG_SYSRET_SS_ATTRS must not be set on AMD cpus.
This bug/feature bit is kind of special as it will be used very early when switching threads. Setting the bit and clearing it a little bit later leaves a critical window where things can go wrong. This time window has enlarged a little bit by using setup_clear_cpu_cap() instead of the hypervisor's set_cpu_features callback. It seems this larger window now makes it rather easy to hit the problem.
The proper solution is to never set the bit in case of Xen.
--- arch/x86/kernel/cpu/amd.c | 5 +++-- arch/x86/xen/enlighten.c | 4 +--- 2 files changed, 4 insertions(+), 5 deletions(-)
arch/x86/kernel/cpu/amd.c +3 -2
@@ -857,8 +857,9 @@ static void init_amd(struct cpuinfo_x86if (cpu_has (c,X86_FEATURE_3DNOW ) ||cpu_has (c,X86_FEATURE_LM ))set_cpu_cap (c,X86_FEATURE_3DNOWPREFETCH ); -/* AMD CPUs don't reset SS attributes on SYSRET */ -set_cpu_bug (c,X86_BUG_SYSRET_SS_ATTRS ); +/* AMD CPUs don't reset SS attributes on SYSRET, Xen does. */ +if (!cpu_has (c,X86_FEATURE_XENPV )) +set_cpu_bug (c,X86_BUG_SYSRET_SS_ATTRS ); }#ifdef CONFIG_X86_32
arch/x86/xen/enlighten.c +1 -3
@@ -473,10 +473,8 @@ static void __init xen_init_cpuid_mask(vstatic void __init xen_init_capabilities (void ) { -if (xen_pv_domain ()) { -setup_clear_cpu_cap (X86_BUG_SYSRET_SS_ATTRS ); +if (xen_pv_domain ())setup_force_cpu_cap (X86_FEATURE_XENPV ); - } }static void xen_set_debugreg (int reg,unsigned long val)
Patches currently in stable-queue which might be from [email protected] are
queue-4.9/x86-amd-don-t-set-x86_bug_sysret_ss_attrs-when-running-under-xen.patch queue-4.9/x86-amd-revert-commit-944e0fc51a89c9827b9.patch queue-4.9/xen-set-cpu-capabilities-from-xen_start_kernel.patch
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerPATCH 3/3 x86/amd: don't set X86_BUG_SYSRET_SS_ATTRS when running under Xen
In reply to Juergen GrossWhen running as Xen pv guest X86_BUG_SYSRET_SS_ATTRS must not be set on AMD cpus.
This bug/feature bit is kind of special as it will be used very early when switching threads. Setting the bit and clearing it a little bit later leaves a critical window where things can go wrong. This time window has enlarged a little bit by using setup_clear_cpu_cap() instead of the hypervisor's set_cpu_features callback. It seems this larger window now makes it rather easy to hit the problem.
The proper solution is to never set the bit in case of Xen.
Upstream commit: def9331a12977770cc6132d79f8e6565871e8e38 ("x86/amd:
don't set X86_BUG_SYSRET_SS_ATTRS when running under Xen")
--- arch/x86/kernel/cpu/amd.c | 5 +++-- arch/x86/xen/enlighten.c | 4 +--- 2 files changed, 4 insertions(+), 5 deletions(-)
arch/x86/kernel/cpu/amd.c +3 -2
@@ -857,8 +857,9 @@ static void init_amd(struct cpuinfo_x86 *c)if (cpu_has (c,X86_FEATURE_3DNOW ) ||cpu_has (c,X86_FEATURE_LM ))set_cpu_cap (c,X86_FEATURE_3DNOWPREFETCH ); -/* AMD CPUs don't reset SS attributes on SYSRET */ -set_cpu_bug (c,X86_BUG_SYSRET_SS_ATTRS ); +/* AMD CPUs don't reset SS attributes on SYSRET, Xen does. */ +if (!cpu_has (c,X86_FEATURE_XENPV )) +set_cpu_bug (c,X86_BUG_SYSRET_SS_ATTRS ); }#ifdef CONFIG_X86_32
arch/x86/xen/enlighten.c +1 -3
@@ -473,10 +473,8 @@ static void __init xen_init_cpuid_mask(void)static void __init xen_init_capabilities (void ) { -if (xen_pv_domain ()) { -setup_clear_cpu_cap (X86_BUG_SYSRET_SS_ATTRS ); +if (xen_pv_domain ())setup_force_cpu_cap (X86_FEATURE_XENPV ); - } }static void xen_set_debugreg (int reg,unsigned long val)
Signature · 7 lines
2.13.6 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 8 lines · Juergen Gross
Above commit is a wrong backport, as it is based on a missing prerequisite patch. Correct that by reverting said commit, include the missing patch, and do the backport correctly.
Juergen Gross (3):
x86/amd: revert commit944e0fc51a89c9827b98813d65dc083274777c7f
xen: set cpu capabilities fromxen_start_kernel()x86/amd: don't setX86_BUG_SYSRET_SS_ATTRSwhen running under Xen
All now queued up, thanks.
greg k-h
Quoted 8 lines · Juergen Gross
Above commit is a wrong backport, as it is based on a missing prerequisite patch. Correct that by reverting said commit, include the missing patch, and do the backport correctly.
Juergen Gross (3):
x86/amd: revert commit944e0fc51a89c9827b98813d65dc083274777c7f
xen: set cpu capabilities fromxen_start_kernel()x86/amd: don't setX86_BUG_SYSRET_SS_ATTRSwhen running under Xen
All now queued up, thanks.
greg k-h
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel