summaryrefslogtreecommitdiff
path: root/arch/sh/kernel/signal_64.c
AgeCommit message (Collapse)Author
2012-03-29sh: 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. Acked-by: Oleg Nesterov <oleg@redhat.com> Cc: Paul Mundt <lethal@linux-sh.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-03-29sh: 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 had no effect on signal delivery. Acked-by: Oleg Nesterov <oleg@redhat.com> Cc: Paul Mundt <lethal@linux-sh.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-01-10sh: Remove redundant try_to_freeze() invocations.Paul Mundt
get_signal_to_deliver() takes care of this, kill off the redundancies, as per the avr32 change. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-15Merge branch 'sh/stable-updates'Paul Mundt
2010-02-15sh64: fix tracing of signals.Paul Mundt
This follows the parisc change to ensure that tracehook_signal_handler() is aware of when we are single-stepping in order to ptrace_notify() appropriately. While this was implemented for 32-bit SH, sh64 neglected to make use of TIF_SINGLESTEP when it was folded in with the 32-bit code, resulting in ptrace_notify() never being called. As sh64 uses all of the other abstractions already, this simply plugs in the thread flag in the appropriate enable/disable paths and fixes up the tracehook notification accordingly. With this in place, sh64 is brought in line with what 32-bit is already doing. Reported-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-01-19sh64: Fix up the build for the thread_xstate changes.Paul Mundt
This updates the sh64 processor info with the sh32 changes in order to tie in to the generic task_xstate management code. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-12-15sh: Fix up FPU build for SH5Matt Fleming
After the recent FPU optimisation commit the signature of save_fpu() changed. "regs" wasn't used in the implementation of save_fpu() anyway. Signed-off-by: Matt Fleming <matt@console-pimps.org> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-10-14sh: TS_RESTORE_SIGMASK conversion.Paul Mundt
Replace TIF_RESTORE_SIGMASK with TS_RESTORE_SIGMASK and define our own set_restore_sigmask() function. This saves the costly SMP-safe set_bit operation, which we do not need for the sigmask flag since TIF_SIGPENDING always has to be set too. Based on the x86 and powerpc change. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-09-16Merge branch 'master' of ↵Paul Mundt
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 Conflicts: arch/sh/kernel/vmlinux.lds.S
2009-09-02KEYS: Add a keyctl to install a process's session keyring on its parent [try #6]David Howells
Add a keyctl to install a process's session keyring onto its parent. This replaces the parent's session keyring. Because the COW credential code does not permit one process to change another process's credentials directly, the change is deferred until userspace next starts executing again. Normally this will be after a wait*() syscall. To support this, three new security hooks have been provided: cred_alloc_blank() to allocate unset security creds, cred_transfer() to fill in the blank security creds and key_session_to_parent() - which asks the LSM if the process may replace its parent's session keyring. The replacement may only happen if the process has the same ownership details as its parent, and the process has LINK permission on the session keyring, and the session keyring is owned by the process, and the LSM permits it. Note that this requires alteration to each architecture's notify_resume path. This has been done for all arches barring blackfin, m68k* and xtensa, all of which need assembly alteration to support TIF_NOTIFY_RESUME. This allows the replacement to be performed at the point the parent process resumes userspace execution. This allows the userspace AFS pioctl emulation to fully emulate newpag() and the VIOCSETTOK and VIOCSETTOK2 pioctls, all of which require the ability to alter the parent process's PAG membership. However, since kAFS doesn't use PAGs per se, but rather dumps the keys into the session keyring, the session keyring of the parent must be replaced if, for example, VIOCSETTOK is passed the newpag flag. This can be tested with the following program: #include <stdio.h> #include <stdlib.h> #include <keyutils.h> #define KEYCTL_SESSION_TO_PARENT 18 #define OSERROR(X, S) do { if ((long)(X) == -1) { perror(S); exit(1); } } while(0) int main(int argc, char **argv) { key_serial_t keyring, key; long ret; keyring = keyctl_join_session_keyring(argv[1]); OSERROR(keyring, "keyctl_join_session_keyring"); key = add_key("user", "a", "b", 1, keyring); OSERROR(key, "add_key"); ret = keyctl(KEYCTL_SESSION_TO_PARENT); OSERROR(ret, "KEYCTL_SESSION_TO_PARENT"); return 0; } Compiled and linked with -lkeyutils, you should see something like: [dhowells@andromeda ~]$ keyctl show Session Keyring -3 --alswrv 4043 4043 keyring: _ses 355907932 --alswrv 4043 -1 \_ keyring: _uid.4043 [dhowells@andromeda ~]$ /tmp/newpag [dhowells@andromeda ~]$ keyctl show Session Keyring -3 --alswrv 4043 4043 keyring: _ses 1055658746 --alswrv 4043 4043 \_ user: a [dhowells@andromeda ~]$ /tmp/newpag hello [dhowells@andromeda ~]$ keyctl show Session Keyring -3 --alswrv 4043 4043 keyring: hello 340417692 --alswrv 4043 4043 \_ user: a Where the test program creates a new session keyring, sticks a user key named 'a' into it and then installs it on its parent. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: James Morris <jmorris@namei.org>
2009-08-04sh: Tidy up NEFF-based sign extension for SH-5.Paul Mundt
This consolidates all of the NEFF-based sign extension for SH-5. In the future the other SH code will need to make use of this as well, so make it generic in preparation for more 32/64 consolidation. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-01-29sh: Fix up spurious syscall restarting.Paul Mundt
The T-bit manipulation for syscall error checking had the side effect of spuriously returning ERESTART* errno values over EINTR. So, we simplify the error checking a bit and leave the T-bit alone. Reported-by: Kaz Kojima <kkojima@rr.iij4u.or.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22sh: Provide asm/syscall.h for SH-5.Paul Mundt
This provides the asm/syscall.h implementation for sh64 parts. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22sh: Handle cases where setup{_rt,}_frame() fail on SH-5 signal delivery.Paul Mundt
Presently these cases are not handled properly due to the return value not being passed back. This needs to be correct to get proper behaviour out of things like the tracehook signal notifier, amongst others. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-09-29sh: Fix up signal_64 cast warnings.Paul Mundt
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-09-24sh: Force pending restarted system calls to return -EINTR.Paul Mundt
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-09-17sh: Fix up signal_64 conflicting handle_signal() definition.Paul Mundt
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-08-02sh: Make syscall tracer use tracehook notifiers, add TIF_NOTIFY_RESUME.Paul Mundt
This follows the changes in commits: 7d6d637dac2050f30a1b57b0a3dc5de4a10616ba 4f72c4279eab1e5f3ed1ac4e55d4527617582392 on powerpc. Adding in TIF_NOTIFY_RESUME, and cleaning up the syscall tracing to be more generic. This is an incremental step to turning on tracehook, as well as unifying more of the ptrace and signal code across the 32/64 split. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-04-16sh64: add missing #include <asm/fpu.h>'sAdrian Bunk
This patch fixes some compile errors due to missing save_fpu() prototypes on sh64 caused by commit 9bbafce2eec190ef7e44b0eb1095ba17ce6ad3af (sh: Fix occasional FPU register corruption under preempt). Signed-off-by: Adrian Bunk <adrian.bunk@movial.fi> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-01-28sh: comment tidying for sh64->sh migration.Paul Mundt
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-01-28sh: Bring the SH-5 FPU in line with the SH-4 FPU API.Paul Mundt
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-01-28sh: Move over and enable FPU support for SH-5.Paul Mundt
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-01-28sh: flush_cache_sigtramp() takes 1 arg only.Paul Mundt
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-01-28sh: Move in the SH-5 signal trampoline impl.Paul Mundt
Signed-off-by: Paul Mundt <lethal@linux-sh.org>