From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EED641DFE35; Wed, 6 Nov 2024 13:13:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730898811; cv=none; b=s3NUr2YdM3FIchLF3F6zKS/WtEpGsesZ+SQ3fd3qIFWJC1a5aZy4jugl33r+wf/bmW2X/tFh/l4TNQfoXaZ2dlxnOD/mCwotbuzCNy5VA6YjrKLVmBvMFTR9YNlZ5topSJEXdnEh2X7KFs5sKMbIAPiEFAUZaCloVFgdaHIyfeo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730898811; c=relaxed/simple; bh=PKirrAqgEMM+GEObo0KnGlRQgKG11jINn66hAhx5NII=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TJVWzvhnuBNFyS5DmVYhrZFYkXmuDdl4mvIeZzXcr408t5kUUcDV/Xy/xlJEUWbd/hGJz/lBOQql79nSIerwDlMylwTQv8jp0ThcN1iK51a/Z1ptPdOyUYoOrBFiVGOiqXX9K7SFqqNnJAc1tGCFVOd70l0uI/o8BkIggW9spaU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Y1pB/hJ4; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Y1pB/hJ4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77D70C4CECD; Wed, 6 Nov 2024 13:13:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1730898810; bh=PKirrAqgEMM+GEObo0KnGlRQgKG11jINn66hAhx5NII=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y1pB/hJ4nN+k8yWdreUEn8o+2kH4iNJgaPpXFj59TliyW1HxcrYyK89uSkYas0Z+A H3D1y/v4xJKrAgB1SaQko4Eyzw62N/MkRorUJVYUxHVNC2D/F6Y4abHAJrwelggtaV n12Xz96E+alOhk3Ffmk50wij4GiSpBCE5hbQubIo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Vasily Gorbik , Michael Mueller , Nico Boehr , Christian Borntraeger , Heiko Carstens , Janosch Frank Subject: [PATCH 5.4 363/462] KVM: s390: Change virtual to physical address access in diag 0x258 handler Date: Wed, 6 Nov 2024 13:04:16 +0100 Message-ID: <20241106120340.494584395@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241106120331.497003148@linuxfoundation.org> References: <20241106120331.497003148@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michael Mueller commit cad4b3d4ab1f062708fff33f44d246853f51e966 upstream. The parameters for the diag 0x258 are real addresses, not virtual, but KVM was using them as virtual addresses. This only happened to work, since the Linux kernel as a guest used to have a 1:1 mapping for physical vs virtual addresses. Fix KVM so that it correctly uses the addresses as real addresses. Cc: stable@vger.kernel.org Fixes: 8ae04b8f500b ("KVM: s390: Guest's memory access functions get access registers") Suggested-by: Vasily Gorbik Signed-off-by: Michael Mueller Signed-off-by: Nico Boehr Reviewed-by: Christian Borntraeger Reviewed-by: Heiko Carstens Link: https://lore.kernel.org/r/20240917151904.74314-3-nrb@linux.ibm.com Acked-by: Janosch Frank Signed-off-by: Heiko Carstens Signed-off-by: Greg Kroah-Hartman --- arch/s390/kvm/diag.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/s390/kvm/diag.c +++ b/arch/s390/kvm/diag.c @@ -78,7 +78,7 @@ static int __diag_page_ref_service(struc vcpu->stat.diagnose_258++; if (vcpu->run->s.regs.gprs[rx] & 7) return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); - rc = read_guest(vcpu, vcpu->run->s.regs.gprs[rx], rx, &parm, sizeof(parm)); + rc = read_guest_real(vcpu, vcpu->run->s.regs.gprs[rx], &parm, sizeof(parm)); if (rc) return kvm_s390_inject_prog_cond(vcpu, rc); if (parm.parm_version != 2 || parm.parm_len < 5 || parm.code != 0x258)