public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Claudio Imbrenda <imbrenda@linux.ibm.com>
To: kvm@vger.kernel.org
Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org,
	frankja@linux.ibm.com, mhartmay@linux.ibm.com, nsg@linux.ibm.com,
	borntraeger@de.ibm.com, nrb@linux.ibm.com
Subject: [PATCH v2 2/2] KVM: s390: pv: fix index value of replaced ASCE
Date: Wed,  5 Jul 2023 13:19:37 +0200	[thread overview]
Message-ID: <20230705111937.33472-3-imbrenda@linux.ibm.com> (raw)
In-Reply-To: <20230705111937.33472-1-imbrenda@linux.ibm.com>

The index field of the struct page corresponding to a guest ASCE should
be 0. When replacing the ASCE in s390_replace_asce(), the index of the
new ASCE should also be set to 0.

Having the wrong index might lead to the wrong addresses being passed
around when notifying pte invalidations, and eventually to validity
intercepts (VM crash) if the prefix gets unmapped and the notifier gets
called with the wrong address.

Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 arch/s390/mm/gmap.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c
index f4b6fc746fce..7c77f246e101 100644
--- a/arch/s390/mm/gmap.c
+++ b/arch/s390/mm/gmap.c
@@ -2853,6 +2853,7 @@ int s390_replace_asce(struct gmap *gmap)
 	page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER);
 	if (!page)
 		return -ENOMEM;
+	page->index = 0;
 	table = page_to_virt(page);
 	memcpy(table, gmap->table, 1UL << (CRST_ALLOC_ORDER + PAGE_SHIFT));
 
-- 
2.41.0


  parent reply	other threads:[~2023-07-05 11:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-05 11:19 [PATCH v2 0/2] KVM: s390: pv: fix two small bugs Claudio Imbrenda
2023-07-05 11:19 ` [PATCH v2 1/2] KVM: s390: pv: simplify shutdown and fix race Claudio Imbrenda
2023-07-11 15:18   ` Nico Boehr
2023-07-05 11:19 ` Claudio Imbrenda [this message]
2023-07-11 14:12   ` [PATCH v2 2/2] KVM: s390: pv: fix index value of replaced ASCE Philippe Mathieu-Daudé
2023-07-11 14:31     ` Claudio Imbrenda
2023-07-12 11:58   ` Janosch Frank
2023-07-12 12:06     ` Claudio Imbrenda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230705111937.33472-3-imbrenda@linux.ibm.com \
    --to=imbrenda@linux.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=frankja@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mhartmay@linux.ibm.com \
    --cc=nrb@linux.ibm.com \
    --cc=nsg@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox