提交 81be2d8c 编写于 作者: G Gerald Schaefer 提交者: Xie XiuQi

s390/mm: fix address space detection in exception handling

commit 962f0af83c239c0aef05639631e871c874b00f99 upstream.

Commit 0aaba41b ("s390: remove all code using the access register
mode") removed access register mode from the kernel, and also from the
address space detection logic. However, user space could still switch
to access register mode (trans_exc_code == 1), and exceptions in that
mode would not be correctly assigned.

Fix this by adding a check for trans_exc_code == 1 to get_fault_type(),
and remove the wrong comment line before that function.

Fixes: 0aaba41b ("s390: remove all code using the access register mode")
Reviewed-by: NJanosch Frank <frankja@linux.ibm.com>
Reviewed-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
Cc: <stable@vger.kernel.org> # v4.15+
Signed-off-by: NGerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 9ae4d00d
...@@ -107,7 +107,6 @@ void bust_spinlocks(int yes) ...@@ -107,7 +107,6 @@ void bust_spinlocks(int yes)
/* /*
* Find out which address space caused the exception. * Find out which address space caused the exception.
* Access register mode is impossible, ignore space == 3.
*/ */
static inline enum fault_type get_fault_type(struct pt_regs *regs) static inline enum fault_type get_fault_type(struct pt_regs *regs)
{ {
...@@ -132,6 +131,10 @@ static inline enum fault_type get_fault_type(struct pt_regs *regs) ...@@ -132,6 +131,10 @@ static inline enum fault_type get_fault_type(struct pt_regs *regs)
} }
return VDSO_FAULT; return VDSO_FAULT;
} }
if (trans_exc_code == 1) {
/* access register mode, not used in the kernel */
return USER_FAULT;
}
/* home space exception -> access via kernel ASCE */ /* home space exception -> access via kernel ASCE */
return KERNEL_FAULT; return KERNEL_FAULT;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册