* [PATCH 0/3] x86/bugs: Some SRSO fixes
@ 2023-08-09 10:26 Borislav Petkov
2023-08-09 10:26 ` [PATCH 1/3] Documentation/hw-vuln: Unify filename specification in index Borislav Petkov
` (3 more replies)
0 siblings, 4 replies; 14+ messages in thread
From: Borislav Petkov @ 2023-08-09 10:26 UTC (permalink / raw)
To: X86 ML; +Cc: Greg Kroah-Hartman, LKML
From: "Borislav Petkov (AMD)" <bp@alien8.de>
Hi all,
those are the leftover smaller fixes which can go after the release
date. I'll queue them next week.
Thx.
Borislav Petkov (AMD) (3):
Documentation/hw-vuln: Unify filename specification in index
driver core: cpu: Unify redundant silly stubs
Documentation/srso: Document IBPB aspect and fix formatting
Documentation/admin-guide/hw-vuln/index.rst | 12 +--
Documentation/admin-guide/hw-vuln/srso.rst | 71 ++++++++++-------
drivers/base/cpu.c | 86 +++++----------------
3 files changed, 68 insertions(+), 101 deletions(-)
--
2.41.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/3] Documentation/hw-vuln: Unify filename specification in index
2023-08-09 10:26 [PATCH 0/3] x86/bugs: Some SRSO fixes Borislav Petkov
@ 2023-08-09 10:26 ` Borislav Petkov
2023-08-09 21:32 ` Pawan Gupta
2023-08-10 9:11 ` [tip: x86/bugs] " tip-bot2 for Borislav Petkov (AMD)
2023-08-09 10:26 ` [PATCH 2/3] driver core: cpu: Unify redundant silly stubs Borislav Petkov
` (2 subsequent siblings)
3 siblings, 2 replies; 14+ messages in thread
From: Borislav Petkov @ 2023-08-09 10:26 UTC (permalink / raw)
To: X86 ML; +Cc: Greg Kroah-Hartman, LKML, Linus Torvalds
From: "Borislav Petkov (AMD)" <bp@alien8.de>
Most of the index.rst files in Documentation/ refer to other rst files
without their file extension in the name. Do that here too.
No functional changes.
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
---
Documentation/admin-guide/hw-vuln/index.rst | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/Documentation/admin-guide/hw-vuln/index.rst b/Documentation/admin-guide/hw-vuln/index.rst
index a7d37e124831..aeee8bff5f82 100644
--- a/Documentation/admin-guide/hw-vuln/index.rst
+++ b/Documentation/admin-guide/hw-vuln/index.rst
@@ -13,11 +13,11 @@ are configurable at compile, boot or run time.
l1tf
mds
tsx_async_abort
- multihit.rst
- special-register-buffer-data-sampling.rst
- core-scheduling.rst
- l1d_flush.rst
- processor_mmio_stale_data.rst
- cross-thread-rsb.rst
+ multihit
+ special-register-buffer-data-sampling
+ core-scheduling
+ l1d_flush
+ processor_mmio_stale_data
+ cross-thread-rsb
srso
gather_data_sampling.rst
--
2.41.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 2/3] driver core: cpu: Unify redundant silly stubs
2023-08-09 10:26 [PATCH 0/3] x86/bugs: Some SRSO fixes Borislav Petkov
2023-08-09 10:26 ` [PATCH 1/3] Documentation/hw-vuln: Unify filename specification in index Borislav Petkov
@ 2023-08-09 10:26 ` Borislav Petkov
2023-08-09 10:56 ` Nikolay Borisov
` (2 more replies)
2023-08-09 10:27 ` [PATCH 3/3] Documentation/srso: Document IBPB aspect and fix formatting Borislav Petkov
2023-08-09 11:11 ` [PATCH 0/3] x86/bugs: Some SRSO fixes Greg Kroah-Hartman
3 siblings, 3 replies; 14+ messages in thread
From: Borislav Petkov @ 2023-08-09 10:26 UTC (permalink / raw)
To: X86 ML; +Cc: Greg Kroah-Hartman, LKML, Linus Torvalds
From: "Borislav Petkov (AMD)" <bp@alien8.de>
Make them all a weak function, aliasing to a single function which
issues the "Not affected" string.
No functional changes.
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
---
drivers/base/cpu.c | 86 ++++++++++------------------------------------
1 file changed, 18 insertions(+), 68 deletions(-)
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 52df435eecf8..971771347aa6 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -509,79 +509,29 @@ static void __init cpu_dev_register_generic(void)
}
#ifdef CONFIG_GENERIC_CPU_VULNERABILITIES
-
-ssize_t __weak cpu_show_meltdown(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- return sysfs_emit(buf, "Not affected\n");
-}
-
-ssize_t __weak cpu_show_spectre_v1(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- return sysfs_emit(buf, "Not affected\n");
-}
-
-ssize_t __weak cpu_show_spectre_v2(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- return sysfs_emit(buf, "Not affected\n");
-}
-
-ssize_t __weak cpu_show_spec_store_bypass(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- return sysfs_emit(buf, "Not affected\n");
-}
-
-ssize_t __weak cpu_show_l1tf(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- return sysfs_emit(buf, "Not affected\n");
-}
-
-ssize_t __weak cpu_show_mds(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- return sysfs_emit(buf, "Not affected\n");
-}
-
-ssize_t __weak cpu_show_tsx_async_abort(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- return sysfs_emit(buf, "Not affected\n");
-}
-
-ssize_t __weak cpu_show_itlb_multihit(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- return sysfs_emit(buf, "Not affected\n");
-}
-
-ssize_t __weak cpu_show_srbds(struct device *dev,
+ssize_t cpu_show_not_affected(struct device *dev,
struct device_attribute *attr, char *buf)
{
return sysfs_emit(buf, "Not affected\n");
}
-ssize_t __weak cpu_show_mmio_stale_data(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- return sysfs_emit(buf, "Not affected\n");
-}
-
-ssize_t __weak cpu_show_retbleed(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- return sysfs_emit(buf, "Not affected\n");
-}
-
-ssize_t __weak cpu_show_spec_rstack_overflow(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- return sysfs_emit(buf, "Not affected\n");
-}
+#define CPU_VULN_FALLBACK(func) \
+ ssize_t cpu_show_##func(struct device *, \
+ struct device_attribute *, char *) \
+ __attribute__((weak, alias("cpu_show_not_affected")))
+
+CPU_VULN_FALLBACK(meltdown);
+CPU_VULN_FALLBACK(spectre_v1);
+CPU_VULN_FALLBACK(spectre_v2);
+CPU_VULN_FALLBACK(spec_store_bypass);
+CPU_VULN_FALLBACK(l1tf);
+CPU_VULN_FALLBACK(mds);
+CPU_VULN_FALLBACK(tsx_async_abort);
+CPU_VULN_FALLBACK(itlb_multihit);
+CPU_VULN_FALLBACK(srbds);
+CPU_VULN_FALLBACK(mmio_stale_data);
+CPU_VULN_FALLBACK(retbleed);
+CPU_VULN_FALLBACK(spec_rstack_overflow);
ssize_t __weak cpu_show_gds(struct device *dev,
struct device_attribute *attr, char *buf)
--
2.41.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 3/3] Documentation/srso: Document IBPB aspect and fix formatting
2023-08-09 10:26 [PATCH 0/3] x86/bugs: Some SRSO fixes Borislav Petkov
2023-08-09 10:26 ` [PATCH 1/3] Documentation/hw-vuln: Unify filename specification in index Borislav Petkov
2023-08-09 10:26 ` [PATCH 2/3] driver core: cpu: Unify redundant silly stubs Borislav Petkov
@ 2023-08-09 10:27 ` Borislav Petkov
2023-08-09 22:03 ` Pawan Gupta
2023-08-10 9:11 ` [tip: x86/bugs] " tip-bot2 for Borislav Petkov (AMD)
2023-08-09 11:11 ` [PATCH 0/3] x86/bugs: Some SRSO fixes Greg Kroah-Hartman
3 siblings, 2 replies; 14+ messages in thread
From: Borislav Petkov @ 2023-08-09 10:27 UTC (permalink / raw)
To: X86 ML; +Cc: Greg Kroah-Hartman, LKML
From: "Borislav Petkov (AMD)" <bp@alien8.de>
Add a note about the dependency of the User->User mitigation on the
previous Spectre v2 IBPB selection.
Make the layout moar pretty.
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
---
Documentation/admin-guide/hw-vuln/srso.rst | 71 ++++++++++++++--------
1 file changed, 44 insertions(+), 27 deletions(-)
diff --git a/Documentation/admin-guide/hw-vuln/srso.rst b/Documentation/admin-guide/hw-vuln/srso.rst
index 32eb5e6db272..af59a9395662 100644
--- a/Documentation/admin-guide/hw-vuln/srso.rst
+++ b/Documentation/admin-guide/hw-vuln/srso.rst
@@ -42,42 +42,59 @@ The sysfs file showing SRSO mitigation status is:
The possible values in this file are:
- - 'Not affected' The processor is not vulnerable
+ * 'Not affected':
- - 'Vulnerable: no microcode' The processor is vulnerable, no
- microcode extending IBPB functionality
- to address the vulnerability has been
- applied.
+ The processor is not vulnerable
- - 'Mitigation: microcode' Extended IBPB functionality microcode
- patch has been applied. It does not
- address User->Kernel and Guest->Host
- transitions protection but it does
- address User->User and VM->VM attack
- vectors.
+ * 'Vulnerable: no microcode':
- (spec_rstack_overflow=microcode)
+ The processor is vulnerable, no microcode extending IBPB
+ functionality to address the vulnerability has been applied.
- - 'Mitigation: safe RET' Software-only mitigation. It complements
- the extended IBPB microcode patch
- functionality by addressing User->Kernel
- and Guest->Host transitions protection.
+ * 'Mitigation: microcode':
- Selected by default or by
- spec_rstack_overflow=safe-ret
+ Extended IBPB functionality microcode patch has been applied. It does
+ not address User->Kernel and Guest->Host transitions protection but it
+ does address User->User and VM->VM attack vectors.
- - 'Mitigation: IBPB' Similar protection as "safe RET" above
- but employs an IBPB barrier on privilege
- domain crossings (User->Kernel,
- Guest->Host).
+ Note that User->User mitigation is controlled by how the IBPB aspect in
+ the Spectre v2 mitigation is selected:
- (spec_rstack_overflow=ibpb)
+ * conditional IBPB:
+
+ where each process can select whether it needs an IBPB issued
+ around it PR_SPEC_DISABLE/_ENABLE etc, see :doc:`spectre`
+
+ * strict:
+
+ i.e., always on - by supplying spectre_v2_user=on on the kernel
+ command line
+
+ (spec_rstack_overflow=microcode)
+
+ * 'Mitigation: safe RET':
+
+ Software-only mitigation. It complements the extended IBPB microcode
+ patch functionality by addressing User->Kernel and Guest->Host
+ transitions protection.
+
+ Selected by default or by spec_rstack_overflow=safe-ret
+
+ * 'Mitigation: IBPB':
+
+ Similar protection as "safe RET" above but employs an IBPB barrier on
+ privilege domain crossings (User->Kernel, Guest->Host).
+
+ (spec_rstack_overflow=ibpb)
+
+ * 'Mitigation: IBPB on VMEXIT':
+
+ Mitigation addressing the cloud provider scenario - the Guest->Host
+ transitions only.
+
+ (spec_rstack_overflow=ibpb-vmexit)
- - 'Mitigation: IBPB on VMEXIT' Mitigation addressing the cloud provider
- scenario - the Guest->Host transitions
- only.
- (spec_rstack_overflow=ibpb-vmexit)
In order to exploit vulnerability, an attacker needs to:
--
2.41.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/3] driver core: cpu: Unify redundant silly stubs
2023-08-09 10:26 ` [PATCH 2/3] driver core: cpu: Unify redundant silly stubs Borislav Petkov
@ 2023-08-09 10:56 ` Nikolay Borisov
2023-08-09 21:47 ` Pawan Gupta
2023-08-10 9:11 ` [tip: x86/bugs] " tip-bot2 for Borislav Petkov (AMD)
2 siblings, 0 replies; 14+ messages in thread
From: Nikolay Borisov @ 2023-08-09 10:56 UTC (permalink / raw)
To: Borislav Petkov, X86 ML; +Cc: Greg Kroah-Hartman, LKML, Linus Torvalds
On 9.08.23 г. 13:26 ч., Borislav Petkov wrote:
> From: "Borislav Petkov (AMD)" <bp@alien8.de>
>
> Make them all a weak function, aliasing to a single function which
> issues the "Not affected" string.
>
> No functional changes.
>
> Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Nikolay Borisov <nik.borisov@suse.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 0/3] x86/bugs: Some SRSO fixes
2023-08-09 10:26 [PATCH 0/3] x86/bugs: Some SRSO fixes Borislav Petkov
` (2 preceding siblings ...)
2023-08-09 10:27 ` [PATCH 3/3] Documentation/srso: Document IBPB aspect and fix formatting Borislav Petkov
@ 2023-08-09 11:11 ` Greg Kroah-Hartman
3 siblings, 0 replies; 14+ messages in thread
From: Greg Kroah-Hartman @ 2023-08-09 11:11 UTC (permalink / raw)
To: Borislav Petkov; +Cc: X86 ML, LKML
On Wed, Aug 09, 2023 at 12:26:57PM +0200, Borislav Petkov wrote:
> From: "Borislav Petkov (AMD)" <bp@alien8.de>
>
> Hi all,
>
> those are the leftover smaller fixes which can go after the release
> date. I'll queue them next week.
>
> Thx.
>
> Borislav Petkov (AMD) (3):
> Documentation/hw-vuln: Unify filename specification in index
> driver core: cpu: Unify redundant silly stubs
> Documentation/srso: Document IBPB aspect and fix formatting
>
> Documentation/admin-guide/hw-vuln/index.rst | 12 +--
> Documentation/admin-guide/hw-vuln/srso.rst | 71 ++++++++++-------
> drivers/base/cpu.c | 86 +++++----------------
> 3 files changed, 68 insertions(+), 101 deletions(-)
>
> --
> 2.41.0
>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/3] Documentation/hw-vuln: Unify filename specification in index
2023-08-09 10:26 ` [PATCH 1/3] Documentation/hw-vuln: Unify filename specification in index Borislav Petkov
@ 2023-08-09 21:32 ` Pawan Gupta
2023-08-09 22:00 ` Borislav Petkov
2023-08-10 9:11 ` [tip: x86/bugs] " tip-bot2 for Borislav Petkov (AMD)
1 sibling, 1 reply; 14+ messages in thread
From: Pawan Gupta @ 2023-08-09 21:32 UTC (permalink / raw)
To: Borislav Petkov; +Cc: X86 ML, Greg Kroah-Hartman, LKML, Linus Torvalds
On Wed, Aug 09, 2023 at 12:26:58PM +0200, Borislav Petkov wrote:
> From: "Borislav Petkov (AMD)" <bp@alien8.de>
>
> Most of the index.rst files in Documentation/ refer to other rst files
> without their file extension in the name. Do that here too.
>
> No functional changes.
>
> Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
> ---
> Documentation/admin-guide/hw-vuln/index.rst | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/Documentation/admin-guide/hw-vuln/index.rst b/Documentation/admin-guide/hw-vuln/index.rst
> index a7d37e124831..aeee8bff5f82 100644
> --- a/Documentation/admin-guide/hw-vuln/index.rst
> +++ b/Documentation/admin-guide/hw-vuln/index.rst
> @@ -13,11 +13,11 @@ are configurable at compile, boot or run time.
> l1tf
> mds
> tsx_async_abort
> - multihit.rst
> - special-register-buffer-data-sampling.rst
> - core-scheduling.rst
> - l1d_flush.rst
> - processor_mmio_stale_data.rst
> - cross-thread-rsb.rst
> + multihit
> + special-register-buffer-data-sampling
> + core-scheduling
> + l1d_flush
> + processor_mmio_stale_data
> + cross-thread-rsb
> srso
> gather_data_sampling.rst
While at it could you please also change this? Else, I will send another
patch.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/3] driver core: cpu: Unify redundant silly stubs
2023-08-09 10:26 ` [PATCH 2/3] driver core: cpu: Unify redundant silly stubs Borislav Petkov
2023-08-09 10:56 ` Nikolay Borisov
@ 2023-08-09 21:47 ` Pawan Gupta
2023-08-09 22:01 ` Borislav Petkov
2023-08-10 9:11 ` [tip: x86/bugs] " tip-bot2 for Borislav Petkov (AMD)
2 siblings, 1 reply; 14+ messages in thread
From: Pawan Gupta @ 2023-08-09 21:47 UTC (permalink / raw)
To: Borislav Petkov; +Cc: X86 ML, Greg Kroah-Hartman, LKML, Linus Torvalds
On Wed, Aug 09, 2023 at 12:26:59PM +0200, Borislav Petkov wrote:
> From: "Borislav Petkov (AMD)" <bp@alien8.de>
>
> Make them all a weak function, aliasing to a single function which
> issues the "Not affected" string.
>
> No functional changes.
>
> Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
> ---
> drivers/base/cpu.c | 86 ++++++++++------------------------------------
> 1 file changed, 18 insertions(+), 68 deletions(-)
>
> diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
> index 52df435eecf8..971771347aa6 100644
> --- a/drivers/base/cpu.c
> +++ b/drivers/base/cpu.c
> @@ -509,79 +509,29 @@ static void __init cpu_dev_register_generic(void)
> }
>
> #ifdef CONFIG_GENERIC_CPU_VULNERABILITIES
> -
> -ssize_t __weak cpu_show_meltdown(struct device *dev,
> - struct device_attribute *attr, char *buf)
> -{
> - return sysfs_emit(buf, "Not affected\n");
> -}
> -
> -ssize_t __weak cpu_show_spectre_v1(struct device *dev,
> - struct device_attribute *attr, char *buf)
> -{
> - return sysfs_emit(buf, "Not affected\n");
> -}
> -
> -ssize_t __weak cpu_show_spectre_v2(struct device *dev,
> - struct device_attribute *attr, char *buf)
> -{
> - return sysfs_emit(buf, "Not affected\n");
> -}
> -
> -ssize_t __weak cpu_show_spec_store_bypass(struct device *dev,
> - struct device_attribute *attr, char *buf)
> -{
> - return sysfs_emit(buf, "Not affected\n");
> -}
> -
> -ssize_t __weak cpu_show_l1tf(struct device *dev,
> - struct device_attribute *attr, char *buf)
> -{
> - return sysfs_emit(buf, "Not affected\n");
> -}
> -
> -ssize_t __weak cpu_show_mds(struct device *dev,
> - struct device_attribute *attr, char *buf)
> -{
> - return sysfs_emit(buf, "Not affected\n");
> -}
> -
> -ssize_t __weak cpu_show_tsx_async_abort(struct device *dev,
> - struct device_attribute *attr,
> - char *buf)
> -{
> - return sysfs_emit(buf, "Not affected\n");
> -}
> -
> -ssize_t __weak cpu_show_itlb_multihit(struct device *dev,
> - struct device_attribute *attr, char *buf)
> -{
> - return sysfs_emit(buf, "Not affected\n");
> -}
> -
> -ssize_t __weak cpu_show_srbds(struct device *dev,
> +ssize_t cpu_show_not_affected(struct device *dev,
> struct device_attribute *attr, char *buf)
> {
> return sysfs_emit(buf, "Not affected\n");
> }
>
> -ssize_t __weak cpu_show_mmio_stale_data(struct device *dev,
> - struct device_attribute *attr, char *buf)
> -{
> - return sysfs_emit(buf, "Not affected\n");
> -}
> -
> -ssize_t __weak cpu_show_retbleed(struct device *dev,
> - struct device_attribute *attr, char *buf)
> -{
> - return sysfs_emit(buf, "Not affected\n");
> -}
> -
> -ssize_t __weak cpu_show_spec_rstack_overflow(struct device *dev,
> - struct device_attribute *attr, char *buf)
> -{
> - return sysfs_emit(buf, "Not affected\n");
> -}
> +#define CPU_VULN_FALLBACK(func) \
Nit, its not actually a vulnerability fallback, does
CPU_SHOW_VULN_FALLBACK() sound better?
> + ssize_t cpu_show_##func(struct device *, \
> + struct device_attribute *, char *) \
> + __attribute__((weak, alias("cpu_show_not_affected")))
> +
> +CPU_VULN_FALLBACK(meltdown);
> +CPU_VULN_FALLBACK(spectre_v1);
> +CPU_VULN_FALLBACK(spectre_v2);
> +CPU_VULN_FALLBACK(spec_store_bypass);
> +CPU_VULN_FALLBACK(l1tf);
> +CPU_VULN_FALLBACK(mds);
> +CPU_VULN_FALLBACK(tsx_async_abort);
> +CPU_VULN_FALLBACK(itlb_multihit);
> +CPU_VULN_FALLBACK(srbds);
> +CPU_VULN_FALLBACK(mmio_stale_data);
> +CPU_VULN_FALLBACK(retbleed);
> +CPU_VULN_FALLBACK(spec_rstack_overflow);
>
> ssize_t __weak cpu_show_gds(struct device *dev,
> struct device_attribute *attr, char *buf)
Do you want me to send a separate patch for this?
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/3] Documentation/hw-vuln: Unify filename specification in index
2023-08-09 21:32 ` Pawan Gupta
@ 2023-08-09 22:00 ` Borislav Petkov
0 siblings, 0 replies; 14+ messages in thread
From: Borislav Petkov @ 2023-08-09 22:00 UTC (permalink / raw)
To: Pawan Gupta; +Cc: X86 ML, Greg Kroah-Hartman, LKML, Linus Torvalds
On Wed, Aug 09, 2023 at 02:32:14PM -0700, Pawan Gupta wrote:
> While at it could you please also change this?
Yes, I can.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/3] driver core: cpu: Unify redundant silly stubs
2023-08-09 21:47 ` Pawan Gupta
@ 2023-08-09 22:01 ` Borislav Petkov
0 siblings, 0 replies; 14+ messages in thread
From: Borislav Petkov @ 2023-08-09 22:01 UTC (permalink / raw)
To: Pawan Gupta; +Cc: X86 ML, Greg Kroah-Hartman, LKML, Linus Torvalds
On Wed, Aug 09, 2023 at 02:47:41PM -0700, Pawan Gupta wrote:
> Do you want me to send a separate patch for this?
No need - I'll fix it up.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/3] Documentation/srso: Document IBPB aspect and fix formatting
2023-08-09 10:27 ` [PATCH 3/3] Documentation/srso: Document IBPB aspect and fix formatting Borislav Petkov
@ 2023-08-09 22:03 ` Pawan Gupta
2023-08-10 9:11 ` [tip: x86/bugs] " tip-bot2 for Borislav Petkov (AMD)
1 sibling, 0 replies; 14+ messages in thread
From: Pawan Gupta @ 2023-08-09 22:03 UTC (permalink / raw)
To: Borislav Petkov; +Cc: X86 ML, Greg Kroah-Hartman, LKML
On Wed, Aug 09, 2023 at 12:27:00PM +0200, Borislav Petkov wrote:
> From: "Borislav Petkov (AMD)" <bp@alien8.de>
>
> Add a note about the dependency of the User->User mitigation on the
> previous Spectre v2 IBPB selection.
>
> Make the layout moar pretty.
>
> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
> ---
> Documentation/admin-guide/hw-vuln/srso.rst | 71 ++++++++++++++--------
> 1 file changed, 44 insertions(+), 27 deletions(-)
>
> diff --git a/Documentation/admin-guide/hw-vuln/srso.rst b/Documentation/admin-guide/hw-vuln/srso.rst
> index 32eb5e6db272..af59a9395662 100644
> --- a/Documentation/admin-guide/hw-vuln/srso.rst
> +++ b/Documentation/admin-guide/hw-vuln/srso.rst
> @@ -42,42 +42,59 @@ The sysfs file showing SRSO mitigation status is:
>
> The possible values in this file are:
>
> - - 'Not affected' The processor is not vulnerable
> + * 'Not affected':
>
> - - 'Vulnerable: no microcode' The processor is vulnerable, no
> - microcode extending IBPB functionality
> - to address the vulnerability has been
> - applied.
> + The processor is not vulnerable
>
> - - 'Mitigation: microcode' Extended IBPB functionality microcode
> - patch has been applied. It does not
> - address User->Kernel and Guest->Host
> - transitions protection but it does
> - address User->User and VM->VM attack
> - vectors.
> + * 'Vulnerable: no microcode':
All other mitigations capitalizes the first letter, to be consistent
s/no microcode/No microcode/
> - (spec_rstack_overflow=microcode)
> + The processor is vulnerable, no microcode extending IBPB
> + functionality to address the vulnerability has been applied.
>
> - - 'Mitigation: safe RET' Software-only mitigation. It complements
> - the extended IBPB microcode patch
> - functionality by addressing User->Kernel
> - and Guest->Host transitions protection.
> + * 'Mitigation: microcode':
Ditto.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [tip: x86/bugs] Documentation/srso: Document IBPB aspect and fix formatting
2023-08-09 10:27 ` [PATCH 3/3] Documentation/srso: Document IBPB aspect and fix formatting Borislav Petkov
2023-08-09 22:03 ` Pawan Gupta
@ 2023-08-10 9:11 ` tip-bot2 for Borislav Petkov (AMD)
1 sibling, 0 replies; 14+ messages in thread
From: tip-bot2 for Borislav Petkov (AMD) @ 2023-08-10 9:11 UTC (permalink / raw)
To: linux-tip-commits
Cc: Borislav Petkov (AMD), Greg Kroah-Hartman, x86, linux-kernel
The following commit has been merged into the x86/bugs branch of tip:
Commit-ID: 09f9f37c324d90102e8574856ab168c34de1916d
Gitweb: https://git.kernel.org/tip/09f9f37c324d90102e8574856ab168c34de1916d
Author: Borislav Petkov (AMD) <bp@alien8.de>
AuthorDate: Wed, 02 Aug 2023 20:07:32 +02:00
Committer: Borislav Petkov (AMD) <bp@alien8.de>
CommitterDate: Thu, 10 Aug 2023 11:03:12 +02:00
Documentation/srso: Document IBPB aspect and fix formatting
Add a note about the dependency of the User->User mitigation on the
previous Spectre v2 IBPB selection.
Make the layout moar pretty.
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20230809102700.29449-4-bp@alien8.de
---
Documentation/admin-guide/hw-vuln/srso.rst | 71 +++++++++++++--------
1 file changed, 44 insertions(+), 27 deletions(-)
diff --git a/Documentation/admin-guide/hw-vuln/srso.rst b/Documentation/admin-guide/hw-vuln/srso.rst
index 32eb5e6..af59a93 100644
--- a/Documentation/admin-guide/hw-vuln/srso.rst
+++ b/Documentation/admin-guide/hw-vuln/srso.rst
@@ -42,42 +42,59 @@ The sysfs file showing SRSO mitigation status is:
The possible values in this file are:
- - 'Not affected' The processor is not vulnerable
+ * 'Not affected':
- - 'Vulnerable: no microcode' The processor is vulnerable, no
- microcode extending IBPB functionality
- to address the vulnerability has been
- applied.
+ The processor is not vulnerable
- - 'Mitigation: microcode' Extended IBPB functionality microcode
- patch has been applied. It does not
- address User->Kernel and Guest->Host
- transitions protection but it does
- address User->User and VM->VM attack
- vectors.
+ * 'Vulnerable: no microcode':
- (spec_rstack_overflow=microcode)
+ The processor is vulnerable, no microcode extending IBPB
+ functionality to address the vulnerability has been applied.
- - 'Mitigation: safe RET' Software-only mitigation. It complements
- the extended IBPB microcode patch
- functionality by addressing User->Kernel
- and Guest->Host transitions protection.
+ * 'Mitigation: microcode':
- Selected by default or by
- spec_rstack_overflow=safe-ret
+ Extended IBPB functionality microcode patch has been applied. It does
+ not address User->Kernel and Guest->Host transitions protection but it
+ does address User->User and VM->VM attack vectors.
- - 'Mitigation: IBPB' Similar protection as "safe RET" above
- but employs an IBPB barrier on privilege
- domain crossings (User->Kernel,
- Guest->Host).
+ Note that User->User mitigation is controlled by how the IBPB aspect in
+ the Spectre v2 mitigation is selected:
- (spec_rstack_overflow=ibpb)
+ * conditional IBPB:
+
+ where each process can select whether it needs an IBPB issued
+ around it PR_SPEC_DISABLE/_ENABLE etc, see :doc:`spectre`
+
+ * strict:
+
+ i.e., always on - by supplying spectre_v2_user=on on the kernel
+ command line
+
+ (spec_rstack_overflow=microcode)
+
+ * 'Mitigation: safe RET':
+
+ Software-only mitigation. It complements the extended IBPB microcode
+ patch functionality by addressing User->Kernel and Guest->Host
+ transitions protection.
+
+ Selected by default or by spec_rstack_overflow=safe-ret
+
+ * 'Mitigation: IBPB':
+
+ Similar protection as "safe RET" above but employs an IBPB barrier on
+ privilege domain crossings (User->Kernel, Guest->Host).
+
+ (spec_rstack_overflow=ibpb)
+
+ * 'Mitigation: IBPB on VMEXIT':
+
+ Mitigation addressing the cloud provider scenario - the Guest->Host
+ transitions only.
+
+ (spec_rstack_overflow=ibpb-vmexit)
- - 'Mitigation: IBPB on VMEXIT' Mitigation addressing the cloud provider
- scenario - the Guest->Host transitions
- only.
- (spec_rstack_overflow=ibpb-vmexit)
In order to exploit vulnerability, an attacker needs to:
^ permalink raw reply [flat|nested] 14+ messages in thread
* [tip: x86/bugs] driver core: cpu: Unify redundant silly stubs
2023-08-09 10:26 ` [PATCH 2/3] driver core: cpu: Unify redundant silly stubs Borislav Petkov
2023-08-09 10:56 ` Nikolay Borisov
2023-08-09 21:47 ` Pawan Gupta
@ 2023-08-10 9:11 ` tip-bot2 for Borislav Petkov (AMD)
2 siblings, 0 replies; 14+ messages in thread
From: tip-bot2 for Borislav Petkov (AMD) @ 2023-08-10 9:11 UTC (permalink / raw)
To: linux-tip-commits
Cc: Linus Torvalds, Borislav Petkov (AMD),
Greg Kroah-Hartman, Nikolay Borisov, x86, linux-kernel
The following commit has been merged into the x86/bugs branch of tip:
Commit-ID: 0fddfe338210aa018137c03030c581f5ea4be282
Gitweb: https://git.kernel.org/tip/0fddfe338210aa018137c03030c581f5ea4be282
Author: Borislav Petkov (AMD) <bp@alien8.de>
AuthorDate: Sat, 29 Jul 2023 17:20:33 +02:00
Committer: Borislav Petkov (AMD) <bp@alien8.de>
CommitterDate: Thu, 10 Aug 2023 11:03:04 +02:00
driver core: cpu: Unify redundant silly stubs
Make them all a weak function, aliasing to a single function which
issues the "Not affected" string.
No functional changes.
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Nikolay Borisov <nik.borisov@suse.com>
Link: https://lore.kernel.org/r/20230809102700.29449-3-bp@alien8.de
---
drivers/base/cpu.c | 87 +++++++++------------------------------------
1 file changed, 19 insertions(+), 68 deletions(-)
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 52df435..054c81b 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -509,79 +509,30 @@ static void __init cpu_dev_register_generic(void)
}
#ifdef CONFIG_GENERIC_CPU_VULNERABILITIES
-
-ssize_t __weak cpu_show_meltdown(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- return sysfs_emit(buf, "Not affected\n");
-}
-
-ssize_t __weak cpu_show_spectre_v1(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- return sysfs_emit(buf, "Not affected\n");
-}
-
-ssize_t __weak cpu_show_spectre_v2(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- return sysfs_emit(buf, "Not affected\n");
-}
-
-ssize_t __weak cpu_show_spec_store_bypass(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- return sysfs_emit(buf, "Not affected\n");
-}
-
-ssize_t __weak cpu_show_l1tf(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- return sysfs_emit(buf, "Not affected\n");
-}
-
-ssize_t __weak cpu_show_mds(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- return sysfs_emit(buf, "Not affected\n");
-}
-
-ssize_t __weak cpu_show_tsx_async_abort(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- return sysfs_emit(buf, "Not affected\n");
-}
-
-ssize_t __weak cpu_show_itlb_multihit(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- return sysfs_emit(buf, "Not affected\n");
-}
-
-ssize_t __weak cpu_show_srbds(struct device *dev,
+ssize_t cpu_show_not_affected(struct device *dev,
struct device_attribute *attr, char *buf)
{
return sysfs_emit(buf, "Not affected\n");
}
-ssize_t __weak cpu_show_mmio_stale_data(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- return sysfs_emit(buf, "Not affected\n");
-}
-
-ssize_t __weak cpu_show_retbleed(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- return sysfs_emit(buf, "Not affected\n");
-}
-
-ssize_t __weak cpu_show_spec_rstack_overflow(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- return sysfs_emit(buf, "Not affected\n");
-}
+#define CPU_SHOW_VULN_FALLBACK(func) \
+ ssize_t cpu_show_##func(struct device *, \
+ struct device_attribute *, char *) \
+ __attribute__((weak, alias("cpu_show_not_affected")))
+
+CPU_SHOW_VULN_FALLBACK(meltdown);
+CPU_SHOW_VULN_FALLBACK(spectre_v1);
+CPU_SHOW_VULN_FALLBACK(spectre_v2);
+CPU_SHOW_VULN_FALLBACK(spec_store_bypass);
+CPU_SHOW_VULN_FALLBACK(l1tf);
+CPU_SHOW_VULN_FALLBACK(mds);
+CPU_SHOW_VULN_FALLBACK(tsx_async_abort);
+CPU_SHOW_VULN_FALLBACK(itlb_multihit);
+CPU_SHOW_VULN_FALLBACK(srbds);
+CPU_SHOW_VULN_FALLBACK(mmio_stale_data);
+CPU_SHOW_VULN_FALLBACK(retbleed);
+CPU_SHOW_VULN_FALLBACK(spec_rstack_overflow);
+CPU_SHOW_VULN_FALLBACK(gather_data_sampling);
ssize_t __weak cpu_show_gds(struct device *dev,
struct device_attribute *attr, char *buf)
^ permalink raw reply [flat|nested] 14+ messages in thread
* [tip: x86/bugs] Documentation/hw-vuln: Unify filename specification in index
2023-08-09 10:26 ` [PATCH 1/3] Documentation/hw-vuln: Unify filename specification in index Borislav Petkov
2023-08-09 21:32 ` Pawan Gupta
@ 2023-08-10 9:11 ` tip-bot2 for Borislav Petkov (AMD)
1 sibling, 0 replies; 14+ messages in thread
From: tip-bot2 for Borislav Petkov (AMD) @ 2023-08-10 9:11 UTC (permalink / raw)
To: linux-tip-commits
Cc: Linus Torvalds, Borislav Petkov (AMD),
Greg Kroah-Hartman, x86, linux-kernel
The following commit has been merged into the x86/bugs branch of tip:
Commit-ID: 182ac87070e26d32a01445cec7ca7afa07411468
Gitweb: https://git.kernel.org/tip/182ac87070e26d32a01445cec7ca7afa07411468
Author: Borislav Petkov (AMD) <bp@alien8.de>
AuthorDate: Sat, 29 Jul 2023 16:53:02 +02:00
Committer: Borislav Petkov (AMD) <bp@alien8.de>
CommitterDate: Thu, 10 Aug 2023 10:48:12 +02:00
Documentation/hw-vuln: Unify filename specification in index
Most of the index.rst files in Documentation/ refer to other rst files
without their file extension in the name. Do that here too.
No functional changes.
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20230809102700.29449-2-bp@alien8.de
---
Documentation/admin-guide/hw-vuln/index.rst | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/Documentation/admin-guide/hw-vuln/index.rst b/Documentation/admin-guide/hw-vuln/index.rst
index a7d37e1..de99caa 100644
--- a/Documentation/admin-guide/hw-vuln/index.rst
+++ b/Documentation/admin-guide/hw-vuln/index.rst
@@ -13,11 +13,11 @@ are configurable at compile, boot or run time.
l1tf
mds
tsx_async_abort
- multihit.rst
- special-register-buffer-data-sampling.rst
- core-scheduling.rst
- l1d_flush.rst
- processor_mmio_stale_data.rst
- cross-thread-rsb.rst
+ multihit
+ special-register-buffer-data-sampling
+ core-scheduling
+ l1d_flush
+ processor_mmio_stale_data
+ cross-thread-rsb
srso
- gather_data_sampling.rst
+ gather_data_sampling
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2023-08-10 9:12 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-09 10:26 [PATCH 0/3] x86/bugs: Some SRSO fixes Borislav Petkov
2023-08-09 10:26 ` [PATCH 1/3] Documentation/hw-vuln: Unify filename specification in index Borislav Petkov
2023-08-09 21:32 ` Pawan Gupta
2023-08-09 22:00 ` Borislav Petkov
2023-08-10 9:11 ` [tip: x86/bugs] " tip-bot2 for Borislav Petkov (AMD)
2023-08-09 10:26 ` [PATCH 2/3] driver core: cpu: Unify redundant silly stubs Borislav Petkov
2023-08-09 10:56 ` Nikolay Borisov
2023-08-09 21:47 ` Pawan Gupta
2023-08-09 22:01 ` Borislav Petkov
2023-08-10 9:11 ` [tip: x86/bugs] " tip-bot2 for Borislav Petkov (AMD)
2023-08-09 10:27 ` [PATCH 3/3] Documentation/srso: Document IBPB aspect and fix formatting Borislav Petkov
2023-08-09 22:03 ` Pawan Gupta
2023-08-10 9:11 ` [tip: x86/bugs] " tip-bot2 for Borislav Petkov (AMD)
2023-08-09 11:11 ` [PATCH 0/3] x86/bugs: Some SRSO fixes Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®