lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f7197f64bbac99860ddfeee540c9e44075a29f43.camel@redhat.com>
Date:   Thu, 12 Oct 2023 22:30:43 +0300
From:   Maxim Levitsky <mlevitsk@...hat.com>
To:     Vitaly Kuznetsov <vkuznets@...hat.com>, kvm@...r.kernel.org,
        Paolo Bonzini <pbonzini@...hat.com>,
        Sean Christopherson <seanjc@...gle.com>
Cc:     linux-kernel@...r.kernel.org
Subject: Re: [PATCH RFC 01/11] KVM: x86: xen: Remove unneeded xen context
 from struct kvm_arch when !CONFIG_KVM_XEN

У вт, 2023-10-10 у 18:02 +0200, Vitaly Kuznetsov пише:
> Saving a few bytes of memory per KVM VM is certainly great but what's more
> important is the ability to see where the code accesses Xen emulation
> context while CONFIG_KVM_XEN is not enabled. Currently, kvm_cpu_get_extint()
> is the only such place and it is harmless: kvm_xen_has_interrupt() always
> returns '0' when !CONFIG_KVM_XEN.
> 
> No functional change intended.
> 
> Signed-off-by: Vitaly Kuznetsov <vkuznets@...hat.com>
> ---
>  arch/x86/include/asm/kvm_host.h | 5 +++++
>  arch/x86/kvm/irq.c              | 2 ++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> index 17715cb8731d..e5d4b8a44630 100644
> --- a/arch/x86/include/asm/kvm_host.h
> +++ b/arch/x86/include/asm/kvm_host.h
> @@ -1126,6 +1126,7 @@ struct msr_bitmap_range {
>  	unsigned long *bitmap;
>  };
>  
> +#ifdef CONFIG_KVM_XEN
>  /* Xen emulation context */
>  struct kvm_xen {
>  	struct mutex xen_lock;
> @@ -1137,6 +1138,7 @@ struct kvm_xen {
>  	struct idr evtchn_ports;
>  	unsigned long poll_mask[BITS_TO_LONGS(KVM_MAX_VCPUS)];
>  };
> +#endif
>  
>  enum kvm_irqchip_mode {
>  	KVM_IRQCHIP_NONE,
> @@ -1338,7 +1340,10 @@ struct kvm_arch {
>  	struct hlist_head mask_notifier_list;
>  
>  	struct kvm_hv hyperv;
> +
> +#ifdef CONFIG_KVM_XEN
>  	struct kvm_xen xen;
> +#endif
>  
>  	bool backwards_tsc_observed;
>  	bool boot_vcpu_runs_old_kvmclock;
> diff --git a/arch/x86/kvm/irq.c b/arch/x86/kvm/irq.c
> index b2c397dd2bc6..ad9ca8a60144 100644
> --- a/arch/x86/kvm/irq.c
> +++ b/arch/x86/kvm/irq.c
> @@ -118,8 +118,10 @@ static int kvm_cpu_get_extint(struct kvm_vcpu *v)
>  	if (!lapic_in_kernel(v))
>  		return v->arch.interrupt.nr;
>  
> +#ifdef CONFIG_KVM_XEN
>  	if (kvm_xen_has_interrupt(v))
>  		return v->kvm->arch.xen.upcall_vector;
> +#endif
>  
>  	if (irqchip_split(v->kvm)) {
>  		int vector = v->arch.pending_external_vector;


Reviewed-by: Maxim Levitsky <mlevitsk@...hat.com>

Best regards,
	Maxim Levitsky

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ