[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251222165033.162329-9-imbrenda@linux.ibm.com>
Date: Mon, 22 Dec 2025 17:50:13 +0100
From: Claudio Imbrenda <imbrenda@...ux.ibm.com>
To: kvm@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, linux-s390@...r.kernel.org,
borntraeger@...ibm.com, frankja@...ux.ibm.com, nsg@...ux.ibm.com,
nrb@...ux.ibm.com, seiden@...ux.ibm.com, gra@...ux.ibm.com,
schlameuss@...ux.ibm.com, hca@...ux.ibm.com, svens@...ux.ibm.com,
agordeev@...ux.ibm.com, gor@...ux.ibm.com, david@...hat.com,
gerald.schaefer@...ux.ibm.com
Subject: [PATCH v6 08/28] s390/mm: Warn if uv_convert_from_secure_pte() fails
If uv_convert_from_secure_pte() fails, the page becomes unusable by the
host. The failure can only occour in case of hardware malfunction or a
serious KVM bug.
When the unusable page is reused, the system can have issues and
hang.
Print a warning to aid debugging such unlikely scenarios.
Signed-off-by: Claudio Imbrenda <imbrenda@...ux.ibm.com>
---
arch/s390/include/asm/pgtable.h | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
index 73c30b811b98..04335f5e7f47 100644
--- a/arch/s390/include/asm/pgtable.h
+++ b/arch/s390/include/asm/pgtable.h
@@ -1239,7 +1239,7 @@ static inline pte_t ptep_get_and_clear(struct mm_struct *mm,
res = ptep_xchg_lazy(mm, addr, ptep, __pte(_PAGE_INVALID));
/* At this point the reference through the mapping is still present */
if (mm_is_protected(mm) && pte_present(res))
- uv_convert_from_secure_pte(res);
+ WARN_ON_ONCE(uv_convert_from_secure_pte(res));
return res;
}
@@ -1257,7 +1257,7 @@ static inline pte_t ptep_clear_flush(struct vm_area_struct *vma,
res = ptep_xchg_direct(vma->vm_mm, addr, ptep, __pte(_PAGE_INVALID));
/* At this point the reference through the mapping is still present */
if (mm_is_protected(vma->vm_mm) && pte_present(res))
- uv_convert_from_secure_pte(res);
+ WARN_ON_ONCE(uv_convert_from_secure_pte(res));
return res;
}
@@ -1294,9 +1294,10 @@ static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm,
/*
* If something went wrong and the page could not be destroyed, or
* if this is not a mm teardown, the slower export is used as
- * fallback instead.
+ * fallback instead. If even that fails, print a warning and leak
+ * the page, to avoid crashing the whole system.
*/
- uv_convert_from_secure_pte(res);
+ WARN_ON_ONCE(uv_convert_from_secure_pte(res));
return res;
}
--
2.52.0
Powered by blists - more mailing lists