Skip to contentSkip to conversation

Patch "parisc: Unbreak handling exceptions from kernel modules" has been added to the 4.5-stable tree

PATCH [email protected] 1 participant 1 message Apr 12, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

parisc: Unbreak handling exceptions from kernel modules

to the 4.5-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
parisc-unbreak-handling-exceptions-from-kernel-modules.patch
and it can be found in the queue-4.5 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 2ef4dfd9d9f288943e249b78365a69e3ea3ec072 Mon Sep 17 00:00:00 2001

From: Helge Deller <[email protected]>
Date: Fri, 8 Apr 2016 18:32:52 +0200
Subject: parisc: Unbreak handling exceptions from kernel modules

From: Helge Deller <[email protected]>

commit 2ef4dfd9d9f288943e249b78365a69e3ea3ec072 upstream.

Handling exceptions from modules never worked on parisc. It was just masked by the fact that exceptions from modules don't happen during normal use.

When a module triggers an exception in get_user() we need to load the main kernel dp value before accessing the exception_data structure, and afterwards restore the original dp value of the module on exit.

---
 arch/parisc/include/asm/uaccess.h |    1 +
 arch/parisc/kernel/asm-offsets.c  |    1 +
 arch/parisc/lib/fixup.S           |    6 ++++++
 arch/parisc/mm/fault.c            |    1 +
 4 files changed, 9 insertions(+)
arch/parisc/include/asm/uaccess.h +1 -0
@@ -76,6 +76,7 @@ struct exception_table_entry {
  */
 struct exception_data {
 	unsigned long fault_ip;
+	unsigned long fault_gp;
 	unsigned long fault_space;
 	unsigned long fault_addr;
 };
arch/parisc/kernel/asm-offsets.c +1 -0
@@ -299,6 +299,7 @@ int main(void)
 #endif
 	BLANK();
 	DEFINE(EXCDATA_IP, offsetof(struct exception_data, fault_ip));
+	DEFINE(EXCDATA_GP, offsetof(struct exception_data, fault_gp));
 	DEFINE(EXCDATA_SPACE, offsetof(struct exception_data, fault_space));
 	DEFINE(EXCDATA_ADDR, offsetof(struct exception_data, fault_addr));
 	BLANK();
arch/parisc/lib/fixup.S +6 -0
@@ -26,6 +26,7 @@
 
 #ifdef CONFIG_SMP
 	.macro  get_fault_ip t1 t2
+	loadgp
 	addil LT%__per_cpu_offset,%r27
 	LDREG RT%__per_cpu_offset(%r1),\t1
 	/* t2 = smp_processor_id() */
@@ -40,14 +41,19 @@
 	LDREG RT%exception_data(%r1),\t1
 	/* t1 = this_cpu_ptr(&exception_data) */
 	add,l \t1,\t2,\t1
+	/* %r27 = t1->fault_gp - restore gp */
+	LDREG EXCDATA_GP(\t1), %r27
 	/* t1 = t1->fault_ip */
 	LDREG EXCDATA_IP(\t1), \t1
 	.endm
 #else
 	.macro  get_fault_ip t1 t2
+	loadgp
 	/* t1 = this_cpu_ptr(&exception_data) */
 	addil LT%exception_data,%r27
 	LDREG RT%exception_data(%r1),\t2
+	/* %r27 = t2->fault_gp - restore gp */
+	LDREG EXCDATA_GP(\t2), %r27
 	/* t1 = t2->fault_ip */
 	LDREG EXCDATA_IP(\t2), \t1
 	.endm
arch/parisc/mm/fault.c +1 -0
@@ -151,6 +151,7 @@ int fixup_exception(struct pt_regs *regs
 		struct exception_data *d;
 		d = this_cpu_ptr(&exception_data);
 		d->fault_ip = regs->iaoq[0];
+		d->fault_gp = regs->gr[27];
 		d->fault_space = regs->isr;
 		d->fault_addr = regs->ior;
 

Patches currently in stable-queue which might be from [email protected] are

queue-4.5/parisc-fix-kernel-crash-with-reversed-copy_from_user.patch queue-4.5/parisc-unbreak-handling-exceptions-from-kernel-modules.patch queue-4.5/parisc-avoid-function-pointers-for-kernel-exception-routines.patch queue-4.5/parisc-fix-and-enable-seccomp-filter-support.patch queue-4.5/parisc-fix-sigsys-signals-in-compat-case.patch