Re: [PATCH 4/4] KVM: s390: Restore sigset on error path

Claudio Imbrenda <[email protected]>
Newsgroups org.kernel.vger.linux-s390,org.kernel.vger.kvm
Organization IBM
Message-ID <20260812133001.0a7031fb@p-imbrenda>
On Tue, 11 Aug 2026 17:37:38 +0200
Christian Borntraeger <[email protected]> wrote:

> kvm_sigset_activate() installs vcpu->sigset via sigprocmask() and
> stashes the caller's mask in current->real_blocked; only
> kvm_sigset_deactivate() restores it.
> 
> For KVM_RUN on a STOPPED vcpu the error path will not restore the
> userspace mask.  Re-arrange the error handling to also restore the
> signal mask.
> 
> Fixes: 6352e4d2dd9a3 ("KVM: s390: implement KVM_(S|G)ET_MP_STATE for user space state control")
> Cc: [email protected]
> Signed-off-by: Christian Borntraeger <[email protected]>

Reviewed-by: Claudio Imbrenda <[email protected]>

> ---
>  arch/s390/kvm/kvm-s390.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
> index f3814dd60184..608e40401554 100644
> --- a/arch/s390/kvm/kvm-s390.c
> +++ b/arch/s390/kvm/kvm-s390.c
> @@ -5071,7 +5071,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)
>  		pr_err_ratelimited("can't run stopped vcpu %d\n",
>  				   vcpu->vcpu_id);
>  		rc = -EINVAL;
> -		goto out;
> +		goto out_sigset;
>  	}
>  
>  	kernel_fpu_begin(&fpu, KERNEL_FPC | KERNEL_VXR);
> @@ -5101,9 +5101,11 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)
>  	store_regs(vcpu);
>  	kernel_fpu_end(&fpu, KERNEL_FPC | KERNEL_VXR);
>  
> +	vcpu->stat.exit_userspace++;
> +
> +out_sigset:
>  	kvm_sigset_deactivate(vcpu);
>  
> -	vcpu->stat.exit_userspace++;
>  out:
>  	vcpu_put(vcpu);
>  	return rc;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.