summaryrefslogtreecommitdiffstats
path: root/arch/microblaze/kernel/signal.c
Commit message (Collapse)AuthorAgeFilesLines
* all arches, signal: move restart_block to struct task_structAndy Lutomirski2015-02-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* microblaze: Fix variable types to remove W=1 warningMichal Simek2015-01-081-2/+2
| | | | | | | | | This patch removes this warning: arch/microblaze/kernel/signal.c: In function 'setup_rt_frame': arch/microblaze/kernel/signal.c:177:3: warning: signed and unsigned type in conditional expression [-Wsign-compare] Signed-off-by: Michal Simek <michal.simek@xilinx.com>
* microblaze: Use sigsp()Richard Weinberger2014-08-061-6/+3
| | | | | | Use sigsp() instead of the open coded variant. Signed-off-by: Richard Weinberger <richard@nod.at>
* microblaze: Use get_signal() signal_setup_done()Richard Weinberger2014-08-061-31/+17
| | | | | | | Use the more generic functions get_signal() signal_setup_done() for signal delivery. Signed-off-by: Richard Weinberger <richard@nod.at>
* microblaze: Use asm-generic/io.hMichal Simek2014-04-071-1/+1
| | | | | | | | | | Using generic io.h will narrow down code duplication in architecture io.h. - define PCI_IOBASE - remove non existing pci_io_base extern Signed-off-by: Michal Simek <michal.simek@xilinx.com>
* Merge branch 'next' of git://git.monstr.eu/linux-2.6-microblazeLinus Torvalds2013-02-261-3/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pull microblaze update from Michal Simek: "Microblaze changes. After my discussion with Arnd I have also added there asm-generic io patch which is Acked by him and Geert." * 'next' of git://git.monstr.eu/linux-2.6-microblaze: asm-generic: io: Fix ioread16/32be and iowrite16/32be microblaze: Do not use module.h in files which are not modules microblaze: Fix coding style issues microblaze: Add missing return from debugfs_tlb microblaze: Makefile clean microblaze: Add .gitignore entries for auto-generated files microblaze: Fix strncpy_from_user macro
| * microblaze: Fix coding style issuesMichal Simek2013-02-121-3/+3
| | | | | | | | | | | | Fix coding style issues reported by checkpatch.pl. Signed-off-by: Michal Simek <monstr@monstr.eu>
* | microblaze: evict the check for kernel_mode(regs) from do_notify_resume()Al Viro2013-02-031-9/+0
| | | | | | | | | | | | | | | | | | Only one caller hasn't done it in assembler - work_pending on !MMU. Everything else can't reach do_notify_resume() if we are returning to kernel mode, so move that check to that sole caller and make do_notify_resume() reachable only when returning to userland. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | microblaze: switch to generic sigaltstackAl Viro2013-02-031-15/+2
|/ | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* microblaze: signal: Declare do_notify_resumeMichal Simek2012-12-131-1/+1
| | | | | | | | | | Fix sparse warning by declaration do_notify_resume function called from entry.S. Warning: arch/microblaze/kernel/signal.c:357:6: warning: symbol 'do_notify_resume' was not declared. Should it be static? Signed-off-by: Michal Simek <michal.simek@xilinx.com>
* microblaze: rt_sigreturn is too trigger-happy about sigaltstack errorsAl Viro2012-11-281-1/+1
| | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* Merge branch 'for-linus' of ↵Linus Torvalds2012-10-121-5/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal Pull pile 2 of execve and kernel_thread unification work from Al Viro: "Stuff in there: kernel_thread/kernel_execve/sys_execve conversions for several more architectures plus assorted signal fixes and cleanups. There'll be more (in particular, real fixes for the alpha do_notify_resume() irq mess)..." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal: (43 commits) alpha: don't open-code trace_report_syscall_{enter,exit} Uninclude linux/freezer.h m32r: trim masks avr32: trim masks tile: don't bother with SIGTRAP in setup_frame microblaze: don't bother with SIGTRAP in setup_rt_frame() mn10300: don't bother with SIGTRAP in setup_frame() frv: no need to raise SIGTRAP in setup_frame() x86: get rid of duplicate code in case of CONFIG_VM86 unicore32: remove pointless test h8300: trim _TIF_WORK_MASK parisc: decide whether to go to slow path (tracesys) based on thread flags parisc: don't bother looping in do_signal() parisc: fix double restarts bury the rest of TIF_IRET sanitize tsk_is_polling() bury _TIF_RESTORE_SIGMASK unicore32: unobfuscate _TIF_WORK_MASK mips: NOTIFY_RESUME is not needed in TIF masks mips: merge the identical "return from syscall" per-ABI code ... Conflicts: arch/arm/include/asm/thread_info.h
| * microblaze: don't bother with SIGTRAP in setup_rt_frame()Al Viro2012-10-011-5/+2
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | Revert "microblaze_mmu_v2: Update signal returning address"Michal Simek2012-10-041-8/+0
|/ | | | | | | | | | | | This reverts commit 8b28626a6b1522b39f75d0bf80d5dec23c931f5a. Offset -8 is wrong because when it is applied then one instruction before brki r14, 8 is called again when we return. Offset -4 is correct and brki instruction is called again. This change came from ancient MMU kernel. Signed-off-by: Michal Simek <monstr@monstr.eu>
* new helper: signal_delivered()Al Viro2012-06-011-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>
* most of set_current_blocked() callers want SIGKILL/SIGSTOP removed from setAl Viro2012-06-011-3/+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>
* pull clearing RESTORE_SIGMASK into block_sigmask()Al Viro2012-06-011-14/+3
| | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* new helper: sigmask_to_save()Al Viro2012-06-011-7/+2
| | | | | | | 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>
* new helper: restore_saved_sigmask()Al Viro2012-06-011-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>
* move key_repace_session_keyring() into tracehook_notify_resume()Al Viro2012-05-231-4/+1
| | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* microblaze: drop 'oldset' argument of do_notify_resume()Al Viro2012-05-211-8/+6
| | | | | | never used... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* microblaze: handle TIF_NOTIFY_RESUMEAl Viro2012-05-211-11/+23
| | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* microblaze: ->restart_block.fn needs to be reset on rt_sigreturnAl Viro2012-05-211-0/+3
| | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* microblaze: use set_current_blocked() and block_sigmask()Matt Fleming2012-05-211-10/+2
| | | | | | | | | | | | | | | | | | | | 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> Acked-by: Michal Simek <monstr@monstr.eu> 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>
* microblaze: fix signal maskingMatt Fleming2012-05-211-13/+18
| | | | | | | | | | | | | | | | | | There are a couple of problems with the current signal code, 1. If we failed to setup the signal stack frame then we should not be masking any signals. 2. ka->sa.sa_mask is only added to the current blocked signals list if SA_NODEFER is set in ka->sa.sa_flags. If we successfully setup the signal frame and are going to run the handler then we must honour sa_mask. Acked-by: Oleg Nesterov <oleg@redhat.com> Acked-by: Michal Simek <monstr@monstr.eu> 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>
* microblaze: no need to reset handler if SA_ONESHOTMatt Fleming2012-05-211-3/+0
| | | | | | | | | | | | | | 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> Acked-by: Michal Simek <monstr@monstr.eu> 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>
* microblaze: don't reimplement force_sigsegv()Matt Fleming2012-05-211-3/+1
| | | | | | | | | | | | | | | | 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> Acked-by: Michal Simek <monstr@monstr.eu> 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>
* microblaze: Fix sparse warnings - signal.cMichal Simek2011-03-091-2/+2
| | | | | | | | | | | Warning log: CHECK arch/microblaze/kernel/signal.c arch/microblaze/kernel/signal.c:200:9: warning: Using plain integer as NULL pointer arch/microblaze/kernel/signal.c:201:9: warning: incorrect type in initializer (different address spaces) arch/microblaze/kernel/signal.c:201:9: expected void [noderef] *volatile __gu_val<asn:1> arch/microblaze/kernel/signal.c:201:9: got void *<noident> Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Remove r0_ram pointer and PTO alignmentMichal Simek2011-03-091-2/+2
| | | | | | | | | | | | | | r0_ram pool was used for saving/restoring register content if hw exception happen. This poll was replaced by pt_pool_space with PT_SIZE size. Based on this change SAVE_STATE_ARG_SPACE was removed which caused that PTO offset is zero that's why is also removed. r0_ram space was used as scratchpad by v850. In early Microblaze Linux developing phase was this part of code blindly copied. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Remove rt_sigsuspend wrapperMichal Simek2009-12-141-1/+0
| | | | | | Generic rt_sigsuspend syscalls doesn't need any asm wrapper. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Support for WB cacheMichal Simek2009-12-141-2/+28
| | | | | | | | | | | Microblaze version 7.20.d is the first MB version which can be run on MMU linux. Please do not used previous version because they contain HW bug. Based on WB support was necessary to redesign whole cache design. Microblaze versions from 7.20.a don't need to disable IRQ and cache before working with them that's why there are special structures for it. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Ptrace notifying from signal codeMichal Simek2009-12-141-0/+4
| | | | | | | | | After the signal frame is set up on the userspace stack, ptrace() should be given an opportunity to single-step into the signal handler FRV, Blackfin, mn10300 and UM. Worth to look at that patches. Signed-off-by: Michal Simek <monstr@monstr.eu>
* headers: smp_lock.h reduxAlexey Dobriyan2009-07-121-1/+0
| | | | | | | | | | | | | * Remove smp_lock.h from files which don't need it (including some headers!) * Add smp_lock.h to files which do need it * Make smp_lock.h include conditional in hardirq.h It's needed only for one kernel_locked() usage which is under CONFIG_PREEMPT This will make hardirq.h inclusion cheaper for every PREEMPT=n config (which includes allmodconfig/allyesconfig, BTW) Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* microblaze: use generic syscalls.hArnd Bergmann2009-07-061-1/+1
| | | | | | | | | The prototypes in syscalls.h all make sense for microblaze, but for some of them, the actual implementation in sys_microblaze.c needs to be adapted. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: clean up signal handlingArnd Bergmann2009-07-061-136/+36
| | | | | | | | | | | | | | | When legacy signal handling is disabled, the arch/microblaze/kernel/signal.c implementation can be much simpler, as most of it is handled generically from kernel/signal.c. This is also a prerequisite for using the generic asm/unistd.h, which does not provide __NR_sigreturn, because this macro is referenced by the current signal.c implementation. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze_mmu_v2: Update signal returning addressMichal Simek2009-05-261-0/+8
| | | | Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: prepare signal handling for generic unistd.hMichal Simek2009-05-211-76/+3
| | | | | | | | | We need to define set_restore_sigmask() in order to get pselect and ppoll. Also, the setup_frame function can not be used when __NR_sigreturn is not defined. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: fix __user annotationsArnd Bergmann2009-05-211-12/+10
| | | | | | | | | | | | The microblaze signal handling code gets some __user pointers wrong, as shown by sparse. This adds the annotations where appropriate and change sys_rt_sigreturn to correctly pass a user stack down to do_sigaltstack instead of a kernel structure. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: Add STATE_SAVE_ARG_SPACE for noMMU kernel tooMichal Simek2009-04-231-4/+10
| | | | | | | For noMMU kernel this change nothing bring but this change helps with MMU synchronization. Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze: remove duplicated #include'sHuang Weiyi2009-04-141-1/+0
| | | | | | | | | | | | Remove duplicated #include's in arch/microblaze/include/asm/io.h arch/microblaze/kernel/prom.c arch/microblaze/kernel/ptrace.c arch/microblaze/kernel/signal.c arch/microblaze/kernel/sys_microblaze.c Signed-off-by: Huang Weiyi <weiyi.huang@gmail.com> Signed-off-by: Michal Simek <monstr@monstr.eu>
* microblaze_v8: Signal supportMichal Simek2009-03-271-0/+538
Reviewed-by: Ingo Molnar <mingo@elte.hu> Acked-by: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com> Acked-by: John Linn <john.linn@xilinx.com> Acked-by: John Williams <john.williams@petalogix.com> Signed-off-by: Michal Simek <monstr@monstr.eu>
OpenPOWER on IntegriCloud