提交 500d5830 编写于 作者: E Eric W. Biederman

signal/openrisc: Fix do_unaligned_access to send the proper signal

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.

Cc: stable@vger.kernel.org
Fixes: 769a8a96 ("OpenRISC: Traps")
Cc: Jonas Bonn <jonas@southpole.se>
Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
Cc: Stafford Horne <shorne@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: openrisc@lists.librecores.org
Acked-by: NStafford Horne <shorne@gmail.com>
Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
上级 0e88bb00
...@@ -266,12 +266,12 @@ asmlinkage void do_unaligned_access(struct pt_regs *regs, unsigned long address) ...@@ -266,12 +266,12 @@ asmlinkage void do_unaligned_access(struct pt_regs *regs, unsigned long address)
siginfo_t info; siginfo_t info;
if (user_mode(regs)) { if (user_mode(regs)) {
/* Send a SIGSEGV */ /* Send a SIGBUS */
info.si_signo = SIGSEGV; info.si_signo = SIGBUS;
info.si_errno = 0; info.si_errno = 0;
/* info.si_code has been set above */ info.si_code = BUS_ADRALN;
info.si_addr = (void *)address; info.si_addr = (void __user *)address;
force_sig_info(SIGSEGV, &info, current); force_sig_info(SIGBUS, &info, current);
} else { } else {
printk("KERNEL: Unaligned Access 0x%.8lx\n", address); printk("KERNEL: Unaligned Access 0x%.8lx\n", address);
show_registers(regs); show_registers(regs);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册