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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <86tttytsqh.wl-maz@kernel.org>
Date:   Thu, 20 Jul 2023 18:09:26 +0100
From:   Marc Zyngier <maz@...nel.org>
To:     Raghavendra Rao Ananta <rananta@...gle.com>
Cc:     Oliver Upton <oliver.upton@...ux.dev>,
        James Morse <james.morse@....com>,
        Suzuki K Poulose <suzuki.poulose@....com>,
        Will Deacon <will@...nel.org>, Fuad Tabba <tabba@...gle.com>,
        Jing Zhang <jingzhangos@...gle.com>,
        Colton Lewis <coltonlewis@...gle.com>,
        Reiji Watanabe <reijiw@...gle.com>, kvmarm@...ts.linux.dev,
        linux-kernel@...r.kernel.org, kvm@...r.kernel.org
Subject: Re: [PATCH v2] KVM: arm64: Fix hardware enable/disable flows for pKVM

On Wed, 19 Jul 2023 22:57:25 +0100,
Raghavendra Rao Ananta <rananta@...gle.com> wrote:
> 
> When running in protected mode, the hyp stub is disabled after pKVM is
> initialized, meaning the host cannot enable/disable the hyp at
> runtime. As such, kvm_arm_hardware_enabled is always 1 after
> initialization, and kvm_arch_hardware_enable() never enables the vgic
> maintenance irq or timer irqs.
> 
> Unconditionally enable/disable the vgic + timer irqs in the respective
> calls, instead relying on the percpu bookkeeping in the generic code
> to keep track of which cpus have the interrupts unmasked.
> 
> Fixes: 466d27e48d7c ("KVM: arm64: Simplify the CPUHP logic")
> Reported-by: Oliver Upton <oliver.upton@...ux.dev>
> Suggested-by: Oliver Upton <oliver.upton@...ux.dev>
> Signed-off-by: Raghavendra Rao Ananta <rananta@...gle.com>
> ---
>  arch/arm64/kvm/arm.c | 14 ++++----------
>  1 file changed, 4 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
> index c2c14059f6a8..010ebfa69650 100644
> --- a/arch/arm64/kvm/arm.c
> +++ b/arch/arm64/kvm/arm.c
> @@ -1867,14 +1867,10 @@ static void _kvm_arch_hardware_enable(void *discard)
>  
>  int kvm_arch_hardware_enable(void)
>  {
> -	int was_enabled = __this_cpu_read(kvm_arm_hardware_enabled);
> -
>  	_kvm_arch_hardware_enable(NULL);
>  
> -	if (!was_enabled) {
> -		kvm_vgic_cpu_up();
> -		kvm_timer_cpu_up();
> -	}
> +	kvm_vgic_cpu_up();
> +	kvm_timer_cpu_up();
>  
>  	return 0;
>  }
> @@ -1889,10 +1885,8 @@ static void _kvm_arch_hardware_disable(void *discard)
>  
>  void kvm_arch_hardware_disable(void)
>  {
> -	if (__this_cpu_read(kvm_arm_hardware_enabled)) {
> -		kvm_timer_cpu_down();
> -		kvm_vgic_cpu_down();
> -	}
> +	kvm_timer_cpu_down();
> +	kvm_vgic_cpu_down();
>  
>  	if (!is_protected_kvm_enabled())
>  		_kvm_arch_hardware_disable(NULL);

Note that this will likely conflict with the preemption disabling
patch that is on its way to upstream. Otherwise:

Acked-by: Marc Zyngier <maz@...nel.org>

	M.

-- 
Without deviation from the norm, progress is not possible.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ