On Wed, 2022-12-21 at 10:55 +0800, Yuan Yao wrote: > > +#ifdef CONFIG_X86_64 > > +/* untag addr for guest, according to vCPU CR3 and CR4 settings */ > > +static inline u64 kvm_untagged_addr(u64 addr, struct kvm_vcpu > > *vcpu) > > +{ > > + if (addr >> 63 == 0) { > > + /* User pointers */ > > + if (kvm_read_cr3(vcpu) & X86_CR3_LAM_U57) > > + addr = get_canonical(addr, 57); > > + else if (kvm_read_cr3(vcpu) & X86_CR3_LAM_U48) { > > + /* > > + * If guest enabled 5-level paging and LAM_U48, > > + * bit 47 should be 0, bit 48:56 contains meta > > data > > + * although bit 47:56 are valid 5-level address > > + * bits. > > + * If LAM_U48 and 4-level paging, bit47 is 0. > > + */ > > + WARN_ON(addr & _BITUL(47)); > > IIUC, LAM_47 userspace canonical checking rule requests "bit 63 == > bit 47 == 0" > before sign-extened the address. > > if so looks it's guest's fault to not follow the LAM canonical > checking rule, > what's the behavior of such violation on bare metal, #GP ? Spec (ISE 10.2) doesn't mention a #GP for this case. IIUC, those overlap bits are zeroed. Current native Kernel LAM only enables LAM_U57. > The behavior > shuld be same for guest instead of WARN_ON() on host, host does > nothing wrong. > Agree that host did nothing wrong. So remove WARN_ON(), use a pr_warn() instead? I here meant to warn that such case happens.