提交 338679f7 编写于 作者: C Christian Borntraeger 提交者: Martin Schwidefsky

s390/pgtable: Fix guest overindication for change bit

When doing the transition invalid->valid in the host page table for
a guest, then the guest view of C/R is in the pgste. After validation
the view is pgste OR real key. We must zero out the real key C/R to
avoid guest over-indication for change (and reference).

Touching the real key is ok also for the host: The change bit is
tracked via write protection and the reference bit is also ok
because set_pte_at was called and  the page will be touched anyway
soon. Furthermore architecture defines reference as "substantially
accurate", over- and underindication are ok.
Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
上级 4d3797d7
...@@ -704,17 +704,19 @@ static inline void pgste_set_key(pte_t *ptep, pgste_t pgste, pte_t entry) ...@@ -704,17 +704,19 @@ static inline void pgste_set_key(pte_t *ptep, pgste_t pgste, pte_t entry)
{ {
#ifdef CONFIG_PGSTE #ifdef CONFIG_PGSTE
unsigned long address; unsigned long address;
unsigned long okey, nkey; unsigned long nkey;
if (pte_val(entry) & _PAGE_INVALID) if (pte_val(entry) & _PAGE_INVALID)
return; return;
VM_BUG_ON(!(pte_val(*ptep) & _PAGE_INVALID));
address = pte_val(entry) & PAGE_MASK; address = pte_val(entry) & PAGE_MASK;
okey = nkey = page_get_storage_key(address); /*
nkey &= ~(_PAGE_ACC_BITS | _PAGE_FP_BIT); * Set page access key and fetch protection bit from pgste.
/* Set page access key and fetch protection bit from pgste */ * The guest C/R information is still in the PGSTE, set real
nkey |= (pgste_val(pgste) & (RCP_ACC_BITS | RCP_FP_BIT)) >> 56; * key C/R to 0.
if (okey != nkey) */
page_set_storage_key(address, nkey, 0); nkey = (pgste_val(pgste) & (RCP_ACC_BITS | RCP_FP_BIT)) >> 56;
page_set_storage_key(address, nkey, 0);
#endif #endif
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册