diff options
author | Heiko Carstens | 2020-12-07 20:56:38 +0100 |
---|---|---|
committer | Heiko Carstens | 2020-12-09 21:02:08 +0100 |
commit | b4d70a6134d2152d692ccc873ff6fa3351631927 (patch) | |
tree | 506d435fedb08619cb849906cb4e207139c6b337 /arch | |
parent | 454efcf82ea17d7efeb86ebaa20775a21ec87d27 (diff) |
s390/mm: use invalid asce for user space when switching to init_mm
Currently only idle_task_exit() explicitly switches (switch_mm) to
init_mm. This causes the kernel asce to be loaded into cr7 and
therefore it would be used for potential user space accesses.
This is currently no problem since idle_task_exit() is nearly the last
thing a CPU executes before it is taken down. However things might
change - and therefore make sure that always the invalid asce is used
for cr7 when active_mm is init_mm.
This makes sure that all potential user space accesses will fail,
instead of accessing kernel address space.
Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/s390/include/asm/mmu_context.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/s390/include/asm/mmu_context.h b/arch/s390/include/asm/mmu_context.h index 87a84fc59fc3..5dc49c467319 100644 --- a/arch/s390/include/asm/mmu_context.h +++ b/arch/s390/include/asm/mmu_context.h @@ -76,7 +76,10 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, { int cpu = smp_processor_id(); - S390_lowcore.user_asce = next->context.asce; + if (next == &init_mm) + S390_lowcore.user_asce = s390_invalid_asce; + else + S390_lowcore.user_asce = next->context.asce; cpumask_set_cpu(cpu, &next->context.cpu_attach_mask); /* Clear previous user-ASCE from CR7 */ __ctl_load(s390_invalid_asce, 7, 7); |