Skip to contentSkip to conversation

x86/lam: Disable ADDRESS_MASKING in most cases

PATCH Superseded Pawan Gupta 3 participants 7 messages Jan 19, 2024 x86

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/lam: Disable ADDRESS_MASKING in most cases

Intel feature Linear Address Masking (LAM) has a weakness related to transient execution as described in the SLAM paper[1]. Unless Linear Address Space Separation (LASS) is enabled this weakness may be exploitable.

Until kernel adds support for LASS[2], only allow LAM for COMPILE_TEST, or when speculation mitigations have been disabled at compile time, otherwise keep LAM disabled.

[1] SLAM: https://download.vusec.net/papers/slam_sp24.pdf
[2] LASS: https://lore.kernel.org/lkml/[email protected]/

---
 arch/x86/Kconfig | 1 +
 1 file changed, 1 insertion(+)
arch/x86/Kconfig +1 -0
index 1566748f16c4..794517df8068 100644
@@ -2270,6 +2270,7 @@ config RANDOMIZE_MEMORY_PHYSICAL_PADDING
 config ADDRESS_MASKING
 	bool "Linear Address Masking support"
 	depends on X86_64
+	depends on COMPILE_TEST || !SPECULATION_MITIGATIONS # wait for LASS
 	help
 	  Linear Address Masking (LAM) modifies the checking that is applied
 	  to 64-bit linear addresses, allowing software to use of the

base-commit: 0dd3ee31125508cd67f7e7172247f05b7fd1753a

Signature · 1 line
2.34.1
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Pawan Gupta

Intel feature Linear Address Masking (LAM) has a weakness related to transient execution as described in the SLAM paper[1]. Unless Linear Address Space Separation (LASS) is enabled this weakness may be exploitable.

Until kernel adds support for LASS[2], only allow LAM for COMPILE_TEST, or when speculation mitigations have been disabled at compile time, otherwise keep LAM disabled.

It worth adding that there's no HW on market that supports LAM, so nobody affected by the issue.

Quoted 5 lines

[1] SLAM: https://download.vusec.net/papers/slam_sp24.pdf
[2] LASS: https://lore.kernel.org/lkml/[email protected]/

Signature · 1 line
  Kiryl Shutsemau / Kirill A. Shutemov
#2 lore raw
Quoted 6 lines · On Fri, Jan 19, 2024 at 07:58:28AM +0300, [email protected] wrote:
Quoted 5 lines · Pawan Gupta

Intel feature Linear Address Masking (LAM) has a weakness related to transient execution as described in the SLAM paper[1]. Unless Linear Address Space Separation (LASS) is enabled this weakness may be exploitable.

Quoted 7 lines
Quoted 4 lines

Until kernel adds support for LASS[2], only allow LAM for COMPILE_TEST, or when speculation mitigations have been disabled at compile time, otherwise keep LAM disabled.

It worth adding that there's no HW on market that supports LAM, so nobody affected by the issue.

Right.

Quoted 7 lines
Quoted 5 lines

[1] SLAM: https://download.vusec.net/papers/slam_sp24.pdf
[2] LASS: https://lore.kernel.org/lkml/[email protected]/

Thanks.

#3 lore raw
In reply to Pawan Gupta

Hi Pawan,

arch/x86/Kconfig config RANDOMIZE_MEMORY_PHYSICAL_PADDING · line 2273

Quoted 12 lines · Pawan Gupta
 arch/x86/Kconfig | 1 +
 1 file changed, 1 insertion(+)
arch/x86/Kconfig +1 -0
index 1566748f16c4..794517df8068 100644
@@ -2270,6 +2270,7 @@ config RANDOMIZE_MEMORY_PHYSICAL_PADDING
 config ADDRESS_MASKING
 	bool "Linear Address Masking support"
 	depends on X86_64
+	depends on COMPILE_TEST || !SPECULATION_MITIGATIONS # wait for LASS

I was wondering if the COMPILE_TEST dependency here is a bit redundant.

Having ADDRESS_MASKING depend on just !SPECULATION_MITIGATIONS might be enough to get the LAM code compile tested through various configurations.

I don't have a strong preference here. Mainly looking to understand the reasoning. Other than that the patch looks fine to me.

Sohil

Quoted 3 lines
arch/x86/Kconfig +0 -0
 	help
 	  Linear Address Masking (LAM) modifies the checking that is applied
 	  to 64-bit linear addresses, allowing software to use of the
#4 lore raw
Quoted 18 lines · Sohil Mehta

Hi Pawan,

arch/x86/Kconfig config RANDOMIZE_MEMORY_PHYSICAL_PADDING · line 2273

Quoted 12 lines · Pawan Gupta
 arch/x86/Kconfig | 1 +
 1 file changed, 1 insertion(+)
arch/x86/Kconfig +1 -0
index 1566748f16c4..794517df8068 100644
@@ -2270,6 +2270,7 @@ config RANDOMIZE_MEMORY_PHYSICAL_PADDING
 config ADDRESS_MASKING
 	bool "Linear Address Masking support"
 	depends on X86_64
+	depends on COMPILE_TEST || !SPECULATION_MITIGATIONS # wait for LASS

I was wondering if the COMPILE_TEST dependency here is a bit redundant.

Quoted 5 lines

Having ADDRESS_MASKING depend on just !SPECULATION_MITIGATIONS might be enough to get the LAM code compile tested through various configurations.

I don't have a strong preference here. Mainly looking to understand the reasoning. Other than that the patch looks fine to me.

The goal is to compile test it whenever possible. As SPECULATION_MITIGATIONS are ON by default, it wont get tested for most configuration.

Reviewed-by
#5 lore raw
Quoted 3 lines · Pawan Gupta

The goal is to compile test it whenever possible. As SPECULATION_MITIGATIONS are ON by default, it wont get tested for most configuration.

Sure, that would help increase the compile coverage. I wasn't sure how much of a difference it would make. Anyways, the restriction is expected to be short lived until LASS is available.

Please feel free to add:

#6 lore raw
Quoted 9 lines · Sohil Mehta
Quoted 3 lines · Pawan Gupta

The goal is to compile test it whenever possible. As SPECULATION_MITIGATIONS are ON by default, it wont get tested for most configuration.

Sure, that would help increase the compile coverage. I wasn't sure how much of a difference it would make. Anyways, the restriction is expected to be short lived until LASS is available.

True.

Quoted 2 lines

Please feel free to add:

Thanks