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: <CAAhV-H5_xrmDVTiB=un7LzdLHQDjD564tVmVcHLrgGhhX6Omaw@mail.gmail.com>
Date: Mon, 26 Aug 2024 22:49:02 +0800
From: Huacai Chen <chenhuacai@...nel.org>
To: Bibo Mao <maobibo@...ngson.cn>
Cc: Tianrui Zhao <zhaotianrui@...ngson.cn>, WANG Xuerui <kernel@...0n.name>, kvm@...r.kernel.org, 
	loongarch@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/2] LoongArch: KVM: Invalid guest steal time address
 on vCPU reset

Applied, thanks.

Huacai

On Thu, Aug 15, 2024 at 3:15 PM Bibo Mao <maobibo@...ngson.cn> wrote:
>
> If paravirt steal time feature is enabled, there is percpu gpa address
> passed from guest vcpu and host modified guest memory space with this gpa
> address. When vcpu is reset normally, it will notify host and invalidate
> gpa address.
>
> However if VM is crashed and VMM reboots VM forcely, vcpu reboot
> notification callback will not be called in VM, host needs invalid the
> gpa address, else host will modify guest memory during VM reboots. Here it
> is invalidated from vCPU KVM_REG_LOONGARCH_VCPU_RESET ioctl interface.
>
> Also funciton kvm_reset_timer() is removed at vCPU reset stage, since SW
> emulated timer is only used in vCPU block state. When vCPU is removed
> from block waiting queue, kvm_restore_timer() is called and SW timer
> is cancelled. And timer register is cleared at VMM when vCPU is reset.
>
> Signed-off-by: Bibo Mao <maobibo@...ngson.cn>
> ---
>  arch/loongarch/include/asm/kvm_vcpu.h | 1 -
>  arch/loongarch/kvm/timer.c            | 7 -------
>  arch/loongarch/kvm/vcpu.c             | 2 +-
>  3 files changed, 1 insertion(+), 9 deletions(-)
>
> diff --git a/arch/loongarch/include/asm/kvm_vcpu.h b/arch/loongarch/include/asm/kvm_vcpu.h
> index c416cb7125c0..86570084e05a 100644
> --- a/arch/loongarch/include/asm/kvm_vcpu.h
> +++ b/arch/loongarch/include/asm/kvm_vcpu.h
> @@ -76,7 +76,6 @@ static inline void kvm_restore_lasx(struct loongarch_fpu *fpu) { }
>  #endif
>
>  void kvm_init_timer(struct kvm_vcpu *vcpu, unsigned long hz);
> -void kvm_reset_timer(struct kvm_vcpu *vcpu);
>  void kvm_save_timer(struct kvm_vcpu *vcpu);
>  void kvm_restore_timer(struct kvm_vcpu *vcpu);
>
> diff --git a/arch/loongarch/kvm/timer.c b/arch/loongarch/kvm/timer.c
> index bcc6b6d063d9..74a4b5c272d6 100644
> --- a/arch/loongarch/kvm/timer.c
> +++ b/arch/loongarch/kvm/timer.c
> @@ -188,10 +188,3 @@ void kvm_save_timer(struct kvm_vcpu *vcpu)
>         kvm_save_hw_gcsr(csr, LOONGARCH_CSR_ESTAT);
>         preempt_enable();
>  }
> -
> -void kvm_reset_timer(struct kvm_vcpu *vcpu)
> -{
> -       write_gcsr_timercfg(0);
> -       kvm_write_sw_gcsr(vcpu->arch.csr, LOONGARCH_CSR_TCFG, 0);
> -       hrtimer_cancel(&vcpu->arch.swtimer);
> -}
> diff --git a/arch/loongarch/kvm/vcpu.c b/arch/loongarch/kvm/vcpu.c
> index 16756ffb55e8..6905283f535b 100644
> --- a/arch/loongarch/kvm/vcpu.c
> +++ b/arch/loongarch/kvm/vcpu.c
> @@ -647,7 +647,7 @@ static int kvm_set_one_reg(struct kvm_vcpu *vcpu,
>                                 vcpu->kvm->arch.time_offset = (signed long)(v - drdtime());
>                         break;
>                 case KVM_REG_LOONGARCH_VCPU_RESET:
> -                       kvm_reset_timer(vcpu);
> +                       vcpu->arch.st.guest_addr = 0;
>                         memset(&vcpu->arch.irq_pending, 0, sizeof(vcpu->arch.irq_pending));
>                         memset(&vcpu->arch.irq_clear, 0, sizeof(vcpu->arch.irq_clear));
>                         break;
> --
> 2.39.3
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ