Skip to content

Commit 8ce1248

Browse files
author
CKI KWF Bot
committed
Merge: s390/mm: Fix __ptep_rdp() inline assembly
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/7616 JIRA: https://issues.redhat.com/browse/RHEL-129168 Conflicts: Code changes necessary to adapt to existing differences to upstream - no functional change ``` commit 31475b8 Author: Heiko Carstens <hca@linux.ibm.com> Date: Thu Nov 13 13:21:47 2025 +0100 s390/mm: Fix __ptep_rdp() inline assembly When a zero ASCE is passed to the __ptep_rdp() inline assembly, the generated instruction should have the R3 field of the instruction set to zero. However the inline assembly is written incorrectly: for such cases a zero is loaded into a register allocated by the compiler and this register is then used by the instruction. This means that selected TLB entries may not be flushed since the specified ASCE does not match the one which was used when the selected TLB entries were created. Fix this by removing the asce and opt parameters of __ptep_rdp(), since all callers always pass zero, and use a hard-coded register zero for the R3 field. Fixes: 0807b85 ("s390/mm: add support for RDP (Reset DAT-Protection)") Cc: stable@vger.kernel.org Reviewed-by: Gerald Schaefer <gerald.schaefer@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com> ``` Signed-off-by: Gerald Schaefer <gerald.schaefer@linux.ibm.com> Signed-off-by: Mete Durlu <mdurlu@redhat.com> Approved-by: Steve Best <sbest@redhat.com> Approved-by: Thomas Huth <thuth@redhat.com> Approved-by: Rafael Aquini <raquini@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: CKI GitLab Kmaint Pipeline Bot <26919896-cki-kmaint-pipeline-bot@users.noreply.gitlab.com>
2 parents 4b838cc + f9b67c1 commit 8ce1248

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

arch/s390/include/asm/pgtable.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,17 +1104,15 @@ static inline pte_t pte_mkhuge(pte_t pte)
11041104
#define IPTE_NODAT 0x400
11051105
#define IPTE_GUEST_ASCE 0x800
11061106

1107-
static __always_inline void __ptep_rdp(unsigned long addr, pte_t *ptep,
1108-
unsigned long opt, unsigned long asce,
1109-
int local)
1107+
static __always_inline void __ptep_rdp(unsigned long addr, pte_t *ptep, int local)
11101108
{
11111109
unsigned long pto;
11121110

11131111
pto = __pa(ptep) & ~(PTRS_PER_PTE * sizeof(pte_t) - 1);
1114-
asm volatile(".insn rrf,0xb98b0000,%[r1],%[r2],%[asce],%[m4]"
1112+
asm volatile(".insn rrf,0xb98b0000,%[r1],%[r2],%%r0,%[m4]"
11151113
: "+m" (*ptep)
1116-
: [r1] "a" (pto), [r2] "a" ((addr & PAGE_MASK) | opt),
1117-
[asce] "a" (asce), [m4] "i" (local));
1114+
: [r1] "a" (pto), [r2] "a" (addr & PAGE_MASK),
1115+
[m4] "i" (local));
11181116
}
11191117

11201118
static __always_inline void __ptep_ipte(unsigned long address, pte_t *ptep,
@@ -1298,7 +1296,7 @@ static inline void flush_tlb_fix_spurious_fault(struct vm_area_struct *vma,
12981296
* A local RDP can be used to do the flush.
12991297
*/
13001298
if (MACHINE_HAS_RDP && !(pte_val(*ptep) & _PAGE_PROTECT))
1301-
__ptep_rdp(address, ptep, 0, 0, 1);
1299+
__ptep_rdp(address, ptep, 1);
13021300
}
13031301
#define flush_tlb_fix_spurious_fault flush_tlb_fix_spurious_fault
13041302

arch/s390/mm/pgtable.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,9 @@ void ptep_reset_dat_prot(struct mm_struct *mm, unsigned long addr, pte_t *ptep,
303303
preempt_disable();
304304
atomic_inc(&mm->context.flush_count);
305305
if (cpumask_equal(mm_cpumask(mm), cpumask_of(smp_processor_id())))
306-
__ptep_rdp(addr, ptep, 0, 0, 1);
306+
__ptep_rdp(addr, ptep, 1);
307307
else
308-
__ptep_rdp(addr, ptep, 0, 0, 0);
308+
__ptep_rdp(addr, ptep, 0);
309309
/*
310310
* PTE is not invalidated by RDP, only _PAGE_PROTECT is cleared. That
311311
* means it is still valid and active, and must not be changed according

0 commit comments

Comments
 (0)