s390/mm: always force a load of the primary ASCE on context switch
authorMartin Schwidefsky <schwidefsky@de.ibm.com>
Tue, 8 Jan 2019 11:44:57 +0000 (12:44 +0100)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Fri, 11 Jan 2019 16:12:02 +0000 (17:12 +0100)
commita38662084c8bdb829ff486468c7ea801c13fcc34
tree43557879c0695fdada5b9c95b849e11ce2b48f9d
parent03aa047ef2db4985e444af6ee1c1dd084ad9fb4c
s390/mm: always force a load of the primary ASCE on context switch

The ASCE of an mm_struct can be modified after a task has been created,
e.g. via crst_table_downgrade for a compat process. The active_mm logic
to avoid the switch_mm call if the next task is a kernel thread can
lead to a situation where switch_mm is called where 'prev == next' is
true but 'prev->context.asce == next->context.asce' is not.

This can lead to a situation where a CPU uses the outdated ASCE to run
a task. The result can be a crash, endless loops and really subtle
problem due to TLBs being created with an invalid ASCE.

Cc: stable@kernel.org # v3.15+
Fixes: 53e857f30867 ("s390/mm,tlb: race of lazy TLB flush vs. recreation")
Reported-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/include/asm/mmu_context.h