linux-stable/arch/x86
Kirill A. Shutemov a8e8c79ed2 x86/tdx: Preserve shared bit on mprotect()
commit a0a8d15a79 upstream.

The TDX guest platform takes one bit from the physical address to
indicate if the page is shared (accessible by VMM). This bit is not part
of the physical_mask and is not preserved during mprotect(). As a
result, the 'shared' bit is lost during mprotect() on shared mappings.

_COMMON_PAGE_CHG_MASK specifies which PTE bits need to be preserved
during modification. AMD includes 'sme_me_mask' in the define to
preserve the 'encrypt' bit.

To cover both Intel and AMD cases, include 'cc_mask' in
_COMMON_PAGE_CHG_MASK instead of 'sme_me_mask'.

Reported-and-tested-by: Chris Oo <cho@microsoft.com>

Fixes: 41394e33f3 ("x86/tdx: Extend the confidential computing API to support TDX guests")
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Reviewed-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/all/20240424082035.4092071-1-kirill.shutemov%40linux.intel.com
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-05-02 16:29:30 +02:00
..
boot x86/efistub: Remap kernel text read-only before dropping NX attribute 2024-04-27 17:07:07 +02:00
coco x86/coco: Require seeding RNG with RDRAND on CoCo systems 2024-04-10 16:28:33 +02:00
configs
crypto crypto: x86/sha - load modules based on CPU features 2023-11-28 17:07:07 +00:00
entry x86/bhi: Add support for clearing branch history at syscall entry 2024-04-10 16:28:35 +02:00
events perf/x86: Fix out of range data 2024-04-17 11:18:27 +02:00
hyperv x86/hyperv: Fix the detection of E820_TYPE_PRAM in a Gen2 VM 2023-12-20 17:00:21 +01:00
ia32
include x86/tdx: Preserve shared bit on mprotect() 2024-05-02 16:29:30 +02:00
kernel x86/cpu: Fix check for RDPKRU in __show_regs() 2024-05-02 16:29:27 +02:00
kvm KVM: x86/pmu: Do not mask LVTPC when handling a PMI on AMD platforms 2024-04-27 17:07:16 +02:00
lib x86/retpoline: Add NOENDBR annotation to the SRSO dummy return thunk 2024-04-10 16:28:32 +02:00
math-emu
mm x86/sme: Move early SME kernel encryption handling into .head.text 2024-04-27 17:07:07 +02:00
net x86/returnthunk: Allow different return thunks 2024-03-01 13:26:33 +01:00
pci x86/pci/xen: populate MSI sysfs entries 2023-05-30 14:03:22 +01:00
platform x86/efi: Make efi_set_virtual_address_map IBT safe 2023-07-19 16:21:45 +02:00
power x86/pm: Add enumeration check before spec MSRs save/restore setup 2022-11-21 14:16:16 +01:00
purgatory x86/purgatory: Remove LTO flags 2023-09-23 11:11:09 +02:00
ras
realmode x86/boot: Skip realmode init code when running as Xen PV guest 2022-12-31 13:32:16 +01:00
tools x86, relocs: Ignore relocations in .notes section 2024-03-26 18:20:39 -04:00
um x86: um: vdso: Add '%rcx' and '%r11' to the syscall clobber list 2023-03-11 13:55:22 +01:00
video
virt/vmx/tdx
xen x86/xen: Add some null pointer checking to smp.c 2024-03-26 18:20:24 -04:00
.gitignore
Kbuild
Kconfig cpu: Re-enable CPU mitigations by default for !X86 architectures 2024-05-02 16:29:28 +02:00
Kconfig.assembler
Kconfig.cpu x86/Kconfig: Transmeta Crusoe is CPU family 5, not 6 2024-02-23 09:12:43 +01:00
Kconfig.debug
Makefile x86/build: Move '-mindirect-branch-cs-prefix' out of GCC-only block 2023-02-09 11:28:13 +01:00
Makefile.um um: Only disable SSE on clang to work around old GCC bugs 2023-05-01 08:26:27 +09:00
Makefile_32.cpu