Introduce support for guest CET feature
Subsystems (4)
v14 cover Introduce support for guest CET feature
Control-flow Enforcement Technology (CET) provides protection against Return/Jump-Oriented Programming (ROP/JOP) attack. There're two CET
sub-features: Shadow Stack (SHSTK) and Indirect Branch Tracking (IBT). SHSTK is to prevent ROP programming and IBT is to prevent JOP programming.
Several parts in KVM have been updated to provide VM CET support, including:
CPUID/XSAVES config, MSR pass-through, user space MSR access interface, vmentry/vmexit config, nested VM etc. These patches have dependency on CET kernel patches for xsaves support and CET definitions, e.g., MSR and related feature flags.
CET kernel patches are here:
SHSTK: https://lkml.kernel.org/r/[email protected]/
IBT: https://lkml.kernel.org/r/[email protected]/
CET QEMU patch:
https://patchwork.ozlabs.org/project/qemu-devel/patch/[email protected]/
KVM Unit test:
https://patchwork.kernel.org/project/kvm/patch/[email protected]/
v14:
- Sean refactored v13 patchset then came out v14-rc1, this version is rebased on top of 5.10-rc1 and tested on TGL.
- Fixed a few minor issues found during test, such as nested CET broken, call-trace and guest reboot failure etc.
- Original v14-rc1 is here: https://github.com/sean-jc/linux/tree/vmx/cet.
v13:
- Added CET definitions as a separate patch to facilitate KVM test.
- Disabled CET support in KVM if unrestricted_guest is turned off since in this case CET related instructions/infrastructure cannot be emulated well.
v12:
- Fixed a few issues per Sean and Paolo's review feeback.
- Refactored patches to make them properly arranged.
- Removed unnecessary hard-coded CET states for host/guest.
- Added compile-time assertions for vmcs_field_to_offset_table to detect mismatch of the field type and field encoding number.
- Added a custom MSR MSR_KVM_GUEST_SSP for guest active SSP save/restore.
- Rebased patches to 5.7-rc3.
v11:
- Fixed a guest vmentry failure issue when guest reboots.
- Used vm_xxx_control_{set, clear}bit() to avoid side effect, it'll clear cached data instead of pure VMCS field bits.
- Added vcpu->arch.guest_supported_xss dedidated for guest runtime mask, this avoids supported_xss overwritten issue caused by an old qemu.
- Separated vmentry/vmexit state setting with CR0/CR4 dependency check to make the patch more clear.
- Added CET VMCS states in dump_vmcs() for debugging purpose.
- Other refactor based on testing.
- This patch serial is built on top of below branch and CET kernel patches for seeking xsaves support.
v10:
- Refactored code per Sean's review feedback.
- Added CET support for nested VM.
- Removed fix-patch for CPUID(0xd,N) enumeration as this part is done by Paolo and Sean.
- This new patchset is based on Paolo's queued cpu_caps branch.
- Modified patch per XSAVES related change.
- Consolidated KVM unit-test patch with KVM patches.
v9:
- Refactored msr-check functions per Sean's feedback.
- Fixed a few issues per Sean's suggestion.
- Rebased patch to kernel-v5.4.
- Moved CET CPUID feature bits and CR4.CET to last patch.
v8:
- Addressed Jim and Sean's feedback on: 1) CPUID(0xD,i) enumeration. 2) sanity check when configure guest CET. 3) function improvement.
- Added more sanity check functions.
- Set host vmexit default status so that guest won't leak CET status to host when vmexit.
- Added CR0.WP vs. CR4.CET mutual constrains.
v7:
- Rebased patch to kernel v5.3
- Sean suggested to change CPUID(0xd, n) enumeration code as alined with existing one, and I think it's better to make the fix as an independent patch since XSS MSR are being used widely on X86 platforms.
- Check more host and guest status before configure guest CET
per Sean's feedback.
- Add error-check before guest accesses CET MSRs per Sean's feedback.
- Other minor fixes suggested by Sean.
v6:
- Rebase patch to kernel v5.2.
- Move CPUID(0xD, n>=1) helper to a seperate patch.
- Merge xsave size fix with other patch.
- Other minor fixes per community feedback.
v5:
- Rebase patch to kernel v5.1.
- Wrap CPUID(0xD, n>=1) code to a helper function.
- Pass through MSR_IA32_PL1_SSP and MSR_IA32_PL2_SSP to Guest.
- Add Co-developed-by expression in patch description.
- Refine patch description.
v4:
- Add Sean's patch for loading Guest fpu state before access XSAVES managed CET MSRs.
- Melt down CET bits setting into CPUID configuration patch.
- Add VMX interface to query Host XSS.
- Check Host and Guest XSS support bits before set Guest XSS.
- Make Guest SHSTK and IBT feature enabling independent.
- Do not report CET support to Guest when Host CET feature is Disabled.
v3:
- Modified patches to make Guest CET independent to Host enabling.
- Added patch 8 to add user space access for Guest CET MSR access.
- Modified code comments and patch description to reflect changes.
v2:
- Re-ordered patch sequence, combined one patch.
- Added more description for CET related VMCS fields.
- Added Host CET capability check while enabling Guest CET loading bit.
- Added Host CET capability check while reporting Guest CPUID(EAX=7, EXC=0).
- Modified code in reporting Guest CPUID(EAX=D,ECX>=1), make it clearer.
- Added Host and Guest XSS mask check while setting bits for Guest XSS.
Sean Christopherson (2):
KVM: x86: Report XSS as an MSR to be saved if there are supported features
KVM: x86: Load guest fpu state when accessing MSRs managed by XSAVES
Yang Weijiang (11):
KVM: x86: Refresh CPUID on writes to MSR_IA32_XSS
KVM: x86: Add #CP support in guest exception dispatch
KVM: VMX: Introduce CET VMCS fields and flags
KVM: x86: Add fault checks for CR4.CET
KVM: VMX: Emulate reads and writes to CET MSRs
KVM: VMX: Add a synthetic MSR to allow userspace VMM to access GUEST_SSP
KVM: x86: Report CET MSRs as to-be-saved if CET is supported
KVM: x86: Enable CET virtualization for VMX and advertise CET to userspace
KVM: VMX: Pass through CET MSRs to the guest when supported
KVM: nVMX: Add helper to check the vmcs01 MSR bitmap for MSR pass-through
KVM: nVMX: Enable CET support for nested VMX
arch/x86/include/asm/kvm_host.h | 4 +- arch/x86/include/asm/vmx.h | 8 ++ arch/x86/include/uapi/asm/kvm.h | 1 + arch/x86/include/uapi/asm/kvm_para.h | 1 + arch/x86/kvm/cpuid.c | 26 +++- arch/x86/kvm/vmx/capabilities.h | 5 + arch/x86/kvm/vmx/nested.c | 57 ++++++-- arch/x86/kvm/vmx/vmcs12.c | 6 + arch/x86/kvm/vmx/vmcs12.h | 14 +- arch/x86/kvm/vmx/vmx.c | 207 ++++++++++++++++++++++++++- arch/x86/kvm/x86.c | 56 +++++++- arch/x86/kvm/x86.h | 10 +- 12 files changed, 370 insertions(+), 25 deletions(-)
Signature · 1 line
2.17.2
PATCH v14 1/13 KVM: x86: Report XSS as an MSR to be saved if there are supported features
From: Sean Christopherson <[email protected]>
Add MSR_IA32_XSS to the list of MSRs reported to userspace if supported_xss is non-zero, i.e. KVM supports at least one XSS based feature.
--- arch/x86/kvm/x86.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/x86/kvm/x86.c +6 -0
@@ -1237,6 +1237,8 @@ static const u32 msrs_to_save_all[] = {MSR_ARCH_PERFMON_EVENTSEL0 +12 ,MSR_ARCH_PERFMON_EVENTSEL0 +13 ,MSR_ARCH_PERFMON_EVENTSEL0 +14 ,MSR_ARCH_PERFMON_EVENTSEL0 +15 ,MSR_ARCH_PERFMON_EVENTSEL0 +16 ,MSR_ARCH_PERFMON_EVENTSEL0 +17 , + + MSR_IA32_XSS, };static u32 msrs_to_save[ARRAY_SIZE (msrs_to_save_all)];
@@ -5728,6 +5730,10 @@ static void kvm_init_msr_list(void) min(INTEL_PMC_MAX_GENERIC, x86_pmu.num_counters_gp)) continue;break ; +case MSR_IA32_XSS : +if (!supported_xss) +continue ; +break ;default :break ; }
Signature · 1 line
2.17.2
PATCH v14 2/13 KVM: x86: Refresh CPUID on writes to MSR_IA32_XSS
In reply to Yang WeijiangUpdated CPUID.0xD.0x1, which reports the current required storage size of all features enabled via XCR0 | XSS, when the guest's XSS is modified.
Note, KVM does not yet support any XSS based features, i.e. supported_xss is guaranteed to be zero at this time.
--- arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/cpuid.c | 21 ++++++++++++++++++--- arch/x86/kvm/x86.c | 7 +++++-- 3 files changed, 24 insertions(+), 5 deletions(-)
arch/x86/include/asm/kvm_host.h +1 -0
@@ -611,6 +611,7 @@ struct kvm_vcpu_arch {u64 xcr0;u64 guest_supported_xcr0; +u64 guest_supported_xss;struct kvm_pio_request pio;void *pio_data;
arch/x86/kvm/cpuid.c +18 -3
@@ -115,9 +115,24 @@ void kvm_update_cpuid_runtime(struct kvm_vcpu *vcpu) best->ebx =xstate_required_size (vcpu->arch.xcr0, false); best =kvm_find_cpuid_entry (vcpu,0xD ,1 ); -if (best && (cpuid_entry_has (best,X86_FEATURE_XSAVES ) || -cpuid_entry_has (best,X86_FEATURE_XSAVEC ))) - best->ebx =xstate_required_size (vcpu->arch.xcr0, true); +if (best) { +if (cpuid_entry_has (best,X86_FEATURE_XSAVES ) || +cpuid_entry_has (best,X86_FEATURE_XSAVEC )) { +u64 xstate = vcpu->arch.xcr0 | vcpu->arch.ia32_xss; + + best->ebx =xstate_required_size (xstate, true); + } + +if (!cpuid_entry_has (best,X86_FEATURE_XSAVES )) { + best->ecx =0 ; + best->edx =0 ; + } + vcpu->arch.guest_supported_xss = + (((u64 )best->edx <<32 ) | best->ecx) & supported_xss; + + }else { + vcpu->arch.guest_supported_xss =0 ; + } best =kvm_find_cpuid_entry (vcpu,KVM_CPUID_FEATURES ,0 ); if (kvm_hlt_in_guest(vcpu->kvm) && best &&
arch/x86/kvm/x86.c +5 -2
@@ -3124,9 +3124,12 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)* IA32_XSS[bit 8]. Guests have to use RDMSR/WRMSR rather than * XSAVES/XRSTORS to save/restore PT MSRs. */ -if (data & ~supported_xss) +if (data & ~vcpu->arch.guest_supported_xss)return 1 ; - vcpu->arch.ia32_xss = data; +if (vcpu->arch.ia32_xss != data) { + vcpu->arch.ia32_xss = data; +kvm_update_cpuid_runtime (vcpu); + }break ;case MSR_SMI_COUNT :if (!msr_info->host_initiated)
Signature · 1 line
2.17.2
PATCH v14 6/13 KVM: x86: Load guest fpu state when accessing MSRs managed by XSAVES
In reply to Yang WeijiangFrom: Sean Christopherson <[email protected]>
A handful of CET MSRs are not context switched through "traditional" methods, e.g. VMCS or manual switching, but rather are passed through to the guest and are saved and restored by XSAVES/XRSTORS, i.e. in the guest's FPU state.
Load the guest's FPU state if userspace is accessing MSRs whose values are managed by XSAVES so that the MSR helper, e.g. vmx_{get,set}_msr(), can simply do {RD,WR}MSR to access the guest's value.
Because is also used for the KVM_GET_MSRS device ioctl(), explicitly check that @vcpu is non-null before attempting to load guest state. The CET MSRs cannot be retrieved via the device ioctl() without loading guest FPU state (which doesn't exist).
Note that guest_cpuid_has() is not queried as host userspace is allowed to access MSRs that have not been exposed to the guest, e.g. it might do KVM_SET_MSRS prior to KVM_SET_CPUID2.
--- arch/x86/kvm/x86.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
arch/x86/kvm/x86.c +18 -1
@@ -109,6 +109,8 @@ static void enter_smm(struct kvm_vcpu *vcpu);static void __kvm_set_rflags (struct kvm_vcpu *vcpu,unsigned long rflags);static void store_regs (struct kvm_vcpu *vcpu);static int sync_regs (struct kvm_vcpu *vcpu); +static void kvm_load_guest_fpu (struct kvm_vcpu *vcpu); +static void kvm_put_guest_fpu (struct kvm_vcpu *vcpu);struct kvm_x86_ops kvm_x86_ops__read_mostly ;EXPORT_SYMBOL_GPL (kvm_x86_ops);
@@ -3582,6 +3584,12 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) }EXPORT_SYMBOL_GPL (kvm_get_msr_common); +static bool is_xsaves_msr (u32 index) +{ +return index ==MSR_IA32_U_CET || + (index >=MSR_IA32_PL0_SSP && index <=MSR_IA32_PL3_SSP ); +} +/* * Read or write a bunch of msrs. All parameters are kernel addresses. *
@@ -3592,11 +3600,20 @@ static int __msr_io(struct kvm_vcpu *vcpu, struct kvm_msrs *msrs,int (*do_msr)(struct kvm_vcpu *vcpu, unsigned index, u64 *data)) { +bool fpu_loaded = false;int i; -for (i =0 ; i < msrs->nmsrs; ++i) +for (i =0 ; i < msrs->nmsrs; ++i) { +if (vcpu && !fpu_loaded && supported_xss && +is_xsaves_msr (entries[i].index)) { +kvm_load_guest_fpu (vcpu); + fpu_loaded = true; + }if (do_msr (vcpu, entries[i].index, &entries[i].data))break ; + } +if (fpu_loaded) +kvm_put_guest_fpu (vcpu);return i; }
Signature · 1 line
2.17.2
PATCH v14 7/13 KVM: VMX: Emulate reads and writes to CET MSRs
In reply to Yang WeijiangAdd support for emulating read and write accesses to CET MSRs. CET MSRs are universally "special" as they are either context switched via dedicated VMCS fields or via XSAVES, i.e. no additional in-memory tracking is needed, but emulated reads/writes are more expensive.
MSRs that are switched through XSAVES are especially annoying due to the possibility of the kernel's FPU being used in IRQ context. Disable IRQs and ensure the guest's FPU state is loaded when accessing such MSRs.
--- arch/x86/kvm/vmx/vmx.c | 105 +++++++++++++++++++++++++++++++++++++++++ arch/x86/kvm/x86.h | 5 ++ 2 files changed, 110 insertions(+)
arch/x86/kvm/vmx/vmx.c +105 -0
@@ -1788,6 +1788,66 @@ static int vmx_get_msr_feature(struct kvm_msr_entry *msr) } } +static void vmx_get_xsave_msr (struct msr_data *msr_info) +{ +local_irq_disable (); +if (test_thread_flag (TIF_NEED_FPU_LOAD )) +switch_fpu_return (); +rdmsrl (msr_info->index, msr_info->data); +local_irq_enable (); +} + +static void vmx_set_xsave_msr (struct msr_data *msr_info) +{ +local_irq_disable (); +if (test_thread_flag (TIF_NEED_FPU_LOAD )) +switch_fpu_return (); +wrmsrl (msr_info->index, msr_info->data); +local_irq_enable (); +} + +static bool cet_is_ssp_msr_accessible (struct kvm_vcpu *vcpu, +struct msr_data *msr) +{ +u64 mask; + +if (!kvm_cet_supported ()) +return false; + +if (msr->host_initiated) +return true; + +if (!guest_cpuid_has (vcpu,X86_FEATURE_SHSTK )) +return false; + +if (msr->index ==MSR_IA32_INT_SSP_TAB ) +return false; + + mask = (msr->index ==MSR_IA32_PL3_SSP ) ?XFEATURE_MASK_CET_USER : +XFEATURE_MASK_CET_KERNEL ; +return !!(vcpu->arch.guest_supported_xss & mask); +} + +static bool cet_is_control_msr_accessible (struct kvm_vcpu *vcpu, +struct msr_data *msr) +{ +u64 mask; + +if (!kvm_cet_supported ()) +return false; + +if (msr->host_initiated) +return true; + +if (!guest_cpuid_has (vcpu,X86_FEATURE_SHSTK ) && + !guest_cpuid_has (vcpu,X86_FEATURE_IBT )) +return false; + + mask = (msr->index ==MSR_IA32_U_CET ) ?XFEATURE_MASK_CET_USER : +XFEATURE_MASK_CET_KERNEL ; +return !!(vcpu->arch.guest_supported_xss & mask); +} +/* * Reads an msr value (of 'msr_index') into 'pdata'. * Returns 0 on success, non-0 otherwise.
@@ -1920,6 +1980,26 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)else msr_info->data = vmx->pt_desc.guest.addr_a[index /2 ];break ; +case MSR_IA32_S_CET : +if (!cet_is_control_msr_accessible (vcpu, msr_info)) +return 1 ; + msr_info->data =vmcs_readl (GUEST_S_CET ); +break ; +case MSR_IA32_U_CET : +if (!cet_is_control_msr_accessible (vcpu, msr_info)) +return 1 ; +vmx_get_xsave_msr (msr_info); +break ; +case MSR_IA32_INT_SSP_TAB : +if (!cet_is_ssp_msr_accessible (vcpu, msr_info)) +return 1 ; + msr_info->data =vmcs_readl (GUEST_INTR_SSP_TABLE ); +break ; + case MSR_IA32_PL0_SSP ... MSR_IA32_PL3_SSP: +if (!cet_is_ssp_msr_accessible (vcpu, msr_info)) +return 1 ; +vmx_get_xsave_msr (msr_info); +break ;case MSR_TSC_AUX :if (!msr_info->host_initiated && !guest_cpuid_has (vcpu,X86_FEATURE_RDTSCP ))
@@ -2189,6 +2269,31 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)else vmx->pt_desc.guest.addr_a[index /2 ] = data;break ; +case MSR_IA32_S_CET : +case MSR_IA32_U_CET : +if (!cet_is_control_msr_accessible (vcpu, msr_info)) +return 1 ; +if (data &GENMASK (9 ,6 )) +return 1 ; +if (msr_index ==MSR_IA32_S_CET ) +vmcs_writel (GUEST_S_CET , data); +else +vmx_set_xsave_msr (msr_info); +break ; +case MSR_IA32_INT_SSP_TAB : +if (!cet_is_control_msr_accessible (vcpu, msr_info)) +return 1 ; +if (is_noncanonical_address (data, vcpu)) +return 1 ; +vmcs_writel (GUEST_INTR_SSP_TABLE , data); +break ; + case MSR_IA32_PL0_SSP ... MSR_IA32_PL3_SSP: +if (!cet_is_ssp_msr_accessible (vcpu, msr_info)) +return 1 ; +if ((data &GENMASK (2 ,0 )) ||is_noncanonical_address (data, vcpu)) +return 1 ; +vmx_set_xsave_msr (msr_info); +break ;case MSR_TSC_AUX :if (!msr_info->host_initiated && !guest_cpuid_has (vcpu,X86_FEATURE_RDTSCP ))
arch/x86/kvm/x86.h +5 -0
@@ -286,6 +286,11 @@ static inline bool kvm_mpx_supported(void) == (XFEATURE_MASK_BNDREGS | XFEATURE_MASK_BNDCSR); } +static inline bool kvm_cet_supported (void ) +{ +return supported_xss &XFEATURE_MASK_CET_USER ; +} +extern unsigned int min_timer_period_us;extern bool enable_vmware_backdoor;
Signature · 1 line
2.17.2
PATCH v14 9/13 KVM: x86: Report CET MSRs as to-be-saved if CET is supported
In reply to Yang WeijiangReport all CET MSRs, including the synthetic GUEST_SSP MSR, as to-be-saved, e.g. for migration, if CET is supported by KVM.
--- arch/x86/kvm/x86.c | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/x86/kvm/x86.c +9 -0
@@ -1248,6 +1248,8 @@ static const u32 msrs_to_save_all[] = {MSR_ARCH_PERFMON_EVENTSEL0 +16 ,MSR_ARCH_PERFMON_EVENTSEL0 +17 ,MSR_IA32_XSS , +MSR_IA32_U_CET ,MSR_IA32_S_CET ,MSR_IA32_INT_SSP_TAB ,MSR_KVM_GUEST_SSP , + MSR_IA32_PL0_SSP, MSR_IA32_PL1_SSP, MSR_IA32_PL2_SSP, MSR_IA32_PL3_SSP, };static u32 msrs_to_save[ARRAY_SIZE (msrs_to_save_all)];
@@ -5761,6 +5763,13 @@ static void kvm_init_msr_list(void)if (!supported_xss)continue ;break ; +case MSR_IA32_U_CET : +case MSR_IA32_S_CET : +case MSR_IA32_INT_SSP_TAB : + case MSR_IA32_PL0_SSP ... MSR_IA32_PL3_SSP: +if (!kvm_cet_supported ()) +continue ; +break ;default :break ; }
Signature · 1 line
2.17.2
PATCH v14 10/13 KVM: x86: Enable CET virtualization for VMX and advertise CET to userspace
In reply to Yang WeijiangSet the feature bits so that CET capabilities can be seen in guest via CPUID enumeration. Add CR4.CET bit support in order to allow guest set CET master control bit(CR4.CET).
Disable KVM CET feature if unrestricted_guest is unsupported/disabled as KVM does not support emulating CET. Reset guest CET states in vmcs so as to avoid vmentry failure when guest toggles CR4.CET bit, e.g. during guest reboot.
Don't expose CET feature if dependent CET bits are cleared in host XSS, or if XSAVES isn't supported. Updating the CET features in common x86 is a little ugly, but there is on clean solution without risking breakage of SVM if SVM hardware ever gains support for CET, e.g. moving everything to common x86 would prematurely expose CET on SVM. The alternative is to put all the logic in VMX, but that means rereading host_xss in VMX and duplicating the XSAVES check across VMX and SVM.
--- arch/x86/include/asm/kvm_host.h | 3 +- arch/x86/kvm/cpuid.c | 5 +-- arch/x86/kvm/vmx/capabilities.h | 5 +++ arch/x86/kvm/vmx/vmx.c | 64 +++++++++++++++++++++++++++++++-- arch/x86/kvm/x86.c | 8 +++++ 5 files changed, 79 insertions(+), 6 deletions(-)
arch/x86/include/asm/kvm_host.h +2 -1
@@ -100,7 +100,8 @@ | X86_CR4_PGE | X86_CR4_PCE | X86_CR4_OSFXSR | X86_CR4_PCIDE \ | X86_CR4_OSXSAVE | X86_CR4_SMEP | X86_CR4_FSGSBASE \ | X86_CR4_OSXMMEXCPT | X86_CR4_LA57 | X86_CR4_VMXE \ - | X86_CR4_SMAP | X86_CR4_PKE | X86_CR4_UMIP)) + | X86_CR4_SMAP | X86_CR4_PKE | X86_CR4_UMIP \ + | X86_CR4_CET))#define CR8_RESERVED_BITS (~(unsigned long)X86_CR8_TPR)
arch/x86/kvm/cpuid.c +3 -2
@@ -405,7 +405,8 @@ void kvm_set_cpu_caps(void)F (AVX512VBMI ) |F (LA57 ) |F (PKU ) |0 /*OSPKE*/ |F (RDPID ) |F (AVX512_VPOPCNTDQ ) |F (UMIP ) |F (AVX512_VBMI2 ) |F (GFNI ) |F (VAES ) |F (VPCLMULQDQ ) |F (AVX512_VNNI ) |F (AVX512_BITALG ) | -F (CLDEMOTE ) |F (MOVDIRI ) |F (MOVDIR64B ) |0 /*WAITPKG*/ +F (CLDEMOTE ) |F (MOVDIRI ) |F (MOVDIR64B ) |0 /*WAITPKG*/ | +F (SHSTK ) );/* Set LA57 based on hardware capability. */ if (cpuid_ecx (7 ) &F (LA57 ))
@@ -422,7 +423,7 @@ void kvm_set_cpu_caps(void)F (AVX512_4VNNIW ) |F (AVX512_4FMAPS ) |F (SPEC_CTRL ) |F (SPEC_CTRL_SSBD ) |F (ARCH_CAPABILITIES ) |F (INTEL_STIBP ) |F (MD_CLEAR ) |F (AVX512_VP2INTERSECT ) |F (FSRM ) | -F (SERIALIZE ) |F (TSXLDTRK ) +F (SERIALIZE ) |F (TSXLDTRK ) |F (IBT ) );/* TSC_ADJUST and ARCH_CAPABILITIES are emulated in software. */
arch/x86/kvm/vmx/capabilities.h +5 -0
@@ -103,6 +103,11 @@ static inline bool cpu_has_load_perf_global_ctrl(void) (vmcs_config.vmexit_ctrl &VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL ); } +static inline bool cpu_has_load_cet_ctrl (void ) +{ +return (vmcs_config.vmentry_ctrl &VM_ENTRY_LOAD_CET_STATE ) && + (vmcs_config.vmexit_ctrl &VM_EXIT_LOAD_CET_STATE ); +}static inline bool cpu_has_vmx_mpx (void ) { return (vmcs_config.vmexit_ctrl & VM_EXIT_CLEAR_BNDCFGS) &&
arch/x86/kvm/vmx/vmx.c +61 -3
131 lines not on this page · raw message
arch/x86/kvm/x86.c +8 -0
@@ -10197,6 +10197,14 @@ int kvm_arch_hardware_setup(void *opaque)if (!kvm_cpu_cap_has (X86_FEATURE_XSAVES )) supported_xss =0 ; +else + supported_xss &= host_xss; + +/* Update CET features now that supported_xss is finalized. */ +if (!kvm_cet_supported ()) { +kvm_cpu_cap_clear (X86_FEATURE_SHSTK ); +kvm_cpu_cap_clear (X86_FEATURE_IBT ); + }#define __kvm_cpu_cap_has (UNUSED_ , f) kvm_cpu_cap_has(f) cr4_reserved_bits =__cr4_reserved_bits (__kvm_cpu_cap_has,UNUSED_ );
Signature · 1 line
2.17.2
PATCH v14 11/13 KVM: VMX: Pass through CET MSRs to the guest when supported
In reply to Yang WeijiangPass through all CET MSRs when the associated CET component (kernel vs. user) is enabled to improve guest performance. All CET MSRs are context switched, either via dedicated VMCS fields or XSAVES.
--- arch/x86/kvm/vmx/vmx.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
arch/x86/kvm/vmx/vmx.c +29 -0
@@ -7366,6 +7366,32 @@ static void update_intel_pt_cfg(struct kvm_vcpu *vcpu) vmx->pt_desc.ctl_bitmask &= ~(0xfULL << (32 + i *4 )); } +static bool is_cet_state_supported (struct kvm_vcpu *vcpu,u32 xss_state) +{ +return (vcpu->arch.guest_supported_xss & xss_state) && + (guest_cpuid_has (vcpu,X86_FEATURE_SHSTK ) || +guest_cpuid_has (vcpu,X86_FEATURE_IBT )); +} + +static void vmx_update_intercept_for_cet_msr (struct kvm_vcpu *vcpu) +{ +bool incpt = !is_cet_state_supported (vcpu,XFEATURE_MASK_CET_USER ); + +vmx_set_intercept_for_msr (vcpu,MSR_IA32_U_CET ,MSR_TYPE_RW , incpt); + + incpt |= !guest_cpuid_has (vcpu,X86_FEATURE_SHSTK ); +vmx_set_intercept_for_msr (vcpu,MSR_IA32_PL3_SSP ,MSR_TYPE_RW , incpt); + + incpt = !is_cet_state_supported (vcpu,XFEATURE_MASK_CET_KERNEL ); +vmx_set_intercept_for_msr (vcpu,MSR_IA32_S_CET ,MSR_TYPE_RW , incpt); + + incpt |= !guest_cpuid_has (vcpu,X86_FEATURE_SHSTK ); +vmx_set_intercept_for_msr (vcpu,MSR_IA32_INT_SSP_TAB ,MSR_TYPE_RW , incpt); +vmx_set_intercept_for_msr (vcpu,MSR_IA32_PL0_SSP ,MSR_TYPE_RW , incpt); +vmx_set_intercept_for_msr (vcpu,MSR_IA32_PL1_SSP ,MSR_TYPE_RW , incpt); +vmx_set_intercept_for_msr (vcpu,MSR_IA32_PL2_SSP ,MSR_TYPE_RW , incpt); +} +static void vmx_vcpu_after_set_cpuid (struct kvm_vcpu *vcpu) {struct vcpu_vmx *vmx =to_vmx (vcpu);
@@ -7409,6 +7435,9 @@ static void vmx_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu)/* Refresh #PF interception to account for MAXPHYADDR changes. */ update_exception_bitmap (vcpu); + +if (kvm_cet_supported ()) +vmx_update_intercept_for_cet_msr (vcpu); }static __init void vmx_set_cpu_caps (void )
Signature · 1 line
2.17.2
PATCH v14 12/13 KVM: nVMX: Add helper to check the vmcs01 MSR bitmap for MSR pass-through
In reply to Yang WeijiangAdd a helper to perform the check on the vmcs01/l01 MSR bitmap when disabling interception of an MSR for L2. This reduces the boilerplate for the existing cases, and will be used heavily in a future patch for CET MSRs.
--- arch/x86/kvm/vmx/nested.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-)
arch/x86/kvm/vmx/nested.c +17 -10
@@ -544,6 +544,17 @@ static void nested_vmx_disable_intercept_for_msr(unsigned long *msr_bitmap_l1, } } +static void nested_vmx_cond_disable_intercept_for_msr (struct kvm_vcpu *vcpu,u32 msr, +unsigned long *bitmap_12, +unsigned long *bitmap_02, +int type) +{ +if (msr_write_intercepted_l01 (vcpu, msr)) +return ; + +nested_vmx_disable_intercept_for_msr (bitmap_12, bitmap_02, msr, type); +} +static inline void enable_x2apic_msr_intercepts (unsigned long *msr_bitmap) {int msr;
@@ -640,17 +651,13 @@ static inline bool nested_vmx_prepare_msr_bitmap(struct kvm_vcpu *vcpu,* updated to reflect this when L1 (or its L2s) actually write to * the MSR. */ -if (!msr_write_intercepted_l01 (vcpu,MSR_IA32_SPEC_CTRL )) -nested_vmx_disable_intercept_for_msr ( - msr_bitmap_l1, msr_bitmap_l0, -MSR_IA32_SPEC_CTRL , -MSR_TYPE_R |MSR_TYPE_W ); +nested_vmx_cond_disable_intercept_for_msr (vcpu,MSR_IA32_SPEC_CTRL , + msr_bitmap_l1, msr_bitmap_l0, +MSR_TYPE_R |MSR_TYPE_W ); -if (!msr_write_intercepted_l01 (vcpu,MSR_IA32_PRED_CMD )) -nested_vmx_disable_intercept_for_msr ( - msr_bitmap_l1, msr_bitmap_l0, -MSR_IA32_PRED_CMD , -MSR_TYPE_W ); +nested_vmx_cond_disable_intercept_for_msr (vcpu,MSR_IA32_PRED_CMD , + msr_bitmap_l1, msr_bitmap_l0, +MSR_TYPE_W );kvm_vcpu_unmap (vcpu, &to_vmx (vcpu)->nested.msr_bitmap_map, false);
Signature · 1 line
2.17.2
PATCH v14 13/13 KVM: nVMX: Enable CET support for nested VMX
In reply to Yang WeijiangAdd vmcs12 fields for all CET fields, pass-through CET MSRs to L2 when possible, and enumerate the VMCS controls and CR4 bit as supported.
--- arch/x86/kvm/vmx/nested.c | 30 ++++++++++++++++++++++++++++-- arch/x86/kvm/vmx/vmcs12.c | 6 ++++++ arch/x86/kvm/vmx/vmcs12.h | 14 +++++++++++++- arch/x86/kvm/vmx/vmx.c | 1 + 4 files changed, 48 insertions(+), 3 deletions(-)
arch/x86/kvm/vmx/nested.c +28 -2
@@ -638,6 +638,29 @@ static inline bool nested_vmx_prepare_msr_bitmap(struct kvm_vcpu *vcpu,nested_vmx_disable_intercept_for_msr (msr_bitmap_l1, msr_bitmap_l0,MSR_KERNEL_GS_BASE ,MSR_TYPE_RW ); +/* Pass CET MSRs to nested VM if L0 and L1 are set to pass-through. */ +nested_vmx_cond_disable_intercept_for_msr (vcpu,MSR_IA32_U_CET , + msr_bitmap_l1, msr_bitmap_l0, +MSR_TYPE_RW ); +nested_vmx_cond_disable_intercept_for_msr (vcpu,MSR_IA32_PL3_SSP , + msr_bitmap_l1, msr_bitmap_l0, +MSR_TYPE_RW ); +nested_vmx_cond_disable_intercept_for_msr (vcpu,MSR_IA32_S_CET , + msr_bitmap_l1, msr_bitmap_l0, +MSR_TYPE_RW ); +nested_vmx_cond_disable_intercept_for_msr (vcpu,MSR_IA32_PL0_SSP , + msr_bitmap_l1, msr_bitmap_l0, +MSR_TYPE_RW ); +nested_vmx_cond_disable_intercept_for_msr (vcpu,MSR_IA32_PL1_SSP , + msr_bitmap_l1, msr_bitmap_l0, +MSR_TYPE_RW ); +nested_vmx_cond_disable_intercept_for_msr (vcpu,MSR_IA32_PL2_SSP , + msr_bitmap_l1, msr_bitmap_l0, +MSR_TYPE_RW ); +nested_vmx_cond_disable_intercept_for_msr (vcpu,MSR_IA32_INT_SSP_TAB , + msr_bitmap_l1, msr_bitmap_l0, +MSR_TYPE_RW ); +/* * Checking the L0->L1 bitmap is trying to verify two things: *
@@ -6336,7 +6359,9 @@ void nested_vmx_setup_ctls_msrs(struct nested_vmx_msrs *msrs, u32 ept_caps)VM_EXIT_HOST_ADDR_SPACE_SIZE | #endifVM_EXIT_LOAD_IA32_PAT |VM_EXIT_SAVE_IA32_PAT | -VM_EXIT_CLEAR_BNDCFGS |VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL ; +VM_EXIT_CLEAR_BNDCFGS |VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL | +VM_EXIT_LOAD_CET_STATE ; + msrs->exit_ctls_high |=VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR | VM_EXIT_LOAD_IA32_EFER | VM_EXIT_SAVE_IA32_EFER |
@@ -6356,7 +6381,8 @@ void nested_vmx_setup_ctls_msrs(struct nested_vmx_msrs *msrs, u32 ept_caps)VM_ENTRY_IA32E_MODE | #endifVM_ENTRY_LOAD_IA32_PAT |VM_ENTRY_LOAD_BNDCFGS | -VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL ; +VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL |VM_ENTRY_LOAD_CET_STATE ; + msrs->entry_ctls_high |= (VM_ENTRY_ALWAYSON_WITHOUT_TRUE_MSR |VM_ENTRY_LOAD_IA32_EFER );
arch/x86/kvm/vmx/vmcs12.c +6 -0
@@ -137,6 +137,9 @@ const unsigned short vmcs_field_to_offset_table[] = {FIELD (GUEST_PENDING_DBG_EXCEPTIONS , guest_pending_dbg_exceptions),FIELD (GUEST_SYSENTER_ESP , guest_sysenter_esp),FIELD (GUEST_SYSENTER_EIP , guest_sysenter_eip), +FIELD (GUEST_S_CET , guest_s_cet), +FIELD (GUEST_SSP , guest_ssp), +FIELD (GUEST_INTR_SSP_TABLE , guest_ssp_tbl),FIELD (HOST_CR0 , host_cr0),FIELD (HOST_CR3 , host_cr3), FIELD(HOST_CR4, host_cr4),
@@ -149,5 +152,8 @@ const unsigned short vmcs_field_to_offset_table[] = {FIELD (HOST_IA32_SYSENTER_EIP , host_ia32_sysenter_eip),FIELD (HOST_RSP , host_rsp),FIELD (HOST_RIP , host_rip), +FIELD (HOST_S_CET , host_s_cet), +FIELD (HOST_SSP , host_ssp), + FIELD(HOST_INTR_SSP_TABLE, host_ssp_tbl), };const unsigned int nr_vmcs12_fields =ARRAY_SIZE (vmcs_field_to_offset_table);
arch/x86/kvm/vmx/vmcs12.h +13 -1
@@ -115,7 +115,13 @@ struct __packed vmcs12 {natural_width host_ia32_sysenter_eip;natural_width host_rsp;natural_width host_rip; -natural_width paddingl[8 ];/* room for future expansion */ +natural_width host_s_cet; +natural_width host_ssp; +natural_width host_ssp_tbl; +natural_width guest_s_cet; +natural_width guest_ssp; +natural_width guest_ssp_tbl; +natural_width paddingl[2 ];/* room for future expansion */ u32 pin_based_vm_exec_control;u32 cpu_based_vm_exec_control;u32 exception_bitmap;
@@ -295,6 +301,12 @@ static inline void vmx_check_vmcs12_offsets(void)CHECK_OFFSET (host_ia32_sysenter_eip,656 );CHECK_OFFSET (host_rsp,664 );CHECK_OFFSET (host_rip,672 ); +CHECK_OFFSET (host_s_cet,680 ); +CHECK_OFFSET (host_ssp,688 ); +CHECK_OFFSET (host_ssp_tbl,696 ); +CHECK_OFFSET (guest_s_cet,704 ); +CHECK_OFFSET (guest_ssp,712 ); +CHECK_OFFSET (guest_ssp_tbl,720 );CHECK_OFFSET (pin_based_vm_exec_control,744 );CHECK_OFFSET (cpu_based_vm_exec_control,748 );CHECK_OFFSET (exception_bitmap,752 );
arch/x86/kvm/vmx/vmx.c +1 -0
@@ -7276,6 +7276,7 @@ static void nested_vmx_cr_fixed1_bits_update(struct kvm_vcpu *vcpu)cr4_fixed1_update (X86_CR4_PKE , ecx,feature_bit (PKU ));cr4_fixed1_update (X86_CR4_UMIP , ecx,feature_bit (UMIP ));cr4_fixed1_update (X86_CR4_LA57 , ecx,feature_bit (LA57 )); +cr4_fixed1_update (X86_CR4_CET , ecx,feature_bit (SHSTK ));#undef cr4_fixed1_update }
Signature · 1 line
2.17.2
PATCH v14 8/13 KVM: VMX: Add a synthetic MSR to allow userspace VMM to access GUEST_SSP
In reply to Yang WeijiangIntroduce a host-only synthetic MSR, MSR_KVM_GUEST_SSP so that the VMM can read/write the guest's SSP, e.g. to migrate CET state. Use a synthetic MSR, e.g. as opposed to a VCPU_REG_, as GUEST_SSP is subject to the same consistency checks as the PL*_SSP MSRs, i.e. can share code.
--- arch/x86/include/uapi/asm/kvm_para.h | 1 + arch/x86/kvm/vmx/vmx.c | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-)
arch/x86/include/uapi/asm/kvm_para.h +1 -0
@@ -53,6 +53,7 @@#define MSR_KVM_POLL_CONTROL 0x4b564d05#define MSR_KVM_ASYNC_PF_INT 0x4b564d06#define MSR_KVM_ASYNC_PF_ACK 0x4b564d07 +#define MSR_KVM_GUEST_SSP 0x4b564d08struct kvm_steal_time {__u64 steal;
arch/x86/kvm/vmx/vmx.c +12 -2
@@ -1817,7 +1817,8 @@ static bool cet_is_ssp_msr_accessible(struct kvm_vcpu *vcpu,if (msr->host_initiated)return true; -if (!guest_cpuid_has (vcpu,X86_FEATURE_SHSTK )) +if (!guest_cpuid_has (vcpu,X86_FEATURE_SHSTK ) || + msr->index ==MSR_KVM_GUEST_SSP )return false;if (msr->index ==MSR_IA32_INT_SSP_TAB )
@@ -1995,6 +1996,11 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)return 1 ; msr_info->data =vmcs_readl (GUEST_INTR_SSP_TABLE );break ; +case MSR_KVM_GUEST_SSP : +if (!cet_is_ssp_msr_accessible (vcpu, msr_info)) +return 1 ; + msr_info->data =vmcs_readl (GUEST_SSP ); +break ; case MSR_IA32_PL0_SSP ... MSR_IA32_PL3_SSP:if (!cet_is_ssp_msr_accessible (vcpu, msr_info))return 1 ;
@@ -2287,12 +2293,16 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)return 1 ;vmcs_writel (GUEST_INTR_SSP_TABLE , data);break ; +case MSR_KVM_GUEST_SSP : case MSR_IA32_PL0_SSP ... MSR_IA32_PL3_SSP:if (!cet_is_ssp_msr_accessible (vcpu, msr_info))return 1 ;if ((data &GENMASK (2 ,0 )) ||is_noncanonical_address (data, vcpu))return 1 ; -vmx_set_xsave_msr (msr_info); +if (msr_index ==MSR_KVM_GUEST_SSP ) +vmcs_writel (GUEST_SSP , data); +else +vmx_set_xsave_msr (msr_info);break ;case MSR_TSC_AUX : if (!msr_info->host_initiated &&
Signature · 1 line
2.17.2
PATCH v14 5/13 KVM: x86: Add fault checks for CR4.CET
In reply to Yang WeijiangAdd the fault checks for CR4.CET, which is the master control for all CET features (SHSTK and IBT). In addition to basic support checks, CET can be enabled if and only if CR0.WP==1, i.e. setting CR4.CET=1 faults if CR0.WP==0 and setting CR0.WP=0 fails if CR4.CET==1.
--- arch/x86/kvm/x86.c | 6 ++++++ arch/x86/kvm/x86.h | 3 +++ 2 files changed, 9 insertions(+)
arch/x86/kvm/x86.c +6 -0
@@ -847,6 +847,9 @@ int kvm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0)if (!(cr0 &X86_CR0_PG ) &&kvm_read_cr4_bits (vcpu,X86_CR4_PCIDE ))return 1 ; +if (!(cr0 &X86_CR0_WP ) &&kvm_read_cr4_bits (vcpu,X86_CR4_CET )) +return 1 ; + kvm_x86_ops.set_cr0 (vcpu, cr0);if ((cr0 ^ old_cr0) &X86_CR0_PG ) {
@@ -1008,6 +1011,9 @@ int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)return 1 ; } +if ((cr4 &X86_CR4_CET ) && !(kvm_read_cr0 (vcpu) &X86_CR0_WP )) +return 1 ; +if (kvm_x86_ops.set_cr4 (vcpu, cr4))return 1 ;
arch/x86/kvm/x86.h +3 -0
@@ -398,6 +398,9 @@ bool kvm_msr_allowed(struct kvm_vcpu *vcpu, u32 index, u32 type); __reserved_bits |=X86_CR4_UMIP ; \if (!__cpu_has (__c,X86_FEATURE_VMX )) \ __reserved_bits |=X86_CR4_VMXE ; \ +if (!__cpu_has (__c,X86_FEATURE_SHSTK ) && \ + !__cpu_has (__c,X86_FEATURE_IBT )) \ + __reserved_bits |=X86_CR4_CET ; \ __reserved_bits; \ })
Signature · 1 line
2.17.2
PATCH v14 3/13 KVM: x86: Add #CP support in guest exception dispatch
In reply to Yang WeijiangAdd handling for Control Protection (#CP) exceptions, vector 21, used and introduced by Intel's Control-Flow Enforcement Technology (CET). relevant CET violation case. See Intel's SDM for details.
--- arch/x86/include/uapi/asm/kvm.h | 1 + arch/x86/kvm/x86.c | 1 + arch/x86/kvm/x86.h | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-)
arch/x86/include/uapi/asm/kvm.h +1 -0
@@ -31,6 +31,7 @@#define MC_VECTOR 18#define XM_VECTOR 19#define VE_VECTOR 20 +#define CP_VECTOR 21/* Select x86 specific features in <linux/kvm.h> */ #define __KVM_HAVE_PIT
arch/x86/kvm/x86.c +1 -0
@@ -433,6 +433,7 @@ static int exception_class(int vector)case NP_VECTOR :case SS_VECTOR :case GP_VECTOR : +case CP_VECTOR :return EXCPT_CONTRIBUTORY ;default :break ;
arch/x86/kvm/x86.h +1 -1
@@ -115,7 +115,7 @@ static inline bool x86_exception_has_error_code(unsigned int vector) {static u32 exception_has_error_code =BIT (DF_VECTOR ) |BIT (TS_VECTOR ) |BIT (NP_VECTOR ) |BIT (SS_VECTOR ) |BIT (GP_VECTOR ) | -BIT (PF_VECTOR ) |BIT (AC_VECTOR ); +BIT (PF_VECTOR ) |BIT (AC_VECTOR ) |BIT (CP_VECTOR );return (1U << vector) & exception_has_error_code; }
Signature · 1 line
2.17.2
PATCH v14 4/13 KVM: VMX: Introduce CET VMCS fields and flags
In reply to Yang WeijiangCET (Control-flow Enforcement Technology) is a CPU feature used to prevent Return/Jump-Oriented Programming (ROP/JOP) attacks. CET introduces a new exception type, Control Protection (#CP), and two sub-features to defend against ROP/JOP style control-flow subversion attacks:
Shadow Stack (SHSTK):
A shadow stack is a second stack used exclusively for control transfer operations. The shadow stack is separate from the data/normal stack and can be enabled individually in user and kernel mode. When shadow stacks are enabled, CALL pushes the return address on both the data and shadow stack. RET pops the return address from both stacks and compares them. If the return addresses from the two stacks do not match, the processor signals a #CP.
Indirect Branch Tracking (IBT):
IBT adds a new instrution, ENDBRANCH, that is used to mark valid target addresses of indirect branches (CALL, JMP, ENCLU[EEXIT], etc...). If an indirect branch is executed and the next instruction is _not_ an ENDBRANCH, the processor signals a #CP.
Several new CET MSRs are defined to support CET:
MSR_IA32_{U,S}_CET: Controls the CET settings for user mode and kernel
mode respectively.
MSR_IA32_PL{0,1,2,3}_SSP: Stores shadow stack pointers for CPL-0,1,2,3
protection respectively.
MSR_IA32_INT_SSP_TAB: Stores base address of shadow stack pointer table.
Two XSAVES state bits are introduced for CET:
IA32_XSS:[bit 11]: Control saving/restoring user mode CET states IA32_XSS:[bit 12]: Control saving/restoring kernel mode CET states.
Six VMCS fields are introduced for CET:
{HOST,GUEST}_S_CET: Stores CET settings for kernel mode. {HOST,GUEST}_SSP: Stores shadow stack pointer of current task/thread. {HOST,GUEST}_INTR_SSP_TABLE: Stores base address of shadow stack pointer table.
If VM_EXIT_LOAD_HOST_CET_STATE = 1, the host CET states are restored from the following VMCS fields at VM-Exit:
HOST_S_CET
HOST_SSP
HOST_INTR_SSP_TABLE
If VM_ENTRY_LOAD_GUEST_CET_STATE = 1, the guest CET states are loaded from the following VMCS fields at VM-Entry:
GUEST_S_CET
GUEST_SSP
GUEST_INTR_SSP_TABLE
--- arch/x86/include/asm/vmx.h | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/x86/include/asm/vmx.h +8 -0
@@ -94,6 +94,7 @@#define VM_EXIT_CLEAR_BNDCFGS 0x00800000#define VM_EXIT_PT_CONCEAL_PIP 0x01000000#define VM_EXIT_CLEAR_IA32_RTIT_CTL 0x02000000 +#define VM_EXIT_LOAD_CET_STATE 0x10000000#define VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR 0x00036dff
@@ -107,6 +108,7 @@#define VM_ENTRY_LOAD_BNDCFGS 0x00010000#define VM_ENTRY_PT_CONCEAL_PIP 0x00020000#define VM_ENTRY_LOAD_IA32_RTIT_CTL 0x00040000 +#define VM_ENTRY_LOAD_CET_STATE 0x00100000#define VM_ENTRY_ALWAYSON_WITHOUT_TRUE_MSR 0x000011ff
@@ -328,6 +330,9 @@ enum vmcs_field {GUEST_PENDING_DBG_EXCEPTIONS =0x00006822 ,GUEST_SYSENTER_ESP =0x00006824 ,GUEST_SYSENTER_EIP =0x00006826 , +GUEST_S_CET =0x00006828 , +GUEST_SSP =0x0000682a , +GUEST_INTR_SSP_TABLE =0x0000682c ,HOST_CR0 =0x00006c00 ,HOST_CR3 =0x00006c02 , HOST_CR4 = 0x00006c04,
@@ -340,6 +345,9 @@ enum vmcs_field {HOST_IA32_SYSENTER_EIP =0x00006c12 ,HOST_RSP =0x00006c14 ,HOST_RIP =0x00006c16 , +HOST_S_CET =0x00006c18 , +HOST_SSP =0x00006c1a , + HOST_INTR_SSP_TABLE = 0x00006c1c };/*
Signature · 1 line
2.17.2
kernel test robot
build botRe: [PATCH v14 09/13] KVM: x86: Report CET MSRs as to-be-saved if CET is supported
In reply to Yang WeijiangThank you for the patch! Perhaps something to improve:
Hi Yang,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on tip/master]
[also build test WARNING on linus/master kvm/linux-next v5.10-rc3 next-20201106] [cannot apply to vhost/linux-next linux/master]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Yang-Weijiang/Introduce-support-for-guest-CET-feature/20201106-090915 base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 6f72faf4a32303c8bdc6491186b79391e9cf0c7e config: i386-randconfig-r022-20201109 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 reproduce (this is a W=1 build): # https://github.com/0day-ci/linux/commit/d52c3d57bc17482b10d4071ea5b2cced7d2dc63e git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Yang-Weijiang/Introduce-support-for-guest-CET-feature/20201106-090915 git checkout d52c3d57bc17482b10d4071ea5b2cced7d2dc63e # save the attached .config to linux build tree make W=1 ARCH=i386
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
In file included from arch/x86/kvm/cpuid.h:5,
from arch/x86/kvm/mmu.h:7,
from arch/x86/kvm/x86.c:22:
arch/x86/kvm/x86.h: In function 'kvm_cet_supported':
arch/x86/kvm/x86.h:291:25: error: 'XFEATURE_MASK_CET_USER' undeclared (first use in this function); did you mean 'XFEATURE_MASK_SSE'?
291 | return supported_xss & XFEATURE_MASK_CET_USER;
| ^~~~~~~~~~~~~~~~~~~~~~
| XFEATURE_MASK_SSE
arch/x86/kvm/x86.h:291:25: note: each undeclared identifier is reported only once for each function it appears in
arch/x86/kvm/x86.c: In function 'kvm_set_cr0':
arch/x86/kvm/x86.c:852:53: error: 'X86_CR4_CET' undeclared (first use in this function); did you mean 'X86_CR4_DE'?
852 | if (!(cr0 & X86_CR0_WP) && kvm_read_cr4_bits(vcpu, X86_CR4_CET))
| ^~~~~~~~~~~
| X86_CR4_DE
arch/x86/kvm/x86.c: In function 'kvm_set_cr4':
arch/x86/kvm/x86.c:1016:13: error: 'X86_CR4_CET' undeclared (first use in this function); did you mean 'X86_CR4_DE'?
1016 | if ((cr4 & X86_CR4_CET) && !(kvm_read_cr0(vcpu) & X86_CR0_WP))
| ^~~~~~~~~~~
| X86_CR4_DE
arch/x86/kvm/x86.c: At top level:
arch/x86/kvm/x86.c:1251:2: error: 'MSR_IA32_U_CET' undeclared here (not in a function); did you mean 'MSR_IA32_PMC0'?
1251 | MSR_IA32_U_CET, MSR_IA32_S_CET, MSR_IA32_INT_SSP_TAB, MSR_KVM_GUEST_SSP,
| ^~~~~~~~~~~~~~
| MSR_IA32_PMC0
arch/x86/kvm/x86.c:1251:18: error: 'MSR_IA32_S_CET' undeclared here (not in a function); did you mean 'MSR_IA32_PMC0'?
1251 | MSR_IA32_U_CET, MSR_IA32_S_CET, MSR_IA32_INT_SSP_TAB, MSR_KVM_GUEST_SSP,
| ^~~~~~~~~~~~~~
| MSR_IA32_PMC0
arch/x86/kvm/x86.c:1251:34: error: 'MSR_IA32_INT_SSP_TAB' undeclared here (not in a function)
1251 | MSR_IA32_U_CET, MSR_IA32_S_CET, MSR_IA32_INT_SSP_TAB, MSR_KVM_GUEST_SSP,
| ^~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.c:1252:2: error: 'MSR_IA32_PL0_SSP' undeclared here (not in a function); did you mean 'MSR_IA32_MCG_ESP'?
1252 | MSR_IA32_PL0_SSP, MSR_IA32_PL1_SSP, MSR_IA32_PL2_SSP, MSR_IA32_PL3_SSP,
| ^~~~~~~~~~~~~~~~
| MSR_IA32_MCG_ESP
arch/x86/kvm/x86.c:1252:20: error: 'MSR_IA32_PL1_SSP' undeclared here (not in a function); did you mean 'MSR_IA32_MCG_ESP'?
1252 | MSR_IA32_PL0_SSP, MSR_IA32_PL1_SSP, MSR_IA32_PL2_SSP, MSR_IA32_PL3_SSP,
| ^~~~~~~~~~~~~~~~
| MSR_IA32_MCG_ESP
arch/x86/kvm/x86.c:1252:38: error: 'MSR_IA32_PL2_SSP' undeclared here (not in a function); did you mean 'MSR_IA32_MCG_ESP'?
1252 | MSR_IA32_PL0_SSP, MSR_IA32_PL1_SSP, MSR_IA32_PL2_SSP, MSR_IA32_PL3_SSP,
| ^~~~~~~~~~~~~~~~
| MSR_IA32_MCG_ESP
arch/x86/kvm/x86.c:1252:56: error: 'MSR_IA32_PL3_SSP' undeclared here (not in a function); did you mean 'MSR_IA32_MCG_ESP'?
1252 | MSR_IA32_PL0_SSP, MSR_IA32_PL1_SSP, MSR_IA32_PL2_SSP, MSR_IA32_PL3_SSP,
| ^~~~~~~~~~~~~~~~
| MSR_IA32_MCG_ESP
arch/x86/kvm/x86.c: In function 'is_xsaves_msr':
>> arch/x86/kvm/x86.c:3591:15: warning: comparison between pointer and integer
3591 | return index == MSR_IA32_U_CET ||
| ^~
arch/x86/kvm/x86.c:3592:16: warning: comparison between pointer and integer
3592 | (index >= MSR_IA32_PL0_SSP && index <= MSR_IA32_PL3_SSP);
| ^~
arch/x86/kvm/x86.c:3592:45: warning: comparison between pointer and integer
3592 | (index >= MSR_IA32_PL0_SSP && index <= MSR_IA32_PL3_SSP);
| ^~
arch/x86/kvm/x86.c: In function 'kvm_arch_hardware_setup':
arch/x86/kvm/x86.h:406:22: error: 'X86_FEATURE_SHSTK' undeclared (first use in this function); did you mean 'X86_FEATURE_EST'?
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.c:10201:55: note: in definition of macro '__kvm_cpu_cap_has'
10201 | #define __kvm_cpu_cap_has(UNUSED_, f) kvm_cpu_cap_has(f)
| ^
arch/x86/kvm/x86.c:10202:22: note: in expansion of macro '__cr4_reserved_bits'
10202 | cr4_reserved_bits = __cr4_reserved_bits(__kvm_cpu_cap_has, UNUSED_);
| ^~~~~~~~~~~~~~~~~~~
>> arch/x86/kvm/x86.h:406:22: warning: passing argument 1 of 'kvm_cpu_cap_has' makes integer from pointer without a cast [-Wint-conversion]
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~~~~~~~~~
| |
| const u32 * {aka const unsigned int *}
arch/x86/kvm/x86.c:10201:55: note: in definition of macro '__kvm_cpu_cap_has'
10201 | #define __kvm_cpu_cap_has(UNUSED_, f) kvm_cpu_cap_has(f)
| ^
arch/x86/kvm/x86.c:10202:22: note: in expansion of macro '__cr4_reserved_bits'
10202 | cr4_reserved_bits = __cr4_reserved_bits(__kvm_cpu_cap_has, UNUSED_);
| ^~~~~~~~~~~~~~~~~~~
In file included from arch/x86/kvm/mmu.h:7,
from arch/x86/kvm/x86.c:22:
arch/x86/kvm/cpuid.h:301:58: note: expected 'unsigned int' but argument is of type 'const u32 *' {aka 'const unsigned int *'}
301 | static __always_inline bool kvm_cpu_cap_has(unsigned int x86_feature)
| ~~~~~~~~~~~~~^~~~~~~~~~~
arch/x86/kvm/x86.h:407:22: error: 'X86_FEATURE_IBT' undeclared (first use in this function); did you mean 'X86_FEATURE_IBS'?
407 | !__cpu_has(__c, X86_FEATURE_IBT)) \
| ^~~~~~~~~~~~~~~
arch/x86/kvm/x86.c:10201:55: note: in definition of macro '__kvm_cpu_cap_has'
10201 | #define __kvm_cpu_cap_has(UNUSED_, f) kvm_cpu_cap_has(f)
| ^
arch/x86/kvm/x86.c:10202:22: note: in expansion of macro '__cr4_reserved_bits'
10202 | cr4_reserved_bits = __cr4_reserved_bits(__kvm_cpu_cap_has, UNUSED_);
| ^~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:407:22: warning: passing argument 1 of 'kvm_cpu_cap_has' makes integer from pointer without a cast [-Wint-conversion]
407 | !__cpu_has(__c, X86_FEATURE_IBT)) \
| ^~~~~~~~~~~~~~~
| |
| const u32 * {aka const unsigned int *}
arch/x86/kvm/x86.c:10201:55: note: in definition of macro '__kvm_cpu_cap_has'
10201 | #define __kvm_cpu_cap_has(UNUSED_, f) kvm_cpu_cap_has(f)
| ^
arch/x86/kvm/x86.c:10202:22: note: in expansion of macro '__cr4_reserved_bits'
10202 | cr4_reserved_bits = __cr4_reserved_bits(__kvm_cpu_cap_has, UNUSED_);
| ^~~~~~~~~~~~~~~~~~~
In file included from arch/x86/kvm/mmu.h:7,
from arch/x86/kvm/x86.c:22:
arch/x86/kvm/cpuid.h:301:58: note: expected 'unsigned int' but argument is of type 'const u32 *' {aka 'const unsigned int *'}
301 | static __always_inline bool kvm_cpu_cap_has(unsigned int x86_feature)
| ~~~~~~~~~~~~~^~~~~~~~~~~
In file included from arch/x86/kvm/cpuid.h:5,
from arch/x86/kvm/mmu.h:7,
from arch/x86/kvm/x86.c:22:
arch/x86/kvm/x86.h:408:22: error: 'X86_CR4_CET' undeclared (first use in this function); did you mean 'X86_CR4_DE'?
408 | __reserved_bits |= X86_CR4_CET; \
| ^~~~~~~~~~~
arch/x86/kvm/x86.c:10202:22: note: in expansion of macro '__cr4_reserved_bits'
10202 | cr4_reserved_bits = __cr4_reserved_bits(__kvm_cpu_cap_has, UNUSED_);
| ^~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:408:19: error: invalid operands to binary | (have 'u64' {aka 'long long unsigned int'} and 'const u32 *' {aka 'const unsigned int *'})
408 | __reserved_bits |= X86_CR4_CET; \
| ^~ ~~~~~~~~~~~
| |
| const u32 * {aka const unsigned int *}
arch/x86/kvm/x86.c:10202:22: note: in expansion of macro '__cr4_reserved_bits'
10202 | cr4_reserved_bits = __cr4_reserved_bits(__kvm_cpu_cap_has, UNUSED_);
| ^~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:408:3: warning: statement with no effect [-Wunused-value]
408 | __reserved_bits |= X86_CR4_CET; \
| ^~~~~~~~~~~~~~~
arch/x86/kvm/x86.c:10202:22: note: in expansion of macro '__cr4_reserved_bits'
10202 | cr4_reserved_bits = __cr4_reserved_bits(__kvm_cpu_cap_has, UNUSED_);
| ^~~~~~~~~~~~~~~~~~~
In file included from arch/x86/include/asm/thread_info.h:53,
from include/linux/thread_info.h:38,
from arch/x86/include/asm/preempt.h:7,
from include/linux/preempt.h:78,
from include/linux/percpu.h:6,
from include/linux/context_tracking_state.h:5,
from include/linux/hardirq.h:5,
from include/linux/kvm_host.h:7,
from arch/x86/kvm/x86.c:19:
arch/x86/kvm/x86.c: In function 'kvm_arch_check_processor_compat':
arch/x86/kvm/x86.h:406:22: error: 'X86_FEATURE_SHSTK' undeclared (first use in this function); did you mean 'X86_FEATURE_EST'?
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:24: note: in definition of macro 'cpu_has'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:9: error: invalid operands to binary >> (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:72:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
72 | ( CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 0, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:37: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:72:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
72 | ( CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 0, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:29: error: invalid operands to binary << (have 'long unsigned int' and 'const u32 *' {aka 'const unsigned int *'})
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:72:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
72 | ( CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 0, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:42: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~~~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:72:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
72 | ( CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 0, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:9: error: invalid operands to binary >> (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:73:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
73 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 1, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
>> arch/x86/include/asm/cpufeature.h:62:13: warning: comparison between pointer and integer
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ^~
arch/x86/include/asm/cpufeature.h:73:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
73 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 1, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:37: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:73:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
73 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 1, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:29: error: invalid operands to binary << (have 'long unsigned int' and 'const u32 *' {aka 'const unsigned int *'})
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:73:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
73 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 1, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:42: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~~~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:73:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
73 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 1, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:9: error: invalid operands to binary >> (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:74:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
74 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 2, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
>> arch/x86/include/asm/cpufeature.h:62:13: warning: comparison between pointer and integer
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ^~
arch/x86/include/asm/cpufeature.h:74:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
74 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 2, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:37: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:74:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
74 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 2, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:29: error: invalid operands to binary << (have 'long unsigned int' and 'const u32 *' {aka 'const unsigned int *'})
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:74:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
74 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 2, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:42: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~~~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:74:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
74 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 2, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:9: error: invalid operands to binary >> (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:75:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
75 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 3, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
>> arch/x86/include/asm/cpufeature.h:62:13: warning: comparison between pointer and integer
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ^~
arch/x86/include/asm/cpufeature.h:75:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
75 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 3, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:37: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:75:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
75 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 3, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:29: error: invalid operands to binary << (have 'long unsigned int' and 'const u32 *' {aka 'const unsigned int *'})
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:75:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
75 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 3, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:42: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~~~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:75:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
75 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 3, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:9: error: invalid operands to binary >> (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:76:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
76 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 4, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
>> arch/x86/include/asm/cpufeature.h:62:13: warning: comparison between pointer and integer
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ^~
arch/x86/include/asm/cpufeature.h:76:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
76 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 4, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:37: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:76:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
76 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 4, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:29: error: invalid operands to binary << (have 'long unsigned int' and 'const u32 *' {aka 'const unsigned int *'})
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:76:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
76 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 4, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:42: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~~~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:76:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
76 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 4, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:9: error: invalid operands to binary >> (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:77:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
77 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 5, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
>> arch/x86/include/asm/cpufeature.h:62:13: warning: comparison between pointer and integer
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ^~
arch/x86/include/asm/cpufeature.h:77:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
77 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 5, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:37: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:77:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
77 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 5, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:29: error: invalid operands to binary << (have 'long unsigned int' and 'const u32 *' {aka 'const unsigned int *'})
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:77:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
77 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 5, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:42: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~~~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:77:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
77 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 5, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:9: error: invalid operands to binary >> (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:78:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
78 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 6, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
>> arch/x86/include/asm/cpufeature.h:62:13: warning: comparison between pointer and integer
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ^~
arch/x86/include/asm/cpufeature.h:78:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
78 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 6, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:37: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:78:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
78 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 6, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:29: error: invalid operands to binary << (have 'long unsigned int' and 'const u32 *' {aka 'const unsigned int *'})
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:78:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
78 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 6, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:42: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~~~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:78:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
78 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 6, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:9: error: invalid operands to binary >> (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:79:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
79 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 7, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
>> arch/x86/include/asm/cpufeature.h:62:13: warning: comparison between pointer and integer
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ^~
arch/x86/include/asm/cpufeature.h:79:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
79 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 7, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:37: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:79:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
79 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 7, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:29: error: invalid operands to binary << (have 'long unsigned int' and 'const u32 *' {aka 'const unsigned int *'})
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:79:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
79 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 7, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:42: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~~~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:79:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
79 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 7, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:9: error: invalid operands to binary >> (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:80:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
80 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 8, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
>> arch/x86/include/asm/cpufeature.h:62:13: warning: comparison between pointer and integer
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ^~
arch/x86/include/asm/cpufeature.h:80:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
80 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 8, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:37: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:80:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
80 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 8, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:29: error: invalid operands to binary << (have 'long unsigned int' and 'const u32 *' {aka 'const unsigned int *'})
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:80:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
80 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 8, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:42: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~~~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:80:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
80 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 8, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:9: error: invalid operands to binary >> (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:81:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
81 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 9, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
>> arch/x86/include/asm/cpufeature.h:62:13: warning: comparison between pointer and integer
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ^~
arch/x86/include/asm/cpufeature.h:81:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
81 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 9, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:37: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:81:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
81 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 9, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:29: error: invalid operands to binary << (have 'long unsigned int' and 'const u32 *' {aka 'const unsigned int *'})
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:81:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
81 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 9, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:42: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~~~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:81:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
81 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 9, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:9: error: invalid operands to binary >> (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:82:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
82 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 10, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
>> arch/x86/include/asm/cpufeature.h:62:13: warning: comparison between pointer and integer
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ^~
arch/x86/include/asm/cpufeature.h:82:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
82 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 10, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:37: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:82:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
82 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 10, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:29: error: invalid operands to binary << (have 'long unsigned int' and 'const u32 *' {aka 'const unsigned int *'})
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:82:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
82 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 10, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:42: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~~~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:82:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
82 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 10, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:9: error: invalid operands to binary >> (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:83:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
83 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 11, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
>> arch/x86/include/asm/cpufeature.h:62:13: warning: comparison between pointer and integer
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ^~
arch/x86/include/asm/cpufeature.h:83:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
83 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 11, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:37: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:83:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
83 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 11, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:29: error: invalid operands to binary << (have 'long unsigned int' and 'const u32 *' {aka 'const unsigned int *'})
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:83:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
83 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 11, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:42: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~~~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:83:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
83 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 11, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:9: error: invalid operands to binary >> (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:84:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
84 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 12, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
>> arch/x86/include/asm/cpufeature.h:62:13: warning: comparison between pointer and integer
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ^~
arch/x86/include/asm/cpufeature.h:84:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
84 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 12, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:37: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:84:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
84 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 12, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:29: error: invalid operands to binary << (have 'long unsigned int' and 'const u32 *' {aka 'const unsigned int *'})
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:84:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
84 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 12, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:42: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~~~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:84:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
84 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 12, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:9: error: invalid operands to binary >> (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:85:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
85 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 13, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
>> arch/x86/include/asm/cpufeature.h:62:13: warning: comparison between pointer and integer
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ^~
arch/x86/include/asm/cpufeature.h:85:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
85 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 13, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:37: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:85:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
85 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 13, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:29: error: invalid operands to binary << (have 'long unsigned int' and 'const u32 *' {aka 'const unsigned int *'})
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:85:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
85 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 13, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:42: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~~~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:85:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
85 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 13, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:9: error: invalid operands to binary >> (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:86:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
86 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 14, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
>> arch/x86/include/asm/cpufeature.h:62:13: warning: comparison between pointer and integer
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ^~
arch/x86/include/asm/cpufeature.h:86:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
86 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 14, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:37: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:86:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
86 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 14, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:29: error: invalid operands to binary << (have 'long unsigned int' and 'const u32 *' {aka 'const unsigned int *'})
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:86:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
86 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 14, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:42: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~~~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:86:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
86 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 14, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:9: error: invalid operands to binary >> (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:87:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
87 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 15, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
>> arch/x86/include/asm/cpufeature.h:62:13: warning: comparison between pointer and integer
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ^~
arch/x86/include/asm/cpufeature.h:87:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
87 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 15, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:37: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:87:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
87 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 15, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:29: error: invalid operands to binary << (have 'long unsigned int' and 'const u32 *' {aka 'const unsigned int *'})
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:87:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
87 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 15, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:42: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~~~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:87:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
87 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 15, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:9: error: invalid operands to binary >> (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:88:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
88 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 16, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
>> arch/x86/include/asm/cpufeature.h:62:13: warning: comparison between pointer and integer
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ^~
arch/x86/include/asm/cpufeature.h:88:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
88 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 16, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:37: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:88:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
88 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 16, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:29: error: invalid operands to binary << (have 'long unsigned int' and 'const u32 *' {aka 'const unsigned int *'})
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:88:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
88 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 16, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:42: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~~~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:88:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
88 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 16, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:9: error: invalid operands to binary >> (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:89:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
89 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 17, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
>> arch/x86/include/asm/cpufeature.h:62:13: warning: comparison between pointer and integer
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ^~
arch/x86/include/asm/cpufeature.h:89:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
89 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 17, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:37: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:89:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
89 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 17, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:29: error: invalid operands to binary << (have 'long unsigned int' and 'const u32 *' {aka 'const unsigned int *'})
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:89:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
89 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 17, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:42: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~~~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:89:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
89 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 17, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:9: error: invalid operands to binary >> (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:90:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
90 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 18, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
>> arch/x86/include/asm/cpufeature.h:62:13: warning: comparison between pointer and integer
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ^~
arch/x86/include/asm/cpufeature.h:90:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
90 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 18, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:37: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:90:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
90 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 18, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:29: error: invalid operands to binary << (have 'long unsigned int' and 'const u32 *' {aka 'const unsigned int *'})
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ^~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:90:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
90 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 18, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:62:42: error: invalid operands to binary & (have 'const u32 *' {aka 'const unsigned int *'} and 'int')
62 | (((bit)>>5)==(word) && (1UL<<((bit)&31) & maskname##word ))
| ~~~ ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:90:5: note: in expansion of macro 'CHECK_BIT_IN_MASK_WORD'
90 | CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 18, feature_bit) || \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:32: note: in expansion of macro 'REQUIRED_MASK_BIT_SET'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:22: warning: passing argument 1 of 'test_bit' makes integer from pointer without a cast [-Wint-conversion]
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~~~~~~~~~
| |
| const u32 * {aka const unsigned int *}
arch/x86/include/asm/cpufeature.h:52:12: note: in definition of macro 'test_cpu_cap'
52 | test_bit(bit, (unsigned long *)((c)->x86_capability))
| ^~~
arch/x86/kvm/x86.h:406:7: note: in expansion of macro 'cpu_has'
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~
arch/x86/kvm/x86.c:10235:6: note: in expansion of macro '__cr4_reserved_bits'
10235 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
In file included from arch/x86/include/asm/bitops.h:392,
from include/linux/bitops.h:29,
from include/linux/kernel.h:12,
from include/asm-generic/bug.h:20,
from arch/x86/include/asm/bug.h:93,
from include/linux/bug.h:5,
from include/linux/mmdebug.h:5,
from include/linux/percpu.h:5,
from include/linux/context_tracking_state.h:5,
from include/linux/hardirq.h:5,
from include/linux/kvm_host.h:7,
from arch/x86/kvm/x86.c:19:
include/asm-generic/bitops/instrumented-non-atomic.h:132:34: note: expected 'long int' but argument is of type 'const u32 *' {aka 'const unsigned int *'}
132 | static inline bool test_bit(long nr, const volatile unsigned long *addr)
| ~~~~~^~
In file included from arch/x86/include/asm/thread_info.h:53,
from include/linux/thread_info.h:38,
from arch/x86/include/asm/preempt.h:7,
from include/linux/preempt.h:78,
from include/linux/percpu.h:6,
from include/linux/context_tracking_state.h:5,vim +3591 arch/x86/kvm/x86.c
15c4a6406f6c406 drivers/kvm/x86.c Carsten Otte 2007-10-30 3588
40d6256c456d0be arch/x86/kvm/x86.c Sean Christopherson 2020-11-06 3589 static bool is_xsaves_msr(u32 index)
40d6256c456d0be arch/x86/kvm/x86.c Sean Christopherson 2020-11-06 3590 {
40d6256c456d0be arch/x86/kvm/x86.c Sean Christopherson 2020-11-06 @3591 return index == MSR_IA32_U_CET ||
40d6256c456d0be arch/x86/kvm/x86.c Sean Christopherson 2020-11-06 3592 (index >= MSR_IA32_PL0_SSP && index <= MSR_IA32_PL3_SSP);
40d6256c456d0be arch/x86/kvm/x86.c Sean Christopherson 2020-11-06 3593 }40d6256c456d0be arch/x86/kvm/x86.c Sean Christopherson 2020-11-06 3594
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]
kernel test robot
build botRe: [PATCH v14 10/13] KVM: x86: Enable CET virtualization for VMX and advertise CET to userspace
In reply to Yang WeijiangThank you for the patch! Perhaps something to improve:
Hi Yang,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on tip/master]
[also build test WARNING on linus/master v5.10-rc3 next-20201106] [cannot apply to vhost/linux-next kvm/linux-next linux/master] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Yang-Weijiang/Introduce-support-for-guest-CET-feature/20201106-090915 base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 6f72faf4a32303c8bdc6491186b79391e9cf0c7e config: i386-randconfig-r022-20201109 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 reproduce (this is a W=1 build): # https://github.com/0day-ci/linux/commit/34e06718bac59b9ecb835d2c4a04ae9378067819 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Yang-Weijiang/Introduce-support-for-guest-CET-feature/20201106-090915 git checkout 34e06718bac59b9ecb835d2c4a04ae9378067819 # save the attached .config to linux build tree make W=1 ARCH=i386
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
In file included from arch/x86/kvm/cpuid.h:5,
from arch/x86/kvm/mmu.h:7,
from arch/x86/kvm/x86.c:22:
arch/x86/kvm/x86.h: In function 'kvm_cet_supported':
arch/x86/kvm/x86.h:291:25: error: 'XFEATURE_MASK_CET_USER' undeclared (first use in this function); did you mean 'XFEATURE_MASK_SSE'?
291 | return supported_xss & XFEATURE_MASK_CET_USER;
| ^~~~~~~~~~~~~~~~~~~~~~
| XFEATURE_MASK_SSE
arch/x86/kvm/x86.h:291:25: note: each undeclared identifier is reported only once for each function it appears in
In file included from include/linux/kvm_host.h:36,
from arch/x86/kvm/x86.c:19:
arch/x86/kvm/x86.c: At top level:
arch/x86/include/asm/kvm_host.h:104:8: error: 'X86_CR4_CET' undeclared here (not in a function); did you mean 'X86_CR4_DE'?
104 | | X86_CR4_CET))
| ^~~~~~~~~~~
arch/x86/kvm/x86.c:101:46: note: in expansion of macro 'CR4_RESERVED_BITS'
101 | static u64 __read_mostly cr4_reserved_bits = CR4_RESERVED_BITS;
| ^~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.c:1251:2: error: 'MSR_IA32_U_CET' undeclared here (not in a function); did you mean 'MSR_IA32_PMC0'?
1251 | MSR_IA32_U_CET, MSR_IA32_S_CET, MSR_IA32_INT_SSP_TAB, MSR_KVM_GUEST_SSP,
| ^~~~~~~~~~~~~~
| MSR_IA32_PMC0
arch/x86/kvm/x86.c:1251:18: error: 'MSR_IA32_S_CET' undeclared here (not in a function); did you mean 'MSR_IA32_PMC0'?
1251 | MSR_IA32_U_CET, MSR_IA32_S_CET, MSR_IA32_INT_SSP_TAB, MSR_KVM_GUEST_SSP,
| ^~~~~~~~~~~~~~
| MSR_IA32_PMC0
arch/x86/kvm/x86.c:1251:34: error: 'MSR_IA32_INT_SSP_TAB' undeclared here (not in a function)
1251 | MSR_IA32_U_CET, MSR_IA32_S_CET, MSR_IA32_INT_SSP_TAB, MSR_KVM_GUEST_SSP,
| ^~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.c:1252:2: error: 'MSR_IA32_PL0_SSP' undeclared here (not in a function); did you mean 'MSR_IA32_MCG_ESP'?
1252 | MSR_IA32_PL0_SSP, MSR_IA32_PL1_SSP, MSR_IA32_PL2_SSP, MSR_IA32_PL3_SSP,
| ^~~~~~~~~~~~~~~~
| MSR_IA32_MCG_ESP
arch/x86/kvm/x86.c:1252:20: error: 'MSR_IA32_PL1_SSP' undeclared here (not in a function); did you mean 'MSR_IA32_MCG_ESP'?
1252 | MSR_IA32_PL0_SSP, MSR_IA32_PL1_SSP, MSR_IA32_PL2_SSP, MSR_IA32_PL3_SSP,
| ^~~~~~~~~~~~~~~~
| MSR_IA32_MCG_ESP
arch/x86/kvm/x86.c:1252:38: error: 'MSR_IA32_PL2_SSP' undeclared here (not in a function); did you mean 'MSR_IA32_MCG_ESP'?
1252 | MSR_IA32_PL0_SSP, MSR_IA32_PL1_SSP, MSR_IA32_PL2_SSP, MSR_IA32_PL3_SSP,
| ^~~~~~~~~~~~~~~~
| MSR_IA32_MCG_ESP
arch/x86/kvm/x86.c:1252:56: error: 'MSR_IA32_PL3_SSP' undeclared here (not in a function); did you mean 'MSR_IA32_MCG_ESP'?
1252 | MSR_IA32_PL0_SSP, MSR_IA32_PL1_SSP, MSR_IA32_PL2_SSP, MSR_IA32_PL3_SSP,
| ^~~~~~~~~~~~~~~~
| MSR_IA32_MCG_ESP
arch/x86/kvm/x86.c: In function 'is_xsaves_msr':
arch/x86/kvm/x86.c:3591:15: warning: comparison between pointer and integer
3591 | return index == MSR_IA32_U_CET ||
| ^~
arch/x86/kvm/x86.c:3592:16: warning: comparison between pointer and integer
3592 | (index >= MSR_IA32_PL0_SSP && index <= MSR_IA32_PL3_SSP);
| ^~
arch/x86/kvm/x86.c:3592:45: warning: comparison between pointer and integer
3592 | (index >= MSR_IA32_PL0_SSP && index <= MSR_IA32_PL3_SSP);
| ^~
arch/x86/kvm/x86.c: In function 'kvm_arch_hardware_setup':
arch/x86/kvm/x86.c:10205:21: error: 'X86_FEATURE_SHSTK' undeclared (first use in this function); did you mean 'X86_FEATURE_EST'?
10205 | kvm_cpu_cap_clear(X86_FEATURE_SHSTK);
| ^~~~~~~~~~~~~~~~~
| X86_FEATURE_EST
>> arch/x86/kvm/x86.c:10205:21: warning: passing argument 1 of 'kvm_cpu_cap_clear' makes integer from pointer without a cast [-Wint-conversion]
In file included from arch/x86/kvm/mmu.h:7,
from arch/x86/kvm/x86.c:22:
arch/x86/kvm/cpuid.h:277:60: note: expected 'unsigned int' but argument is of type 'const u32 *' {aka 'const unsigned int *'}
277 | static __always_inline void kvm_cpu_cap_clear(unsigned int x86_feature)
| ~~~~~~~~~~~~~^~~~~~~~~~~
arch/x86/kvm/x86.c:10206:21: error: 'X86_FEATURE_IBT' undeclared (first use in this function); did you mean 'X86_FEATURE_IBS'?
10206 | kvm_cpu_cap_clear(X86_FEATURE_IBT);
| ^~~~~~~~~~~~~~~
| X86_FEATURE_IBS
arch/x86/kvm/x86.c:10206:21: warning: passing argument 1 of 'kvm_cpu_cap_clear' makes integer from pointer without a cast [-Wint-conversion]
In file included from arch/x86/kvm/mmu.h:7,
from arch/x86/kvm/x86.c:22:
arch/x86/kvm/cpuid.h:277:60: note: expected 'unsigned int' but argument is of type 'const u32 *' {aka 'const unsigned int *'}
277 | static __always_inline void kvm_cpu_cap_clear(unsigned int x86_feature)
| ~~~~~~~~~~~~~^~~~~~~~~~~
In file included from include/linux/kvm_host.h:36,
from arch/x86/kvm/x86.c:19:
arch/x86/include/asm/kvm_host.h:104:6: error: invalid operands to binary | (have 'long unsigned int' and 'const u32 *' {aka 'const unsigned int *'})
104 | | X86_CR4_CET))
| ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/kvm/x86.h:388:24: note: in expansion of macro 'CR4_RESERVED_BITS'
388 | u64 __reserved_bits = CR4_RESERVED_BITS; \
| ^~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.c:10210:22: note: in expansion of macro '__cr4_reserved_bits'
10210 | cr4_reserved_bits = __cr4_reserved_bits(__kvm_cpu_cap_has, UNUSED_);
| ^~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:406:22: warning: passing argument 1 of 'kvm_cpu_cap_has' makes integer from pointer without a cast [-Wint-conversion]
406 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~~~~~~~~~
| |
| const u32 * {aka const unsigned int *}
arch/x86/kvm/x86.c:10209:55: note: in definition of macro '__kvm_cpu_cap_has'
10209 | #define __kvm_cpu_cap_has(UNUSED_, f) kvm_cpu_cap_has(f)
| ^
arch/x86/kvm/x86.c:10210:22: note: in expansion of macro '__cr4_reserved_bits'
10210 | cr4_reserved_bits = __cr4_reserved_bits(__kvm_cpu_cap_has, UNUSED_);
| ^~~~~~~~~~~~~~~~~~~
In file included from arch/x86/kvm/mmu.h:7,
from arch/x86/kvm/x86.c:22:
arch/x86/kvm/cpuid.h:301:58: note: expected 'unsigned int' but argument is of type 'const u32 *' {aka 'const unsigned int *'}
301 | static __always_inline bool kvm_cpu_cap_has(unsigned int x86_feature)
| ~~~~~~~~~~~~~^~~~~~~~~~~
arch/x86/kvm/x86.h:407:22: warning: passing argument 1 of 'kvm_cpu_cap_has' makes integer from pointer without a cast [-Wint-conversion]
407 | !__cpu_has(__c, X86_FEATURE_IBT)) \
| ^~~~~~~~~~~~~~~
| |
| const u32 * {aka const unsigned int *}
arch/x86/kvm/x86.c:10209:55: note: in definition of macro '__kvm_cpu_cap_has'
10209 | #define __kvm_cpu_cap_has(UNUSED_, f) kvm_cpu_cap_has(f)
| ^
arch/x86/kvm/x86.c:10210:22: note: in expansion of macro '__cr4_reserved_bits'
10210 | cr4_reserved_bits = __cr4_reserved_bits(__kvm_cpu_cap_has, UNUSED_);
| ^~~~~~~~~~~~~~~~~~~
In file included from arch/x86/kvm/mmu.h:7,
from arch/x86/kvm/x86.c:22:
arch/x86/kvm/cpuid.h:301:58: note: expected 'unsigned int' but argument is of type 'const u32 *' {aka 'const unsigned int *'}
301 | static __always_inline bool kvm_cpu_cap_has(unsigned int x86_feature)
| ~~~~~~~~~~~~~^~~~~~~~~~~
In file included from arch/x86/kvm/cpuid.h:5,
from arch/x86/kvm/mmu.h:7,
from arch/x86/kvm/x86.c:22:
arch/x86/kvm/x86.h:408:19: error: invalid operands to binary | (have 'u64' {aka 'long long unsigned int'} and 'const u32 *' {aka 'const unsigned int *'})
408 | __reserved_bits |= X86_CR4_CET; \
| ^~ ~~~~~~~~~~~
| |
| const u32 * {aka const unsigned int *}
arch/x86/kvm/x86.c:10210:22: note: in expansion of macro '__cr4_reserved_bits'
10210 | cr4_reserved_bits = __cr4_reserved_bits(__kvm_cpu_cap_has, UNUSED_);
| ^~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:408:3: warning: statement with no effect [-Wunused-value]
408 | __reserved_bits |= X86_CR4_CET; \
| ^~~~~~~~~~~~~~~
arch/x86/kvm/x86.c:10210:22: note: in expansion of macro '__cr4_reserved_bits'
10210 | cr4_reserved_bits = __cr4_reserved_bits(__kvm_cpu_cap_has, UNUSED_);
| ^~~~~~~~~~~~~~~~~~~
In file included from include/linux/kvm_host.h:36,
from arch/x86/kvm/x86.c:19:
arch/x86/kvm/x86.c: In function 'kvm_arch_check_processor_compat':
arch/x86/include/asm/kvm_host.h:104:6: error: invalid operands to binary | (have 'long unsigned int' and 'const u32 *' {aka 'const unsigned int *'})
104 | | X86_CR4_CET))
| ^
| |
| const u32 * {aka const unsigned int *}
arch/x86/kvm/x86.h:388:24: note: in expansion of macro 'CR4_RESERVED_BITS'
388 | u64 __reserved_bits = CR4_RESERVED_BITS; \
| ^~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.c:10243:6: note: in expansion of macro '__cr4_reserved_bits'
10243 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
In file included from arch/x86/include/asm/thread_info.h:53,
from include/linux/thread_info.h:38,
from arch/x86/include/asm/preempt.h:7,
from include/linux/preempt.h:78,
from include/linux/percpu.h:6,
from include/linux/context_tracking_state.h:5,
from include/linux/hardirq.h:5,
from include/linux/kvm_host.h:7,
from arch/x86/kvm/x86.c:19:vim +/kvm_cpu_cap_clear +10205 arch/x86/kvm/x86.c
10181
10182 int kvm_arch_hardware_setup(void *opaque)
10183 {
10184 struct kvm_x86_init_ops *ops = opaque;
10185 int r;
10186
10187 rdmsrl_safe(MSR_EFER, &host_efer);
10188
10189 if (boot_cpu_has(X86_FEATURE_XSAVES))
10190 rdmsrl(MSR_IA32_XSS, host_xss);
10191
10192 r = ops->hardware_setup();
10193 if (r != 0)
10194 return r;
10195
10196 memcpy(&kvm_x86_ops, ops->runtime_ops, sizeof(kvm_x86_ops));
10197
10198 if (!kvm_cpu_cap_has(X86_FEATURE_XSAVES))
10199 supported_xss = 0;
10200 else
10201 supported_xss &= host_xss;
10202
10203 /* Update CET features now that supported_xss is finalized. */
10204 if (!kvm_cet_supported()) {
10205 kvm_cpu_cap_clear(X86_FEATURE_SHSTK);
10206 kvm_cpu_cap_clear(X86_FEATURE_IBT);
10207 }
10208
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kernel test robot
build botRe: [PATCH v14 05/13] KVM: x86: Add fault checks for CR4.CET
In reply to Yang WeijiangThank you for the patch! Yet something to improve:
Hi Yang,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on tip/master]
[also build test ERROR on linus/master kvm/linux-next v5.10-rc3 next-20201109] [cannot apply to vhost/linux-next linux/master]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Yang-Weijiang/Introduce-support-for-guest-CET-feature/20201106-090915 base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 6f72faf4a32303c8bdc6491186b79391e9cf0c7e config: i386-randconfig-r022-20201109 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 reproduce (this is a W=1 build): # https://github.com/0day-ci/linux/commit/6ad097a38652897acc9b138f8c43f6c61ce92fc5 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Yang-Weijiang/Introduce-support-for-guest-CET-feature/20201106-090915 git checkout 6ad097a38652897acc9b138f8c43f6c61ce92fc5 # save the attached .config to linux build tree make W=1 ARCH=i386
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
arch/x86/kvm/x86.c: In function 'kvm_set_cr0':
arch/x86/kvm/x86.c:850:53: error: 'X86_CR4_CET' undeclared (first use in this function); did you mean 'X86_CR4_DE'?
850 | if (!(cr0 & X86_CR0_WP) && kvm_read_cr4_bits(vcpu, X86_CR4_CET))
| ^~~~~~~~~~~
| X86_CR4_DE
arch/x86/kvm/x86.c:850:53: note: each undeclared identifier is reported only once for each function it appears in
arch/x86/kvm/x86.c: In function 'kvm_set_cr4':
arch/x86/kvm/x86.c:1014:13: error: 'X86_CR4_CET' undeclared (first use in this function); did you mean 'X86_CR4_DE'?
1014 | if ((cr4 & X86_CR4_CET) && !(kvm_read_cr0(vcpu) & X86_CR0_WP))
| ^~~~~~~~~~~
| X86_CR4_DE
arch/x86/kvm/x86.c: In function 'kvm_arch_hardware_setup':
>> arch/x86/kvm/x86.h:401:22: error: 'X86_FEATURE_SHSTK' undeclared (first use in this function); did you mean 'X86_FEATURE_EST'?
401 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.c:10175:55: note: in definition of macro '__kvm_cpu_cap_has'
10175 | #define __kvm_cpu_cap_has(UNUSED_, f) kvm_cpu_cap_has(f)
| ^
arch/x86/kvm/x86.c:10176:22: note: in expansion of macro '__cr4_reserved_bits'
10176 | cr4_reserved_bits = __cr4_reserved_bits(__kvm_cpu_cap_has, UNUSED_);
| ^~~~~~~~~~~~~~~~~~~
>> arch/x86/kvm/x86.h:402:22: error: 'X86_FEATURE_IBT' undeclared (first use in this function); did you mean 'X86_FEATURE_IBS'?
402 | !__cpu_has(__c, X86_FEATURE_IBT)) \
| ^~~~~~~~~~~~~~~
arch/x86/kvm/x86.c:10175:55: note: in definition of macro '__kvm_cpu_cap_has'
10175 | #define __kvm_cpu_cap_has(UNUSED_, f) kvm_cpu_cap_has(f)
| ^
arch/x86/kvm/x86.c:10176:22: note: in expansion of macro '__cr4_reserved_bits'
10176 | cr4_reserved_bits = __cr4_reserved_bits(__kvm_cpu_cap_has, UNUSED_);
| ^~~~~~~~~~~~~~~~~~~
In file included from arch/x86/kvm/cpuid.h:5,
from arch/x86/kvm/mmu.h:7,
from arch/x86/kvm/x86.c:22:
arch/x86/kvm/x86.h:403:22: error: 'X86_CR4_CET' undeclared (first use in this function); did you mean 'X86_CR4_DE'?
403 | __reserved_bits |= X86_CR4_CET; \
| ^~~~~~~~~~~
arch/x86/kvm/x86.c:10176:22: note: in expansion of macro '__cr4_reserved_bits'
10176 | cr4_reserved_bits = __cr4_reserved_bits(__kvm_cpu_cap_has, UNUSED_);
| ^~~~~~~~~~~~~~~~~~~
In file included from arch/x86/include/asm/thread_info.h:53,
from include/linux/thread_info.h:38,
from arch/x86/include/asm/preempt.h:7,
from include/linux/preempt.h:78,
from include/linux/percpu.h:6,
from include/linux/context_tracking_state.h:5,
from include/linux/hardirq.h:5,
from include/linux/kvm_host.h:7,
from arch/x86/kvm/x86.c:19:
arch/x86/kvm/x86.c: In function 'kvm_arch_check_processor_compat':
>> arch/x86/kvm/x86.h:401:22: error: 'X86_FEATURE_SHSTK' undeclared (first use in this function); did you mean 'X86_FEATURE_EST'?
401 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:24: note: in definition of macro 'cpu_has'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~
arch/x86/kvm/x86.c:10209:6: note: in expansion of macro '__cr4_reserved_bits'
10209 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
>> arch/x86/kvm/x86.h:402:22: error: 'X86_FEATURE_IBT' undeclared (first use in this function); did you mean 'X86_FEATURE_IBS'?
402 | !__cpu_has(__c, X86_FEATURE_IBT)) \
| ^~~~~~~~~~~~~~~
arch/x86/include/asm/cpufeature.h:118:24: note: in definition of macro 'cpu_has'
118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^~~
arch/x86/kvm/x86.c:10209:6: note: in expansion of macro '__cr4_reserved_bits'
10209 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
In file included from arch/x86/kvm/cpuid.h:5,
from arch/x86/kvm/mmu.h:7,
from arch/x86/kvm/x86.c:22:
arch/x86/kvm/x86.h:403:22: error: 'X86_CR4_CET' undeclared (first use in this function); did you mean 'X86_CR4_DE'?
403 | __reserved_bits |= X86_CR4_CET; \
| ^~~~~~~~~~~
arch/x86/kvm/x86.c:10209:6: note: in expansion of macro '__cr4_reserved_bits'
10209 | if (__cr4_reserved_bits(cpu_has, c) !=
| ^~~~~~~~~~~~~~~~~~~
--
In file included from arch/x86/kvm/cpuid.h:5,
from arch/x86/kvm/cpuid.c:21:
arch/x86/kvm/cpuid.c: In function 'kvm_vcpu_after_set_cpuid':
>> arch/x86/kvm/x86.h:401:22: error: 'X86_FEATURE_SHSTK' undeclared (first use in this function); did you mean 'X86_FEATURE_EST'?
401 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~~~~~~~~~
arch/x86/kvm/cpuid.c:185:6: note: in expansion of macro '__cr4_reserved_bits'
185 | __cr4_reserved_bits(guest_cpuid_has, vcpu);
| ^~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:401:22: note: each undeclared identifier is reported only once for each function it appears in
401 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \
| ^~~~~~~~~~~~~~~~~
arch/x86/kvm/cpuid.c:185:6: note: in expansion of macro '__cr4_reserved_bits'
185 | __cr4_reserved_bits(guest_cpuid_has, vcpu);
| ^~~~~~~~~~~~~~~~~~~
>> arch/x86/kvm/x86.h:402:22: error: 'X86_FEATURE_IBT' undeclared (first use in this function); did you mean 'X86_FEATURE_IBS'?
402 | !__cpu_has(__c, X86_FEATURE_IBT)) \
| ^~~~~~~~~~~~~~~
arch/x86/kvm/cpuid.c:185:6: note: in expansion of macro '__cr4_reserved_bits'
185 | __cr4_reserved_bits(guest_cpuid_has, vcpu);
| ^~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.h:403:22: error: 'X86_CR4_CET' undeclared (first use in this function); did you mean 'X86_CR4_MCE'?
403 | __reserved_bits |= X86_CR4_CET; \
| ^~~~~~~~~~~
arch/x86/kvm/cpuid.c:185:6: note: in expansion of macro '__cr4_reserved_bits'
185 | __cr4_reserved_bits(guest_cpuid_has, vcpu);
| ^~~~~~~~~~~~~~~~~~~vim +401 arch/x86/kvm/x86.h
380
381 #define __cr4_reserved_bits(__cpu_has, __c) \
382 ({ \
383 u64 __reserved_bits = CR4_RESERVED_BITS; \
384 \
385 if (!__cpu_has(__c, X86_FEATURE_XSAVE)) \
386 __reserved_bits |= X86_CR4_OSXSAVE; \
387 if (!__cpu_has(__c, X86_FEATURE_SMEP)) \
388 __reserved_bits |= X86_CR4_SMEP; \
389 if (!__cpu_has(__c, X86_FEATURE_SMAP)) \
390 __reserved_bits |= X86_CR4_SMAP; \
391 if (!__cpu_has(__c, X86_FEATURE_FSGSBASE)) \
392 __reserved_bits |= X86_CR4_FSGSBASE; \
393 if (!__cpu_has(__c, X86_FEATURE_PKU)) \
394 __reserved_bits |= X86_CR4_PKE; \
395 if (!__cpu_has(__c, X86_FEATURE_LA57)) \
396 __reserved_bits |= X86_CR4_LA57; \
397 if (!__cpu_has(__c, X86_FEATURE_UMIP)) \
398 __reserved_bits |= X86_CR4_UMIP; \
399 if (!__cpu_has(__c, X86_FEATURE_VMX)) \
400 __reserved_bits |= X86_CR4_VMXE; \
> 401 if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \ > 402 !__cpu_has(__c, X86_FEATURE_IBT)) \
403 __reserved_bits |= X86_CR4_CET; \
404 __reserved_bits; \
405 })
406
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Paolo Bonzini
maintainerRe: [PATCH v14 08/13] KVM: VMX: Add a synthetic MSR to allow userspace VMM to access GUEST_SSP
In reply to Yang WeijiangQuoted 60 lines · Yang Weijiang
Introduce a host-only synthetic MSR,
MSR_KVM_GUEST_SSPso that the VMM can read/write the guest's SSP, e.g. to migrate CET state. Use a synthetic MSR, e.g. as opposed to aVCPU_REG_, asGUEST_SSPis subject to the same consistency checks as the PL*_SSP MSRs, i.e. can share code.Co-developed-by Sean Christopherson <[email protected]>Signed-off-by Sean Christopherson <[email protected]>Signed-off-by Yang Weijiang <[email protected]>--- arch/x86/include/uapi/asm/kvm_para.h | 1 + arch/x86/kvm/vmx/vmx.c | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-)arch/x86/include/uapi/asm/kvm_para.h +1
-0@@ -53,6 +53,7 @@#define MSR_KVM_POLL_CONTROL 0x4b564d05#define MSR_KVM_ASYNC_PF_INT 0x4b564d06#define MSR_KVM_ASYNC_PF_ACK 0x4b564d07 +#define MSR_KVM_GUEST_SSP 0x4b564d08struct kvm_steal_time {__u64 steal;arch/x86/kvm/vmx/vmx.c +8
-1@@ -1817,7 +1817,8 @@ static bool cet_is_ssp_msr_accessible(struct kvm_vcpu *vcpu,if (msr->host_initiated)return true; -if (!guest_cpuid_has (vcpu,X86_FEATURE_SHSTK )) +if (!guest_cpuid_has (vcpu,X86_FEATURE_SHSTK ) || + msr->index ==MSR_KVM_GUEST_SSP )return false;if (msr->index ==MSR_IA32_INT_SSP_TAB )@@ -1995,6 +1996,11 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)return 1 ; msr_info->data =vmcs_readl (GUEST_INTR_SSP_TABLE );break ; +case MSR_KVM_GUEST_SSP : +if (!cet_is_ssp_msr_accessible (vcpu, msr_info)) +return 1 ; + msr_info->data =vmcs_readl (GUEST_SSP ); +break ; case MSR_IA32_PL0_SSP ... MSR_IA32_PL3_SSP:if (!cet_is_ssp_msr_accessible (vcpu, msr_info))return 1 ;@@ -2287,12 +2293,16 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)return 1 ;vmcs_writel (GUEST_INTR_SSP_TABLE , data);break ; +case MSR_KVM_GUEST_SSP : case MSR_IA32_PL0_SSP ... MSR_IA32_PL3_SSP:if (!cet_is_ssp_msr_accessible (vcpu, msr_info))return 1 ;
arch/x86/kvm/vmx/vmx.c static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) · line 2308
Quoted 10 lines
arch/x86/kvm/vmx/vmx.c +4
-1if ((data &GENMASK (2 ,0 )) ||is_noncanonical_address (data, vcpu))return 1 ; -vmx_set_xsave_msr (msr_info); +if (msr_index ==MSR_KVM_GUEST_SSP ) +vmcs_writel (GUEST_SSP , data); +else +vmx_set_xsave_msr (msr_info);break ;case MSR_TSC_AUX : if (!msr_info->host_initiated &&
Better make this fail if !msr_info->host_initiated.
Paolo
Paolo Bonzini
maintainerRe: [PATCH v14 08/13] KVM: VMX: Add a synthetic MSR to allow userspace VMM to access GUEST_SSP
In reply to Yang WeijiangQuoted 60 lines · Yang Weijiang
Introduce a host-only synthetic MSR,
MSR_KVM_GUEST_SSPso that the VMM can read/write the guest's SSP, e.g. to migrate CET state. Use a synthetic MSR, e.g. as opposed to aVCPU_REG_, asGUEST_SSPis subject to the same consistency checks as the PL*_SSP MSRs, i.e. can share code.Co-developed-by Sean Christopherson <[email protected]>Signed-off-by Sean Christopherson <[email protected]>Signed-off-by Yang Weijiang <[email protected]>--- arch/x86/include/uapi/asm/kvm_para.h | 1 + arch/x86/kvm/vmx/vmx.c | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-)arch/x86/include/uapi/asm/kvm_para.h +1
-0@@ -53,6 +53,7 @@#define MSR_KVM_POLL_CONTROL 0x4b564d05#define MSR_KVM_ASYNC_PF_INT 0x4b564d06#define MSR_KVM_ASYNC_PF_ACK 0x4b564d07 +#define MSR_KVM_GUEST_SSP 0x4b564d08struct kvm_steal_time {__u64 steal;arch/x86/kvm/vmx/vmx.c +8
-1@@ -1817,7 +1817,8 @@ static bool cet_is_ssp_msr_accessible(struct kvm_vcpu *vcpu,if (msr->host_initiated)return true; -if (!guest_cpuid_has (vcpu,X86_FEATURE_SHSTK )) +if (!guest_cpuid_has (vcpu,X86_FEATURE_SHSTK ) || + msr->index ==MSR_KVM_GUEST_SSP )return false;if (msr->index ==MSR_IA32_INT_SSP_TAB )@@ -1995,6 +1996,11 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)return 1 ; msr_info->data =vmcs_readl (GUEST_INTR_SSP_TABLE );break ; +case MSR_KVM_GUEST_SSP : +if (!cet_is_ssp_msr_accessible (vcpu, msr_info)) +return 1 ; + msr_info->data =vmcs_readl (GUEST_SSP ); +break ; case MSR_IA32_PL0_SSP ... MSR_IA32_PL3_SSP:if (!cet_is_ssp_msr_accessible (vcpu, msr_info))return 1 ;@@ -2287,12 +2293,16 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)return 1 ;vmcs_writel (GUEST_INTR_SSP_TABLE , data);break ; +case MSR_KVM_GUEST_SSP : case MSR_IA32_PL0_SSP ... MSR_IA32_PL3_SSP:if (!cet_is_ssp_msr_accessible (vcpu, msr_info))return 1 ;
arch/x86/kvm/vmx/vmx.c static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) · line 2308
Quoted 10 lines
arch/x86/kvm/vmx/vmx.c +4
-1if ((data &GENMASK (2 ,0 )) ||is_noncanonical_address (data, vcpu))return 1 ; -vmx_set_xsave_msr (msr_info); +if (msr_index ==MSR_KVM_GUEST_SSP ) +vmcs_writel (GUEST_SSP , data); +else +vmx_set_xsave_msr (msr_info);break ;case MSR_TSC_AUX : if (!msr_info->host_initiated &&
Doh, I misread the change in cet_is_ssp_msr_accessible, sorry. */
Paolo Bonzini
maintainerRe: [PATCH v14 07/13] KVM: VMX: Emulate reads and writes to CET MSRs
In reply to Yang WeijiangQuoted 7 lines · Yang Weijiang
arch/x86/kvm/vmx/vmx.c +6
-0+static bool cet_is_ssp_msr_accessible (struct kvm_vcpu *vcpu, +struct msr_data *msr) +{ +u64 mask; + +if (!kvm_cet_supported ())
arch/x86/kvm/vmx/vmx.c static int vmx_get_msr_feature(struct kvm_msr_entry *msr) · line 1824
Quoted 10 lines
arch/x86/kvm/vmx/vmx.c +10
-0+return false; + +if (msr->host_initiated) +return true; + +if (!guest_cpuid_has (vcpu,X86_FEATURE_SHSTK )) +return false; + +if (msr->index ==MSR_IA32_INT_SSP_TAB ) +return false;
Shouldn't this return true?
Paolo
Quoted 4 lines
arch/x86/kvm/vmx/vmx.c +4
-0+ mask = (msr->index ==MSR_IA32_PL3_SSP ) ?XFEATURE_MASK_CET_USER : +XFEATURE_MASK_CET_KERNEL ; +return !!(vcpu->arch.guest_supported_xss & mask); +}
Paolo Bonzini
maintainerRe: [PATCH v14 09/13] KVM: x86: Report CET MSRs as to-be-saved if CET is supported
In reply to Yang WeijiangQuoted 28 lines · Yang Weijiang
Report all CET MSRs, including the synthetic
GUEST_SSPMSR, as to-be-saved, e.g. for migration, if CET is supported by KVM.Co-developed-by Sean Christopherson <[email protected]>Signed-off-by Sean Christopherson <[email protected]>Signed-off-by Yang Weijiang <[email protected]>--- arch/x86/kvm/x86.c | 9 +++++++++ 1 file changed, 9 insertions(+)arch/x86/kvm/x86.c +2
-0@@ -1248,6 +1248,8 @@ static const u32 msrs_to_save_all[] = {MSR_ARCH_PERFMON_EVENTSEL0 +16 ,MSR_ARCH_PERFMON_EVENTSEL0 +17 ,MSR_IA32_XSS , +MSR_IA32_U_CET ,MSR_IA32_S_CET ,MSR_IA32_INT_SSP_TAB ,MSR_KVM_GUEST_SSP , + MSR_IA32_PL0_SSP, MSR_IA32_PL1_SSP, MSR_IA32_PL2_SSP, MSR_IA32_PL3_SSP, };static u32 msrs_to_save[ARRAY_SIZE (msrs_to_save_all)];@@ -5761,6 +5763,13 @@ static void kvm_init_msr_list(void)if (!supported_xss)continue ;break ;
arch/x86/kvm/x86.c static void kvm_init_msr_list(void) · line 5775
Quoted 10 lines
arch/x86/kvm/x86.c +7
-0+case MSR_IA32_U_CET : +case MSR_IA32_S_CET : +case MSR_IA32_INT_SSP_TAB : + case MSR_IA32_PL0_SSP ... MSR_IA32_PL3_SSP: +if (!kvm_cet_supported ()) +continue ; +break ;default :break ; }
Missing "case MSR_KVM_GUEST_SSP".
Paolo
Paolo Bonzini
maintainerRe: [PATCH v14 10/13] KVM: x86: Enable CET virtualization for VMX and advertise CET to userspace
In reply to Yang Weijiangarch/x86/kvm/vmx/vmx.c int vmx_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) · line 3303
Quoted 8 lines · Yang Weijiang
arch/x86/kvm/vmx/vmx.c +7
-0+ +if (((cr4 ^ old_cr4) &X86_CR4_CET ) &&kvm_cet_supported ()) { +vmcs_writel (GUEST_SSP ,0 ); +vmcs_writel (GUEST_S_CET ,0 ); +vmcs_writel (GUEST_INTR_SSP_TABLE ,0 ); + } +
Is this behavior documented for bare metal? I suspect it is at least not true for S_CET and INTR_SSP_TABLE, because SMM entry does not save those to SMRAM (and clears CR4.CET).
Also, you need to save/restore GUEST_SSP to SMRAM.
Paolo
Paolo Bonzini
maintainerRe: [PATCH v14 11/13] KVM: VMX: Pass through CET MSRs to the guest when supported
In reply to Yang WeijiangQuoted 52 lines · Yang Weijiang
Pass through all CET MSRs when the associated CET component (kernel vs. user) is enabled to improve guest performance. All CET MSRs are context switched, either via dedicated VMCS fields or XSAVES.
Co-developed-by Zhang Yi Z <[email protected]>Signed-off-by Zhang Yi Z <[email protected]>Co-developed-by Sean Christopherson <[email protected]>Signed-off-by Sean Christopherson <[email protected]>Signed-off-by Yang Weijiang <[email protected]>--- arch/x86/kvm/vmx/vmx.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)arch/x86/kvm/vmx/vmx.c +26
-0@@ -7366,6 +7366,32 @@ static void update_intel_pt_cfg(struct kvm_vcpu *vcpu) vmx->pt_desc.ctl_bitmask &= ~(0xfULL << (32 + i *4 )); } +static bool is_cet_state_supported (struct kvm_vcpu *vcpu,u32 xss_state) +{ +return (vcpu->arch.guest_supported_xss & xss_state) && + (guest_cpuid_has (vcpu,X86_FEATURE_SHSTK ) || +guest_cpuid_has (vcpu,X86_FEATURE_IBT )); +} + +static void vmx_update_intercept_for_cet_msr (struct kvm_vcpu *vcpu) +{ +bool incpt = !is_cet_state_supported (vcpu,XFEATURE_MASK_CET_USER ); + +vmx_set_intercept_for_msr (vcpu,MSR_IA32_U_CET ,MSR_TYPE_RW , incpt); + + incpt |= !guest_cpuid_has (vcpu,X86_FEATURE_SHSTK ); +vmx_set_intercept_for_msr (vcpu,MSR_IA32_PL3_SSP ,MSR_TYPE_RW , incpt); + + incpt = !is_cet_state_supported (vcpu,XFEATURE_MASK_CET_KERNEL ); +vmx_set_intercept_for_msr (vcpu,MSR_IA32_S_CET ,MSR_TYPE_RW , incpt); + + incpt |= !guest_cpuid_has (vcpu,X86_FEATURE_SHSTK ); +vmx_set_intercept_for_msr (vcpu,MSR_IA32_INT_SSP_TAB ,MSR_TYPE_RW , incpt); +vmx_set_intercept_for_msr (vcpu,MSR_IA32_PL0_SSP ,MSR_TYPE_RW , incpt); +vmx_set_intercept_for_msr (vcpu,MSR_IA32_PL1_SSP ,MSR_TYPE_RW , incpt); +vmx_set_intercept_for_msr (vcpu,MSR_IA32_PL2_SSP ,MSR_TYPE_RW , incpt); +} +static void vmx_vcpu_after_set_cpuid (struct kvm_vcpu *vcpu) {struct vcpu_vmx *vmx =to_vmx (vcpu);
arch/x86/kvm/vmx/vmx.c static void vmx_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu) · line 7443
Quoted 9 lines
arch/x86/kvm/vmx/vmx.c +3
-0@@ -7409,6 +7435,9 @@ static void vmx_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu)/* Refresh #PF interception to account for MAXPHYADDR changes. */ update_exception_bitmap (vcpu); + +if (kvm_cet_supported ()) +vmx_update_intercept_for_cet_msr (vcpu); }static __init void vmx_set_cpu_caps (void )
Can you do this only if CR4.CET=1?
Paolo
Paolo Bonzini
maintainerQuoted 141 lines · Yang Weijiang
Control-flow Enforcement Technology (CET) provides protection against Return/Jump-Oriented Programming (ROP/JOP) attack. There're two CET
sub-features: Shadow Stack (SHSTK) and Indirect Branch Tracking (IBT). SHSTK is to prevent ROP programming and IBT is to prevent JOP programming.Several parts in KVM have been updated to provide VM CET support, including:
CPUID/XSAVES config, MSR pass-through, user space MSR access interface, vmentry/vmexit config, nested VM etc. These patches have dependency on CET kernel patches for xsaves support and CET definitions, e.g., MSR and related feature flags.CET kernel patches are here:
SHSTK: https://lkml.kernel.org/r/[email protected]/
IBT: https://lkml.kernel.org/r/[email protected]/CET QEMU patch:
https://patchwork.ozlabs.org/project/qemu-devel/patch/[email protected]/
KVM Unit test:
https://patchwork.kernel.org/project/kvm/patch/[email protected]/v14:
- Sean refactored v13 patchset then came out v14-rc1, this version is rebased on top of 5.10-rc1 and tested on TGL.
- Fixed a few minor issues found during test, such as nested CET broken, call-trace and guest reboot failure etc.
- Original v14-rc1 is here: https://github.com/sean-jc/linux/tree/vmx/cet.v13:
- Added CET definitions as a separate patch to facilitate KVM test.
- Disabled CET support in KVM ifunrestricted_guestis turned off since in this case CET related instructions/infrastructure cannot be emulated well.v12:
- Fixed a few issues per Sean and Paolo's review feeback.
- Refactored patches to make them properly arranged.
- Removed unnecessary hard-coded CET states for host/guest.
- Added compile-time assertions forvmcs_field_to_offset_tableto detect mismatch of the field type and field encoding number.
- Added a custom MSRMSR_KVM_GUEST_SSPfor guest active SSP save/restore.
- Rebased patches to 5.7-rc3.v11:
- Fixed a guest vmentry failure issue when guest reboots.
- Used vm_xxx_control_{set, clear}bit() to avoid side effect, it'll clear cached data instead of pure VMCS field bits.
- Addedvcpu->arch.guest_supported_xssdedidated for guest runtime mask, this avoidssupported_xssoverwritten issue caused by an old qemu.
- Separated vmentry/vmexit state setting with CR0/CR4 dependency check to make the patch more clear.
- Added CET VMCS states indump_vmcs()for debugging purpose.
- Other refactor based on testing.
- This patch serial is built on top of below branch and CET kernel patches for seeking xsaves support.v10:
- Refactored code per Sean's review feedback.
- Added CET support for nested VM.
- Removed fix-patch forCPUID(0xd,N)enumeration as this part is done by Paolo and Sean.
- This new patchset is based on Paolo's queuedcpu_capsbranch.
- Modified patch per XSAVES related change.
- Consolidated KVM unit-test patch with KVM patches.v9:
- Refactored msr-check functions per Sean's feedback.
- Fixed a few issues per Sean's suggestion.
- Rebased patch to kernel-v5.4.
- Moved CET CPUID feature bits and CR4.CET to last patch.v8:
- Addressed Jim and Sean's feedback on: 1)CPUID(0xD,i)enumeration. 2) sanity check when configure guest CET. 3) function improvement.
- Added more sanity check functions.
- Set host vmexit default status so that guest won't leak CET status to host when vmexit.
- Added CR0.WP vs. CR4.CET mutual constrains.v7:
- Rebased patch to kernel v5.3
- Sean suggested to changeCPUID(0xd, n)enumeration code as alined with existing one, and I think it's better to make the fix as an independent patch since XSS MSR are being used widely on X86 platforms.
- Check more host and guest status before configure guest CET
per Sean's feedback.
- Add error-check before guest accesses CET MSRs per Sean's feedback.
- Other minor fixes suggested by Sean.v6:
- Rebase patch to kernel v5.2.
- MoveCPUID(0xD, n>=1)helper to a seperate patch.
- Merge xsave size fix with other patch.
- Other minor fixes per community feedback.v5:
- Rebase patch to kernel v5.1.
- WrapCPUID(0xD, n>=1)code to a helper function.
- Pass throughMSR_IA32_PL1_SSPandMSR_IA32_PL2_SSPto Guest.
- Add Co-developed-by expression in patch description.
- Refine patch description.v4:
- Add Sean's patch for loading Guest fpu state before access XSAVES managed CET MSRs.
- Melt down CET bits setting into CPUID configuration patch.
- Add VMX interface to query Host XSS.
- Check Host and Guest XSS support bits before set Guest XSS.
- Make Guest SHSTK and IBT feature enabling independent.
- Do not report CET support to Guest when Host CET feature is Disabled.v3:
- Modified patches to make Guest CET independent to Host enabling.
- Added patch 8 to add user space access for Guest CET MSR access.
- Modified code comments and patch description to reflect changes.v2:
- Re-ordered patch sequence, combined one patch.
- Added more description for CET related VMCS fields.
- Added Host CET capability check while enabling Guest CET loading bit.
- Added Host CET capability check while reporting GuestCPUID(EAX=7, EXC=0).
- Modified code in reporting GuestCPUID(EAX=D,ECX>=1), make it clearer.
- Added Host and Guest XSS mask check while setting bits for Guest XSS.Sean Christopherson (2):
KVM: x86: Report XSS as an MSR to be saved if there are supported features
KVM: x86: Load guest fpu state when accessing MSRs managed by XSAVESYang Weijiang (11):
KVM: x86: Refresh CPUID on writes toMSR_IA32_XSS
KVM: x86: Add #CP support in guest exception dispatch
KVM: VMX: Introduce CET VMCS fields and flags
KVM: x86: Add fault checks for CR4.CET
KVM: VMX: Emulate reads and writes to CET MSRs
KVM: VMX: Add a synthetic MSR to allow userspace VMM to accessGUEST_SSP
KVM: x86: Report CET MSRs as to-be-saved if CET is supported
KVM: x86: Enable CET virtualization for VMX and advertise CET to userspace
KVM: VMX: Pass through CET MSRs to the guest when supported
KVM: nVMX: Add helper to check the vmcs01 MSR bitmap for MSR pass-through
KVM: nVMX: Enable CET support for nested VMX
Quoted 14 lines
arch/x86/include/asm/kvm_host.h | 4 +- arch/x86/include/asm/vmx.h | 8 ++ arch/x86/include/uapi/asm/kvm.h | 1 + arch/x86/include/uapi/asm/kvm_para.h | 1 + arch/x86/kvm/cpuid.c | 26 +++- arch/x86/kvm/vmx/capabilities.h | 5 + arch/x86/kvm/vmx/nested.c | 57 ++++++-- arch/x86/kvm/vmx/vmcs12.c | 6 + arch/x86/kvm/vmx/vmcs12.h | 14 +- arch/x86/kvm/vmx/vmx.c | 207 ++++++++++++++++++++++++++- arch/x86/kvm/x86.c | 56 +++++++- arch/x86/kvm/x86.h | 10 +- 12 files changed, 370 insertions(+), 25 deletions(-)
I reviewed the patch and it is mostly okay. However, if I understand it correctly, it will not do anything until host support materializes, because otherwise XSS will be 0.
If this is the case, I plan to apply locally v15 and hold on it until the host code is committed.
Paolo
Paolo Bonzini
maintainerQuoted 7 lines · Sean Christopherson
Quoted 5 lines · Paolo Bonzini
Quoted 4 lines · Yang Weijiang
Control-flow Enforcement Technology (CET) provides protection against Return/Jump-Oriented Programming (ROP/JOP) attack. There're two CET
sub-features: Shadow Stack (SHSTK) and Indirect Branch Tracking (IBT). SHSTK is to prevent ROP programming and IBT is to prevent JOP programming.
Quoted 8 lines
...
Quoted 3 lines
I reviewed the patch and it is mostly okay. However, if I understand it correctly, it will not do anything until host support materializes, because otherwise XSS will be 0.
IIRC, it won't even compile due to the
X86_FEATURE_SHSTKandX86_FEATURE_IBTdependencies.
Of course, but if that was the only issue I would sort it out with Boris as usual. OTOH if it is dead code I won't push it to Linus.
Paolo
Quoted 6 lines
Quoted 5 lines
If this is the case, I plan to apply locally v15 and hold on it until the host code is committed.
Paolo
Sean Christopherson
maintainerQuoted 5 lines · Paolo Bonzini
Quoted 4 lines · Yang Weijiang
Control-flow Enforcement Technology (CET) provides protection against Return/Jump-Oriented Programming (ROP/JOP) attack. There're two CET
sub-features: Shadow Stack (SHSTK) and Indirect Branch Tracking (IBT). SHSTK is to prevent ROP programming and IBT is to prevent JOP programming.
...
Quoted 3 lines
I reviewed the patch and it is mostly okay. However, if I understand it correctly, it will not do anything until host support materializes, because otherwise XSS will be 0.
IIRC, it won't even compile due to the X86_FEATURE_SHSTK and X86_FEATURE_IBT dependencies.
Quoted 5 lines
If this is the case, I plan to apply locally v15 and hold on it until the host code is committed.
Paolo
Paolo Bonzini
maintainerRe: [PATCH v14 11/13] KVM: VMX: Pass through CET MSRs to the guest when supported
In reply to Paolo BonziniQuoted 60 lines · Paolo Bonzini
Quoted 59 lines · Yang Weijiang
Pass through all CET MSRs when the associated CET component (kernel vs. user) is enabled to improve guest performance. All CET MSRs are context switched, either via dedicated VMCS fields or XSAVES.
Co-developed-by Zhang Yi Z <[email protected]>Signed-off-by Zhang Yi Z <[email protected]>Co-developed-by Sean Christopherson <[email protected]>Signed-off-by Sean Christopherson <[email protected]>Signed-off-by Yang Weijiang <[email protected]>---
arch/x86/kvm/vmx/vmx.c| 29 +++++++++++++++++++++++++++++1 file changed, 29 insertions(+)arch/x86/kvm/vmx/vmx.c +23
-0@@ -7366,6 +7366,32 @@ static void update_intel_pt_cfg(struct kvm_vcpu *vcpu) vmx->pt_desc.ctl_bitmask &= ~(0xfULL << (32 + i * 4)); } +static bool is_cet_state_supported (struct kvm_vcpu *vcpu,u32 xss_state) +{ + return (vcpu->arch.guest_supported_xss & xss_state) && + (guest_cpuid_has(vcpu, X86_FEATURE_SHSTK) || + guest_cpuid_has(vcpu, X86_FEATURE_IBT)); +} + +static void vmx_update_intercept_for_cet_msr (struct kvm_vcpu *vcpu) +{ + bool incpt = !is_cet_state_supported(vcpu, XFEATURE_MASK_CET_USER); + + vmx_set_intercept_for_msr(vcpu, MSR_IA32_U_CET, MSR_TYPE_RW, incpt); + + incpt |= !guest_cpuid_has(vcpu, X86_FEATURE_SHSTK); + vmx_set_intercept_for_msr(vcpu, MSR_IA32_PL3_SSP, MSR_TYPE_RW, incpt); + + incpt = !is_cet_state_supported(vcpu, XFEATURE_MASK_CET_KERNEL); + vmx_set_intercept_for_msr(vcpu, MSR_IA32_S_CET, MSR_TYPE_RW, incpt); + + incpt |= !guest_cpuid_has(vcpu, X86_FEATURE_SHSTK); + vmx_set_intercept_for_msr(vcpu, MSR_IA32_INT_SSP_TAB,MSR_TYPE_RW , incpt); + vmx_set_intercept_for_msr(vcpu, MSR_IA32_PL0_SSP, MSR_TYPE_RW, incpt); + vmx_set_intercept_for_msr(vcpu, MSR_IA32_PL1_SSP, MSR_TYPE_RW,incpt);
+vmx_set_intercept_for_msr(vcpu, MSR_IA32_PL2_SSP, MSR_TYPE_RW, incpt);arch/x86/kvm/vmx/vmx.c +2
-0+} +static void
vmx_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu){
structvcpu_vmx*vmx =to_vmx(vcpu);arch/x86/kvm/vmx/vmx.c +0
-0@@ -7409,6 +7435,9 @@ static void vmx_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu) /* Refresh #PF interception to account for MAXPHYADDR changes. */ update_exception_bitmap(vcpu);
Quoted 8 lines
arch/x86/kvm/vmx/vmx.c static void vmx_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu)
Quoted 6 lines
arch/x86/kvm/vmx/vmx.c +3
-0+ + if (kvm_cet_supported()) + vmx_update_intercept_for_cet_msr(vcpu); } static __init void vmx_set_cpu_caps(void)Can you do this only if CR4.CET=1?
Actually, considering this is XSAVES and not RDMSR/WRMSR state, this is okay as is.
Paolo
Sean Christopherson
maintainerQuoted 14 lines · Paolo Bonzini
Quoted 13 lines · Sean Christopherson
Quoted 5 lines · Paolo Bonzini
Quoted 4 lines · Yang Weijiang
Control-flow Enforcement Technology (CET) provides protection against Return/Jump-Oriented Programming (ROP/JOP) attack. There're two CET
sub-features: Shadow Stack (SHSTK) and Indirect Branch Tracking (IBT). SHSTK is to prevent ROP programming and IBT is to prevent JOP programming....
Quoted 3 lines
I reviewed the patch and it is mostly okay. However, if I understand it correctly, it will not do anything until host support materializes, because otherwise XSS will be 0.
Quoted 5 lines
Quoted 2 lines
IIRC, it won't even compile due to the
X86_FEATURE_SHSTKandX86_FEATURE_IBTdependencies.Of course, but if that was the only issue I would sort it out with Boris as usual. OTOH if it is dead code I won't push it to Linus.
Yes, at best it's dead code. At worst, if it somehow became undead, the guest state would bleed into the host and wouldn't be migrated as the kernel wouldn't touch CET state when doing XSAVES/XRSTORS.
I floated the idea of pulling in just enough of the kernel bits to enable KVM, but that didn't go anywhere.
Re: [PATCH v14 07/13] KVM: VMX: Emulate reads and writes to CET MSRs
In reply to Paolo BonziniQuoted 12 lines · Paolo Bonzini
Quoted 11 lines · Yang Weijiang
arch/x86/kvm/vmx/vmx.c +10
-0+static bool cet_is_ssp_msr_accessible (struct kvm_vcpu *vcpu, +struct msr_data *msr) +{ +u64 mask; + +if (!kvm_cet_supported ()) +return false; + +if (msr->host_initiated) +return true;
Quoted 9 lines
arch/x86/kvm/vmx/vmx.c static int vmx_get_msr_feature(struct kvm_msr_entry *msr) · line 1824
Quoted 6 lines
arch/x86/kvm/vmx/vmx.c +6
-0+ +if (!guest_cpuid_has (vcpu,X86_FEATURE_SHSTK )) +return false; + +if (msr->index ==MSR_IA32_INT_SSP_TAB ) +return false;Shouldn't this return true?
Hi, Paolo,
Thanks for the feedback!
Yes, it should be true, will fix it in next release.
Quoted 6 lines
Paolo
Quoted 4 lines
arch/x86/kvm/vmx/vmx.c +4
-0+ mask = (msr->index ==MSR_IA32_PL3_SSP ) ?XFEATURE_MASK_CET_USER : +XFEATURE_MASK_CET_KERNEL ; +return !!(vcpu->arch.guest_supported_xss & mask); +}
Re: [PATCH v14 09/13] KVM: x86: Report CET MSRs as to-be-saved if CET is supported
In reply to Paolo BonziniQuoted 31 lines · Paolo Bonzini
Quoted 30 lines · Yang Weijiang
Report all CET MSRs, including the synthetic
GUEST_SSPMSR, as to-be-saved, e.g. for migration, if CET is supported by KVM.Co-developed-by Sean Christopherson <[email protected]>Signed-off-by Sean Christopherson <[email protected]>Signed-off-by Yang Weijiang <[email protected]>--- arch/x86/kvm/x86.c | 9 +++++++++ 1 file changed, 9 insertions(+)arch/x86/kvm/x86.c +7
-0@@ -1248,6 +1248,8 @@ static const u32 msrs_to_save_all[] = {MSR_ARCH_PERFMON_EVENTSEL0 +16 ,MSR_ARCH_PERFMON_EVENTSEL0 +17 ,MSR_IA32_XSS , +MSR_IA32_U_CET ,MSR_IA32_S_CET ,MSR_IA32_INT_SSP_TAB ,MSR_KVM_GUEST_SSP , + MSR_IA32_PL0_SSP, MSR_IA32_PL1_SSP, MSR_IA32_PL2_SSP, MSR_IA32_PL3_SSP, };static u32 msrs_to_save[ARRAY_SIZE (msrs_to_save_all)];@@ -5761,6 +5763,13 @@ static void kvm_init_msr_list(void)if (!supported_xss)continue ;break ; +case MSR_IA32_U_CET : +case MSR_IA32_S_CET : +case MSR_IA32_INT_SSP_TAB : + case MSR_IA32_PL0_SSP ... MSR_IA32_PL3_SSP: +if (!kvm_cet_supported ())
Quoted 9 lines
arch/x86/kvm/x86.c static void kvm_init_msr_list(void) · line 5775
Quoted 6 lines
arch/x86/kvm/x86.c +2
-0+continue ; +break ;default :break ; }Missing "case
MSR_KVM_GUEST_SSP".
OK, will fix it in next version.
Quoted 1 line
Paolo
Re: [PATCH v14 10/13] KVM: x86: Enable CET virtualization for VMX and advertise CET to userspace
In reply to a message not in the archiveQuoted 28 lines · Paolo Bonzini
Quoted 6 lines · Yang Weijiang
Quoted 6 lines
Quoted 6 lines
It's specific to VM case, during VM reboot, memory mode reset but
VM_ENTRY_LOAD_CET_STATEis still set, and VMCS contains staleGUEST_SSP, this hits vm-entry failure documented in 10.7 VM Entry at:
https://software.intel.com/sites/default/files/managed/4d/2a/control-flow-enforcement-technology-preview.pdf
Since CR4.CET is also reset during VM reboot, to take the change to clear the stale data. Maybe I need to find a better place to do the things.Quoted 6 lines
Quoted 4 lines
Then you must use a field of struct
vmx_vcpuinstead of the VMCS to holdGUEST_SSP(whileGUEST_S_CETandGUEST_INTR_SSP_TABLEshould not be an issue).Sorry, I don't get your point, can I just clear the
GUEST_SSPfield in this case? Anyway save/restoreGUEST_SSPvia VMCS is an efficient way.You cannot clear it, because it is preserved when CR4.CET is modified.
However, I checked the latest SDM and the
GUEST_SSPrules are changed to just this:SSP. The following checks are performed if the “load CET state” VM-entry control is 1
— Bits 1:0 must be 0.
— If the processor supports the Intel 64 architecture, bits 63:N must be identical, where N is the CPU’s maximum linear-address width. (This check does not apply if the processor supports 64 linear-address bits.) The guest SSP value is not required to be canonical; the value of bit N-1 may differ from that of bit N.
Quoted 4 lines
In particular it doesn't mention the "IA-32e mode guest" VM-entry control or the CS.L bit anymore, so it should not be necessary anymore to even reset SSP to 0, and you can keep
GUEST_SSPin the VMCS.
There could be some gaps between the two specs, I tested VM reboot with these patches, if I don't clear GUEST_SSP field while CR4.CET is changed, then it always encounters the vm-entry failure issue, the VMCS dump is like below:
[341485.265277] *** Guest State *** [341485.265280] CR0: actual=0x0000000000000030, shadow=0x0000000060000010, gh_mask=fffffffffffffff7 [341485.265281] CR4: actual=0x0000000000002040, shadow=0x0000000000000000, gh_mask=fffffffffffef871 [341485.265282] CR3 = 0x0000000000000000 [341485.265283] RSP = 0x0000000000000000 RIP = 0x000000000000fff0 [341485.265283] RFLAGS=0x00000002 DR7 = 0x0000000000000400 [341485.265284] Sysenter RSP=0000000000000000 CS:RIP=0000:0000000000000000 [341485.265285] CS: sel=0xf000, attr=0x0009b, limit=0x0000ffff, base=0x00000000ffff0000 [341485.265286] DS: sel=0x0000, attr=0x00093, limit=0x0000ffff, base=0x0000000000000000 [341485.265287] SS: sel=0x0000, attr=0x00093, limit=0x0000ffff, base=0x0000000000000000 [341485.265288] ES: sel=0x0000, attr=0x00093, limit=0x0000ffff, base=0x0000000000000000 [341485.265288] FS: sel=0x0000, attr=0x00093, limit=0x0000ffff, base=0x0000000000000000 [341485.265289] GS: sel=0x0000, attr=0x00093, limit=0x0000ffff, base=0x0000000000000000 [341485.265289] GDTR: limit=0x0000ffff, base=0x0000000000000000 [341485.265290] LDTR: sel=0x0000, attr=0x00082, limit=0x0000ffff, base=0x0000000000000000 [341485.265291] IDTR: limit=0x0000ffff, base=0x0000000000000000 [341485.265291] TR: sel=0x0000, attr=0x0008b, limit=0x0000ffff, base=0x0000000000000000 [341485.265292] EFER = 0x0000000000000000 PAT = 0x0007040600070406 [341485.265292] DebugCtl = 0x0000000000000000 DebugExceptions = 0x0000000000000000 [341485.265293] Interruptibility = 00000000 ActivityState = 00000000 [341485.265294] InterruptStatus = 0000 [341485.265294] S_CET = 0x0000000000000000 [341485.265295] SSP = 0x00007fc1727fdfd0 [341485.265295] SSP TABLE = 0x0000000000000000 [341485.265296] *** Host State *** [341485.265296] RIP = 0xffffffffc1235900 RSP = 0xffffaed7c150bd68 [341485.265297] CS=0010 SS=0018 DS=0000 ES=0000 FS=0000 GS=0000 TR=0040 [341485.265298] FSBase=00007f6851d36700 GSBase=ffff9de2e0980000 TRBase=fffffe0000141000 [341485.265298] GDTBase=fffffe000013f000 IDTBase=fffffe0000000000 [341485.265299] CR0=0000000080050033 CR3=00000001135ae001 CR4=0000000000f72ee0 [341485.265300] Sysenter RSP=fffffe0000141000 CS:RIP=0010:ffffffff8dc015e0 [341485.265301] EFER = 0x0000000000000d01 PAT = 0x0407050600070106 [341485.265301] *** Control State *** [341485.265302] PinBased=000000ff CPUBased=b5a06dfa SecondaryExec=021237eb [341485.265303] EntryControls=0010d1ff ExitControls=102befff [341485.265303] ExceptionBitmap=00060042 PFECmask=00000000 PFECmatch=00000000 [341485.265304] VMEntry: intr_info=00000000 errcode=00000000 ilen=00000000 [341485.265305] VMExit: intr_info=00000000 errcode=00000000 ilen=00000002 [341485.265306] reason=80000021 qualification=0000000000000000 [341485.265306] IDTVectoring: info=00000000 errcode=00000000 [341485.265307] TSC Offset = 0xfffd10acb111a2a0 [341485.265307] TSC Multiplier = 0x0001000000000000 [341485.265308] SVI|RVI = 00|00 TPR Threshold = 0x00 [341485.265309] APIC-access addr = 0x0000000499d63000 virt-APIC addr = 0x000000011ade6000 [341485.265310] PostedIntrVec = 0xf2 [341485.265310] EPT pointer = 0x000000011fffc05e [341485.265310] PLE Gap=00000080 Window=00010000 [341485.265311] Virtual processor ID = 0x0001 [341485.265312] S_CET = 0x0000000000000000 [341485.265312] SSP = 0x0000000000000000 [341485.265312] SSP TABLE = 0x0000000000000000
The alternative way is to clear it in exit_lmode(), it also works.
Quoted 1 line
Paolo
Re: [PATCH v14 10/13] KVM: x86: Enable CET virtualization for VMX and advertise CET to userspace
In reply to a message not in the archiveQuoted 28 lines · Paolo Bonzini
Quoted 6 lines · Yang Weijiang
Quoted 6 lines
Quoted 6 lines
It's specific to VM case, during VM reboot, memory mode reset but
VM_ENTRY_LOAD_CET_STATEis still set, and VMCS contains staleGUEST_SSP, this hits vm-entry failure documented in 10.7 VM Entry at:
https://software.intel.com/sites/default/files/managed/4d/2a/control-flow-enforcement-technology-preview.pdf
Since CR4.CET is also reset during VM reboot, to take the change to clear the stale data. Maybe I need to find a better place to do the things.Quoted 6 lines
Quoted 4 lines
Then you must use a field of struct
vmx_vcpuinstead of the VMCS to holdGUEST_SSP(whileGUEST_S_CETandGUEST_INTR_SSP_TABLEshould not be an issue).Sorry, I don't get your point, can I just clear the
GUEST_SSPfield in this case? Anyway save/restoreGUEST_SSPvia VMCS is an efficient way.You cannot clear it, because it is preserved when CR4.CET is modified.
However, I checked the latest SDM and the
GUEST_SSPrules are changed to just this:SSP. The following checks are performed if the “load CET state” VM-entry control is 1
— Bits 1:0 must be 0.
— If the processor supports the Intel 64 architecture, bits 63:N must be identical, where N is the CPU’s maximum linear-address width. (This check does not apply if the processor supports 64 linear-address bits.) The guest SSP value is not required to be canonical; the value of bit N-1 may differ from that of bit N.
Quoted 4 lines
In particular it doesn't mention the "IA-32e mode guest" VM-entry control or the CS.L bit anymore, so it should not be necessary anymore to even reset SSP to 0, and you can keep
GUEST_SSPin the VMCS.
The vm-entry failure issue is due to mismatch of MSR_KVM_GUEST_SSP between QEMU and KVM. The original code is occupied by other usage, so QEMU cannot reset it properly. Sorry for the noise!
Quoted 1 line
Paolo