]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-5.1/s390-mm-fix-address-space-detection-in-exception-handling.patch
4.4-stable patches
[thirdparty/kernel/stable-queue.git] / queue-5.1 / s390-mm-fix-address-space-detection-in-exception-handling.patch
1 From 962f0af83c239c0aef05639631e871c874b00f99 Mon Sep 17 00:00:00 2001
2 From: Gerald Schaefer <gerald.schaefer@de.ibm.com>
3 Date: Mon, 27 May 2019 18:40:19 +0200
4 Subject: s390/mm: fix address space detection in exception handling
5
6 From: Gerald Schaefer <gerald.schaefer@de.ibm.com>
7
8 commit 962f0af83c239c0aef05639631e871c874b00f99 upstream.
9
10 Commit 0aaba41b58bc ("s390: remove all code using the access register
11 mode") removed access register mode from the kernel, and also from the
12 address space detection logic. However, user space could still switch
13 to access register mode (trans_exc_code == 1), and exceptions in that
14 mode would not be correctly assigned.
15
16 Fix this by adding a check for trans_exc_code == 1 to get_fault_type(),
17 and remove the wrong comment line before that function.
18
19 Fixes: 0aaba41b58bc ("s390: remove all code using the access register mode")
20 Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
21 Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
22 Cc: <stable@vger.kernel.org> # v4.15+
23 Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
24 Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
25 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
26
27 ---
28 arch/s390/mm/fault.c | 5 ++++-
29 1 file changed, 4 insertions(+), 1 deletion(-)
30
31 --- a/arch/s390/mm/fault.c
32 +++ b/arch/s390/mm/fault.c
33 @@ -83,7 +83,6 @@ static inline int notify_page_fault(stru
34
35 /*
36 * Find out which address space caused the exception.
37 - * Access register mode is impossible, ignore space == 3.
38 */
39 static inline enum fault_type get_fault_type(struct pt_regs *regs)
40 {
41 @@ -108,6 +107,10 @@ static inline enum fault_type get_fault_
42 }
43 return VDSO_FAULT;
44 }
45 + if (trans_exc_code == 1) {
46 + /* access register mode, not used in the kernel */
47 + return USER_FAULT;
48 + }
49 /* home space exception -> access via kernel ASCE */
50 return KERNEL_FAULT;
51 }