From: Claudio Imbrenda Date: Tue, 28 Oct 2025 13:01:50 +0000 (+0100) Subject: KVM: s390: fix missing present bit for gmap puds X-Git-Tag: v6.19-rc1~112^2~100 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1452468447da77e846bda51c3a298ce843395d9c;p=thirdparty%2Flinux.git KVM: s390: fix missing present bit for gmap puds For hugetlbs, gmap puds have the present bit set. For normal puds (which point to ptes), the bit is not set. This is in contrast to the normal userspace puds, which always have the bit set for present pmds. This causes issues when ___pte_offset_map() is modified to only check for the present bit. The solution to the problem is simply to always set the present bit for present gmap pmds. Link: https://lkml.kernel.org/r/20251028130150.57379-2-imbrenda@linux.ibm.com Signed-off-by: Claudio Imbrenda Link: https://lore.kernel.org/lkml/20251017144924.10034-1-borntraeger@linux.ibm.com/ Tested-by: Christian Borntraeger Acked-by: Christian Borntraeger Acked-by: Balbir Singh Cc: Alexander Gordeev Cc: Alistair Popple Cc: Baolin Wang Cc: Barry Song Cc: Byungchul Park Cc: Danilo Krummrich Cc: Dave Airlie Cc: David Hildenbrand Cc: Dev Jain Cc: Francois Dugast Cc: Gregory Price Cc: Heiko Carstens Cc: "Huang, Ying" Cc: Joshua Hahn Cc: Liam Howlett Cc: Lorenzo Stoakes Cc: Lyude Cc: Mathew Brost Cc: Mika Penttilä Cc: Nico Pache Cc: Oscar Salvador Cc: Rakie Kim Cc: Ralph Campbell Cc: Ryan Roberts Cc: Vasily Gorbik Cc: Zi Yan Signed-off-by: Andrew Morton --- diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c index 8ff6bba107e88..22c448b323406 100644 --- a/arch/s390/mm/gmap.c +++ b/arch/s390/mm/gmap.c @@ -599,8 +599,9 @@ int __gmap_link(struct gmap *gmap, unsigned long gaddr, unsigned long vmaddr) | _SEGMENT_ENTRY_GMAP_UC | _SEGMENT_ENTRY; } else - *table = pmd_val(*pmd) & - _SEGMENT_ENTRY_HARDWARE_BITS; + *table = (pmd_val(*pmd) & + _SEGMENT_ENTRY_HARDWARE_BITS) + | _SEGMENT_ENTRY; } } else if (*table & _SEGMENT_ENTRY_PROTECT && !(pmd_val(*pmd) & _SEGMENT_ENTRY_PROTECT)) {