summaryrefslogtreecommitdiffstats
path: root/arch/sh/include/asm/syscalls_32.h
Commit message (Collapse)AuthorAgeFilesLines
* sh: push extra copy of r0-r2 for syscall parametersBobby Bingham2014-04-031-9/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When invoking syscall handlers on sh32, the saved userspace registers are at the top of the stack. This seems to have been intentional, as it is an easy way to pass r0, r1, ... to the handler as parameters 5, 6, ... It causes problems, however, because the compiler is allowed to generate code for a function which clobbers that function's own parameters. For example, gcc generates the following code for clone: <SyS_clone>: mov.l 8c020714 <SyS_clone+0xc>,r1 ! 8c020540 <do_fork> mov.l r7,@r15 mov r6,r7 jmp @r1 mov #0,r6 nop .word 0x0540 .word 0x8c02 The `mov.l r7,@r15` clobbers the saved value of r0 passed from userspace. For most system calls, this might not be a problem, because we'll be overwriting r0 with the return value anyway. But in the case of clone, copy_thread will need the original value of r0 if the CLONE_SETTLS flag was specified. The first patch in this series fixes this issue for system calls by pushing to the stack and extra copy of r0-r2 before invoking the handler. We discard this copy before restoring the userspace registers, so it is not a problem if they are clobbered. Exception handlers also receive the userspace register values in a similar manner, and may hit the same problem. The second patch removes the do_fpu_error handler, which looks susceptible to this problem and which, as far as I can tell, has not been used in some time. The third patch addresses other exception handlers. This patch (of 3): The userspace registers are stored at the top of the stack when the syscall handler is invoked, which allows r0-r2 to act as parameters 5-7. Parameters passed on the stack may be clobbered by the syscall handler. The solution is to push an extra copy of the registers which might be used as syscall parameters to the stack, so that the authoritative set of saved register values does not get clobbered. A few system call handlers are also updated to get the userspace registers using current_pt_regs() instead of from the stack. Signed-off-by: Bobby Bingham <koorogi@koorogi.info> Cc: Paul Mundt <paul.mundt@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* sh: switch to generic old sigaction()Al Viro2013-02-031-2/+0
| | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* sh: switch to generic old sigsuspend()Al Viro2013-02-031-1/+0
| | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* sh: switch to generic sigaltstackAl Viro2013-02-031-3/+0
| | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* sh: switch to generic fork/vfork/cloneAl Viro2012-11-281-10/+0
| | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* sh: convert to generic sys_execve()Al Viro2012-10-221-4/+0
| | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* sh: switch to saved_sigmask-based sigsuspend()/rt_sigsuspend()Al Viro2012-05-211-3/+1
| | | | | | | | | Complete the move of sh64 to it, trim the crap from prototypes, tidy up a bit. Infrastructure in do_signal() had already been there, in signal_64 as well as in signal_32 (where it was already used). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* SH: Add missing consts to sys_execve() declarationDavid Howells2010-10-071-3/+4
| | | | | | | | | | Add missing consts to the sys_execve() declaration which result in the following error: arch/sh/kernel/process_32.c:303: error: conflicting types for 'sys_execve' /warthog/nfs/linux-2.6-fscache/arch/sh/include/asm/syscalls_32.h:24: error: previous declaration of 'sys_execve' was here Signed-off-by: David Howells <dhowells@redhat.com>
* Mark arguments to certain syscalls as being constDavid Howells2010-08-131-1/+1
| | | | | | | | | | | | | | | | Mark arguments to certain system calls as being const where they should be but aren't. The list includes: (*) The filename arguments of various stat syscalls, execve(), various utimes syscalls and some mount syscalls. (*) The filename arguments of some syscall helpers relating to the above. (*) The buffer argument of various write syscalls. Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* [CVE-2009-0029] Remove __attribute__((weak)) from sys_pipe/sys_pipe2Heiko Carstens2009-01-141-3/+3
| | | | | | | | | | | | | Remove __attribute__((weak)) from common code sys_pipe implemantation. IA64, ALPHA, SUPERH (32bit) and SPARC (32bit) have own implemantations with the same name. Just rename them. For sys_pipe2 there is no architecture specific implementation. Cc: Richard Henderson <rth@twiddle.net> Cc: David S. Miller <davem@davemloft.net> Cc: Paul Mundt <lethal@linux-sh.org> Cc: Tony Luck <tony.luck@intel.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
* sh: fixup many sparse errors.Paul Mundt2008-09-081-0/+56
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
OpenPOWER on IntegriCloud