xref: /openbmc/linux/arch/x86/um/syscalls_32.c (revision 05bcf503)
1 /*
2  * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com)
3  * Licensed under the GPL
4  */
5 
6 #include <linux/syscalls.h>
7 #include <sysdep/syscalls.h>
8 
9 /*
10  * The prototype on i386 is:
11  *
12  *     int clone(int flags, void * child_stack, int * parent_tidptr, struct user_desc * newtls
13  *
14  * and the "newtls" arg. on i386 is read by copy_thread directly from the
15  * register saved on the stack.
16  */
17 long i386_clone(unsigned long clone_flags, unsigned long newsp,
18 		int __user *parent_tid, void *newtls, int __user *child_tid)
19 {
20 	return sys_clone(clone_flags, newsp, parent_tid, child_tid);
21 }
22 
23 
24 long sys_sigaction(int sig, const struct old_sigaction __user *act,
25 			 struct old_sigaction __user *oact)
26 {
27 	struct k_sigaction new_ka, old_ka;
28 	int ret;
29 
30 	if (act) {
31 		old_sigset_t mask;
32 		if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
33 		    __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
34 		    __get_user(new_ka.sa.sa_restorer, &act->sa_restorer) ||
35 		    __get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
36 		    __get_user(mask, &act->sa_mask))
37 			return -EFAULT;
38 		siginitset(&new_ka.sa.sa_mask, mask);
39 	}
40 
41 	ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
42 
43 	if (!ret && oact) {
44 		if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
45 		    __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
46 		    __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer) ||
47 		    __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
48 		    __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
49 			return -EFAULT;
50 	}
51 
52 	return ret;
53 }
54