Commit 675525e3 authored by David Hildenbrand's avatar David Hildenbrand Committed by Greg Kroah-Hartman

s390/mm: fix gmap tlb flush issues

commit f0454029 upstream.

__tlb_flush_asce() should never be used if multiple asce belong to a mm.

As this function changes mm logic determining if local or global tlb
flushes will be neded, we might end up flushing only the gmap asce on all
CPUs and a follow up mm asce flushes will only flush on the local CPU,
although that asce ran on multiple CPUs.

The missing tlb flushes will provoke strange faults in user space and even
low address protections in user space, crashing the kernel.

Fixes: 1b948d6c ("s390/mm,tlb: optimize TLB flushing for zEC12")
Cc: stable@vger.kernel.org # 3.15+
Reported-by: default avatarSascha Silbe <silbe@linux.vnet.ibm.com>
Acked-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: default avatarDavid Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e765b192
...@@ -81,7 +81,8 @@ static inline void __tlb_flush_full(struct mm_struct *mm) ...@@ -81,7 +81,8 @@ static inline void __tlb_flush_full(struct mm_struct *mm)
} }
/* /*
* Flush TLB entries for a specific ASCE on all CPUs. * Flush TLB entries for a specific ASCE on all CPUs. Should never be used
* when more than one asce (e.g. gmap) ran on this mm.
*/ */
static inline void __tlb_flush_asce(struct mm_struct *mm, unsigned long asce) static inline void __tlb_flush_asce(struct mm_struct *mm, unsigned long asce)
{ {
......
...@@ -166,7 +166,7 @@ EXPORT_SYMBOL_GPL(gmap_alloc); ...@@ -166,7 +166,7 @@ EXPORT_SYMBOL_GPL(gmap_alloc);
static void gmap_flush_tlb(struct gmap *gmap) static void gmap_flush_tlb(struct gmap *gmap)
{ {
if (MACHINE_HAS_IDTE) if (MACHINE_HAS_IDTE)
__tlb_flush_asce(gmap->mm, gmap->asce); __tlb_flush_idte(gmap->asce);
else else
__tlb_flush_global(); __tlb_flush_global();
} }
...@@ -205,7 +205,7 @@ void gmap_free(struct gmap *gmap) ...@@ -205,7 +205,7 @@ void gmap_free(struct gmap *gmap)
/* Flush tlb. */ /* Flush tlb. */
if (MACHINE_HAS_IDTE) if (MACHINE_HAS_IDTE)
__tlb_flush_asce(gmap->mm, gmap->asce); __tlb_flush_idte(gmap->asce);
else else
__tlb_flush_global(); __tlb_flush_global();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment