Commit af227003 authored by Peter Zijlstra's avatar Peter Zijlstra
parent 991625f3
...@@ -73,4 +73,7 @@ void init_ia32_feat_ctl(struct cpuinfo_x86 *c); ...@@ -73,4 +73,7 @@ void init_ia32_feat_ctl(struct cpuinfo_x86 *c);
#else #else
static inline void init_ia32_feat_ctl(struct cpuinfo_x86 *c) {} static inline void init_ia32_feat_ctl(struct cpuinfo_x86 *c) {}
#endif #endif
extern __noendbr void cet_disable(void);
#endif /* _ASM_X86_CPU_H */ #endif /* _ASM_X86_CPU_H */
...@@ -535,6 +535,12 @@ static __always_inline void setup_cet(struct cpuinfo_x86 *c) ...@@ -535,6 +535,12 @@ static __always_inline void setup_cet(struct cpuinfo_x86 *c)
} }
} }
__noendbr void cet_disable(void)
{
if (cpu_feature_enabled(X86_FEATURE_IBT))
wrmsrl(MSR_IA32_S_CET, 0);
}
/* /*
* Some CPU features depend on higher CPUID levels, which may not always * Some CPU features depend on higher CPUID levels, which may not always
* be available due to CPUID level capping or broken virtualization * be available due to CPUID level capping or broken virtualization
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <asm/kexec-bzimage64.h> #include <asm/kexec-bzimage64.h>
#include <asm/setup.h> #include <asm/setup.h>
#include <asm/set_memory.h> #include <asm/set_memory.h>
#include <asm/cpu.h>
#ifdef CONFIG_ACPI #ifdef CONFIG_ACPI
/* /*
...@@ -310,6 +311,7 @@ void machine_kexec(struct kimage *image) ...@@ -310,6 +311,7 @@ void machine_kexec(struct kimage *image)
/* Interrupts aren't acceptable while we reboot */ /* Interrupts aren't acceptable while we reboot */
local_irq_disable(); local_irq_disable();
hw_breakpoint_disable(); hw_breakpoint_disable();
cet_disable();
if (image->preserve_context) { if (image->preserve_context) {
#ifdef CONFIG_X86_IO_APIC #ifdef CONFIG_X86_IO_APIC
...@@ -325,7 +327,7 @@ void machine_kexec(struct kimage *image) ...@@ -325,7 +327,7 @@ void machine_kexec(struct kimage *image)
} }
control_page = page_address(image->control_code_page) + PAGE_SIZE; control_page = page_address(image->control_code_page) + PAGE_SIZE;
memcpy(control_page, relocate_kernel, KEXEC_CONTROL_CODE_MAX_SIZE); __memcpy(control_page, relocate_kernel, KEXEC_CONTROL_CODE_MAX_SIZE);
page_list[PA_CONTROL_PAGE] = virt_to_phys(control_page); page_list[PA_CONTROL_PAGE] = virt_to_phys(control_page);
page_list[VA_CONTROL_PAGE] = (unsigned long)control_page; page_list[VA_CONTROL_PAGE] = (unsigned long)control_page;
......
...@@ -114,6 +114,14 @@ SYM_CODE_START_LOCAL_NOALIGN(identity_mapped) ...@@ -114,6 +114,14 @@ SYM_CODE_START_LOCAL_NOALIGN(identity_mapped)
/* store the start address on the stack */ /* store the start address on the stack */
pushq %rdx pushq %rdx
/*
* Clear X86_CR4_CET (if it was set) such that we can clear CR0_WP
* below.
*/
movq %cr4, %rax
andq $~(X86_CR4_CET), %rax
movq %rax, %cr4
/* /*
* Set cr0 to a known state: * Set cr0 to a known state:
* - Paging enabled * - Paging enabled
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment