aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68k/kernel/signal.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2018-05-22m68k: Fix style, spelling, and grammar in siginfo_build_tests()Geert Uytterhoeven1-11/+12
Fixes: 4be33329d46f80e8 ("m68k: Verify the offsets in struct siginfo never change.") Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
2018-04-02m68k: Verify the offsets in struct siginfo never change.Eric W. Biederman1-0/+62
A change to the generic struct siginfo accidentally changed the offset of si_offset. Add build time checks to ensure the offsets of all known fields in struct siginfo never change. This copies the form of similar changes on x86. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
2017-06-19m68k: Remove ptrace_signal_deliverAndreas Schwab1-16/+0
This fixes debugger syscall restart interactions. A debugger that modifies the tracee's program counter is expected to set the orig_d0 pseudo register to -1, to disable a possible syscall restart. This removes the last user of the ptrace_signal_deliver hook in the ptrace signal handling, so remove that as well. Signed-off-by: Andreas Schwab <schwab@linux-m68k.org> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
2017-03-28m68k: switch to generic extable.hAl Viro1-1/+1
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2017-02-12m68k/kernel: Modernize printing of kernel messagesGeert Uytterhoeven1-17/+7
- Use pr_err_ratelimited() instead of deprecated printk_ratelimit(), - Add dummies for validating format strings when debugging is disabled, - Convert from printk() to pr_*(), - Correct printf()-style format specifiers. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
2016-12-24Replace <asm/uaccess.h> with <linux/uaccess.h> globallyLinus Torvalds1-1/+1
This was entirely automated, using the script by Al: PATT='^[[:blank:]]*#[[:blank:]]*include[[:blank:]]*<asm/uaccess.h>' sed -i -e "s!$PATT!#include <linux/uaccess.h>!" \ $(git grep -l "$PATT"|grep -v ^include/linux/uaccess.h) to do the replacement at the end of the merge window. Requested-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-10-03Merge tag 'm68k-for-v4.9-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68kLinus Torvalds1-1/+1
Pull m68k updates from Geert Uytterhoeven: - cleanups - defconfig updates - GPG fingerprint update * tag 'm68k-for-v4.9-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k: m68k: Migrate exception table users off module.h and onto extable.h CREDITS: Update fingerprint for Geert Uytterhoeven m68k: Use IS_ENABLED() instead of checking for built-in or module m68k/defconfig: Update defconfigs for v4.8-rc1
2016-09-30m68k: Migrate exception table users off module.h and onto extable.hPaul Gortmaker1-1/+1
This file was only including module.h for exception table related functions. We've now separated that content out into its own file "extable.h" so now move over to that and avoid all the extra header content in module.h that we don't really need to compile this. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
2016-08-08m68knommu: fix user a5 register being overwrittenGreg Ungerer1-1/+0
On no-MMU systems the application a5 register can be overwitten with the address of the process data segment when processing application signals. For flat format applications compiled with full absolute relocation this effectively corrupts the a5 register on signal processing - and this very quickly leads to process crash and often takes out the whole system with a panic as well. This has no effect on flat format applications compiled with the more common PIC methods (such as -msep-data). These format applications reserve a5 for the pointer to the data segment anyway - so it doesn't change it. A long time ago the a5 register was used in the code packed into the user stack to enable signal return processing. And so it had to be restored on end of signal cleanup processing back to the original a5 user value. This was historically done by saving away a5 in the sigcontext structure. At some point (a long time back it seems) the a5 restore process was changed and it was hard coded to put the user data segment address directly into a5. Which is ok for the common PIC compiled application case, but breaks the full relocation application code. We no longer use this type of signal handling mechanism and so we don't need to do anything special to save and restore a5 at all now. So remove the code that hard codes a5 to the address of the user data segment. Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
2016-02-29m68k: Use conventional function parameters for do_sigreturnGreg Ungerer1-6/+2
Create conventional stack parameters for the calls to do_sigreturn and do_rt_sigreturn. The current C code for do_sigreturn and do_rt_sigreturn dig into the stack to create local pointers to the saved switch stack and the pt_regs structs. The motivation for this change is a problem with non-MMU targets that have broken signal return paths on newer versions of gcc. It appears as though gcc has determined that the pointers into the saved stack structs, and the saved structs themselves, are function parameters and updates to them will be lost on function return, so they are optimized away. This results in large parts of restore_sigcontext() and mangle_kernel_stack() functions being removed. Of course this results in non-functional code causing kernel oops. This problem has been observed with gcc version 5.2 and 5.3, and probably exists in earlier versions as well. Using conventional stack parameter pointers passed to these functions has the advantage of the code here not needing to know the exact details of how the underlying entry handler layed these structs out on the stack. So the rather ugly pointer setup casting and arg referencing can be removed. The resulting code after this change is a few bytes larger (due to the overhead of creating the stack args and their tear down). Not being hot paths I don't think this is too much of a problem here. An alternative solution is to put a barrier() in the do_sigreturn() code, but this doesn't feel quite as clean as this solution. This change has been compile tested on all defconfigs, and run tested on Atari (through aranym), ColdFire with MMU (M5407EVB) and ColdFire with no-MMU (QEMU and M5208EVB). Signed-off-by: Greg Ungerer <gerg@uclinux.org> Acked-by: Andreas Schwab <schwab@linux-m68k.org> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
2015-04-12m68k: Remove signal translation and exec_domainRichard Weinberger1-12/+2
As execution domain support is gone we can remove signal translation from the signal code and remove exec_domain from thread_info. Signed-off-by: Richard Weinberger <richard@nod.at>
2015-02-12all arches, signal: move restart_block to struct task_structAndy Lutomirski1-2/+2
If an attacker can cause a controlled kernel stack overflow, overwriting the restart block is a very juicy exploit target. This is because the restart_block is held in the same memory allocation as the kernel stack. Moving the restart block to struct task_struct prevents this exploit by making the restart_block harder to locate. Note that there are other fields in thread_info that are also easy targets, at least on some architectures. It's also a decent simplification, since the restart code is more or less identical on all architectures. [james.hogan@imgtec.com: metag: align thread_info::supervisor_stack] Signed-off-by: Andy Lutomirski <luto@amacapital.net> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Kees Cook <keescook@chromium.org> Cc: David Miller <davem@davemloft.net> Acked-by: Richard Weinberger <richard@nod.at> Cc: Richard Henderson <rth@twiddle.net> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Cc: Matt Turner <mattst88@gmail.com> Cc: Vineet Gupta <vgupta@synopsys.com> Cc: Russell King <rmk@arm.linux.org.uk> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will.deacon@arm.com> Cc: Haavard Skinnemoen <hskinnemoen@gmail.com> Cc: Hans-Christian Egtvedt <egtvedt@samfundet.no> Cc: Steven Miao <realmz6@gmail.com> Cc: Mark Salter <msalter@redhat.com> Cc: Aurelien Jacquiot <a-jacquiot@ti.com> Cc: Mikael Starvik <starvik@axis.com> Cc: Jesper Nilsson <jesper.nilsson@axis.com> Cc: David Howells <dhowells@redhat.com> Cc: Richard Kuo <rkuo@codeaurora.org> Cc: "Luck, Tony" <tony.luck@intel.com> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Michal Simek <monstr@monstr.eu> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Jonas Bonn <jonas@southpole.se> Cc: "James E.J. Bottomley" <jejb@parisc-linux.org> Cc: Helge Deller <deller@gmx.de> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc) Tested-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc) Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Chen Liqin <liqin.linux@gmail.com> Cc: Lennox Wu <lennox.wu@gmail.com> Cc: Chris Metcalf <cmetcalf@ezchip.com> Cc: Guan Xuetao <gxt@mprc.pku.edu.cn> Cc: Chris Zankel <chris@zankel.net> Cc: Max Filippov <jcmvbkbc@gmail.com> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Guenter Roeck <linux@roeck-us.net> Signed-off-by: James Hogan <james.hogan@imgtec.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-08-06m68k: Use sigsp()Richard Weinberger1-12/+4
Use sigsp() instead of the open coded variant. Signed-off-by: Richard Weinberger <richard@nod.at>
2014-08-06m68k: Use get_signal() signal_setup_done()Richard Weinberger1-39/+24
Use the more generic functions get_signal() signal_setup_done() for signal delivery. Signed-off-by: Richard Weinberger <richard@nod.at>
2013-08-26m68k/coldfire: flush cache when creating the signal stack frameAlexander Stein1-0/+8
When the signal stack frame is created, it must be flushed in order to make sure the cache fetches the correct data. Without cache flush the icache might pick up old cached data from an older signal stack frame if the signal is raised again very fast. In case of copyback the data cache muist be pushed first, but is untested. Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com> Signed-off-by: Greg Ungerer <gerg@uclinux.org>
2013-02-03m68k: switch to generic old sigaction()Al Viro1-32/+0
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-02-03m68k: switch to generic old sigsuspendAl Viro1-11/+0
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-02-03m68k: switch to generic sigaltstackAl Viro1-13/+3
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2012-11-29get rid of ptrace_signal_deliver() argumentsAl Viro1-1/+2
the first one is equal to signal_pt_regs(), the second is never used (and always NULL, while we are at it). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2012-06-01new helper: signal_delivered()Al Viro1-1/+1
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 Viro1-4/+0
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 Viro1-2/+0
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2012-06-01new helper: sigmask_to_save()Al Viro1-8/+3
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 Viro1-4/+1
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 Viro1-4/+1
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2012-05-21m68k: add TIF_NOTIFY_RESUME and handle it.Al Viro1-1/+14
TIF_NOTIFY_RESUME added (as bit 5). That way nommu glue needs no changes at all; mmu one needs just to replace jmi do_signal_return to jne do_signal_return There we have flags shifted up, until bit 6 (SIGPENDING) is in MSBit; instead of checking that MSBit is set (jmi) we check that MSBit or something below it is set (jne); bits 0..4 are never set, so that's precisely "bit 6 or bit 5 is set". Usual handling of NOTIFY_RESUME/SIGPENDING is done in do_notify_resume(); glue calls it instead of do_signal(). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2012-05-21m68k: use set_current_blocked() and block_sigmask()Matt Fleming1-8/+3
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: Geert Uytterhoeven <geert@linux-m68k.org> Acked-by: Greg Ungerer <gerg@uclinux.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2012-05-21new helper: sigsuspend()Al Viro1-12/+3
guts of saved_sigmask-based sigsuspend/rt_sigsuspend. Takes kernel sigset_t *. Open-coded instances replaced with calling it. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2012-05-20m68k: merge the MMU and non-MMU signal.c codeGreg Ungerer1-2/+1199
The MMU (signal_mm.c) and non-MMU (signal_no.c) versions of the m68k architecture signal handling code are very similar. Most of their code is the same. Merge the two back into a single signal.c, and move some of the code around inside the file to minimize the number of #ifdefs required. Specificially we can group out the CONFIG_FPU and the CONFIG_MMU code. We end up needing a few other "#ifdef CONFIG_MMU" as well, but not too many. Signed-off-by: Greg Ungerer <gerg@uclinux.org> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
2011-03-25m68k: merge m68k and m68knommu arch directoriesGreg Ungerer1-1015/+3
There is a lot of common code that could be shared between the m68k and m68knommu arch branches. It makes sense to merge the two branches into a single directory structure so that we can more easily share that common code. This is a brute force merge, based on a script from Stephen King <sfking@fdwdc.com>, which was originally written by Arnd Bergmann <arnd@arndb.de>. > The script was inspired by the script Sam Ravnborg used to merge the > includes from m68knommu. For those files common to both arches but > differing in content, the m68k version of the file is renamed to > <file>_mm.<ext> and the m68knommu version of the file is moved into the > corresponding m68k directory and renamed <file>_no.<ext> and a small > wrapper file <file>.<ext> is used to select between the two version. Files > that are common to both but don't differ are removed from the m68knommu > tree and files and directories that are unique to the m68knommu tree are > moved to the m68k tree. Finally, the arch/m68knommu tree is removed. > > To select between the the versions of the files, the wrapper uses > > #ifdef CONFIG_MMU > #include <file>_mm.<ext> > #else > #include <file>_no.<ext> > #endif On top of this file merge I have done a simplistic merge of m68k and m68knommu Kconfig, which primarily attempts to keep existing options and menus in place. Other than a handful of options being moved it produces identical .config outputs on m68k and m68knommu targets I tested it on. With this in place there is now quite a bit of scope for merge cleanups in future patches. Signed-off-by: Greg Ungerer <gerg@uclinux.org>
2011-03-16m68k: Add helper function handle_kernel_fault()Roman Zippel1-1/+23
Add helper function handle_kernel_fault() in signal.c, so frame_extra_sizes can become static, and to avoid future code duplication. Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
2011-01-07m68k: Check __get_user()/__put_user() return valueAl Viro1-6/+6
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
2011-01-07m68k: Fix stack mangling logics in sigreturnAl Viro1-112/+61
a) we should hold modifying regs->format until we know we *will* be doing stack expansion; otherwise attacker can modify sigframe to have wrong ->sc_formatvec and install SIGSEGV handler. b) we should *not* mix copying saved extra stuff from userland with expanding the stack; once we'd done that manual memmove, we'd better not return to C, so cleanup is very hard to do. The easiest way is to copy it on stack first, making sure we won't overwrite on stack expansion. Fortunately that's easy to do... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
2011-01-07m68k: If we fail to set sigframe up, just leave regs alone...Al Viro1-14/+30
Same principle as with the previous patch - do not destroy the state if sigframe setup fails. Incidentally, it's actually _less_ work - we don't need to go through adjust_stack dance on failure if we don't touch regs->stkadj until we know we'd written sigframe out. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
2011-01-07m68k: Don't lose state if sigframe setup failsAl Viro1-7/+12
If we'd failed in setup_frame(), we've no place to store the original sigmask. It's not an unrecoverable situation - we raise SIGSEGV, but that SIGSEGV might be successfully handled (e.g. on altstack). In that case we really don't want sa_mask of original signal permanently slapped on the set of blocked signals. Standard solution: have setup_frame()/setup_rt_frame() report failure and don't mess with the signal-related state if that has happened... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
2011-01-07m68k: Simplify the singlestepping handling in signalsAl Viro1-4/+7
Instead of checking the return value of do_signal() we can just do the work (raise SIGTRAP and clear SR.T1) directly in handle_signal(), when setting the sigframe up. Simplifies the assembler glue and is closer to the way we do it on other targets. Note that do_delayed_trace does *not* disappear; it's still needed to deal with single-stepping through syscall, since 68040 doesn't raise the trace exception at all if the trap exception is pending. We hit it after returning from sys_...() if TIF_DELAYED_TRACE is set; all that has changed is that we don't reuse it for "single-step into the handler" codepath. As the result, do_signal() doesn't need to return anything anymore. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
2011-01-07m68k: Switch to saner sigsuspend()Al Viro1-43/+21
and saner do_signal() arguments, while we are at it Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
2011-01-07m68k: Resetting sa_handler in local copy of k_sigaction is pointlessAl Viro1-3/+0
... and had been such since the introduction of get_signal_to_deliver() Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
2010-02-27m68k: Define sigcontext ABI of ColdFireMaxim Kuvyrkov1-0/+7
The following patch defines sigcontext ABI of ColdFire. Due to ISA restrictions ColdFire needs different rt_sigreturn trampoline. And due to ColdFire FP registers being 8-bytes instead of 12-bytes on m68k, sigcontext and fpregset structures should be updated. Regarding the sc_fpstate[16+6*8] field, it would've been enough 16 bytes to store ColdFire's FP state. To accomodate GLIBC's libSegFault it would'be been enough 6*8 bytes (room for the 6 non-call-clobbered FP registers). I set it to 16+6*8 to provide some extra space for any future changes in the ColdFire FPU. Signed-off-by: Maxim Kuvyrkov <maxim@codesourcery.com> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
2009-01-12m68k: Wire up sys_restart_syscallAndreas Schwab1-0/+15
Make restart blocks working, required for proper syscall restarting. Signed-off-by: Andreas Schwab <schwab@suse.de> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
2006-06-23[PATCH] fix incorrect SA_ONSTACK behaviour for 64-bit processesLaurent MEYER1-1/+1
- When setting a sighandler using sigaction() call, if the flag SA_ONSTACK is set and no alternate stack is provided via sigaltstack(), the kernel still try to install the alternate stack. This behavior is the opposite of the one which is documented in Single Unix Specifications V3. - Also when setting an alternate stack using sigaltstack() with the flag SS_DISABLE, the kernel try to install the alternate stack on signal delivery. These two use cases makes the process crash at signal delivery. Signed-off-by: Laurent Meyer <meyerlau@fr.ibm.com> Cc: Richard Henderson <rth@twiddle.net> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Cc: David Howells <dhowells@redhat.com> Cc: Yoshinori Sato <ysato@users.sourceforge.jp> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Roman Zippel <zippel@linux-m68k.org> Cc: Kyle McMartin <kyle@mcmartin.ca> Cc: Paul Mundt <lethal@linux-sh.org> Cc: Kazumoto Kojima <kkojima@rr.iij4u.or.jp> Cc: Chris Zankel <chris@zankel.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-12[PATCH] m68k: signal __user annotationsAl Viro1-31/+31
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Cc: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-16Linux-2.6.12-rc2Linus Torvalds1-0/+1025
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!