Skip to content

Commit

Permalink
s390/mm: fix address space detection in exception handling
Browse files Browse the repository at this point in the history
Commit 0aaba41 ("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: 0aaba41 ("s390: remove all code using the access register mode")
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: <stable@vger.kernel.org> # v4.15+
Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
  • Loading branch information
Gerald Schaefer authored and Heiko Carstens committed Jun 5, 2019
1 parent f2c7c76 commit 962f0af
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion arch/s390/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ static inline int notify_page_fault(struct pt_regs *regs)

/*
* Find out which address space caused the exception.
* Access register mode is impossible, ignore space == 3.
*/
static enum fault_type get_fault_type(struct pt_regs *regs)
{
Expand All @@ -108,6 +107,10 @@ static enum fault_type get_fault_type(struct pt_regs *regs)
}
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 */
return KERNEL_FAULT;
}
Expand Down

0 comments on commit 962f0af

Please sign in to comment.