summaryrefslogtreecommitdiff
path: root/arch/openrisc/kernel/signal.c
AgeCommit message (Collapse)Author
2014-01-09openrisc: Use get_signal() signal_setup_done()Richard Weinberger
Use the more generic functions get_signal() signal_setup_done() for signal delivery. Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Jonas Bonn <jonas@southpole.se>
2014-01-09openrisc: Rework signal handlingJonas Bonn
The mainline signal handling code for OpenRISC has been buggy since day one with respect to syscall restart. This patch significantly reworks the signal handling code: i) Move the "work pending" loop to C code (borrowed from ARM arch) ii) Allow a tracer to muck about with the IP and skip syscall restart in that case (again, borrowed from ARM) iii) Make signal handling WRT syscall restart actually work v) Make the signal handling code look more like that of other architectures so that it's easier for others to follow Reported-by: Anders Nystrom <anders@southpole.se> Signed-off-by: Jonas Bonn <jonas@southpole.se>
2013-02-03openrisc: switch to generic sigaltstackAl Viro
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2012-11-28openrisk: fix altstack switching on sigreturnAl Viro
do_sigaltstack() expects _userland_ address, TYVM... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2012-06-01new helper: signal_delivered()Al Viro
Does block_sigmask() + tracehook_signal_handler(); called when sigframe has been successfully built. All architectures converted to it; block_sigmask() itself is gone now (merged into this one). I'm still not too happy with the signature, but that's a separate story (IMO we need a structure that would contain signal number + siginfo + k_sigaction, so that get_signal_to_deliver() would fill one, signal_delivered(), handle_signal() and probably setup...frame() - take one). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2012-06-01most of set_current_blocked() callers want SIGKILL/SIGSTOP removed from setAl Viro
Only 3 out of 63 do not. Renamed the current variant to __set_current_blocked(), added set_current_blocked() that will exclude unblockable signals, switched open-coded instances to it. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2012-06-01pull clearing RESTORE_SIGMASK into block_sigmask()Al Viro
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2012-06-01openrisc: tracehook_signal_handler() is supposed to be called on successAl Viro
... not if sigframe couldn't have been built. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2012-06-01new helper: sigmask_to_save()Al Viro
replace boilerplate "should we use ->saved_sigmask or ->blocked?" with calls of obvious inlined helper... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2012-06-01new helper: restore_saved_sigmask()Al Viro
first fruits of ..._restore_sigmask() helpers: now we can take boilerplate "signal didn't have a handler, clear RESTORE_SIGMASK and restore the blocked mask from ->saved_mask" into a common helper. Open-coded instances switched... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2012-05-23move key_repace_session_keyring() into tracehook_notify_resume()Al Viro
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2012-03-06openrisc: sanitize use of orig_gpr11Jonas Bonn
The pt_regs struct had both a 'syscallno' field and an 'orig_gpr11' field and it wasn't really clear how these were supposed to be used. This patch removes the syscallno field altogether and makes orig_gpr11 work more like other architectures: keep track of syscall number in progress or hold -1 for non-syscall exceptions. Signed-off-by: Jonas Bonn <jonas@southpole.se>
2012-02-17OpenRISC: Use set_current_blocked() and block_sigmask()Matt Fleming
As described in e6fa16ab ("signal: sigprocmask() should do retarget_shared_pending()") the modification of current->blocked is incorrect as we need to check whether the signal we're about to block is pending in the shared queue. Also, use the new helper function introduced in commit 5e6292c0f28f ("signal: add block_sigmask() for adding sigmask to current->blocked") which centralises the code for updating current->blocked after successfully delivering a signal and reduces the amount of duplicate code across architectures. In the past some architectures got this code wrong, so using this helper function should stop that from happening again. Cc: Oleg Nesterov <oleg@redhat.com> Cc: Jonas Bonn <jonas@southpole.se> Cc: Arnd Bergmann <arnd@arndb.de> Cc: linux@lists.openrisc.net Signed-off-by: Matt Fleming <matt.fleming@intel.com> Signed-off-by: Jonas Bonn <jonas@southpole.se>
2012-02-17OpenRISC: Don't mask signals if we fail to setup signal stackMatt Fleming
setup_rt_frame() needs to return an indication of whether it succeeded or failed in setting up the signal stack frame. If setup_rt_frame() fails then we must not modify current->blocked. Acked-by: Oleg Nesterov <oleg@redhat.com> Cc: Jonas Bonn <jonas@southpole.se> Cc: Arnd Bergmann <arnd@arndb.de> Cc: linux@lists.openrisc.net Signed-off-by: Matt Fleming <matt.fleming@intel.com> Signed-off-by: Jonas Bonn <jonas@southpole.se>
2012-02-17OpenRISC: No need to reset handler if SA_ONESHOTMatt Fleming
get_signal_to_deliver() already resets the signal handler if SA_ONESHOT is set in ka->sa.sa_flags, there's no need to do it again in handle_signal(). Furthermore, because we were modifying ka->sa.sa_handler (which is a copy of sighand->action[]) instead of sighand->action[] the original code actually had no effect on signal delivery. Acked-by: Oleg Nesterov <oleg@redhat.com> Cc: Jonas Bonn <jonas@southpole.se> Cc: Arnd Bergmann <arnd@arndb.de> Cc: linux@lists.openrisc.net Signed-off-by: Matt Fleming <matt.fleming@intel.com> Signed-off-by: Jonas Bonn <jonas@southpole.se>
2012-02-17OpenRISC: Don't reimplement force_sigsegv()Matt Fleming
Instead of open coding the sequence from force_sigsegv() just call it. This also fixes a bug because we were modifying ka->sa.sa_handler (which is a copy of sighand->action[]), whereas the intention of the code was to modify sighand->action[] directly. As the original code was working with a copy it had no effect on signal delivery. Acked-by: Oleg Nesterov <oleg@redhat.com> Cc: Jonas Bonn <jonas@southpole.se> Cc: Arnd Bergmann <arnd@arndb.de> Cc: linux@lists.openrisc.net Signed-off-by: Matt Fleming <matt.fleming@intel.com> Signed-off-by: Jonas Bonn <jonas@southpole.se>
2011-09-05openrisc: don't use pt_regs in struct sigcontextJonas Bonn
As it was decided not to export struct pt_regs to userspace, struct sigcontext shouldn't be using it either. The pt_regs struct for OpenRISC is kernel internal and the layout of the registers may change in the future. The struct user_regs_struct is what is guaranteed to remain stable, so struct sigcontext may use that instead. This patch removes the usage of struct pt_regs in struct sigcontext and makes according changes in signal.c to get the register layout right. The usp field is removed from the sigcontext structure as this information is already contained in the user_regs_struct. Signed-off-by: Jonas Bonn <jonas@southpole.se> Reviewed-by: Emilio Cota <cota@braap.org>
2011-07-22OpenRISC: Signal handlingJonas Bonn
Signed-off-by: Jonas Bonn <jonas@southpole.se> Reviewed-by: Arnd Bergmann <arnd@arndb.de>