Skip to contentSkip to conversation

Patch "signal/openrisc: Fix do_unaligned_access to send the proper signal" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Feb 15, 2018

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

signal/openrisc: Fix do_unaligned_access to send the proper signal

to the 4.9-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:
signal-openrisc-fix-do_unaligned_access-to-send-the-proper-signal.patch
and it can be found in the queue-4.9 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 500d58300571b6602341b041f97c082a461ef994 Mon Sep 17 00:00:00 2001

From: "Eric W. Biederman" <[email protected]>
Date: Tue, 1 Aug 2017 04:16:47 -0500
Subject: signal/openrisc: Fix do_unaligned_access to send the proper signal

From: Eric W. Biederman <[email protected]>

commit 500d58300571b6602341b041f97c082a461ef994 upstream.

While reviewing the signal sending on openrisc the do_unaligned_access function stood out because it is obviously wrong. A comment about an si_code set above when actually si_code is never set. Leading to a random si_code being sent to userspace in the event of an unaligned access.

Looking further SIGBUS BUS_ADRALN is the proper pair of signal and si_code to send for an unaligned access. That is what other architectures do and what is required by posix.

Given that do_unaligned_access is broken in a way that no one can be relying on it on openrisc fix the code to just do the right thing.

Fixes 769a8a96229e ("OpenRISC: Traps")
Cc Jonas Bonn <[email protected]>
Cc Stefan Kristiansson <[email protected]>
Cc Stafford Horne <[email protected]>
Cc Arnd Bergmann <[email protected]>
---
 arch/openrisc/kernel/traps.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
arch/openrisc/kernel/traps.c +5 -5
@@ -302,12 +302,12 @@ asmlinkage void do_unaligned_access(stru
 	siginfo_t info;
 
 	if (user_mode(regs)) {
-		/* Send a SIGSEGV */
-		info.si_signo = SIGSEGV;
+		/* Send a SIGBUS */
+		info.si_signo = SIGBUS;
 		info.si_errno = 0;
-		/* info.si_code has been set above */
-		info.si_addr = (void *)address;
-		force_sig_info(SIGSEGV, &info, current);
+		info.si_code = BUS_ADRALN;
+		info.si_addr = (void __user *)address;
+		force_sig_info(SIGBUS, &info, current);
 	} else {
 		printk("KERNEL: Unaligned Access 0x%.8lx\n", address);
 		show_registers(regs);

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

queue-4.9/signal-openrisc-fix-do_unaligned_access-to-send-the-proper-signal.patch queue-4.9/signal-sh-ensure-si_signo-is-initialized-in-do_divide_error.patch