aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-04-03 00:22:12 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-04-03 00:22:12 -0400
commit642e7fd23353e22290e3d51719fcb658dc252342 (patch)
tree93688d5ff15836d8e5b0e097748f7fabb13a303a
parent21035965f60b0502fc6537b232839389bb4ce664 (diff)
parentc9a211951c7c79cfb5de888d7d9550872868b086 (diff)
Merge branch 'syscalls-next' of git://git.kernel.org/pub/scm/linux/kernel/git/brodo/linux
Pull removal of in-kernel calls to syscalls from Dominik Brodowski: "System calls are interaction points between userspace and the kernel. Therefore, system call functions such as sys_xyzzy() or compat_sys_xyzzy() should only be called from userspace via the syscall table, but not from elsewhere in the kernel. At least on 64-bit x86, it will likely be a hard requirement from v4.17 onwards to not call system call functions in the kernel: It is better to use use a different calling convention for system calls there, where struct pt_regs is decoded on-the-fly in a syscall wrapper which then hands processing over to the actual syscall function. This means that only those parameters which are actually needed for a specific syscall are passed on during syscall entry, instead of filling in six CPU registers with random user space content all the time (which may cause serious trouble down the call chain). Those x86-specific patches will be pushed through the x86 tree in the near future. Moreover, rules on how data may be accessed may differ between kernel data and user data. This is another reason why calling sys_xyzzy() is generally a bad idea, and -- at most -- acceptable in arch-specific code. This patchset removes all in-kernel calls to syscall functions in the kernel with the exception of arch/. On top of this, it cleans up the three places where many syscalls are referenced or prototyped, namely kernel/sys_ni.c, include/linux/syscalls.h and include/linux/compat.h" * 'syscalls-next' of git://git.kernel.org/pub/scm/linux/kernel/git/brodo/linux: (109 commits) bpf: whitelist all syscalls for error injection kernel/sys_ni: remove {sys_,sys_compat} from cond_syscall definitions kernel/sys_ni: sort cond_syscall() entries syscalls/x86: auto-create compat_sys_*() prototypes syscalls: sort syscall prototypes in include/linux/compat.h net: remove compat_sys_*() prototypes from net/compat.h syscalls: sort syscall prototypes in include/linux/syscalls.h kexec: move sys_kexec_load() prototype to syscalls.h x86/sigreturn: use SYSCALL_DEFINE0 x86: fix sys_sigreturn() return type to be long, not unsigned long x86/ioport: add ksys_ioperm() helper; remove in-kernel calls to sys_ioperm() mm: add ksys_readahead() helper; remove in-kernel calls to sys_readahead() mm: add ksys_mmap_pgoff() helper; remove in-kernel calls to sys_mmap_pgoff() mm: add ksys_fadvise64_64() helper; remove in-kernel call to sys_fadvise64_64() fs: add ksys_fallocate() wrapper; remove in-kernel calls to sys_fallocate() fs: add ksys_p{read,write}64() helpers; remove in-kernel calls to syscalls fs: add ksys_truncate() wrapper; remove in-kernel calls to sys_truncate() fs: add ksys_sync_file_range helper(); remove in-kernel calls to syscall kernel: add ksys_setsid() helper; remove in-kernel call to sys_setsid() kernel: add ksys_unshare() helper; remove in-kernel calls to sys_unshare() ...
-rw-r--r--Documentation/process/adding-syscalls.rst34
-rw-r--r--arch/alpha/kernel/osf_sys.c2
-rw-r--r--arch/arm/kernel/sys_arm.c2
-rw-r--r--arch/arm64/kernel/sys.c2
-rw-r--r--arch/ia64/kernel/sys_ia64.c4
-rw-r--r--arch/m68k/kernel/sys_m68k.c2
-rw-r--r--arch/microblaze/kernel/sys_microblaze.c6
-rw-r--r--arch/mips/kernel/linux32.c22
-rw-r--r--arch/mips/kernel/syscall.c6
-rw-r--r--arch/parisc/kernel/sys_parisc.c30
-rw-r--r--arch/powerpc/kernel/sys_ppc32.c18
-rw-r--r--arch/powerpc/kernel/syscalls.c6
-rw-r--r--arch/riscv/kernel/sys_riscv.c4
-rw-r--r--arch/s390/kernel/compat_linux.c37
-rw-r--r--arch/s390/kernel/sys_s390.c2
-rw-r--r--arch/sh/kernel/sys_sh.c4
-rw-r--r--arch/sh/kernel/sys_sh32.c12
-rw-r--r--arch/sparc/kernel/setup_32.c2
-rw-r--r--arch/sparc/kernel/sys_sparc32.c26
-rw-r--r--arch/sparc/kernel/sys_sparc_32.c6
-rw-r--r--arch/sparc/kernel/sys_sparc_64.c2
-rw-r--r--arch/um/kernel/syscall.c2
-rw-r--r--arch/x86/entry/syscalls/syscall_32.tbl4
-rw-r--r--arch/x86/ia32/ia32_signal.c1
-rw-r--r--arch/x86/ia32/sys_ia32.c50
-rw-r--r--arch/x86/include/asm/sys_ia32.h67
-rw-r--r--arch/x86/include/asm/syscalls.h3
-rw-r--r--arch/x86/kernel/ioport.c7
-rw-r--r--arch/x86/kernel/signal.c5
-rw-r--r--arch/x86/kernel/sys_x86_64.c2
-rw-r--r--arch/xtensa/kernel/syscall.c2
-rw-r--r--drivers/base/devtmpfs.c11
-rw-r--r--drivers/tty/sysrq.c2
-rw-r--r--drivers/tty/vt/vt_ioctl.c6
-rw-r--r--fs/autofs4/dev-ioctl.c2
-rw-r--r--fs/binfmt_misc.c2
-rw-r--r--fs/dcookies.c11
-rw-r--r--fs/eventfd.c9
-rw-r--r--fs/eventpoll.c23
-rw-r--r--fs/fcntl.c12
-rw-r--r--fs/file.c17
-rw-r--r--fs/hostfs/hostfs.h2
-rw-r--r--fs/hostfs/hostfs_kern.c2
-rw-r--r--fs/hostfs/hostfs_user.c2
-rw-r--r--fs/internal.h14
-rw-r--r--fs/ioctl.c7
-rw-r--r--fs/namei.c61
-rw-r--r--fs/namespace.c19
-rw-r--r--fs/notify/fanotify/fanotify_user.c14
-rw-r--r--fs/notify/inotify/inotify_user.c9
-rw-r--r--fs/open.c77
-rw-r--r--fs/pipe.c9
-rw-r--r--fs/quota/compat.c13
-rw-r--r--fs/quota/quota.c10
-rw-r--r--fs/read_write.c45
-rw-r--r--fs/readdir.c11
-rw-r--r--fs/select.c29
-rw-r--r--fs/signalfd.c31
-rw-r--r--fs/splice.c12
-rw-r--r--fs/stat.c12
-rw-r--r--fs/sync.c19
-rw-r--r--fs/utimes.c25
-rw-r--r--include/linux/compat.h644
-rw-r--r--include/linux/futex.h13
-rw-r--r--include/linux/kexec.h4
-rw-r--r--include/linux/quotaops.h3
-rw-r--r--include/linux/socket.h37
-rw-r--r--include/linux/syscalls.h1369
-rw-r--r--include/net/compat.h11
-rw-r--r--init/do_mounts.c26
-rw-r--r--init/do_mounts.h4
-rw-r--r--init/do_mounts_initrd.c42
-rw-r--r--init/do_mounts_md.c29
-rw-r--r--init/do_mounts_rd.c40
-rw-r--r--init/initramfs.c52
-rw-r--r--init/main.c9
-rw-r--r--init/noinitramfs.c6
-rw-r--r--ipc/msg.c60
-rw-r--r--ipc/sem.c44
-rw-r--r--ipc/shm.c28
-rw-r--r--ipc/syscall.c58
-rw-r--r--ipc/util.h31
-rw-r--r--kernel/compat.c55
-rw-r--r--kernel/exit.c2
-rw-r--r--kernel/fork.c11
-rw-r--r--kernel/kexec.c52
-rw-r--r--kernel/pid_namespace.c6
-rw-r--r--kernel/power/hibernate.c2
-rw-r--r--kernel/power/suspend.c2
-rw-r--r--kernel/power/user.c2
-rw-r--r--kernel/sched/core.c8
-rw-r--r--kernel/signal.c29
-rw-r--r--kernel/sys.c74
-rw-r--r--kernel/sys_ni.c617
-rw-r--r--kernel/uid16.c25
-rw-r--r--kernel/uid16.h14
-rw-r--r--kernel/umh.c4
-rw-r--r--mm/fadvise.c10
-rw-r--r--mm/mempolicy.c92
-rw-r--r--mm/migrate.c39
-rw-r--r--mm/mmap.c17
-rw-r--r--mm/nommu.c17
-rw-r--r--mm/readahead.c7
-rw-r--r--net/compat.c136
-rw-r--r--net/socket.c234
105 files changed, 3058 insertions, 1797 deletions
diff --git a/Documentation/process/adding-syscalls.rst b/Documentation/process/adding-syscalls.rst
index 8cc25a06f353..314c8bf6f2a2 100644
--- a/Documentation/process/adding-syscalls.rst
+++ b/Documentation/process/adding-syscalls.rst
@@ -222,7 +222,7 @@ your new syscall number may get adjusted to resolve conflicts.
222The file ``kernel/sys_ni.c`` provides a fallback stub implementation of each 222The file ``kernel/sys_ni.c`` provides a fallback stub implementation of each
223system call, returning ``-ENOSYS``. Add your new system call here too:: 223system call, returning ``-ENOSYS``. Add your new system call here too::
224 224
225 cond_syscall(sys_xyzzy); 225 COND_SYSCALL(xyzzy);
226 226
227Your new kernel functionality, and the system call that controls it, should 227Your new kernel functionality, and the system call that controls it, should
228normally be optional, so add a ``CONFIG`` option (typically to 228normally be optional, so add a ``CONFIG`` option (typically to
@@ -487,6 +487,38 @@ patchset, for the convenience of reviewers.
487The man page should be cc'ed to linux-man@vger.kernel.org 487The man page should be cc'ed to linux-man@vger.kernel.org
488For more details, see https://www.kernel.org/doc/man-pages/patches.html 488For more details, see https://www.kernel.org/doc/man-pages/patches.html
489 489
490
491Do not call System Calls in the Kernel
492--------------------------------------
493
494System calls are, as stated above, interaction points between userspace and
495the kernel. Therefore, system call functions such as ``sys_xyzzy()`` or
496``compat_sys_xyzzy()`` should only be called from userspace via the syscall
497table, but not from elsewhere in the kernel. If the syscall functionality is
498useful to be used within the kernel, needs to be shared between an old and a
499new syscall, or needs to be shared between a syscall and its compatibility
500variant, it should be implemented by means of a "helper" function (such as
501``kern_xyzzy()``). This kernel function may then be called within the
502syscall stub (``sys_xyzzy()``), the compatibility syscall stub
503(``compat_sys_xyzzy()``), and/or other kernel code.
504
505At least on 64-bit x86, it will be a hard requirement from v4.17 onwards to not
506call system call functions in the kernel. It uses a different calling
507convention for system calls where ``struct pt_regs`` is decoded on-the-fly in a
508syscall wrapper which then hands processing over to the actual syscall function.
509This means that only those parameters which are actually needed for a specific
510syscall are passed on during syscall entry, instead of filling in six CPU
511registers with random user space content all the time (which may cause serious
512trouble down the call chain).
513
514Moreover, rules on how data may be accessed may differ between kernel data and
515user data. This is another reason why calling ``sys_xyzzy()`` is generally a
516bad idea.
517
518Exceptions to this rule are only allowed in architecture-specific overrides,
519architecture-specific compatibility wrappers, or other code in arch/.
520
521
490References and Sources 522References and Sources
491---------------------- 523----------------------
492 524
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index fa1a392ca9a2..89faa6f4de47 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -189,7 +189,7 @@ SYSCALL_DEFINE6(osf_mmap, unsigned long, addr, unsigned long, len,
189 goto out; 189 goto out;
190 if (off & ~PAGE_MASK) 190 if (off & ~PAGE_MASK)
191 goto out; 191 goto out;
192 ret = sys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT); 192 ret = ksys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
193 out: 193 out:
194 return ret; 194 return ret;
195} 195}
diff --git a/arch/arm/kernel/sys_arm.c b/arch/arm/kernel/sys_arm.c
index 3151f5623d0e..bdf7514204ab 100644
--- a/arch/arm/kernel/sys_arm.c
+++ b/arch/arm/kernel/sys_arm.c
@@ -35,5 +35,5 @@
35asmlinkage long sys_arm_fadvise64_64(int fd, int advice, 35asmlinkage long sys_arm_fadvise64_64(int fd, int advice,
36 loff_t offset, loff_t len) 36 loff_t offset, loff_t len)
37{ 37{
38 return sys_fadvise64_64(fd, offset, len, advice); 38 return ksys_fadvise64_64(fd, offset, len, advice);
39} 39}
diff --git a/arch/arm64/kernel/sys.c b/arch/arm64/kernel/sys.c
index 26fe8ea93ea2..72981bae10eb 100644
--- a/arch/arm64/kernel/sys.c
+++ b/arch/arm64/kernel/sys.c
@@ -34,7 +34,7 @@ asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
34 if (offset_in_page(off) != 0) 34 if (offset_in_page(off) != 0)
35 return -EINVAL; 35 return -EINVAL;
36 36
37 return sys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT); 37 return ksys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
38} 38}
39 39
40SYSCALL_DEFINE1(arm64_personality, unsigned int, personality) 40SYSCALL_DEFINE1(arm64_personality, unsigned int, personality)
diff --git a/arch/ia64/kernel/sys_ia64.c b/arch/ia64/kernel/sys_ia64.c
index 085adfcc74a4..9ebe1d633abc 100644
--- a/arch/ia64/kernel/sys_ia64.c
+++ b/arch/ia64/kernel/sys_ia64.c
@@ -139,7 +139,7 @@ int ia64_mmap_check(unsigned long addr, unsigned long len,
139asmlinkage unsigned long 139asmlinkage unsigned long
140sys_mmap2 (unsigned long addr, unsigned long len, int prot, int flags, int fd, long pgoff) 140sys_mmap2 (unsigned long addr, unsigned long len, int prot, int flags, int fd, long pgoff)
141{ 141{
142 addr = sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff); 142 addr = ksys_mmap_pgoff(addr, len, prot, flags, fd, pgoff);
143 if (!IS_ERR((void *) addr)) 143 if (!IS_ERR((void *) addr))
144 force_successful_syscall_return(); 144 force_successful_syscall_return();
145 return addr; 145 return addr;
@@ -151,7 +151,7 @@ sys_mmap (unsigned long addr, unsigned long len, int prot, int flags, int fd, lo
151 if (offset_in_page(off) != 0) 151 if (offset_in_page(off) != 0)
152 return -EINVAL; 152 return -EINVAL;
153 153
154 addr = sys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT); 154 addr = ksys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
155 if (!IS_ERR((void *) addr)) 155 if (!IS_ERR((void *) addr))
156 force_successful_syscall_return(); 156 force_successful_syscall_return();
157 return addr; 157 return addr;
diff --git a/arch/m68k/kernel/sys_m68k.c b/arch/m68k/kernel/sys_m68k.c
index 27e10af5153a..6363ec83a290 100644
--- a/arch/m68k/kernel/sys_m68k.c
+++ b/arch/m68k/kernel/sys_m68k.c
@@ -46,7 +46,7 @@ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
46 * so we need to shift the argument down by 1; m68k mmap64(3) 46 * so we need to shift the argument down by 1; m68k mmap64(3)
47 * (in libc) expects the last argument of mmap2 in 4Kb units. 47 * (in libc) expects the last argument of mmap2 in 4Kb units.
48 */ 48 */
49 return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff); 49 return ksys_mmap_pgoff(addr, len, prot, flags, fd, pgoff);
50} 50}
51 51
52/* Convert virtual (user) address VADDR to physical address PADDR */ 52/* Convert virtual (user) address VADDR to physical address PADDR */
diff --git a/arch/microblaze/kernel/sys_microblaze.c b/arch/microblaze/kernel/sys_microblaze.c
index f1e1f666ddde..ed9f34da1a2a 100644
--- a/arch/microblaze/kernel/sys_microblaze.c
+++ b/arch/microblaze/kernel/sys_microblaze.c
@@ -40,7 +40,7 @@ SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len,
40 if (pgoff & ~PAGE_MASK) 40 if (pgoff & ~PAGE_MASK)
41 return -EINVAL; 41 return -EINVAL;
42 42
43 return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff >> PAGE_SHIFT); 43 return ksys_mmap_pgoff(addr, len, prot, flags, fd, pgoff >> PAGE_SHIFT);
44} 44}
45 45
46SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len, 46SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len,
@@ -50,6 +50,6 @@ SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len,
50 if (pgoff & (~PAGE_MASK >> 12)) 50 if (pgoff & (~PAGE_MASK >> 12))
51 return -EINVAL; 51 return -EINVAL;
52 52
53 return sys_mmap_pgoff(addr, len, prot, flags, fd, 53 return ksys_mmap_pgoff(addr, len, prot, flags, fd,
54 pgoff >> (PAGE_SHIFT - 12)); 54 pgoff >> (PAGE_SHIFT - 12));
55} 55}
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index b332f6fc1e72..318f1c05c5b3 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -67,8 +67,8 @@ SYSCALL_DEFINE6(32_mmap2, unsigned long, addr, unsigned long, len,
67{ 67{
68 if (pgoff & (~PAGE_MASK >> 12)) 68 if (pgoff & (~PAGE_MASK >> 12))
69 return -EINVAL; 69 return -EINVAL;
70 return sys_mmap_pgoff(addr, len, prot, flags, fd, 70 return ksys_mmap_pgoff(addr, len, prot, flags, fd,
71 pgoff >> (PAGE_SHIFT-12)); 71 pgoff >> (PAGE_SHIFT-12));
72} 72}
73 73
74#define RLIM_INFINITY32 0x7fffffff 74#define RLIM_INFINITY32 0x7fffffff
@@ -82,13 +82,13 @@ struct rlimit32 {
82SYSCALL_DEFINE4(32_truncate64, const char __user *, path, 82SYSCALL_DEFINE4(32_truncate64, const char __user *, path,
83 unsigned long, __dummy, unsigned long, a2, unsigned long, a3) 83 unsigned long, __dummy, unsigned long, a2, unsigned long, a3)
84{ 84{
85 return sys_truncate(path, merge_64(a2, a3)); 85 return ksys_truncate(path, merge_64(a2, a3));
86} 86}
87 87
88SYSCALL_DEFINE4(32_ftruncate64, unsigned long, fd, unsigned long, __dummy, 88SYSCALL_DEFINE4(32_ftruncate64, unsigned long, fd, unsigned long, __dummy,
89 unsigned long, a2, unsigned long, a3) 89 unsigned long, a2, unsigned long, a3)
90{ 90{
91 return sys_ftruncate(fd, merge_64(a2, a3)); 91 return ksys_ftruncate(fd, merge_64(a2, a3));
92} 92}
93 93
94SYSCALL_DEFINE5(32_llseek, unsigned int, fd, unsigned int, offset_high, 94SYSCALL_DEFINE5(32_llseek, unsigned int, fd, unsigned int, offset_high,
@@ -105,13 +105,13 @@ SYSCALL_DEFINE5(32_llseek, unsigned int, fd, unsigned int, offset_high,
105SYSCALL_DEFINE6(32_pread, unsigned long, fd, char __user *, buf, size_t, count, 105SYSCALL_DEFINE6(32_pread, unsigned long, fd, char __user *, buf, size_t, count,
106 unsigned long, unused, unsigned long, a4, unsigned long, a5) 106 unsigned long, unused, unsigned long, a4, unsigned long, a5)
107{ 107{
108 return sys_pread64(fd, buf, count, merge_64(a4, a5)); 108 return ksys_pread64(fd, buf, count, merge_64(a4, a5));
109} 109}
110 110
111SYSCALL_DEFINE6(32_pwrite, unsigned int, fd, const char __user *, buf, 111SYSCALL_DEFINE6(32_pwrite, unsigned int, fd, const char __user *, buf,
112 size_t, count, u32, unused, u64, a4, u64, a5) 112 size_t, count, u32, unused, u64, a4, u64, a5)
113{ 113{
114 return sys_pwrite64(fd, buf, count, merge_64(a4, a5)); 114 return ksys_pwrite64(fd, buf, count, merge_64(a4, a5));
115} 115}
116 116
117SYSCALL_DEFINE1(32_personality, unsigned long, personality) 117SYSCALL_DEFINE1(32_personality, unsigned long, personality)
@@ -131,7 +131,7 @@ SYSCALL_DEFINE1(32_personality, unsigned long, personality)
131asmlinkage ssize_t sys32_readahead(int fd, u32 pad0, u64 a2, u64 a3, 131asmlinkage ssize_t sys32_readahead(int fd, u32 pad0, u64 a2, u64 a3,
132 size_t count) 132 size_t count)
133{ 133{
134 return sys_readahead(fd, merge_64(a2, a3), count); 134 return ksys_readahead(fd, merge_64(a2, a3), count);
135} 135}
136 136
137asmlinkage long sys32_sync_file_range(int fd, int __pad, 137asmlinkage long sys32_sync_file_range(int fd, int __pad,
@@ -139,7 +139,7 @@ asmlinkage long sys32_sync_file_range(int fd, int __pad,
139 unsigned long a4, unsigned long a5, 139 unsigned long a4, unsigned long a5,
140 int flags) 140 int flags)
141{ 141{
142 return sys_sync_file_range(fd, 142 return ksys_sync_file_range(fd,
143 merge_64(a2, a3), merge_64(a4, a5), 143 merge_64(a2, a3), merge_64(a4, a5),
144 flags); 144 flags);
145} 145}
@@ -149,7 +149,7 @@ asmlinkage long sys32_fadvise64_64(int fd, int __pad,
149 unsigned long a4, unsigned long a5, 149 unsigned long a4, unsigned long a5,
150 int flags) 150 int flags)
151{ 151{
152 return sys_fadvise64_64(fd, 152 return ksys_fadvise64_64(fd,
153 merge_64(a2, a3), merge_64(a4, a5), 153 merge_64(a2, a3), merge_64(a4, a5),
154 flags); 154 flags);
155} 155}
@@ -157,6 +157,6 @@ asmlinkage long sys32_fadvise64_64(int fd, int __pad,
157asmlinkage long sys32_fallocate(int fd, int mode, unsigned offset_a2, 157asmlinkage long sys32_fallocate(int fd, int mode, unsigned offset_a2,
158 unsigned offset_a3, unsigned len_a4, unsigned len_a5) 158 unsigned offset_a3, unsigned len_a4, unsigned len_a5)
159{ 159{
160 return sys_fallocate(fd, mode, merge_64(offset_a2, offset_a3), 160 return ksys_fallocate(fd, mode, merge_64(offset_a2, offset_a3),
161 merge_64(len_a4, len_a5)); 161 merge_64(len_a4, len_a5));
162} 162}
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index 58c6f634b550..69c17b549fd3 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -63,7 +63,8 @@ SYSCALL_DEFINE6(mips_mmap, unsigned long, addr, unsigned long, len,
63{ 63{
64 if (offset & ~PAGE_MASK) 64 if (offset & ~PAGE_MASK)
65 return -EINVAL; 65 return -EINVAL;
66 return sys_mmap_pgoff(addr, len, prot, flags, fd, offset >> PAGE_SHIFT); 66 return ksys_mmap_pgoff(addr, len, prot, flags, fd,
67 offset >> PAGE_SHIFT);
67} 68}
68 69
69SYSCALL_DEFINE6(mips_mmap2, unsigned long, addr, unsigned long, len, 70SYSCALL_DEFINE6(mips_mmap2, unsigned long, addr, unsigned long, len,
@@ -73,7 +74,8 @@ SYSCALL_DEFINE6(mips_mmap2, unsigned long, addr, unsigned long, len,
73 if (pgoff & (~PAGE_MASK >> 12)) 74 if (pgoff & (~PAGE_MASK >> 12))
74 return -EINVAL; 75 return -EINVAL;
75 76
76 return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff >> (PAGE_SHIFT-12)); 77 return ksys_mmap_pgoff(addr, len, prot, flags, fd,
78 pgoff >> (PAGE_SHIFT - 12));
77} 79}
78 80
79save_static_function(sys_fork); 81save_static_function(sys_fork);
diff --git a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c
index 378a754ca186..8c99ebbe2bac 100644
--- a/arch/parisc/kernel/sys_parisc.c
+++ b/arch/parisc/kernel/sys_parisc.c
@@ -270,8 +270,8 @@ asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len,
270{ 270{
271 /* Make sure the shift for mmap2 is constant (12), no matter what PAGE_SIZE 271 /* Make sure the shift for mmap2 is constant (12), no matter what PAGE_SIZE
272 we have. */ 272 we have. */
273 return sys_mmap_pgoff(addr, len, prot, flags, fd, 273 return ksys_mmap_pgoff(addr, len, prot, flags, fd,
274 pgoff >> (PAGE_SHIFT - 12)); 274 pgoff >> (PAGE_SHIFT - 12));
275} 275}
276 276
277asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len, 277asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len,
@@ -279,7 +279,7 @@ asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len,
279 unsigned long offset) 279 unsigned long offset)
280{ 280{
281 if (!(offset & ~PAGE_MASK)) { 281 if (!(offset & ~PAGE_MASK)) {
282 return sys_mmap_pgoff(addr, len, prot, flags, fd, 282 return ksys_mmap_pgoff(addr, len, prot, flags, fd,
283 offset >> PAGE_SHIFT); 283 offset >> PAGE_SHIFT);
284 } else { 284 } else {
285 return -EINVAL; 285 return -EINVAL;
@@ -292,24 +292,24 @@ asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len,
292asmlinkage long parisc_truncate64(const char __user * path, 292asmlinkage long parisc_truncate64(const char __user * path,
293 unsigned int high, unsigned int low) 293 unsigned int high, unsigned int low)
294{ 294{
295 return sys_truncate(path, (long)high << 32 | low); 295 return ksys_truncate(path, (long)high << 32 | low);
296} 296}
297 297
298asmlinkage long parisc_ftruncate64(unsigned int fd, 298asmlinkage long parisc_ftruncate64(unsigned int fd,
299 unsigned int high, unsigned int low) 299 unsigned int high, unsigned int low)
300{ 300{
301 return sys_ftruncate(fd, (long)high << 32 | low); 301 return ksys_ftruncate(fd, (long)high << 32 | low);
302} 302}
303 303
304/* stubs for the benefit of the syscall_table since truncate64 and truncate 304/* stubs for the benefit of the syscall_table since truncate64 and truncate
305 * are identical on LP64 */ 305 * are identical on LP64 */
306asmlinkage long sys_truncate64(const char __user * path, unsigned long length) 306asmlinkage long sys_truncate64(const char __user * path, unsigned long length)
307{ 307{
308 return sys_truncate(path, length); 308 return ksys_truncate(path, length);
309} 309}
310asmlinkage long sys_ftruncate64(unsigned int fd, unsigned long length) 310asmlinkage long sys_ftruncate64(unsigned int fd, unsigned long length)
311{ 311{
312 return sys_ftruncate(fd, length); 312 return ksys_ftruncate(fd, length);
313} 313}
314asmlinkage long sys_fcntl64(unsigned int fd, unsigned int cmd, unsigned long arg) 314asmlinkage long sys_fcntl64(unsigned int fd, unsigned int cmd, unsigned long arg)
315{ 315{
@@ -320,7 +320,7 @@ asmlinkage long sys_fcntl64(unsigned int fd, unsigned int cmd, unsigned long arg
320asmlinkage long parisc_truncate64(const char __user * path, 320asmlinkage long parisc_truncate64(const char __user * path,
321 unsigned int high, unsigned int low) 321 unsigned int high, unsigned int low)
322{ 322{
323 return sys_truncate64(path, (loff_t)high << 32 | low); 323 return ksys_truncate(path, (loff_t)high << 32 | low);
324} 324}
325 325
326asmlinkage long parisc_ftruncate64(unsigned int fd, 326asmlinkage long parisc_ftruncate64(unsigned int fd,
@@ -333,26 +333,26 @@ asmlinkage long parisc_ftruncate64(unsigned int fd,
333asmlinkage ssize_t parisc_pread64(unsigned int fd, char __user *buf, size_t count, 333asmlinkage ssize_t parisc_pread64(unsigned int fd, char __user *buf, size_t count,
334 unsigned int high, unsigned int low) 334 unsigned int high, unsigned int low)
335{ 335{
336 return sys_pread64(fd, buf, count, (loff_t)high << 32 | low); 336 return ksys_pread64(fd, buf, count, (loff_t)high << 32 | low);
337} 337}
338 338
339asmlinkage ssize_t parisc_pwrite64(unsigned int fd, const char __user *buf, 339asmlinkage ssize_t parisc_pwrite64(unsigned int fd, const char __user *buf,
340 size_t count, unsigned int high, unsigned int low) 340 size_t count, unsigned int high, unsigned int low)
341{ 341{
342 return sys_pwrite64(fd, buf, count, (loff_t)high << 32 | low); 342 return ksys_pwrite64(fd, buf, count, (loff_t)high << 32 | low);
343} 343}
344 344
345asmlinkage ssize_t parisc_readahead(int fd, unsigned int high, unsigned int low, 345asmlinkage ssize_t parisc_readahead(int fd, unsigned int high, unsigned int low,
346 size_t count) 346 size_t count)
347{ 347{
348 return sys_readahead(fd, (loff_t)high << 32 | low, count); 348 return ksys_readahead(fd, (loff_t)high << 32 | low, count);
349} 349}
350 350
351asmlinkage long parisc_fadvise64_64(int fd, 351asmlinkage long parisc_fadvise64_64(int fd,
352 unsigned int high_off, unsigned int low_off, 352 unsigned int high_off, unsigned int low_off,
353 unsigned int high_len, unsigned int low_len, int advice) 353 unsigned int high_len, unsigned int low_len, int advice)
354{ 354{
355 return sys_fadvise64_64(fd, (loff_t)high_off << 32 | low_off, 355 return ksys_fadvise64_64(fd, (loff_t)high_off << 32 | low_off,
356 (loff_t)high_len << 32 | low_len, advice); 356 (loff_t)high_len << 32 | low_len, advice);
357} 357}
358 358
@@ -360,15 +360,15 @@ asmlinkage long parisc_sync_file_range(int fd,
360 u32 hi_off, u32 lo_off, u32 hi_nbytes, u32 lo_nbytes, 360 u32 hi_off, u32 lo_off, u32 hi_nbytes, u32 lo_nbytes,
361 unsigned int flags) 361 unsigned int flags)
362{ 362{
363 return sys_sync_file_range(fd, (loff_t)hi_off << 32 | lo_off, 363 return ksys_sync_file_range(fd, (loff_t)hi_off << 32 | lo_off,
364 (loff_t)hi_nbytes << 32 | lo_nbytes, flags); 364 (loff_t)hi_nbytes << 32 | lo_nbytes, flags);
365} 365}
366 366
367asmlinkage long parisc_fallocate(int fd, int mode, u32 offhi, u32 offlo, 367asmlinkage long parisc_fallocate(int fd, int mode, u32 offhi, u32 offlo,
368 u32 lenhi, u32 lenlo) 368 u32 lenhi, u32 lenlo)
369{ 369{
370 return sys_fallocate(fd, mode, ((u64)offhi << 32) | offlo, 370 return ksys_fallocate(fd, mode, ((u64)offhi << 32) | offlo,
371 ((u64)lenhi << 32) | lenlo); 371 ((u64)lenhi << 32) | lenlo);
372} 372}
373 373
374long parisc_personality(unsigned long personality) 374long parisc_personality(unsigned long personality)
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
index 15f216d022e2..c11c73373691 100644
--- a/arch/powerpc/kernel/sys_ppc32.c
+++ b/arch/powerpc/kernel/sys_ppc32.c
@@ -77,44 +77,44 @@ unsigned long compat_sys_mmap2(unsigned long addr, size_t len,
77compat_ssize_t compat_sys_pread64(unsigned int fd, char __user *ubuf, compat_size_t count, 77compat_ssize_t compat_sys_pread64(unsigned int fd, char __user *ubuf, compat_size_t count,
78 u32 reg6, u32 poshi, u32 poslo) 78 u32 reg6, u32 poshi, u32 poslo)
79{ 79{
80 return sys_pread64(fd, ubuf, count, ((loff_t)poshi << 32) | poslo); 80 return ksys_pread64(fd, ubuf, count, ((loff_t)poshi << 32) | poslo);
81} 81}
82 82
83compat_ssize_t compat_sys_pwrite64(unsigned int fd, const char __user *ubuf, compat_size_t count, 83compat_ssize_t compat_sys_pwrite64(unsigned int fd, const char __user *ubuf, compat_size_t count,
84 u32 reg6, u32 poshi, u32 poslo) 84 u32 reg6, u32 poshi, u32 poslo)
85{ 85{
86 return sys_pwrite64(fd, ubuf, count, ((loff_t)poshi << 32) | poslo); 86 return ksys_pwrite64(fd, ubuf, count, ((loff_t)poshi << 32) | poslo);
87} 87}
88 88
89compat_ssize_t compat_sys_readahead(int fd, u32 r4, u32 offhi, u32 offlo, u32 count) 89compat_ssize_t compat_sys_readahead(int fd, u32 r4, u32 offhi, u32 offlo, u32 count)
90{ 90{
91 return sys_readahead(fd, ((loff_t)offhi << 32) | offlo, count); 91 return ksys_readahead(fd, ((loff_t)offhi << 32) | offlo, count);
92} 92}
93 93
94asmlinkage int compat_sys_truncate64(const char __user * path, u32 reg4, 94asmlinkage int compat_sys_truncate64(const char __user * path, u32 reg4,
95 unsigned long high, unsigned long low) 95 unsigned long high, unsigned long low)
96{ 96{
97 return sys_truncate(path, (high << 32) | low); 97 return ksys_truncate(path, (high << 32) | low);
98} 98}
99 99
100asmlinkage long compat_sys_fallocate(int fd, int mode, u32 offhi, u32 offlo, 100asmlinkage long compat_sys_fallocate(int fd, int mode, u32 offhi, u32 offlo,
101 u32 lenhi, u32 lenlo) 101 u32 lenhi, u32 lenlo)
102{ 102{
103 return sys_fallocate(fd, mode, ((loff_t)offhi << 32) | offlo, 103 return ksys_fallocate(fd, mode, ((loff_t)offhi << 32) | offlo,
104 ((loff_t)lenhi << 32) | lenlo); 104 ((loff_t)lenhi << 32) | lenlo);
105} 105}
106 106
107asmlinkage int compat_sys_ftruncate64(unsigned int fd, u32 reg4, unsigned long high, 107asmlinkage int compat_sys_ftruncate64(unsigned int fd, u32 reg4, unsigned long high,
108 unsigned long low) 108 unsigned long low)
109{ 109{
110 return sys_ftruncate(fd, (high << 32) | low); 110 return ksys_ftruncate(fd, (high << 32) | low);
111} 111}
112 112
113long ppc32_fadvise64(int fd, u32 unused, u32 offset_high, u32 offset_low, 113long ppc32_fadvise64(int fd, u32 unused, u32 offset_high, u32 offset_low,
114 size_t len, int advice) 114 size_t len, int advice)
115{ 115{
116 return sys_fadvise64(fd, (u64)offset_high << 32 | offset_low, len, 116 return ksys_fadvise64_64(fd, (u64)offset_high << 32 | offset_low, len,
117 advice); 117 advice);
118} 118}
119 119
120asmlinkage long compat_sys_sync_file_range2(int fd, unsigned int flags, 120asmlinkage long compat_sys_sync_file_range2(int fd, unsigned int flags,
@@ -124,5 +124,5 @@ asmlinkage long compat_sys_sync_file_range2(int fd, unsigned int flags,
124 loff_t offset = ((loff_t)offset_hi << 32) | offset_lo; 124 loff_t offset = ((loff_t)offset_hi << 32) | offset_lo;
125 loff_t nbytes = ((loff_t)nbytes_hi << 32) | nbytes_lo; 125 loff_t nbytes = ((loff_t)nbytes_hi << 32) | nbytes_lo;
126 126
127 return sys_sync_file_range(fd, offset, nbytes, flags); 127 return ksys_sync_file_range(fd, offset, nbytes, flags);
128} 128}
diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c
index a877bf8269fe..1ef3b80b62a6 100644
--- a/arch/powerpc/kernel/syscalls.c
+++ b/arch/powerpc/kernel/syscalls.c
@@ -57,7 +57,7 @@ static inline long do_mmap2(unsigned long addr, size_t len,
57 off >>= shift; 57 off >>= shift;
58 } 58 }
59 59
60 ret = sys_mmap_pgoff(addr, len, prot, flags, fd, off); 60 ret = ksys_mmap_pgoff(addr, len, prot, flags, fd, off);
61out: 61out:
62 return ret; 62 return ret;
63} 63}
@@ -119,8 +119,8 @@ long ppc64_personality(unsigned long personality)
119long ppc_fadvise64_64(int fd, int advice, u32 offset_high, u32 offset_low, 119long ppc_fadvise64_64(int fd, int advice, u32 offset_high, u32 offset_low,
120 u32 len_high, u32 len_low) 120 u32 len_high, u32 len_low)
121{ 121{
122 return sys_fadvise64(fd, (u64)offset_high << 32 | offset_low, 122 return ksys_fadvise64_64(fd, (u64)offset_high << 32 | offset_low,
123 (u64)len_high << 32 | len_low, advice); 123 (u64)len_high << 32 | len_low, advice);
124} 124}
125 125
126long sys_switch_endian(void) 126long sys_switch_endian(void)
diff --git a/arch/riscv/kernel/sys_riscv.c b/arch/riscv/kernel/sys_riscv.c
index 79c78668258e..f7181ed8aafc 100644
--- a/arch/riscv/kernel/sys_riscv.c
+++ b/arch/riscv/kernel/sys_riscv.c
@@ -24,8 +24,8 @@ static long riscv_sys_mmap(unsigned long addr, unsigned long len,
24{ 24{
25 if (unlikely(offset & (~PAGE_MASK >> page_shift_offset))) 25 if (unlikely(offset & (~PAGE_MASK >> page_shift_offset)))
26 return -EINVAL; 26 return -EINVAL;
27 return sys_mmap_pgoff(addr, len, prot, flags, fd, 27 return ksys_mmap_pgoff(addr, len, prot, flags, fd,
28 offset >> (PAGE_SHIFT - page_shift_offset)); 28 offset >> (PAGE_SHIFT - page_shift_offset));
29} 29}
30 30
31#ifdef CONFIG_64BIT 31#ifdef CONFIG_64BIT
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index 79b7a3438d54..8ac38d51ed7d 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -89,18 +89,18 @@
89COMPAT_SYSCALL_DEFINE3(s390_chown16, const char __user *, filename, 89COMPAT_SYSCALL_DEFINE3(s390_chown16, const char __user *, filename,
90 u16, user, u16, group) 90 u16, user, u16, group)
91{ 91{
92 return sys_chown(filename, low2highuid(user), low2highgid(group)); 92 return ksys_chown(filename, low2highuid(user), low2highgid(group));
93} 93}
94 94
95COMPAT_SYSCALL_DEFINE3(s390_lchown16, const char __user *, 95COMPAT_SYSCALL_DEFINE3(s390_lchown16, const char __user *,
96 filename, u16, user, u16, group) 96 filename, u16, user, u16, group)
97{ 97{
98 return sys_lchown(filename, low2highuid(user), low2highgid(group)); 98 return ksys_lchown(filename, low2highuid(user), low2highgid(group));
99} 99}
100 100
101COMPAT_SYSCALL_DEFINE3(s390_fchown16, unsigned int, fd, u16, user, u16, group) 101COMPAT_SYSCALL_DEFINE3(s390_fchown16, unsigned int, fd, u16, user, u16, group)
102{ 102{
103 return sys_fchown(fd, low2highuid(user), low2highgid(group)); 103 return ksys_fchown(fd, low2highuid(user), low2highgid(group));
104} 104}
105 105
106COMPAT_SYSCALL_DEFINE2(s390_setregid16, u16, rgid, u16, egid) 106COMPAT_SYSCALL_DEFINE2(s390_setregid16, u16, rgid, u16, egid)
@@ -302,12 +302,12 @@ COMPAT_SYSCALL_DEFINE5(s390_ipc, uint, call, int, first, compat_ulong_t, second,
302 302
303COMPAT_SYSCALL_DEFINE3(s390_truncate64, const char __user *, path, u32, high, u32, low) 303COMPAT_SYSCALL_DEFINE3(s390_truncate64, const char __user *, path, u32, high, u32, low)
304{ 304{
305 return sys_truncate(path, (unsigned long)high << 32 | low); 305 return ksys_truncate(path, (unsigned long)high << 32 | low);
306} 306}
307 307
308COMPAT_SYSCALL_DEFINE3(s390_ftruncate64, unsigned int, fd, u32, high, u32, low) 308COMPAT_SYSCALL_DEFINE3(s390_ftruncate64, unsigned int, fd, u32, high, u32, low)
309{ 309{
310 return sys_ftruncate(fd, (unsigned long)high << 32 | low); 310 return ksys_ftruncate(fd, (unsigned long)high << 32 | low);
311} 311}
312 312
313COMPAT_SYSCALL_DEFINE5(s390_pread64, unsigned int, fd, char __user *, ubuf, 313COMPAT_SYSCALL_DEFINE5(s390_pread64, unsigned int, fd, char __user *, ubuf,
@@ -315,7 +315,7 @@ COMPAT_SYSCALL_DEFINE5(s390_pread64, unsigned int, fd, char __user *, ubuf,
315{ 315{
316 if ((compat_ssize_t) count < 0) 316 if ((compat_ssize_t) count < 0)
317 return -EINVAL; 317 return -EINVAL;
318 return sys_pread64(fd, ubuf, count, (unsigned long)high << 32 | low); 318 return ksys_pread64(fd, ubuf, count, (unsigned long)high << 32 | low);
319} 319}
320 320
321COMPAT_SYSCALL_DEFINE5(s390_pwrite64, unsigned int, fd, const char __user *, ubuf, 321COMPAT_SYSCALL_DEFINE5(s390_pwrite64, unsigned int, fd, const char __user *, ubuf,
@@ -323,12 +323,12 @@ COMPAT_SYSCALL_DEFINE5(s390_pwrite64, unsigned int, fd, const char __user *, ubu
323{ 323{
324 if ((compat_ssize_t) count < 0) 324 if ((compat_ssize_t) count < 0)
325 return -EINVAL; 325 return -EINVAL;
326 return sys_pwrite64(fd, ubuf, count, (unsigned long)high << 32 | low); 326 return ksys_pwrite64(fd, ubuf, count, (unsigned long)high << 32 | low);
327} 327}
328 328
329COMPAT_SYSCALL_DEFINE4(s390_readahead, int, fd, u32, high, u32, low, s32, count) 329COMPAT_SYSCALL_DEFINE4(s390_readahead, int, fd, u32, high, u32, low, s32, count)
330{ 330{
331 return sys_readahead(fd, (unsigned long)high << 32 | low, count); 331 return ksys_readahead(fd, (unsigned long)high << 32 | low, count);
332} 332}
333 333
334struct stat64_emu31 { 334struct stat64_emu31 {
@@ -442,8 +442,8 @@ COMPAT_SYSCALL_DEFINE1(s390_old_mmap, struct mmap_arg_struct_emu31 __user *, arg
442 return -EFAULT; 442 return -EFAULT;
443 if (a.offset & ~PAGE_MASK) 443 if (a.offset & ~PAGE_MASK)
444 return -EINVAL; 444 return -EINVAL;
445 return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, 445 return ksys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd,
446 a.offset >> PAGE_SHIFT); 446 a.offset >> PAGE_SHIFT);
447} 447}
448 448
449COMPAT_SYSCALL_DEFINE1(s390_mmap2, struct mmap_arg_struct_emu31 __user *, arg) 449COMPAT_SYSCALL_DEFINE1(s390_mmap2, struct mmap_arg_struct_emu31 __user *, arg)
@@ -452,7 +452,7 @@ COMPAT_SYSCALL_DEFINE1(s390_mmap2, struct mmap_arg_struct_emu31 __user *, arg)
452 452
453 if (copy_from_user(&a, arg, sizeof(a))) 453 if (copy_from_user(&a, arg, sizeof(a)))
454 return -EFAULT; 454 return -EFAULT;
455 return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset); 455 return ksys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset);
456} 456}
457 457
458COMPAT_SYSCALL_DEFINE3(s390_read, unsigned int, fd, char __user *, buf, compat_size_t, count) 458COMPAT_SYSCALL_DEFINE3(s390_read, unsigned int, fd, char __user *, buf, compat_size_t, count)
@@ -460,7 +460,7 @@ COMPAT_SYSCALL_DEFINE3(s390_read, unsigned int, fd, char __user *, buf, compat_s
460 if ((compat_ssize_t) count < 0) 460 if ((compat_ssize_t) count < 0)
461 return -EINVAL; 461 return -EINVAL;
462 462
463 return sys_read(fd, buf, count); 463 return ksys_read(fd, buf, count);
464} 464}
465 465
466COMPAT_SYSCALL_DEFINE3(s390_write, unsigned int, fd, const char __user *, buf, compat_size_t, count) 466COMPAT_SYSCALL_DEFINE3(s390_write, unsigned int, fd, const char __user *, buf, compat_size_t, count)
@@ -468,7 +468,7 @@ COMPAT_SYSCALL_DEFINE3(s390_write, unsigned int, fd, const char __user *, buf, c
468 if ((compat_ssize_t) count < 0) 468 if ((compat_ssize_t) count < 0)
469 return -EINVAL; 469 return -EINVAL;
470 470
471 return sys_write(fd, buf, count); 471 return ksys_write(fd, buf, count);
472} 472}
473 473
474/* 474/*
@@ -483,7 +483,8 @@ COMPAT_SYSCALL_DEFINE5(s390_fadvise64, int, fd, u32, high, u32, low, compat_size
483 advise = POSIX_FADV_DONTNEED; 483 advise = POSIX_FADV_DONTNEED;
484 else if (advise == 5) 484 else if (advise == 5)
485 advise = POSIX_FADV_NOREUSE; 485 advise = POSIX_FADV_NOREUSE;
486 return sys_fadvise64(fd, (unsigned long)high << 32 | low, len, advise); 486 return ksys_fadvise64_64(fd, (unsigned long)high << 32 | low, len,
487 advise);
487} 488}
488 489
489struct fadvise64_64_args { 490struct fadvise64_64_args {
@@ -503,19 +504,19 @@ COMPAT_SYSCALL_DEFINE1(s390_fadvise64_64, struct fadvise64_64_args __user *, arg
503 a.advice = POSIX_FADV_DONTNEED; 504 a.advice = POSIX_FADV_DONTNEED;
504 else if (a.advice == 5) 505 else if (a.advice == 5)
505 a.advice = POSIX_FADV_NOREUSE; 506 a.advice = POSIX_FADV_NOREUSE;
506 return sys_fadvise64_64(a.fd, a.offset, a.len, a.advice); 507 return ksys_fadvise64_64(a.fd, a.offset, a.len, a.advice);
507} 508}
508 509
509COMPAT_SYSCALL_DEFINE6(s390_sync_file_range, int, fd, u32, offhigh, u32, offlow, 510COMPAT_SYSCALL_DEFINE6(s390_sync_file_range, int, fd, u32, offhigh, u32, offlow,
510 u32, nhigh, u32, nlow, unsigned int, flags) 511 u32, nhigh, u32, nlow, unsigned int, flags)
511{ 512{
512 return sys_sync_file_range(fd, ((loff_t)offhigh << 32) + offlow, 513 return ksys_sync_file_range(fd, ((loff_t)offhigh << 32) + offlow,
513 ((u64)nhigh << 32) + nlow, flags); 514 ((u64)nhigh << 32) + nlow, flags);
514} 515}
515 516
516COMPAT_SYSCALL_DEFINE6(s390_fallocate, int, fd, int, mode, u32, offhigh, u32, offlow, 517COMPAT_SYSCALL_DEFINE6(s390_fallocate, int, fd, int, mode, u32, offhigh, u32, offlow,
517 u32, lenhigh, u32, lenlow) 518 u32, lenhigh, u32, lenlow)
518{ 519{
519 return sys_fallocate(fd, mode, ((loff_t)offhigh << 32) + offlow, 520 return ksys_fallocate(fd, mode, ((loff_t)offhigh << 32) + offlow,
520 ((u64)lenhigh << 32) + lenlow); 521 ((u64)lenhigh << 32) + lenlow);
521} 522}
diff --git a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c
index 0090037ab148..31cefe0c28c0 100644
--- a/arch/s390/kernel/sys_s390.c
+++ b/arch/s390/kernel/sys_s390.c
@@ -53,7 +53,7 @@ SYSCALL_DEFINE1(mmap2, struct s390_mmap_arg_struct __user *, arg)
53 53
54 if (copy_from_user(&a, arg, sizeof(a))) 54 if (copy_from_user(&a, arg, sizeof(a)))
55 goto out; 55 goto out;
56 error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset); 56 error = ksys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset);
57out: 57out:
58 return error; 58 return error;
59} 59}
diff --git a/arch/sh/kernel/sys_sh.c b/arch/sh/kernel/sys_sh.c
index 724911c59e7d..f8afc014e084 100644
--- a/arch/sh/kernel/sys_sh.c
+++ b/arch/sh/kernel/sys_sh.c
@@ -35,7 +35,7 @@ asmlinkage int old_mmap(unsigned long addr, unsigned long len,
35{ 35{
36 if (off & ~PAGE_MASK) 36 if (off & ~PAGE_MASK)
37 return -EINVAL; 37 return -EINVAL;
38 return sys_mmap_pgoff(addr, len, prot, flags, fd, off>>PAGE_SHIFT); 38 return ksys_mmap_pgoff(addr, len, prot, flags, fd, off>>PAGE_SHIFT);
39} 39}
40 40
41asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, 41asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
@@ -51,7 +51,7 @@ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
51 51
52 pgoff >>= PAGE_SHIFT - 12; 52 pgoff >>= PAGE_SHIFT - 12;
53 53
54 return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff); 54 return ksys_mmap_pgoff(addr, len, prot, flags, fd, pgoff);
55} 55}
56 56
57/* sys_cacheflush -- flush (part of) the processor cache. */ 57/* sys_cacheflush -- flush (part of) the processor cache. */
diff --git a/arch/sh/kernel/sys_sh32.c b/arch/sh/kernel/sys_sh32.c
index f8dc8bfd4606..9dca568509a5 100644
--- a/arch/sh/kernel/sys_sh32.c
+++ b/arch/sh/kernel/sys_sh32.c
@@ -39,23 +39,23 @@ asmlinkage int sys_sh_pipe(void)
39asmlinkage ssize_t sys_pread_wrapper(unsigned int fd, char __user *buf, 39asmlinkage ssize_t sys_pread_wrapper(unsigned int fd, char __user *buf,
40 size_t count, long dummy, loff_t pos) 40 size_t count, long dummy, loff_t pos)
41{ 41{
42 return sys_pread64(fd, buf, count, pos); 42 return ksys_pread64(fd, buf, count, pos);
43} 43}
44 44
45asmlinkage ssize_t sys_pwrite_wrapper(unsigned int fd, const char __user *buf, 45asmlinkage ssize_t sys_pwrite_wrapper(unsigned int fd, const char __user *buf,
46 size_t count, long dummy, loff_t pos) 46 size_t count, long dummy, loff_t pos)
47{ 47{
48 return sys_pwrite64(fd, buf, count, pos); 48 return ksys_pwrite64(fd, buf, count, pos);
49} 49}
50 50
51asmlinkage int sys_fadvise64_64_wrapper(int fd, u32 offset0, u32 offset1, 51asmlinkage int sys_fadvise64_64_wrapper(int fd, u32 offset0, u32 offset1,
52 u32 len0, u32 len1, int advice) 52 u32 len0, u32 len1, int advice)
53{ 53{
54#ifdef __LITTLE_ENDIAN__ 54#ifdef __LITTLE_ENDIAN__
55 return sys_fadvise64_64(fd, (u64)offset1 << 32 | offset0, 55 return ksys_fadvise64_64(fd, (u64)offset1 << 32 | offset0,
56 (u64)len1 << 32 | len0, advice); 56 (u64)len1 << 32 | len0, advice);
57#else 57#else
58 return sys_fadvise64_64(fd, (u64)offset0 << 32 | offset1, 58 return ksys_fadvise64_64(fd, (u64)offset0 << 32 | offset1,
59 (u64)len0 << 32 | len1, advice); 59 (u64)len0 << 32 | len1, advice);
60#endif 60#endif
61} 61}
diff --git a/arch/sparc/kernel/setup_32.c b/arch/sparc/kernel/setup_32.c
index 2e3a3e203061..13664c377196 100644
--- a/arch/sparc/kernel/setup_32.c
+++ b/arch/sparc/kernel/setup_32.c
@@ -86,7 +86,7 @@ static void prom_sync_me(void)
86 show_free_areas(0, NULL); 86 show_free_areas(0, NULL);
87 if (!is_idle_task(current)) { 87 if (!is_idle_task(current)) {
88 local_irq_enable(); 88 local_irq_enable();
89 sys_sync(); 89 ksys_sync();
90 local_irq_disable(); 90 local_irq_disable();
91 } 91 }
92 prom_printf("Returning to prom\n"); 92 prom_printf("Returning to prom\n");
diff --git a/arch/sparc/kernel/sys_sparc32.c b/arch/sparc/kernel/sys_sparc32.c
index 6d964bdefbaa..f166e5bbf506 100644
--- a/arch/sparc/kernel/sys_sparc32.c
+++ b/arch/sparc/kernel/sys_sparc32.c
@@ -57,7 +57,7 @@ asmlinkage long sys32_truncate64(const char __user * path, unsigned long high, u
57 if ((int)high < 0) 57 if ((int)high < 0)
58 return -EINVAL; 58 return -EINVAL;
59 else 59 else
60 return sys_truncate(path, (high << 32) | low); 60 return ksys_truncate(path, (high << 32) | low);
61} 61}
62 62
63asmlinkage long sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned long low) 63asmlinkage long sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned long low)
@@ -65,7 +65,7 @@ asmlinkage long sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned
65 if ((int)high < 0) 65 if ((int)high < 0)
66 return -EINVAL; 66 return -EINVAL;
67 else 67 else
68 return sys_ftruncate(fd, (high << 32) | low); 68 return ksys_ftruncate(fd, (high << 32) | low);
69} 69}
70 70
71static int cp_compat_stat64(struct kstat *stat, 71static int cp_compat_stat64(struct kstat *stat,
@@ -200,7 +200,7 @@ asmlinkage compat_ssize_t sys32_pread64(unsigned int fd,
200 unsigned long poshi, 200 unsigned long poshi,
201 unsigned long poslo) 201 unsigned long poslo)
202{ 202{
203 return sys_pread64(fd, ubuf, count, (poshi << 32) | poslo); 203 return ksys_pread64(fd, ubuf, count, (poshi << 32) | poslo);
204} 204}
205 205
206asmlinkage compat_ssize_t sys32_pwrite64(unsigned int fd, 206asmlinkage compat_ssize_t sys32_pwrite64(unsigned int fd,
@@ -209,7 +209,7 @@ asmlinkage compat_ssize_t sys32_pwrite64(unsigned int fd,
209 unsigned long poshi, 209 unsigned long poshi,
210 unsigned long poslo) 210 unsigned long poslo)
211{ 211{
212 return sys_pwrite64(fd, ubuf, count, (poshi << 32) | poslo); 212 return ksys_pwrite64(fd, ubuf, count, (poshi << 32) | poslo);
213} 213}
214 214
215asmlinkage long compat_sys_readahead(int fd, 215asmlinkage long compat_sys_readahead(int fd,
@@ -217,7 +217,7 @@ asmlinkage long compat_sys_readahead(int fd,
217 unsigned long offlo, 217 unsigned long offlo,
218 compat_size_t count) 218 compat_size_t count)
219{ 219{
220 return sys_readahead(fd, (offhi << 32) | offlo, count); 220 return ksys_readahead(fd, (offhi << 32) | offlo, count);
221} 221}
222 222
223long compat_sys_fadvise64(int fd, 223long compat_sys_fadvise64(int fd,
@@ -225,7 +225,7 @@ long compat_sys_fadvise64(int fd,
225 unsigned long offlo, 225 unsigned long offlo,
226 compat_size_t len, int advice) 226 compat_size_t len, int advice)
227{ 227{
228 return sys_fadvise64_64(fd, (offhi << 32) | offlo, len, advice); 228 return ksys_fadvise64_64(fd, (offhi << 32) | offlo, len, advice);
229} 229}
230 230
231long compat_sys_fadvise64_64(int fd, 231long compat_sys_fadvise64_64(int fd,
@@ -233,15 +233,15 @@ long compat_sys_fadvise64_64(int fd,
233 unsigned long lenhi, unsigned long lenlo, 233 unsigned long lenhi, unsigned long lenlo,
234 int advice) 234 int advice)
235{ 235{
236 return sys_fadvise64_64(fd, 236 return ksys_fadvise64_64(fd,
237 (offhi << 32) | offlo, 237 (offhi << 32) | offlo,
238 (lenhi << 32) | lenlo, 238 (lenhi << 32) | lenlo,
239 advice); 239 advice);
240} 240}
241 241
242long sys32_sync_file_range(unsigned int fd, unsigned long off_high, unsigned long off_low, unsigned long nb_high, unsigned long nb_low, unsigned int flags) 242long sys32_sync_file_range(unsigned int fd, unsigned long off_high, unsigned long off_low, unsigned long nb_high, unsigned long nb_low, unsigned int flags)
243{ 243{
244 return sys_sync_file_range(fd, 244 return ksys_sync_file_range(fd,
245 (off_high << 32) | off_low, 245 (off_high << 32) | off_low,
246 (nb_high << 32) | nb_low, 246 (nb_high << 32) | nb_low,
247 flags); 247 flags);
@@ -250,6 +250,6 @@ long sys32_sync_file_range(unsigned int fd, unsigned long off_high, unsigned lon
250asmlinkage long compat_sys_fallocate(int fd, int mode, u32 offhi, u32 offlo, 250asmlinkage long compat_sys_fallocate(int fd, int mode, u32 offhi, u32 offlo,
251 u32 lenhi, u32 lenlo) 251 u32 lenhi, u32 lenlo)
252{ 252{
253 return sys_fallocate(fd, mode, ((loff_t)offhi << 32) | offlo, 253 return ksys_fallocate(fd, mode, ((loff_t)offhi << 32) | offlo,
254 ((loff_t)lenhi << 32) | lenlo); 254 ((loff_t)lenhi << 32) | lenlo);
255} 255}
diff --git a/arch/sparc/kernel/sys_sparc_32.c b/arch/sparc/kernel/sys_sparc_32.c
index 990703b7cf4d..d980da4ffd7b 100644
--- a/arch/sparc/kernel/sys_sparc_32.c
+++ b/arch/sparc/kernel/sys_sparc_32.c
@@ -104,8 +104,8 @@ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
104{ 104{
105 /* Make sure the shift for mmap2 is constant (12), no matter what PAGE_SIZE 105 /* Make sure the shift for mmap2 is constant (12), no matter what PAGE_SIZE
106 we have. */ 106 we have. */
107 return sys_mmap_pgoff(addr, len, prot, flags, fd, 107 return ksys_mmap_pgoff(addr, len, prot, flags, fd,
108 pgoff >> (PAGE_SHIFT - 12)); 108 pgoff >> (PAGE_SHIFT - 12));
109} 109}
110 110
111asmlinkage long sys_mmap(unsigned long addr, unsigned long len, 111asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
@@ -113,7 +113,7 @@ asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
113 unsigned long off) 113 unsigned long off)
114{ 114{
115 /* no alignment check? */ 115 /* no alignment check? */
116 return sys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT); 116 return ksys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
117} 117}
118 118
119long sparc_remap_file_pages(unsigned long start, unsigned long size, 119long sparc_remap_file_pages(unsigned long start, unsigned long size,
diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c
index 55416db482ad..ebb84dc8a5a7 100644
--- a/arch/sparc/kernel/sys_sparc_64.c
+++ b/arch/sparc/kernel/sys_sparc_64.c
@@ -458,7 +458,7 @@ SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len,
458 goto out; 458 goto out;
459 if (off & ~PAGE_MASK) 459 if (off & ~PAGE_MASK)
460 goto out; 460 goto out;
461 retval = sys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT); 461 retval = ksys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
462out: 462out:
463 return retval; 463 return retval;
464} 464}
diff --git a/arch/um/kernel/syscall.c b/arch/um/kernel/syscall.c
index 6258676bed85..35f7047bdebc 100644
--- a/arch/um/kernel/syscall.c
+++ b/arch/um/kernel/syscall.c
@@ -22,7 +22,7 @@ long old_mmap(unsigned long addr, unsigned long len,
22 if (offset & ~PAGE_MASK) 22 if (offset & ~PAGE_MASK)
23 goto out; 23 goto out;
24 24
25 err = sys_mmap_pgoff(addr, len, prot, flags, fd, offset >> PAGE_SHIFT); 25 err = ksys_mmap_pgoff(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
26 out: 26 out:
27 return err; 27 return err;
28} 28}
diff --git a/arch/x86/entry/syscalls/syscall_32.tbl b/arch/x86/entry/syscalls/syscall_32.tbl
index 2a5e99cff859..c58f75b088c5 100644
--- a/arch/x86/entry/syscalls/syscall_32.tbl
+++ b/arch/x86/entry/syscalls/syscall_32.tbl
@@ -13,7 +13,7 @@
134 i386 write sys_write 134 i386 write sys_write
145 i386 open sys_open compat_sys_open 145 i386 open sys_open compat_sys_open
156 i386 close sys_close 156 i386 close sys_close
167 i386 waitpid sys_waitpid compat_sys_x86_waitpid 167 i386 waitpid sys_waitpid
178 i386 creat sys_creat 178 i386 creat sys_creat
189 i386 link sys_link 189 i386 link sys_link
1910 i386 unlink sys_unlink 1910 i386 unlink sys_unlink
@@ -137,7 +137,7 @@
137128 i386 init_module sys_init_module 137128 i386 init_module sys_init_module
138129 i386 delete_module sys_delete_module 138129 i386 delete_module sys_delete_module
139130 i386 get_kernel_syms 139130 i386 get_kernel_syms
140131 i386 quotactl sys_quotactl sys32_quotactl 140131 i386 quotactl sys_quotactl compat_sys_quotactl32
141132 i386 getpgid sys_getpgid 141132 i386 getpgid sys_getpgid
142133 i386 fchdir sys_fchdir 142133 i386 fchdir sys_fchdir
143134 i386 bdflush sys_bdflush 143134 i386 bdflush sys_bdflush
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index 41c671854642..86b1341cba9a 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -33,7 +33,6 @@
33#include <asm/vdso.h> 33#include <asm/vdso.h>
34#include <asm/sigframe.h> 34#include <asm/sigframe.h>
35#include <asm/sighandling.h> 35#include <asm/sighandling.h>
36#include <asm/sys_ia32.h>
37#include <asm/smap.h> 36#include <asm/smap.h>
38 37
39/* 38/*
diff --git a/arch/x86/ia32/sys_ia32.c b/arch/x86/ia32/sys_ia32.c
index 6512498bbef6..11ef7b7c9cc8 100644
--- a/arch/x86/ia32/sys_ia32.c
+++ b/arch/x86/ia32/sys_ia32.c
@@ -41,12 +41,13 @@
41#include <linux/highuid.h> 41#include <linux/highuid.h>
42#include <linux/sysctl.h> 42#include <linux/sysctl.h>
43#include <linux/slab.h> 43#include <linux/slab.h>
44#include <linux/sched/task.h>
44#include <asm/mman.h> 45#include <asm/mman.h>
45#include <asm/types.h> 46#include <asm/types.h>
46#include <linux/uaccess.h> 47#include <linux/uaccess.h>
47#include <linux/atomic.h> 48#include <linux/atomic.h>
48#include <asm/vgtod.h> 49#include <asm/vgtod.h>
49#include <asm/sys_ia32.h> 50#include <asm/ia32.h>
50 51
51#define AA(__x) ((unsigned long)(__x)) 52#define AA(__x) ((unsigned long)(__x))
52 53
@@ -54,13 +55,14 @@
54COMPAT_SYSCALL_DEFINE3(x86_truncate64, const char __user *, filename, 55COMPAT_SYSCALL_DEFINE3(x86_truncate64, const char __user *, filename,
55 unsigned long, offset_low, unsigned long, offset_high) 56 unsigned long, offset_low, unsigned long, offset_high)
56{ 57{
57 return sys_truncate(filename, ((loff_t) offset_high << 32) | offset_low); 58 return ksys_truncate(filename,
59 ((loff_t) offset_high << 32) | offset_low);
58} 60}
59 61
60COMPAT_SYSCALL_DEFINE3(x86_ftruncate64, unsigned int, fd, 62COMPAT_SYSCALL_DEFINE3(x86_ftruncate64, unsigned int, fd,
61 unsigned long, offset_low, unsigned long, offset_high) 63 unsigned long, offset_low, unsigned long, offset_high)
62{ 64{
63 return sys_ftruncate(fd, ((loff_t) offset_high << 32) | offset_low); 65 return ksys_ftruncate(fd, ((loff_t) offset_high << 32) | offset_low);
64} 66}
65 67
66/* 68/*
@@ -164,29 +166,23 @@ COMPAT_SYSCALL_DEFINE1(x86_mmap, struct mmap_arg_struct32 __user *, arg)
164 if (a.offset & ~PAGE_MASK) 166 if (a.offset & ~PAGE_MASK)
165 return -EINVAL; 167 return -EINVAL;
166 168
167 return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, 169 return ksys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd,
168 a.offset>>PAGE_SHIFT); 170 a.offset>>PAGE_SHIFT);
169} 171}
170 172
171COMPAT_SYSCALL_DEFINE3(x86_waitpid, compat_pid_t, pid, unsigned int __user *,
172 stat_addr, int, options)
173{
174 return compat_sys_wait4(pid, stat_addr, options, NULL);
175}
176
177/* warning: next two assume little endian */ 173/* warning: next two assume little endian */
178COMPAT_SYSCALL_DEFINE5(x86_pread, unsigned int, fd, char __user *, ubuf, 174COMPAT_SYSCALL_DEFINE5(x86_pread, unsigned int, fd, char __user *, ubuf,
179 u32, count, u32, poslo, u32, poshi) 175 u32, count, u32, poslo, u32, poshi)
180{ 176{
181 return sys_pread64(fd, ubuf, count, 177 return ksys_pread64(fd, ubuf, count,
182 ((loff_t)AA(poshi) << 32) | AA(poslo)); 178 ((loff_t)AA(poshi) << 32) | AA(poslo));
183} 179}
184 180
185COMPAT_SYSCALL_DEFINE5(x86_pwrite, unsigned int, fd, const char __user *, ubuf, 181COMPAT_SYSCALL_DEFINE5(x86_pwrite, unsigned int, fd, const char __user *, ubuf,
186 u32, count, u32, poslo, u32, poshi) 182 u32, count, u32, poslo, u32, poshi)
187{ 183{
188 return sys_pwrite64(fd, ubuf, count, 184 return ksys_pwrite64(fd, ubuf, count,
189 ((loff_t)AA(poshi) << 32) | AA(poslo)); 185 ((loff_t)AA(poshi) << 32) | AA(poslo));
190} 186}
191 187
192 188
@@ -198,40 +194,40 @@ COMPAT_SYSCALL_DEFINE6(x86_fadvise64_64, int, fd, __u32, offset_low,
198 __u32, offset_high, __u32, len_low, __u32, len_high, 194 __u32, offset_high, __u32, len_low, __u32, len_high,
199 int, advice) 195 int, advice)
200{ 196{
201 return sys_fadvise64_64(fd, 197 return ksys_fadvise64_64(fd,
202 (((u64)offset_high)<<32) | offset_low, 198 (((u64)offset_high)<<32) | offset_low,
203 (((u64)len_high)<<32) | len_low, 199 (((u64)len_high)<<32) | len_low,
204 advice); 200 advice);
205} 201}
206 202
207COMPAT_SYSCALL_DEFINE4(x86_readahead, int, fd, unsigned int, off_lo, 203COMPAT_SYSCALL_DEFINE4(x86_readahead, int, fd, unsigned int, off_lo,
208 unsigned int, off_hi, size_t, count) 204 unsigned int, off_hi, size_t, count)
209{ 205{
210 return sys_readahead(fd, ((u64)off_hi << 32) | off_lo, count); 206 return ksys_readahead(fd, ((u64)off_hi << 32) | off_lo, count);
211} 207}
212 208
213COMPAT_SYSCALL_DEFINE6(x86_sync_file_range, int, fd, unsigned int, off_low, 209COMPAT_SYSCALL_DEFINE6(x86_sync_file_range, int, fd, unsigned int, off_low,
214 unsigned int, off_hi, unsigned int, n_low, 210 unsigned int, off_hi, unsigned int, n_low,
215 unsigned int, n_hi, int, flags) 211 unsigned int, n_hi, int, flags)
216{ 212{
217 return sys_sync_file_range(fd, 213 return ksys_sync_file_range(fd,
218 ((u64)off_hi << 32) | off_low, 214 ((u64)off_hi << 32) | off_low,
219 ((u64)n_hi << 32) | n_low, flags); 215 ((u64)n_hi << 32) | n_low, flags);
220} 216}
221 217
222COMPAT_SYSCALL_DEFINE5(x86_fadvise64, int, fd, unsigned int, offset_lo, 218COMPAT_SYSCALL_DEFINE5(x86_fadvise64, int, fd, unsigned int, offset_lo,
223 unsigned int, offset_hi, size_t, len, int, advice) 219 unsigned int, offset_hi, size_t, len, int, advice)
224{ 220{
225 return sys_fadvise64_64(fd, ((u64)offset_hi << 32) | offset_lo, 221 return ksys_fadvise64_64(fd, ((u64)offset_hi << 32) | offset_lo,
226 len, advice); 222 len, advice);
227} 223}
228 224
229COMPAT_SYSCALL_DEFINE6(x86_fallocate, int, fd, int, mode, 225COMPAT_SYSCALL_DEFINE6(x86_fallocate, int, fd, int, mode,
230 unsigned int, offset_lo, unsigned int, offset_hi, 226 unsigned int, offset_lo, unsigned int, offset_hi,
231 unsigned int, len_lo, unsigned int, len_hi) 227 unsigned int, len_lo, unsigned int, len_hi)
232{ 228{
233 return sys_fallocate(fd, mode, ((u64)offset_hi << 32) | offset_lo, 229 return ksys_fallocate(fd, mode, ((u64)offset_hi << 32) | offset_lo,
234 ((u64)len_hi << 32) | len_lo); 230 ((u64)len_hi << 32) | len_lo);
235} 231}
236 232
237/* 233/*
@@ -241,6 +237,6 @@ COMPAT_SYSCALL_DEFINE5(x86_clone, unsigned long, clone_flags,
241 unsigned long, newsp, int __user *, parent_tidptr, 237 unsigned long, newsp, int __user *, parent_tidptr,
242 unsigned long, tls_val, int __user *, child_tidptr) 238 unsigned long, tls_val, int __user *, child_tidptr)
243{ 239{
244 return sys_clone(clone_flags, newsp, parent_tidptr, child_tidptr, 240 return _do_fork(clone_flags, newsp, 0, parent_tidptr, child_tidptr,
245 tls_val); 241 tls_val);
246} 242}
diff --git a/arch/x86/include/asm/sys_ia32.h b/arch/x86/include/asm/sys_ia32.h
deleted file mode 100644
index 906794aa034e..000000000000
--- a/arch/x86/include/asm/sys_ia32.h
+++ /dev/null
@@ -1,67 +0,0 @@
1/*
2 * sys_ia32.h - Linux ia32 syscall interfaces
3 *
4 * Copyright (c) 2008 Jaswinder Singh Rajput
5 *
6 * This file is released under the GPLv2.
7 * See the file COPYING for more details.
8 */
9
10#ifndef _ASM_X86_SYS_IA32_H
11#define _ASM_X86_SYS_IA32_H
12
13#ifdef CONFIG_COMPAT
14
15#include <linux/compiler.h>
16#include <linux/linkage.h>
17#include <linux/types.h>
18#include <linux/signal.h>
19#include <asm/compat.h>
20#include <asm/ia32.h>
21
22/* ia32/sys_ia32.c */
23asmlinkage long compat_sys_x86_truncate64(const char __user *, unsigned long,
24 unsigned long);
25asmlinkage long compat_sys_x86_ftruncate64(unsigned int, unsigned long,
26 unsigned long);
27
28asmlinkage long compat_sys_x86_stat64(const char __user *,
29 struct stat64 __user *);
30asmlinkage long compat_sys_x86_lstat64(const char __user *,
31 struct stat64 __user *);
32asmlinkage long compat_sys_x86_fstat64(unsigned int, struct stat64 __user *);
33asmlinkage long compat_sys_x86_fstatat(unsigned int, const char __user *,
34 struct stat64 __user *, int);
35struct mmap_arg_struct32;
36asmlinkage long compat_sys_x86_mmap(struct mmap_arg_struct32 __user *);
37
38asmlinkage long compat_sys_x86_waitpid(compat_pid_t, unsigned int __user *,
39 int);
40
41asmlinkage long compat_sys_x86_pread(unsigned int, char __user *, u32, u32,
42 u32);
43asmlinkage long compat_sys_x86_pwrite(unsigned int, const char __user *, u32,
44 u32, u32);
45
46asmlinkage long compat_sys_x86_fadvise64_64(int, __u32, __u32, __u32, __u32,
47 int);
48
49asmlinkage ssize_t compat_sys_x86_readahead(int, unsigned int, unsigned int,
50 size_t);
51asmlinkage long compat_sys_x86_sync_file_range(int, unsigned int, unsigned int,
52 unsigned int, unsigned int,
53 int);
54asmlinkage long compat_sys_x86_fadvise64(int, unsigned int, unsigned int,
55 size_t, int);
56asmlinkage long compat_sys_x86_fallocate(int, int, unsigned int, unsigned int,
57 unsigned int, unsigned int);
58asmlinkage long compat_sys_x86_clone(unsigned long, unsigned long, int __user *,
59 unsigned long, int __user *);
60
61/* ia32/ia32_signal.c */
62asmlinkage long sys32_sigreturn(void);
63asmlinkage long sys32_rt_sigreturn(void);
64
65#endif /* CONFIG_COMPAT */
66
67#endif /* _ASM_X86_SYS_IA32_H */
diff --git a/arch/x86/include/asm/syscalls.h b/arch/x86/include/asm/syscalls.h
index bad25bb80679..ae6e05fdc24b 100644
--- a/arch/x86/include/asm/syscalls.h
+++ b/arch/x86/include/asm/syscalls.h
@@ -17,6 +17,7 @@
17 17
18/* Common in X86_32 and X86_64 */ 18/* Common in X86_32 and X86_64 */
19/* kernel/ioport.c */ 19/* kernel/ioport.c */
20long ksys_ioperm(unsigned long from, unsigned long num, int turn_on);
20asmlinkage long sys_ioperm(unsigned long, unsigned long, int); 21asmlinkage long sys_ioperm(unsigned long, unsigned long, int);
21asmlinkage long sys_iopl(unsigned int); 22asmlinkage long sys_iopl(unsigned int);
22 23
@@ -34,7 +35,7 @@ asmlinkage long sys_get_thread_area(struct user_desc __user *);
34#ifdef CONFIG_X86_32 35#ifdef CONFIG_X86_32
35 36
36/* kernel/signal.c */ 37/* kernel/signal.c */
37asmlinkage unsigned long sys_sigreturn(void); 38asmlinkage long sys_sigreturn(void);
38 39
39/* kernel/vm86_32.c */ 40/* kernel/vm86_32.c */
40struct vm86_struct; 41struct vm86_struct;
diff --git a/arch/x86/kernel/ioport.c b/arch/x86/kernel/ioport.c
index 38deafebb21b..0fe1c8782208 100644
--- a/arch/x86/kernel/ioport.c
+++ b/arch/x86/kernel/ioport.c
@@ -23,7 +23,7 @@
23/* 23/*
24 * this changes the io permissions bitmap in the current task. 24 * this changes the io permissions bitmap in the current task.
25 */ 25 */
26SYSCALL_DEFINE3(ioperm, unsigned long, from, unsigned long, num, int, turn_on) 26long ksys_ioperm(unsigned long from, unsigned long num, int turn_on)
27{ 27{
28 struct thread_struct *t = &current->thread; 28 struct thread_struct *t = &current->thread;
29 struct tss_struct *tss; 29 struct tss_struct *tss;
@@ -96,6 +96,11 @@ SYSCALL_DEFINE3(ioperm, unsigned long, from, unsigned long, num, int, turn_on)
96 return 0; 96 return 0;
97} 97}
98 98
99SYSCALL_DEFINE3(ioperm, unsigned long, from, unsigned long, num, int, turn_on)
100{
101 return ksys_ioperm(from, num, turn_on);
102}
103
99/* 104/*
100 * sys_iopl has to be used when you want to access the IO ports 105 * sys_iopl has to be used when you want to access the IO ports
101 * beyond the 0x3ff range: to get the full 65536 ports bitmapped 106 * beyond the 0x3ff range: to get the full 65536 ports bitmapped
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
index 4cdc0b27ec82..da270b95fe4d 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -25,6 +25,7 @@
25#include <linux/user-return-notifier.h> 25#include <linux/user-return-notifier.h>
26#include <linux/uprobes.h> 26#include <linux/uprobes.h>
27#include <linux/context_tracking.h> 27#include <linux/context_tracking.h>
28#include <linux/syscalls.h>
28 29
29#include <asm/processor.h> 30#include <asm/processor.h>
30#include <asm/ucontext.h> 31#include <asm/ucontext.h>
@@ -601,7 +602,7 @@ static int x32_setup_rt_frame(struct ksignal *ksig,
601 * Do a signal return; undo the signal stack. 602 * Do a signal return; undo the signal stack.
602 */ 603 */
603#ifdef CONFIG_X86_32 604#ifdef CONFIG_X86_32
604asmlinkage unsigned long sys_sigreturn(void) 605SYSCALL_DEFINE0(sigreturn)
605{ 606{
606 struct pt_regs *regs = current_pt_regs(); 607 struct pt_regs *regs = current_pt_regs();
607 struct sigframe __user *frame; 608 struct sigframe __user *frame;
@@ -633,7 +634,7 @@ badframe:
633} 634}
634#endif /* CONFIG_X86_32 */ 635#endif /* CONFIG_X86_32 */
635 636
636asmlinkage long sys_rt_sigreturn(void) 637SYSCALL_DEFINE0(rt_sigreturn)
637{ 638{
638 struct pt_regs *regs = current_pt_regs(); 639 struct pt_regs *regs = current_pt_regs();
639 struct rt_sigframe __user *frame; 640 struct rt_sigframe __user *frame;
diff --git a/arch/x86/kernel/sys_x86_64.c b/arch/x86/kernel/sys_x86_64.c
index 676774b9bb8d..a3f15ed545b5 100644
--- a/arch/x86/kernel/sys_x86_64.c
+++ b/arch/x86/kernel/sys_x86_64.c
@@ -97,7 +97,7 @@ SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len,
97 if (off & ~PAGE_MASK) 97 if (off & ~PAGE_MASK)
98 goto out; 98 goto out;
99 99
100 error = sys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT); 100 error = ksys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
101out: 101out:
102 return error; 102 return error;
103} 103}
diff --git a/arch/xtensa/kernel/syscall.c b/arch/xtensa/kernel/syscall.c
index 74afbf02d07e..8201748da05b 100644
--- a/arch/xtensa/kernel/syscall.c
+++ b/arch/xtensa/kernel/syscall.c
@@ -55,7 +55,7 @@ asmlinkage long xtensa_shmat(int shmid, char __user *shmaddr, int shmflg)
55asmlinkage long xtensa_fadvise64_64(int fd, int advice, 55asmlinkage long xtensa_fadvise64_64(int fd, int advice,
56 unsigned long long offset, unsigned long long len) 56 unsigned long long offset, unsigned long long len)
57{ 57{
58 return sys_fadvise64_64(fd, offset, len, advice); 58 return ksys_fadvise64_64(fd, offset, len, advice);
59} 59}
60 60
61#ifdef CONFIG_MMU 61#ifdef CONFIG_MMU
diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c
index 50025d7959cb..f7768077e817 100644
--- a/drivers/base/devtmpfs.c
+++ b/drivers/base/devtmpfs.c
@@ -356,7 +356,8 @@ int devtmpfs_mount(const char *mntdir)
356 if (!thread) 356 if (!thread)
357 return 0; 357 return 0;
358 358
359 err = sys_mount("devtmpfs", (char *)mntdir, "devtmpfs", MS_SILENT, NULL); 359 err = ksys_mount("devtmpfs", (char *)mntdir, "devtmpfs", MS_SILENT,
360 NULL);
360 if (err) 361 if (err)
361 printk(KERN_INFO "devtmpfs: error mounting %i\n", err); 362 printk(KERN_INFO "devtmpfs: error mounting %i\n", err);
362 else 363 else
@@ -379,14 +380,14 @@ static int devtmpfsd(void *p)
379{ 380{
380 char options[] = "mode=0755"; 381 char options[] = "mode=0755";
381 int *err = p; 382 int *err = p;
382 *err = sys_unshare(CLONE_NEWNS); 383 *err = ksys_unshare(CLONE_NEWNS);
383 if (*err) 384 if (*err)
384 goto out; 385 goto out;
385 *err = sys_mount("devtmpfs", "/", "devtmpfs", MS_SILENT, options); 386 *err = ksys_mount("devtmpfs", "/", "devtmpfs", MS_SILENT, options);
386 if (*err) 387 if (*err)
387 goto out; 388 goto out;
388 sys_chdir("/.."); /* will traverse into overmounted root */ 389 ksys_chdir("/.."); /* will traverse into overmounted root */
389 sys_chroot("."); 390 ksys_chroot(".");
390 complete(&setup_done); 391 complete(&setup_done);
391 while (1) { 392 while (1) {
392 spin_lock(&req_lock); 393 spin_lock(&req_lock);
diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index b674793be478..6364890575ec 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -660,7 +660,7 @@ static void sysrq_do_reset(struct timer_list *t)
660 660
661 state->reset_requested = true; 661 state->reset_requested = true;
662 662
663 sys_sync(); 663 ksys_sync();
664 kernel_restart(NULL); 664 kernel_restart(NULL);
665} 665}
666 666
diff --git a/drivers/tty/vt/vt_ioctl.c b/drivers/tty/vt/vt_ioctl.c
index d61be307256a..a78ad10a119b 100644
--- a/drivers/tty/vt/vt_ioctl.c
+++ b/drivers/tty/vt/vt_ioctl.c
@@ -57,7 +57,7 @@ extern struct tty_driver *console_driver;
57 */ 57 */
58 58
59#ifdef CONFIG_X86 59#ifdef CONFIG_X86
60#include <linux/syscalls.h> 60#include <asm/syscalls.h>
61#endif 61#endif
62 62
63static void complete_change_console(struct vc_data *vc); 63static void complete_change_console(struct vc_data *vc);
@@ -420,12 +420,12 @@ int vt_ioctl(struct tty_struct *tty,
420 ret = -EINVAL; 420 ret = -EINVAL;
421 break; 421 break;
422 } 422 }
423 ret = sys_ioperm(arg, 1, (cmd == KDADDIO)) ? -ENXIO : 0; 423 ret = ksys_ioperm(arg, 1, (cmd == KDADDIO)) ? -ENXIO : 0;
424 break; 424 break;
425 425
426 case KDENABIO: 426 case KDENABIO:
427 case KDDISABIO: 427 case KDDISABIO:
428 ret = sys_ioperm(GPFIRST, GPNUM, 428 ret = ksys_ioperm(GPFIRST, GPNUM,
429 (cmd == KDENABIO)) ? -ENXIO : 0; 429 (cmd == KDENABIO)) ? -ENXIO : 0;
430 break; 430 break;
431#endif 431#endif
diff --git a/fs/autofs4/dev-ioctl.c b/fs/autofs4/dev-ioctl.c
index b7c816f39404..26f6b4f41ce6 100644
--- a/fs/autofs4/dev-ioctl.c
+++ b/fs/autofs4/dev-ioctl.c
@@ -310,7 +310,7 @@ static int autofs_dev_ioctl_closemount(struct file *fp,
310 struct autofs_sb_info *sbi, 310 struct autofs_sb_info *sbi,
311 struct autofs_dev_ioctl *param) 311 struct autofs_dev_ioctl *param)
312{ 312{
313 return sys_close(param->ioctlfd); 313 return ksys_close(param->ioctlfd);
314} 314}
315 315
316/* 316/*
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index a7c5a9861bef..a41b48f82a70 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -241,7 +241,7 @@ ret:
241 return retval; 241 return retval;
242error: 242error:
243 if (fd_binary > 0) 243 if (fd_binary > 0)
244 sys_close(fd_binary); 244 ksys_close(fd_binary);
245 bprm->interp_flags = 0; 245 bprm->interp_flags = 0;
246 bprm->interp_data = 0; 246 bprm->interp_data = 0;
247 goto ret; 247 goto ret;
diff --git a/fs/dcookies.c b/fs/dcookies.c
index 0d0461cf2431..57bc96435feb 100644
--- a/fs/dcookies.c
+++ b/fs/dcookies.c
@@ -146,7 +146,7 @@ out:
146/* And here is where the userspace process can look up the cookie value 146/* And here is where the userspace process can look up the cookie value
147 * to retrieve the path. 147 * to retrieve the path.
148 */ 148 */
149SYSCALL_DEFINE3(lookup_dcookie, u64, cookie64, char __user *, buf, size_t, len) 149static int do_lookup_dcookie(u64 cookie64, char __user *buf, size_t len)
150{ 150{
151 unsigned long cookie = (unsigned long)cookie64; 151 unsigned long cookie = (unsigned long)cookie64;
152 int err = -EINVAL; 152 int err = -EINVAL;
@@ -203,13 +203,18 @@ out:
203 return err; 203 return err;
204} 204}
205 205
206SYSCALL_DEFINE3(lookup_dcookie, u64, cookie64, char __user *, buf, size_t, len)
207{
208 return do_lookup_dcookie(cookie64, buf, len);
209}
210
206#ifdef CONFIG_COMPAT 211#ifdef CONFIG_COMPAT
207COMPAT_SYSCALL_DEFINE4(lookup_dcookie, u32, w0, u32, w1, char __user *, buf, compat_size_t, len) 212COMPAT_SYSCALL_DEFINE4(lookup_dcookie, u32, w0, u32, w1, char __user *, buf, compat_size_t, len)
208{ 213{
209#ifdef __BIG_ENDIAN 214#ifdef __BIG_ENDIAN
210 return sys_lookup_dcookie(((u64)w0 << 32) | w1, buf, len); 215 return do_lookup_dcookie(((u64)w0 << 32) | w1, buf, len);
211#else 216#else
212 return sys_lookup_dcookie(((u64)w1 << 32) | w0, buf, len); 217 return do_lookup_dcookie(((u64)w1 << 32) | w0, buf, len);
213#endif 218#endif
214} 219}
215#endif 220#endif
diff --git a/fs/eventfd.c b/fs/eventfd.c
index 012f5bd46dfa..08d3bd602f73 100644
--- a/fs/eventfd.c
+++ b/fs/eventfd.c
@@ -380,7 +380,7 @@ struct eventfd_ctx *eventfd_ctx_fileget(struct file *file)
380} 380}
381EXPORT_SYMBOL_GPL(eventfd_ctx_fileget); 381EXPORT_SYMBOL_GPL(eventfd_ctx_fileget);
382 382
383SYSCALL_DEFINE2(eventfd2, unsigned int, count, int, flags) 383static int do_eventfd(unsigned int count, int flags)
384{ 384{
385 struct eventfd_ctx *ctx; 385 struct eventfd_ctx *ctx;
386 int fd; 386 int fd;
@@ -409,8 +409,13 @@ SYSCALL_DEFINE2(eventfd2, unsigned int, count, int, flags)
409 return fd; 409 return fd;
410} 410}
411 411
412SYSCALL_DEFINE2(eventfd2, unsigned int, count, int, flags)
413{
414 return do_eventfd(count, flags);
415}
416
412SYSCALL_DEFINE1(eventfd, unsigned int, count) 417SYSCALL_DEFINE1(eventfd, unsigned int, count)
413{ 418{
414 return sys_eventfd2(count, 0); 419 return do_eventfd(count, 0);
415} 420}
416 421
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 0f3494ed3ed0..602ca4285b2e 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -1936,7 +1936,7 @@ static void clear_tfile_check_list(void)
1936/* 1936/*
1937 * Open an eventpoll file descriptor. 1937 * Open an eventpoll file descriptor.
1938 */ 1938 */
1939SYSCALL_DEFINE1(epoll_create1, int, flags) 1939static int do_epoll_create(int flags)
1940{ 1940{
1941 int error, fd; 1941 int error, fd;
1942 struct eventpoll *ep = NULL; 1942 struct eventpoll *ep = NULL;
@@ -1979,12 +1979,17 @@ out_free_ep:
1979 return error; 1979 return error;
1980} 1980}
1981 1981
1982SYSCALL_DEFINE1(epoll_create1, int, flags)
1983{
1984 return do_epoll_create(flags);
1985}
1986
1982SYSCALL_DEFINE1(epoll_create, int, size) 1987SYSCALL_DEFINE1(epoll_create, int, size)
1983{ 1988{
1984 if (size <= 0) 1989 if (size <= 0)
1985 return -EINVAL; 1990 return -EINVAL;
1986 1991
1987 return sys_epoll_create1(0); 1992 return do_epoll_create(0);
1988} 1993}
1989 1994
1990/* 1995/*
@@ -2148,8 +2153,8 @@ error_return:
2148 * Implement the event wait interface for the eventpoll file. It is the kernel 2153 * Implement the event wait interface for the eventpoll file. It is the kernel
2149 * part of the user space epoll_wait(2). 2154 * part of the user space epoll_wait(2).
2150 */ 2155 */
2151SYSCALL_DEFINE4(epoll_wait, int, epfd, struct epoll_event __user *, events, 2156static int do_epoll_wait(int epfd, struct epoll_event __user *events,
2152 int, maxevents, int, timeout) 2157 int maxevents, int timeout)
2153{ 2158{
2154 int error; 2159 int error;
2155 struct fd f; 2160 struct fd f;
@@ -2190,6 +2195,12 @@ error_fput:
2190 return error; 2195 return error;
2191} 2196}
2192 2197
2198SYSCALL_DEFINE4(epoll_wait, int, epfd, struct epoll_event __user *, events,
2199 int, maxevents, int, timeout)
2200{
2201 return do_epoll_wait(epfd, events, maxevents, timeout);
2202}
2203
2193/* 2204/*
2194 * Implement the event wait interface for the eventpoll file. It is the kernel 2205 * Implement the event wait interface for the eventpoll file. It is the kernel
2195 * part of the user space epoll_pwait(2). 2206 * part of the user space epoll_pwait(2).
@@ -2214,7 +2225,7 @@ SYSCALL_DEFINE6(epoll_pwait, int, epfd, struct epoll_event __user *, events,
2214 set_current_blocked(&ksigmask); 2225 set_current_blocked(&ksigmask);
2215 } 2226 }
2216 2227
2217 error = sys_epoll_wait(epfd, events, maxevents, timeout); 2228 error = do_epoll_wait(epfd, events, maxevents, timeout);
2218 2229
2219 /* 2230 /*
2220 * If we changed the signal mask, we need to restore the original one. 2231 * If we changed the signal mask, we need to restore the original one.
@@ -2257,7 +2268,7 @@ COMPAT_SYSCALL_DEFINE6(epoll_pwait, int, epfd,
2257 set_current_blocked(&ksigmask); 2268 set_current_blocked(&ksigmask);
2258 } 2269 }
2259 2270
2260 err = sys_epoll_wait(epfd, events, maxevents, timeout); 2271 err = do_epoll_wait(epfd, events, maxevents, timeout);
2261 2272
2262 /* 2273 /*
2263 * If we changed the signal mask, we need to restore the original one. 2274 * If we changed the signal mask, we need to restore the original one.
diff --git a/fs/fcntl.c b/fs/fcntl.c
index 1e97f1fda90c..d737ff082472 100644
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -607,8 +607,8 @@ static int fixup_compat_flock(struct flock *flock)
607 return 0; 607 return 0;
608} 608}
609 609
610COMPAT_SYSCALL_DEFINE3(fcntl64, unsigned int, fd, unsigned int, cmd, 610static long do_compat_fcntl64(unsigned int fd, unsigned int cmd,
611 compat_ulong_t, arg) 611 compat_ulong_t arg)
612{ 612{
613 struct fd f = fdget_raw(fd); 613 struct fd f = fdget_raw(fd);
614 struct flock flock; 614 struct flock flock;
@@ -672,6 +672,12 @@ out_put:
672 return err; 672 return err;
673} 673}
674 674
675COMPAT_SYSCALL_DEFINE3(fcntl64, unsigned int, fd, unsigned int, cmd,
676 compat_ulong_t, arg)
677{
678 return do_compat_fcntl64(fd, cmd, arg);
679}
680
675COMPAT_SYSCALL_DEFINE3(fcntl, unsigned int, fd, unsigned int, cmd, 681COMPAT_SYSCALL_DEFINE3(fcntl, unsigned int, fd, unsigned int, cmd,
676 compat_ulong_t, arg) 682 compat_ulong_t, arg)
677{ 683{
@@ -684,7 +690,7 @@ COMPAT_SYSCALL_DEFINE3(fcntl, unsigned int, fd, unsigned int, cmd,
684 case F_OFD_SETLKW: 690 case F_OFD_SETLKW:
685 return -EINVAL; 691 return -EINVAL;
686 } 692 }
687 return compat_sys_fcntl64(fd, cmd, arg); 693 return do_compat_fcntl64(fd, cmd, arg);
688} 694}
689#endif 695#endif
690 696
diff --git a/fs/file.c b/fs/file.c
index 42f0db4bd0fb..7ffd6e9d103d 100644
--- a/fs/file.c
+++ b/fs/file.c
@@ -638,6 +638,7 @@ out_unlock:
638 spin_unlock(&files->file_lock); 638 spin_unlock(&files->file_lock);
639 return -EBADF; 639 return -EBADF;
640} 640}
641EXPORT_SYMBOL(__close_fd); /* for ksys_close() */
641 642
642void do_close_on_exec(struct files_struct *files) 643void do_close_on_exec(struct files_struct *files)
643{ 644{
@@ -870,7 +871,7 @@ out_unlock:
870 return err; 871 return err;
871} 872}
872 873
873SYSCALL_DEFINE3(dup3, unsigned int, oldfd, unsigned int, newfd, int, flags) 874static int ksys_dup3(unsigned int oldfd, unsigned int newfd, int flags)
874{ 875{
875 int err = -EBADF; 876 int err = -EBADF;
876 struct file *file; 877 struct file *file;
@@ -904,6 +905,11 @@ out_unlock:
904 return err; 905 return err;
905} 906}
906 907
908SYSCALL_DEFINE3(dup3, unsigned int, oldfd, unsigned int, newfd, int, flags)
909{
910 return ksys_dup3(oldfd, newfd, flags);
911}
912
907SYSCALL_DEFINE2(dup2, unsigned int, oldfd, unsigned int, newfd) 913SYSCALL_DEFINE2(dup2, unsigned int, oldfd, unsigned int, newfd)
908{ 914{
909 if (unlikely(newfd == oldfd)) { /* corner case */ 915 if (unlikely(newfd == oldfd)) { /* corner case */
@@ -916,10 +922,10 @@ SYSCALL_DEFINE2(dup2, unsigned int, oldfd, unsigned int, newfd)
916 rcu_read_unlock(); 922 rcu_read_unlock();
917 return retval; 923 return retval;
918 } 924 }
919 return sys_dup3(oldfd, newfd, 0); 925 return ksys_dup3(oldfd, newfd, 0);
920} 926}
921 927
922SYSCALL_DEFINE1(dup, unsigned int, fildes) 928int ksys_dup(unsigned int fildes)
923{ 929{
924 int ret = -EBADF; 930 int ret = -EBADF;
925 struct file *file = fget_raw(fildes); 931 struct file *file = fget_raw(fildes);
@@ -934,6 +940,11 @@ SYSCALL_DEFINE1(dup, unsigned int, fildes)
934 return ret; 940 return ret;
935} 941}
936 942
943SYSCALL_DEFINE1(dup, unsigned int, fildes)
944{
945 return ksys_dup(fildes);
946}
947
937int f_dupfd(unsigned int from, struct file *file, unsigned flags) 948int f_dupfd(unsigned int from, struct file *file, unsigned flags)
938{ 949{
939 int err; 950 int err;
diff --git a/fs/hostfs/hostfs.h b/fs/hostfs/hostfs.h
index ffaec2e7526c..cb8374af08a6 100644
--- a/fs/hostfs/hostfs.h
+++ b/fs/hostfs/hostfs.h
@@ -84,7 +84,7 @@ extern int set_attr(const char *file, struct hostfs_iattr *attrs, int fd);
84extern int make_symlink(const char *from, const char *to); 84extern int make_symlink(const char *from, const char *to);
85extern int unlink_file(const char *file); 85extern int unlink_file(const char *file);
86extern int do_mkdir(const char *file, int mode); 86extern int do_mkdir(const char *file, int mode);
87extern int do_rmdir(const char *file); 87extern int hostfs_do_rmdir(const char *file);
88extern int do_mknod(const char *file, int mode, unsigned int major, 88extern int do_mknod(const char *file, int mode, unsigned int major,
89 unsigned int minor); 89 unsigned int minor);
90extern int link_file(const char *from, const char *to); 90extern int link_file(const char *from, const char *to);
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index c148e7f4f451..3cd85eb5bbb1 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -706,7 +706,7 @@ static int hostfs_rmdir(struct inode *ino, struct dentry *dentry)
706 706
707 if ((file = dentry_name(dentry)) == NULL) 707 if ((file = dentry_name(dentry)) == NULL)
708 return -ENOMEM; 708 return -ENOMEM;
709 err = do_rmdir(file); 709 err = hostfs_do_rmdir(file);
710 __putname(file); 710 __putname(file);
711 return err; 711 return err;
712} 712}
diff --git a/fs/hostfs/hostfs_user.c b/fs/hostfs/hostfs_user.c
index 9c1e0f019880..5ecc4706172b 100644
--- a/fs/hostfs/hostfs_user.c
+++ b/fs/hostfs/hostfs_user.c
@@ -304,7 +304,7 @@ int do_mkdir(const char *file, int mode)
304 return 0; 304 return 0;
305} 305}
306 306
307int do_rmdir(const char *file) 307int hostfs_do_rmdir(const char *file)
308{ 308{
309 int err; 309 int err;
310 310
diff --git a/fs/internal.h b/fs/internal.h
index df262f41a0ef..980d005b21b4 100644
--- a/fs/internal.h
+++ b/fs/internal.h
@@ -55,7 +55,15 @@ extern void __init chrdev_init(void);
55extern int user_path_mountpoint_at(int, const char __user *, unsigned int, struct path *); 55extern int user_path_mountpoint_at(int, const char __user *, unsigned int, struct path *);
56extern int vfs_path_lookup(struct dentry *, struct vfsmount *, 56extern int vfs_path_lookup(struct dentry *, struct vfsmount *,
57 const char *, unsigned int, struct path *); 57 const char *, unsigned int, struct path *);
58long do_mknodat(int dfd, const char __user *filename, umode_t mode,
59 unsigned int dev);
60long do_mkdirat(int dfd, const char __user *pathname, umode_t mode);
61long do_rmdir(int dfd, const char __user *pathname);
58long do_unlinkat(int dfd, struct filename *name); 62long do_unlinkat(int dfd, struct filename *name);
63long do_symlinkat(const char __user *oldname, int newdfd,
64 const char __user *newname);
65int do_linkat(int olddfd, const char __user *oldname, int newdfd,
66 const char __user *newname, int flags);
59 67
60/* 68/*
61 * namespace.c 69 * namespace.c
@@ -111,6 +119,12 @@ extern struct file *do_filp_open(int dfd, struct filename *pathname,
111extern struct file *do_file_open_root(struct dentry *, struct vfsmount *, 119extern struct file *do_file_open_root(struct dentry *, struct vfsmount *,
112 const char *, const struct open_flags *); 120 const char *, const struct open_flags *);
113 121
122long do_sys_ftruncate(unsigned int fd, loff_t length, int small);
123long do_faccessat(int dfd, const char __user *filename, int mode);
124int do_fchmodat(int dfd, const char __user *filename, umode_t mode);
125int do_fchownat(int dfd, const char __user *filename, uid_t user, gid_t group,
126 int flag);
127
114extern int open_check_o_direct(struct file *f); 128extern int open_check_o_direct(struct file *f);
115extern int vfs_open(const struct path *, struct file *, const struct cred *); 129extern int vfs_open(const struct path *, struct file *, const struct cred *);
116extern struct file *filp_clone_open(struct file *); 130extern struct file *filp_clone_open(struct file *);
diff --git a/fs/ioctl.c b/fs/ioctl.c
index 5ace7efb0d04..4823431d1c9d 100644
--- a/fs/ioctl.c
+++ b/fs/ioctl.c
@@ -689,7 +689,7 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
689 return error; 689 return error;
690} 690}
691 691
692SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd, unsigned long, arg) 692int ksys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
693{ 693{
694 int error; 694 int error;
695 struct fd f = fdget(fd); 695 struct fd f = fdget(fd);
@@ -702,3 +702,8 @@ SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd, unsigned long, arg)
702 fdput(f); 702 fdput(f);
703 return error; 703 return error;
704} 704}
705
706SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd, unsigned long, arg)
707{
708 return ksys_ioctl(fd, cmd, arg);
709}
diff --git a/fs/namei.c b/fs/namei.c
index cafa365eeb70..5c2b953c352d 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -3729,8 +3729,8 @@ static int may_mknod(umode_t mode)
3729 } 3729 }
3730} 3730}
3731 3731
3732SYSCALL_DEFINE4(mknodat, int, dfd, const char __user *, filename, umode_t, mode, 3732long do_mknodat(int dfd, const char __user *filename, umode_t mode,
3733 unsigned, dev) 3733 unsigned int dev)
3734{ 3734{
3735 struct dentry *dentry; 3735 struct dentry *dentry;
3736 struct path path; 3736 struct path path;
@@ -3773,9 +3773,15 @@ out:
3773 return error; 3773 return error;
3774} 3774}
3775 3775
3776SYSCALL_DEFINE4(mknodat, int, dfd, const char __user *, filename, umode_t, mode,
3777 unsigned int, dev)
3778{
3779 return do_mknodat(dfd, filename, mode, dev);
3780}
3781
3776SYSCALL_DEFINE3(mknod, const char __user *, filename, umode_t, mode, unsigned, dev) 3782SYSCALL_DEFINE3(mknod, const char __user *, filename, umode_t, mode, unsigned, dev)
3777{ 3783{
3778 return sys_mknodat(AT_FDCWD, filename, mode, dev); 3784 return do_mknodat(AT_FDCWD, filename, mode, dev);
3779} 3785}
3780 3786
3781int vfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) 3787int vfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
@@ -3804,7 +3810,7 @@ int vfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
3804} 3810}
3805EXPORT_SYMBOL(vfs_mkdir); 3811EXPORT_SYMBOL(vfs_mkdir);
3806 3812
3807SYSCALL_DEFINE3(mkdirat, int, dfd, const char __user *, pathname, umode_t, mode) 3813long do_mkdirat(int dfd, const char __user *pathname, umode_t mode)
3808{ 3814{
3809 struct dentry *dentry; 3815 struct dentry *dentry;
3810 struct path path; 3816 struct path path;
@@ -3829,9 +3835,14 @@ retry:
3829 return error; 3835 return error;
3830} 3836}
3831 3837
3838SYSCALL_DEFINE3(mkdirat, int, dfd, const char __user *, pathname, umode_t, mode)
3839{
3840 return do_mkdirat(dfd, pathname, mode);
3841}
3842
3832SYSCALL_DEFINE2(mkdir, const char __user *, pathname, umode_t, mode) 3843SYSCALL_DEFINE2(mkdir, const char __user *, pathname, umode_t, mode)
3833{ 3844{
3834 return sys_mkdirat(AT_FDCWD, pathname, mode); 3845 return do_mkdirat(AT_FDCWD, pathname, mode);
3835} 3846}
3836 3847
3837int vfs_rmdir(struct inode *dir, struct dentry *dentry) 3848int vfs_rmdir(struct inode *dir, struct dentry *dentry)
@@ -3873,7 +3884,7 @@ out:
3873} 3884}
3874EXPORT_SYMBOL(vfs_rmdir); 3885EXPORT_SYMBOL(vfs_rmdir);
3875 3886
3876static long do_rmdir(int dfd, const char __user *pathname) 3887long do_rmdir(int dfd, const char __user *pathname)
3877{ 3888{
3878 int error = 0; 3889 int error = 0;
3879 struct filename *name; 3890 struct filename *name;
@@ -4109,8 +4120,8 @@ int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname)
4109} 4120}
4110EXPORT_SYMBOL(vfs_symlink); 4121EXPORT_SYMBOL(vfs_symlink);
4111 4122
4112SYSCALL_DEFINE3(symlinkat, const char __user *, oldname, 4123long do_symlinkat(const char __user *oldname, int newdfd,
4113 int, newdfd, const char __user *, newname) 4124 const char __user *newname)
4114{ 4125{
4115 int error; 4126 int error;
4116 struct filename *from; 4127 struct filename *from;
@@ -4140,9 +4151,15 @@ out_putname:
4140 return error; 4151 return error;
4141} 4152}
4142 4153
4154SYSCALL_DEFINE3(symlinkat, const char __user *, oldname,
4155 int, newdfd, const char __user *, newname)
4156{
4157 return do_symlinkat(oldname, newdfd, newname);
4158}
4159
4143SYSCALL_DEFINE2(symlink, const char __user *, oldname, const char __user *, newname) 4160SYSCALL_DEFINE2(symlink, const char __user *, oldname, const char __user *, newname)
4144{ 4161{
4145 return sys_symlinkat(oldname, AT_FDCWD, newname); 4162 return do_symlinkat(oldname, AT_FDCWD, newname);
4146} 4163}
4147 4164
4148/** 4165/**
@@ -4234,8 +4251,8 @@ EXPORT_SYMBOL(vfs_link);
4234 * with linux 2.0, and to avoid hard-linking to directories 4251 * with linux 2.0, and to avoid hard-linking to directories
4235 * and other special files. --ADM 4252 * and other special files. --ADM
4236 */ 4253 */
4237SYSCALL_DEFINE5(linkat, int, olddfd, const char __user *, oldname, 4254int do_linkat(int olddfd, const char __user *oldname, int newdfd,
4238 int, newdfd, const char __user *, newname, int, flags) 4255 const char __user *newname, int flags)
4239{ 4256{
4240 struct dentry *new_dentry; 4257 struct dentry *new_dentry;
4241 struct path old_path, new_path; 4258 struct path old_path, new_path;
@@ -4299,9 +4316,15 @@ out:
4299 return error; 4316 return error;
4300} 4317}
4301 4318
4319SYSCALL_DEFINE5(linkat, int, olddfd, const char __user *, oldname,
4320 int, newdfd, const char __user *, newname, int, flags)
4321{
4322 return do_linkat(olddfd, oldname, newdfd, newname, flags);
4323}
4324
4302SYSCALL_DEFINE2(link, const char __user *, oldname, const char __user *, newname) 4325SYSCALL_DEFINE2(link, const char __user *, oldname, const char __user *, newname)
4303{ 4326{
4304 return sys_linkat(AT_FDCWD, oldname, AT_FDCWD, newname, 0); 4327 return do_linkat(AT_FDCWD, oldname, AT_FDCWD, newname, 0);
4305} 4328}
4306 4329
4307/** 4330/**
@@ -4479,8 +4502,8 @@ out:
4479} 4502}
4480EXPORT_SYMBOL(vfs_rename); 4503EXPORT_SYMBOL(vfs_rename);
4481 4504
4482SYSCALL_DEFINE5(renameat2, int, olddfd, const char __user *, oldname, 4505static int do_renameat2(int olddfd, const char __user *oldname, int newdfd,
4483 int, newdfd, const char __user *, newname, unsigned int, flags) 4506 const char __user *newname, unsigned int flags)
4484{ 4507{
4485 struct dentry *old_dentry, *new_dentry; 4508 struct dentry *old_dentry, *new_dentry;
4486 struct dentry *trap; 4509 struct dentry *trap;
@@ -4622,15 +4645,21 @@ exit:
4622 return error; 4645 return error;
4623} 4646}
4624 4647
4648SYSCALL_DEFINE5(renameat2, int, olddfd, const char __user *, oldname,
4649 int, newdfd, const char __user *, newname, unsigned int, flags)
4650{
4651 return do_renameat2(olddfd, oldname, newdfd, newname, flags);
4652}
4653
4625SYSCALL_DEFINE4(renameat, int, olddfd, const char __user *, oldname, 4654SYSCALL_DEFINE4(renameat, int, olddfd, const char __user *, oldname,
4626 int, newdfd, const char __user *, newname) 4655 int, newdfd, const char __user *, newname)
4627{ 4656{
4628 return sys_renameat2(olddfd, oldname, newdfd, newname, 0); 4657 return do_renameat2(olddfd, oldname, newdfd, newname, 0);
4629} 4658}
4630 4659
4631SYSCALL_DEFINE2(rename, const char __user *, oldname, const char __user *, newname) 4660SYSCALL_DEFINE2(rename, const char __user *, oldname, const char __user *, newname)
4632{ 4661{
4633 return sys_renameat2(AT_FDCWD, oldname, AT_FDCWD, newname, 0); 4662 return do_renameat2(AT_FDCWD, oldname, AT_FDCWD, newname, 0);
4634} 4663}
4635 4664
4636int vfs_whiteout(struct inode *dir, struct dentry *dentry) 4665int vfs_whiteout(struct inode *dir, struct dentry *dentry)
diff --git a/fs/namespace.c b/fs/namespace.c
index 9d1374ab6e06..e398f32d7541 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1680,7 +1680,7 @@ static inline bool may_mandlock(void)
1680 * unixes. Our API is identical to OSF/1 to avoid making a mess of AMD 1680 * unixes. Our API is identical to OSF/1 to avoid making a mess of AMD
1681 */ 1681 */
1682 1682
1683SYSCALL_DEFINE2(umount, char __user *, name, int, flags) 1683int ksys_umount(char __user *name, int flags)
1684{ 1684{
1685 struct path path; 1685 struct path path;
1686 struct mount *mnt; 1686 struct mount *mnt;
@@ -1720,6 +1720,11 @@ out:
1720 return retval; 1720 return retval;
1721} 1721}
1722 1722
1723SYSCALL_DEFINE2(umount, char __user *, name, int, flags)
1724{
1725 return ksys_umount(name, flags);
1726}
1727
1723#ifdef __ARCH_WANT_SYS_OLDUMOUNT 1728#ifdef __ARCH_WANT_SYS_OLDUMOUNT
1724 1729
1725/* 1730/*
@@ -1727,7 +1732,7 @@ out:
1727 */ 1732 */
1728SYSCALL_DEFINE1(oldumount, char __user *, name) 1733SYSCALL_DEFINE1(oldumount, char __user *, name)
1729{ 1734{
1730 return sys_umount(name, 0); 1735 return ksys_umount(name, 0);
1731} 1736}
1732 1737
1733#endif 1738#endif
@@ -3032,8 +3037,8 @@ struct dentry *mount_subtree(struct vfsmount *mnt, const char *name)
3032} 3037}
3033EXPORT_SYMBOL(mount_subtree); 3038EXPORT_SYMBOL(mount_subtree);
3034 3039
3035SYSCALL_DEFINE5(mount, char __user *, dev_name, char __user *, dir_name, 3040int ksys_mount(char __user *dev_name, char __user *dir_name, char __user *type,
3036 char __user *, type, unsigned long, flags, void __user *, data) 3041 unsigned long flags, void __user *data)
3037{ 3042{
3038 int ret; 3043 int ret;
3039 char *kernel_type; 3044 char *kernel_type;
@@ -3066,6 +3071,12 @@ out_type:
3066 return ret; 3071 return ret;
3067} 3072}
3068 3073
3074SYSCALL_DEFINE5(mount, char __user *, dev_name, char __user *, dir_name,
3075 char __user *, type, unsigned long, flags, void __user *, data)
3076{
3077 return ksys_mount(dev_name, dir_name, type, flags, data);
3078}
3079
3069/* 3080/*
3070 * Return true if path is reachable from root 3081 * Return true if path is reachable from root
3071 * 3082 *
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index c07eb3d655ea..fa803a58a605 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -820,9 +820,8 @@ out_destroy_group:
820 return fd; 820 return fd;
821} 821}
822 822
823SYSCALL_DEFINE5(fanotify_mark, int, fanotify_fd, unsigned int, flags, 823static int do_fanotify_mark(int fanotify_fd, unsigned int flags, __u64 mask,
824 __u64, mask, int, dfd, 824 int dfd, const char __user *pathname)
825 const char __user *, pathname)
826{ 825{
827 struct inode *inode = NULL; 826 struct inode *inode = NULL;
828 struct vfsmount *mnt = NULL; 827 struct vfsmount *mnt = NULL;
@@ -928,13 +927,20 @@ fput_and_out:
928 return ret; 927 return ret;
929} 928}
930 929
930SYSCALL_DEFINE5(fanotify_mark, int, fanotify_fd, unsigned int, flags,
931 __u64, mask, int, dfd,
932 const char __user *, pathname)
933{
934 return do_fanotify_mark(fanotify_fd, flags, mask, dfd, pathname);
935}
936
931#ifdef CONFIG_COMPAT 937#ifdef CONFIG_COMPAT
932COMPAT_SYSCALL_DEFINE6(fanotify_mark, 938COMPAT_SYSCALL_DEFINE6(fanotify_mark,
933 int, fanotify_fd, unsigned int, flags, 939 int, fanotify_fd, unsigned int, flags,
934 __u32, mask0, __u32, mask1, int, dfd, 940 __u32, mask0, __u32, mask1, int, dfd,
935 const char __user *, pathname) 941 const char __user *, pathname)
936{ 942{
937 return sys_fanotify_mark(fanotify_fd, flags, 943 return do_fanotify_mark(fanotify_fd, flags,
938#ifdef __BIG_ENDIAN 944#ifdef __BIG_ENDIAN
939 ((__u64)mask0 << 32) | mask1, 945 ((__u64)mask0 << 32) | mask1,
940#else 946#else
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index 2c908b31d6c9..43c23653ce2e 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -635,7 +635,7 @@ static struct fsnotify_group *inotify_new_group(unsigned int max_events)
635 635
636 636
637/* inotify syscalls */ 637/* inotify syscalls */
638SYSCALL_DEFINE1(inotify_init1, int, flags) 638static int do_inotify_init(int flags)
639{ 639{
640 struct fsnotify_group *group; 640 struct fsnotify_group *group;
641 int ret; 641 int ret;
@@ -660,9 +660,14 @@ SYSCALL_DEFINE1(inotify_init1, int, flags)
660 return ret; 660 return ret;
661} 661}
662 662
663SYSCALL_DEFINE1(inotify_init1, int, flags)
664{
665 return do_inotify_init(flags);
666}
667
663SYSCALL_DEFINE0(inotify_init) 668SYSCALL_DEFINE0(inotify_init)
664{ 669{
665 return sys_inotify_init1(0); 670 return do_inotify_init(0);
666} 671}
667 672
668SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname, 673SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname,
diff --git a/fs/open.c b/fs/open.c
index 7ea118471dce..d0e955b558ad 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -128,7 +128,7 @@ out:
128} 128}
129EXPORT_SYMBOL_GPL(vfs_truncate); 129EXPORT_SYMBOL_GPL(vfs_truncate);
130 130
131static long do_sys_truncate(const char __user *pathname, loff_t length) 131long do_sys_truncate(const char __user *pathname, loff_t length)
132{ 132{
133 unsigned int lookup_flags = LOOKUP_FOLLOW; 133 unsigned int lookup_flags = LOOKUP_FOLLOW;
134 struct path path; 134 struct path path;
@@ -162,7 +162,7 @@ COMPAT_SYSCALL_DEFINE2(truncate, const char __user *, path, compat_off_t, length
162} 162}
163#endif 163#endif
164 164
165static long do_sys_ftruncate(unsigned int fd, loff_t length, int small) 165long do_sys_ftruncate(unsigned int fd, loff_t length, int small)
166{ 166{
167 struct inode *inode; 167 struct inode *inode;
168 struct dentry *dentry; 168 struct dentry *dentry;
@@ -333,7 +333,7 @@ int vfs_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
333} 333}
334EXPORT_SYMBOL_GPL(vfs_fallocate); 334EXPORT_SYMBOL_GPL(vfs_fallocate);
335 335
336SYSCALL_DEFINE4(fallocate, int, fd, int, mode, loff_t, offset, loff_t, len) 336int ksys_fallocate(int fd, int mode, loff_t offset, loff_t len)
337{ 337{
338 struct fd f = fdget(fd); 338 struct fd f = fdget(fd);
339 int error = -EBADF; 339 int error = -EBADF;
@@ -345,12 +345,17 @@ SYSCALL_DEFINE4(fallocate, int, fd, int, mode, loff_t, offset, loff_t, len)
345 return error; 345 return error;
346} 346}
347 347
348SYSCALL_DEFINE4(fallocate, int, fd, int, mode, loff_t, offset, loff_t, len)
349{
350 return ksys_fallocate(fd, mode, offset, len);
351}
352
348/* 353/*
349 * access() needs to use the real uid/gid, not the effective uid/gid. 354 * access() needs to use the real uid/gid, not the effective uid/gid.
350 * We do this by temporarily clearing all FS-related capabilities and 355 * We do this by temporarily clearing all FS-related capabilities and
351 * switching the fsuid/fsgid around to the real ones. 356 * switching the fsuid/fsgid around to the real ones.
352 */ 357 */
353SYSCALL_DEFINE3(faccessat, int, dfd, const char __user *, filename, int, mode) 358long do_faccessat(int dfd, const char __user *filename, int mode)
354{ 359{
355 const struct cred *old_cred; 360 const struct cred *old_cred;
356 struct cred *override_cred; 361 struct cred *override_cred;
@@ -426,12 +431,17 @@ out:
426 return res; 431 return res;
427} 432}
428 433
434SYSCALL_DEFINE3(faccessat, int, dfd, const char __user *, filename, int, mode)
435{
436 return do_faccessat(dfd, filename, mode);
437}
438
429SYSCALL_DEFINE2(access, const char __user *, filename, int, mode) 439SYSCALL_DEFINE2(access, const char __user *, filename, int, mode)
430{ 440{
431 return sys_faccessat(AT_FDCWD, filename, mode); 441 return do_faccessat(AT_FDCWD, filename, mode);
432} 442}
433 443
434SYSCALL_DEFINE1(chdir, const char __user *, filename) 444int ksys_chdir(const char __user *filename)
435{ 445{
436 struct path path; 446 struct path path;
437 int error; 447 int error;
@@ -457,6 +467,11 @@ out:
457 return error; 467 return error;
458} 468}
459 469
470SYSCALL_DEFINE1(chdir, const char __user *, filename)
471{
472 return ksys_chdir(filename);
473}
474
460SYSCALL_DEFINE1(fchdir, unsigned int, fd) 475SYSCALL_DEFINE1(fchdir, unsigned int, fd)
461{ 476{
462 struct fd f = fdget_raw(fd); 477 struct fd f = fdget_raw(fd);
@@ -479,7 +494,7 @@ out:
479 return error; 494 return error;
480} 495}
481 496
482SYSCALL_DEFINE1(chroot, const char __user *, filename) 497int ksys_chroot(const char __user *filename)
483{ 498{
484 struct path path; 499 struct path path;
485 int error; 500 int error;
@@ -512,6 +527,11 @@ out:
512 return error; 527 return error;
513} 528}
514 529
530SYSCALL_DEFINE1(chroot, const char __user *, filename)
531{
532 return ksys_chroot(filename);
533}
534
515static int chmod_common(const struct path *path, umode_t mode) 535static int chmod_common(const struct path *path, umode_t mode)
516{ 536{
517 struct inode *inode = path->dentry->d_inode; 537 struct inode *inode = path->dentry->d_inode;
@@ -541,7 +561,7 @@ out_unlock:
541 return error; 561 return error;
542} 562}
543 563
544SYSCALL_DEFINE2(fchmod, unsigned int, fd, umode_t, mode) 564int ksys_fchmod(unsigned int fd, umode_t mode)
545{ 565{
546 struct fd f = fdget(fd); 566 struct fd f = fdget(fd);
547 int err = -EBADF; 567 int err = -EBADF;
@@ -554,7 +574,12 @@ SYSCALL_DEFINE2(fchmod, unsigned int, fd, umode_t, mode)
554 return err; 574 return err;
555} 575}
556 576
557SYSCALL_DEFINE3(fchmodat, int, dfd, const char __user *, filename, umode_t, mode) 577SYSCALL_DEFINE2(fchmod, unsigned int, fd, umode_t, mode)
578{
579 return ksys_fchmod(fd, mode);
580}
581
582int do_fchmodat(int dfd, const char __user *filename, umode_t mode)
558{ 583{
559 struct path path; 584 struct path path;
560 int error; 585 int error;
@@ -572,9 +597,15 @@ retry:
572 return error; 597 return error;
573} 598}
574 599
600SYSCALL_DEFINE3(fchmodat, int, dfd, const char __user *, filename,
601 umode_t, mode)
602{
603 return do_fchmodat(dfd, filename, mode);
604}
605
575SYSCALL_DEFINE2(chmod, const char __user *, filename, umode_t, mode) 606SYSCALL_DEFINE2(chmod, const char __user *, filename, umode_t, mode)
576{ 607{
577 return sys_fchmodat(AT_FDCWD, filename, mode); 608 return do_fchmodat(AT_FDCWD, filename, mode);
578} 609}
579 610
580static int chown_common(const struct path *path, uid_t user, gid_t group) 611static int chown_common(const struct path *path, uid_t user, gid_t group)
@@ -619,8 +650,8 @@ retry_deleg:
619 return error; 650 return error;
620} 651}
621 652
622SYSCALL_DEFINE5(fchownat, int, dfd, const char __user *, filename, uid_t, user, 653int do_fchownat(int dfd, const char __user *filename, uid_t user, gid_t group,
623 gid_t, group, int, flag) 654 int flag)
624{ 655{
625 struct path path; 656 struct path path;
626 int error = -EINVAL; 657 int error = -EINVAL;
@@ -651,18 +682,24 @@ out:
651 return error; 682 return error;
652} 683}
653 684
685SYSCALL_DEFINE5(fchownat, int, dfd, const char __user *, filename, uid_t, user,
686 gid_t, group, int, flag)
687{
688 return do_fchownat(dfd, filename, user, group, flag);
689}
690
654SYSCALL_DEFINE3(chown, const char __user *, filename, uid_t, user, gid_t, group) 691SYSCALL_DEFINE3(chown, const char __user *, filename, uid_t, user, gid_t, group)
655{ 692{
656 return sys_fchownat(AT_FDCWD, filename, user, group, 0); 693 return do_fchownat(AT_FDCWD, filename, user, group, 0);
657} 694}
658 695
659SYSCALL_DEFINE3(lchown, const char __user *, filename, uid_t, user, gid_t, group) 696SYSCALL_DEFINE3(lchown, const char __user *, filename, uid_t, user, gid_t, group)
660{ 697{
661 return sys_fchownat(AT_FDCWD, filename, user, group, 698 return do_fchownat(AT_FDCWD, filename, user, group,
662 AT_SYMLINK_NOFOLLOW); 699 AT_SYMLINK_NOFOLLOW);
663} 700}
664 701
665SYSCALL_DEFINE3(fchown, unsigned int, fd, uid_t, user, gid_t, group) 702int ksys_fchown(unsigned int fd, uid_t user, gid_t group)
666{ 703{
667 struct fd f = fdget(fd); 704 struct fd f = fdget(fd);
668 int error = -EBADF; 705 int error = -EBADF;
@@ -682,6 +719,11 @@ out:
682 return error; 719 return error;
683} 720}
684 721
722SYSCALL_DEFINE3(fchown, unsigned int, fd, uid_t, user, gid_t, group)
723{
724 return ksys_fchown(fd, user, group);
725}
726
685int open_check_o_direct(struct file *f) 727int open_check_o_direct(struct file *f)
686{ 728{
687 /* NB: we're sure to have correct a_ops only after f_op->open */ 729 /* NB: we're sure to have correct a_ops only after f_op->open */
@@ -1114,7 +1156,7 @@ COMPAT_SYSCALL_DEFINE4(openat, int, dfd, const char __user *, filename, int, fla
1114 */ 1156 */
1115SYSCALL_DEFINE2(creat, const char __user *, pathname, umode_t, mode) 1157SYSCALL_DEFINE2(creat, const char __user *, pathname, umode_t, mode)
1116{ 1158{
1117 return sys_open(pathname, O_CREAT | O_WRONLY | O_TRUNC, mode); 1159 return ksys_open(pathname, O_CREAT | O_WRONLY | O_TRUNC, mode);
1118} 1160}
1119 1161
1120#endif 1162#endif
@@ -1163,7 +1205,6 @@ SYSCALL_DEFINE1(close, unsigned int, fd)
1163 1205
1164 return retval; 1206 return retval;
1165} 1207}
1166EXPORT_SYMBOL(sys_close);
1167 1208
1168/* 1209/*
1169 * This routine simulates a hangup on the tty, to arrange that users 1210 * This routine simulates a hangup on the tty, to arrange that users
diff --git a/fs/pipe.c b/fs/pipe.c
index 7b1954caf388..39d6f431da83 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -841,7 +841,7 @@ int do_pipe_flags(int *fd, int flags)
841 * sys_pipe() is the normal C calling standard for creating 841 * sys_pipe() is the normal C calling standard for creating
842 * a pipe. It's not the way Unix traditionally does this, though. 842 * a pipe. It's not the way Unix traditionally does this, though.
843 */ 843 */
844SYSCALL_DEFINE2(pipe2, int __user *, fildes, int, flags) 844static int do_pipe2(int __user *fildes, int flags)
845{ 845{
846 struct file *files[2]; 846 struct file *files[2];
847 int fd[2]; 847 int fd[2];
@@ -863,9 +863,14 @@ SYSCALL_DEFINE2(pipe2, int __user *, fildes, int, flags)
863 return error; 863 return error;
864} 864}
865 865
866SYSCALL_DEFINE2(pipe2, int __user *, fildes, int, flags)
867{
868 return do_pipe2(fildes, flags);
869}
870
866SYSCALL_DEFINE1(pipe, int __user *, fildes) 871SYSCALL_DEFINE1(pipe, int __user *, fildes)
867{ 872{
868 return sys_pipe2(fildes, 0); 873 return do_pipe2(fildes, 0);
869} 874}
870 875
871static int wait_for_partner(struct pipe_inode_info *pipe, unsigned int *cnt) 876static int wait_for_partner(struct pipe_inode_info *pipe, unsigned int *cnt)
diff --git a/fs/quota/compat.c b/fs/quota/compat.c
index 779caed4f078..c30572857619 100644
--- a/fs/quota/compat.c
+++ b/fs/quota/compat.c
@@ -41,8 +41,9 @@ struct compat_fs_quota_stat {
41 __u16 qs_iwarnlimit; 41 __u16 qs_iwarnlimit;
42}; 42};
43 43
44asmlinkage long sys32_quotactl(unsigned int cmd, const char __user *special, 44COMPAT_SYSCALL_DEFINE4(quotactl32, unsigned int, cmd,
45 qid_t id, void __user *addr) 45 const char __user *, special, qid_t, id,
46 void __user *, addr)
46{ 47{
47 unsigned int cmds; 48 unsigned int cmds;
48 struct if_dqblk __user *dqblk; 49 struct if_dqblk __user *dqblk;
@@ -59,7 +60,7 @@ asmlinkage long sys32_quotactl(unsigned int cmd, const char __user *special,
59 case Q_GETQUOTA: 60 case Q_GETQUOTA:
60 dqblk = compat_alloc_user_space(sizeof(struct if_dqblk)); 61 dqblk = compat_alloc_user_space(sizeof(struct if_dqblk));
61 compat_dqblk = addr; 62 compat_dqblk = addr;
62 ret = sys_quotactl(cmd, special, id, dqblk); 63 ret = kernel_quotactl(cmd, special, id, dqblk);
63 if (ret) 64 if (ret)
64 break; 65 break;
65 if (copy_in_user(compat_dqblk, dqblk, sizeof(*compat_dqblk)) || 66 if (copy_in_user(compat_dqblk, dqblk, sizeof(*compat_dqblk)) ||
@@ -75,12 +76,12 @@ asmlinkage long sys32_quotactl(unsigned int cmd, const char __user *special,
75 get_user(data, &compat_dqblk->dqb_valid) || 76 get_user(data, &compat_dqblk->dqb_valid) ||
76 put_user(data, &dqblk->dqb_valid)) 77 put_user(data, &dqblk->dqb_valid))
77 break; 78 break;
78 ret = sys_quotactl(cmd, special, id, dqblk); 79 ret = kernel_quotactl(cmd, special, id, dqblk);
79 break; 80 break;
80 case Q_XGETQSTAT: 81 case Q_XGETQSTAT:
81 fsqstat = compat_alloc_user_space(sizeof(struct fs_quota_stat)); 82 fsqstat = compat_alloc_user_space(sizeof(struct fs_quota_stat));
82 compat_fsqstat = addr; 83 compat_fsqstat = addr;
83 ret = sys_quotactl(cmd, special, id, fsqstat); 84 ret = kernel_quotactl(cmd, special, id, fsqstat);
84 if (ret) 85 if (ret)
85 break; 86 break;
86 ret = -EFAULT; 87 ret = -EFAULT;
@@ -113,7 +114,7 @@ asmlinkage long sys32_quotactl(unsigned int cmd, const char __user *special,
113 ret = 0; 114 ret = 0;
114 break; 115 break;
115 default: 116 default:
116 ret = sys_quotactl(cmd, special, id, addr); 117 ret = kernel_quotactl(cmd, special, id, addr);
117 } 118 }
118 return ret; 119 return ret;
119} 120}
diff --git a/fs/quota/quota.c b/fs/quota/quota.c
index 43612e2a73af..860bfbe7a07a 100644
--- a/fs/quota/quota.c
+++ b/fs/quota/quota.c
@@ -833,8 +833,8 @@ static struct super_block *quotactl_block(const char __user *special, int cmd)
833 * calls. Maybe we need to add the process quotas etc. in the future, 833 * calls. Maybe we need to add the process quotas etc. in the future,
834 * but we probably should use rlimits for that. 834 * but we probably should use rlimits for that.
835 */ 835 */
836SYSCALL_DEFINE4(quotactl, unsigned int, cmd, const char __user *, special, 836int kernel_quotactl(unsigned int cmd, const char __user *special,
837 qid_t, id, void __user *, addr) 837 qid_t id, void __user *addr)
838{ 838{
839 uint cmds, type; 839 uint cmds, type;
840 struct super_block *sb = NULL; 840 struct super_block *sb = NULL;
@@ -885,3 +885,9 @@ out:
885 path_put(pathp); 885 path_put(pathp);
886 return ret; 886 return ret;
887} 887}
888
889SYSCALL_DEFINE4(quotactl, unsigned int, cmd, const char __user *, special,
890 qid_t, id, void __user *, addr)
891{
892 return kernel_quotactl(cmd, special, id, addr);
893}
diff --git a/fs/read_write.c b/fs/read_write.c
index f8547b82dfb3..c4eabbfc90df 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -301,7 +301,7 @@ loff_t vfs_llseek(struct file *file, loff_t offset, int whence)
301} 301}
302EXPORT_SYMBOL(vfs_llseek); 302EXPORT_SYMBOL(vfs_llseek);
303 303
304SYSCALL_DEFINE3(lseek, unsigned int, fd, off_t, offset, unsigned int, whence) 304off_t ksys_lseek(unsigned int fd, off_t offset, unsigned int whence)
305{ 305{
306 off_t retval; 306 off_t retval;
307 struct fd f = fdget_pos(fd); 307 struct fd f = fdget_pos(fd);
@@ -319,10 +319,15 @@ SYSCALL_DEFINE3(lseek, unsigned int, fd, off_t, offset, unsigned int, whence)
319 return retval; 319 return retval;
320} 320}
321 321
322SYSCALL_DEFINE3(lseek, unsigned int, fd, off_t, offset, unsigned int, whence)
323{
324 return ksys_lseek(fd, offset, whence);
325}
326
322#ifdef CONFIG_COMPAT 327#ifdef CONFIG_COMPAT
323COMPAT_SYSCALL_DEFINE3(lseek, unsigned int, fd, compat_off_t, offset, unsigned int, whence) 328COMPAT_SYSCALL_DEFINE3(lseek, unsigned int, fd, compat_off_t, offset, unsigned int, whence)
324{ 329{
325 return sys_lseek(fd, offset, whence); 330 return ksys_lseek(fd, offset, whence);
326} 331}
327#endif 332#endif
328 333
@@ -563,7 +568,7 @@ static inline void file_pos_write(struct file *file, loff_t pos)
563 file->f_pos = pos; 568 file->f_pos = pos;
564} 569}
565 570
566SYSCALL_DEFINE3(read, unsigned int, fd, char __user *, buf, size_t, count) 571ssize_t ksys_read(unsigned int fd, char __user *buf, size_t count)
567{ 572{
568 struct fd f = fdget_pos(fd); 573 struct fd f = fdget_pos(fd);
569 ssize_t ret = -EBADF; 574 ssize_t ret = -EBADF;
@@ -578,8 +583,12 @@ SYSCALL_DEFINE3(read, unsigned int, fd, char __user *, buf, size_t, count)
578 return ret; 583 return ret;
579} 584}
580 585
581SYSCALL_DEFINE3(write, unsigned int, fd, const char __user *, buf, 586SYSCALL_DEFINE3(read, unsigned int, fd, char __user *, buf, size_t, count)
582 size_t, count) 587{
588 return ksys_read(fd, buf, count);
589}
590
591ssize_t ksys_write(unsigned int fd, const char __user *buf, size_t count)
583{ 592{
584 struct fd f = fdget_pos(fd); 593 struct fd f = fdget_pos(fd);
585 ssize_t ret = -EBADF; 594 ssize_t ret = -EBADF;
@@ -595,8 +604,14 @@ SYSCALL_DEFINE3(write, unsigned int, fd, const char __user *, buf,
595 return ret; 604 return ret;
596} 605}
597 606
598SYSCALL_DEFINE4(pread64, unsigned int, fd, char __user *, buf, 607SYSCALL_DEFINE3(write, unsigned int, fd, const char __user *, buf,
599 size_t, count, loff_t, pos) 608 size_t, count)
609{
610 return ksys_write(fd, buf, count);
611}
612
613ssize_t ksys_pread64(unsigned int fd, char __user *buf, size_t count,
614 loff_t pos)
600{ 615{
601 struct fd f; 616 struct fd f;
602 ssize_t ret = -EBADF; 617 ssize_t ret = -EBADF;
@@ -615,8 +630,14 @@ SYSCALL_DEFINE4(pread64, unsigned int, fd, char __user *, buf,
615 return ret; 630 return ret;
616} 631}
617 632
618SYSCALL_DEFINE4(pwrite64, unsigned int, fd, const char __user *, buf, 633SYSCALL_DEFINE4(pread64, unsigned int, fd, char __user *, buf,
619 size_t, count, loff_t, pos) 634 size_t, count, loff_t, pos)
635{
636 return ksys_pread64(fd, buf, count, pos);
637}
638
639ssize_t ksys_pwrite64(unsigned int fd, const char __user *buf,
640 size_t count, loff_t pos)
620{ 641{
621 struct fd f; 642 struct fd f;
622 ssize_t ret = -EBADF; 643 ssize_t ret = -EBADF;
@@ -635,6 +656,12 @@ SYSCALL_DEFINE4(pwrite64, unsigned int, fd, const char __user *, buf,
635 return ret; 656 return ret;
636} 657}
637 658
659SYSCALL_DEFINE4(pwrite64, unsigned int, fd, const char __user *, buf,
660 size_t, count, loff_t, pos)
661{
662 return ksys_pwrite64(fd, buf, count, pos);
663}
664
638static ssize_t do_iter_readv_writev(struct file *filp, struct iov_iter *iter, 665static ssize_t do_iter_readv_writev(struct file *filp, struct iov_iter *iter,
639 loff_t *ppos, int type, rwf_t flags) 666 loff_t *ppos, int type, rwf_t flags)
640{ 667{
diff --git a/fs/readdir.c b/fs/readdir.c
index 1b83b0ad183b..d97f548e6323 100644
--- a/fs/readdir.c
+++ b/fs/readdir.c
@@ -292,8 +292,8 @@ efault:
292 return -EFAULT; 292 return -EFAULT;
293} 293}
294 294
295SYSCALL_DEFINE3(getdents64, unsigned int, fd, 295int ksys_getdents64(unsigned int fd, struct linux_dirent64 __user *dirent,
296 struct linux_dirent64 __user *, dirent, unsigned int, count) 296 unsigned int count)
297{ 297{
298 struct fd f; 298 struct fd f;
299 struct linux_dirent64 __user * lastdirent; 299 struct linux_dirent64 __user * lastdirent;
@@ -326,6 +326,13 @@ SYSCALL_DEFINE3(getdents64, unsigned int, fd,
326 return error; 326 return error;
327} 327}
328 328
329
330SYSCALL_DEFINE3(getdents64, unsigned int, fd,
331 struct linux_dirent64 __user *, dirent, unsigned int, count)
332{
333 return ksys_getdents64(fd, dirent, count);
334}
335
329#ifdef CONFIG_COMPAT 336#ifdef CONFIG_COMPAT
330struct compat_old_linux_dirent { 337struct compat_old_linux_dirent {
331 compat_ulong_t d_ino; 338 compat_ulong_t d_ino;
diff --git a/fs/select.c b/fs/select.c
index b6c36254028a..ba879c51288f 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -675,8 +675,8 @@ out_nofds:
675 return ret; 675 return ret;
676} 676}
677 677
678SYSCALL_DEFINE5(select, int, n, fd_set __user *, inp, fd_set __user *, outp, 678static int kern_select(int n, fd_set __user *inp, fd_set __user *outp,
679 fd_set __user *, exp, struct timeval __user *, tvp) 679 fd_set __user *exp, struct timeval __user *tvp)
680{ 680{
681 struct timespec64 end_time, *to = NULL; 681 struct timespec64 end_time, *to = NULL;
682 struct timeval tv; 682 struct timeval tv;
@@ -699,6 +699,12 @@ SYSCALL_DEFINE5(select, int, n, fd_set __user *, inp, fd_set __user *, outp,
699 return ret; 699 return ret;
700} 700}
701 701
702SYSCALL_DEFINE5(select, int, n, fd_set __user *, inp, fd_set __user *, outp,
703 fd_set __user *, exp, struct timeval __user *, tvp)
704{
705 return kern_select(n, inp, outp, exp, tvp);
706}
707
702static long do_pselect(int n, fd_set __user *inp, fd_set __user *outp, 708static long do_pselect(int n, fd_set __user *inp, fd_set __user *outp,
703 fd_set __user *exp, struct timespec __user *tsp, 709 fd_set __user *exp, struct timespec __user *tsp,
704 const sigset_t __user *sigmask, size_t sigsetsize) 710 const sigset_t __user *sigmask, size_t sigsetsize)
@@ -784,7 +790,7 @@ SYSCALL_DEFINE1(old_select, struct sel_arg_struct __user *, arg)
784 790
785 if (copy_from_user(&a, arg, sizeof(a))) 791 if (copy_from_user(&a, arg, sizeof(a)))
786 return -EFAULT; 792 return -EFAULT;
787 return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp); 793 return kern_select(a.n, a.inp, a.outp, a.exp, a.tvp);
788} 794}
789#endif 795#endif
790 796
@@ -1259,9 +1265,9 @@ out_nofds:
1259 return ret; 1265 return ret;
1260} 1266}
1261 1267
1262COMPAT_SYSCALL_DEFINE5(select, int, n, compat_ulong_t __user *, inp, 1268static int do_compat_select(int n, compat_ulong_t __user *inp,
1263 compat_ulong_t __user *, outp, compat_ulong_t __user *, exp, 1269 compat_ulong_t __user *outp, compat_ulong_t __user *exp,
1264 struct compat_timeval __user *, tvp) 1270 struct compat_timeval __user *tvp)
1265{ 1271{
1266 struct timespec64 end_time, *to = NULL; 1272 struct timespec64 end_time, *to = NULL;
1267 struct compat_timeval tv; 1273 struct compat_timeval tv;
@@ -1284,6 +1290,13 @@ COMPAT_SYSCALL_DEFINE5(select, int, n, compat_ulong_t __user *, inp,
1284 return ret; 1290 return ret;
1285} 1291}
1286 1292
1293COMPAT_SYSCALL_DEFINE5(select, int, n, compat_ulong_t __user *, inp,
1294 compat_ulong_t __user *, outp, compat_ulong_t __user *, exp,
1295 struct compat_timeval __user *, tvp)
1296{
1297 return do_compat_select(n, inp, outp, exp, tvp);
1298}
1299
1287struct compat_sel_arg_struct { 1300struct compat_sel_arg_struct {
1288 compat_ulong_t n; 1301 compat_ulong_t n;
1289 compat_uptr_t inp; 1302 compat_uptr_t inp;
@@ -1298,8 +1311,8 @@ COMPAT_SYSCALL_DEFINE1(old_select, struct compat_sel_arg_struct __user *, arg)
1298 1311
1299 if (copy_from_user(&a, arg, sizeof(a))) 1312 if (copy_from_user(&a, arg, sizeof(a)))
1300 return -EFAULT; 1313 return -EFAULT;
1301 return compat_sys_select(a.n, compat_ptr(a.inp), compat_ptr(a.outp), 1314 return do_compat_select(a.n, compat_ptr(a.inp), compat_ptr(a.outp),
1302 compat_ptr(a.exp), compat_ptr(a.tvp)); 1315 compat_ptr(a.exp), compat_ptr(a.tvp));
1303} 1316}
1304 1317
1305static long do_compat_pselect(int n, compat_ulong_t __user *inp, 1318static long do_compat_pselect(int n, compat_ulong_t __user *inp,
diff --git a/fs/signalfd.c b/fs/signalfd.c
index 76bf9cc62074..d2187a813376 100644
--- a/fs/signalfd.c
+++ b/fs/signalfd.c
@@ -256,8 +256,8 @@ static const struct file_operations signalfd_fops = {
256 .llseek = noop_llseek, 256 .llseek = noop_llseek,
257}; 257};
258 258
259SYSCALL_DEFINE4(signalfd4, int, ufd, sigset_t __user *, user_mask, 259static int do_signalfd4(int ufd, sigset_t __user *user_mask, size_t sizemask,
260 size_t, sizemask, int, flags) 260 int flags)
261{ 261{
262 sigset_t sigmask; 262 sigset_t sigmask;
263 struct signalfd_ctx *ctx; 263 struct signalfd_ctx *ctx;
@@ -310,17 +310,22 @@ SYSCALL_DEFINE4(signalfd4, int, ufd, sigset_t __user *, user_mask,
310 return ufd; 310 return ufd;
311} 311}
312 312
313SYSCALL_DEFINE4(signalfd4, int, ufd, sigset_t __user *, user_mask,
314 size_t, sizemask, int, flags)
315{
316 return do_signalfd4(ufd, user_mask, sizemask, flags);
317}
318
313SYSCALL_DEFINE3(signalfd, int, ufd, sigset_t __user *, user_mask, 319SYSCALL_DEFINE3(signalfd, int, ufd, sigset_t __user *, user_mask,
314 size_t, sizemask) 320 size_t, sizemask)
315{ 321{
316 return sys_signalfd4(ufd, user_mask, sizemask, 0); 322 return do_signalfd4(ufd, user_mask, sizemask, 0);
317} 323}
318 324
319#ifdef CONFIG_COMPAT 325#ifdef CONFIG_COMPAT
320COMPAT_SYSCALL_DEFINE4(signalfd4, int, ufd, 326static long do_compat_signalfd4(int ufd,
321 const compat_sigset_t __user *,sigmask, 327 const compat_sigset_t __user *sigmask,
322 compat_size_t, sigsetsize, 328 compat_size_t sigsetsize, int flags)
323 int, flags)
324{ 329{
325 sigset_t tmp; 330 sigset_t tmp;
326 sigset_t __user *ksigmask; 331 sigset_t __user *ksigmask;
@@ -333,13 +338,21 @@ COMPAT_SYSCALL_DEFINE4(signalfd4, int, ufd,
333 if (copy_to_user(ksigmask, &tmp, sizeof(sigset_t))) 338 if (copy_to_user(ksigmask, &tmp, sizeof(sigset_t)))
334 return -EFAULT; 339 return -EFAULT;
335 340
336 return sys_signalfd4(ufd, ksigmask, sizeof(sigset_t), flags); 341 return do_signalfd4(ufd, ksigmask, sizeof(sigset_t), flags);
342}
343
344COMPAT_SYSCALL_DEFINE4(signalfd4, int, ufd,
345 const compat_sigset_t __user *, sigmask,
346 compat_size_t, sigsetsize,
347 int, flags)
348{
349 return do_compat_signalfd4(ufd, sigmask, sigsetsize, flags);
337} 350}
338 351
339COMPAT_SYSCALL_DEFINE3(signalfd, int, ufd, 352COMPAT_SYSCALL_DEFINE3(signalfd, int, ufd,
340 const compat_sigset_t __user *,sigmask, 353 const compat_sigset_t __user *,sigmask,
341 compat_size_t, sigsetsize) 354 compat_size_t, sigsetsize)
342{ 355{
343 return compat_sys_signalfd4(ufd, sigmask, sigsetsize, 0); 356 return do_compat_signalfd4(ufd, sigmask, sigsetsize, 0);
344} 357}
345#endif 358#endif
diff --git a/fs/splice.c b/fs/splice.c
index 39e2dc01ac12..005d09cf3fa8 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -1331,8 +1331,8 @@ static long vmsplice_to_pipe(struct file *file, const struct iovec __user *uiov,
1331 * Currently we punt and implement it as a normal copy, see pipe_to_user(). 1331 * Currently we punt and implement it as a normal copy, see pipe_to_user().
1332 * 1332 *
1333 */ 1333 */
1334SYSCALL_DEFINE4(vmsplice, int, fd, const struct iovec __user *, iov, 1334static long do_vmsplice(int fd, const struct iovec __user *iov,
1335 unsigned long, nr_segs, unsigned int, flags) 1335 unsigned long nr_segs, unsigned int flags)
1336{ 1336{
1337 struct fd f; 1337 struct fd f;
1338 long error; 1338 long error;
@@ -1358,6 +1358,12 @@ SYSCALL_DEFINE4(vmsplice, int, fd, const struct iovec __user *, iov,
1358 return error; 1358 return error;
1359} 1359}
1360 1360
1361SYSCALL_DEFINE4(vmsplice, int, fd, const struct iovec __user *, iov,
1362 unsigned long, nr_segs, unsigned int, flags)
1363{
1364 return do_vmsplice(fd, iov, nr_segs, flags);
1365}
1366
1361#ifdef CONFIG_COMPAT 1367#ifdef CONFIG_COMPAT
1362COMPAT_SYSCALL_DEFINE4(vmsplice, int, fd, const struct compat_iovec __user *, iov32, 1368COMPAT_SYSCALL_DEFINE4(vmsplice, int, fd, const struct compat_iovec __user *, iov32,
1363 unsigned int, nr_segs, unsigned int, flags) 1369 unsigned int, nr_segs, unsigned int, flags)
@@ -1375,7 +1381,7 @@ COMPAT_SYSCALL_DEFINE4(vmsplice, int, fd, const struct compat_iovec __user *, io
1375 put_user(v.iov_len, &iov[i].iov_len)) 1381 put_user(v.iov_len, &iov[i].iov_len))
1376 return -EFAULT; 1382 return -EFAULT;
1377 } 1383 }
1378 return sys_vmsplice(fd, iov, nr_segs, flags); 1384 return do_vmsplice(fd, iov, nr_segs, flags);
1379} 1385}
1380#endif 1386#endif
1381 1387
diff --git a/fs/stat.c b/fs/stat.c
index 873785dae022..f8e6fb2c3657 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -379,8 +379,8 @@ SYSCALL_DEFINE2(newfstat, unsigned int, fd, struct stat __user *, statbuf)
379 return error; 379 return error;
380} 380}
381 381
382SYSCALL_DEFINE4(readlinkat, int, dfd, const char __user *, pathname, 382static int do_readlinkat(int dfd, const char __user *pathname,
383 char __user *, buf, int, bufsiz) 383 char __user *buf, int bufsiz)
384{ 384{
385 struct path path; 385 struct path path;
386 int error; 386 int error;
@@ -415,10 +415,16 @@ retry:
415 return error; 415 return error;
416} 416}
417 417
418SYSCALL_DEFINE4(readlinkat, int, dfd, const char __user *, pathname,
419 char __user *, buf, int, bufsiz)
420{
421 return do_readlinkat(dfd, pathname, buf, bufsiz);
422}
423
418SYSCALL_DEFINE3(readlink, const char __user *, path, char __user *, buf, 424SYSCALL_DEFINE3(readlink, const char __user *, path, char __user *, buf,
419 int, bufsiz) 425 int, bufsiz)
420{ 426{
421 return sys_readlinkat(AT_FDCWD, path, buf, bufsiz); 427 return do_readlinkat(AT_FDCWD, path, buf, bufsiz);
422} 428}
423 429
424 430
diff --git a/fs/sync.c b/fs/sync.c
index 6e0a2cbaf6de..9908a114d506 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -105,7 +105,7 @@ static void fdatawait_one_bdev(struct block_device *bdev, void *arg)
105 * just write metadata (such as inodes or bitmaps) to block device page cache 105 * just write metadata (such as inodes or bitmaps) to block device page cache
106 * and do not sync it on their own in ->sync_fs(). 106 * and do not sync it on their own in ->sync_fs().
107 */ 107 */
108SYSCALL_DEFINE0(sync) 108void ksys_sync(void)
109{ 109{
110 int nowait = 0, wait = 1; 110 int nowait = 0, wait = 1;
111 111
@@ -117,6 +117,11 @@ SYSCALL_DEFINE0(sync)
117 iterate_bdevs(fdatawait_one_bdev, NULL); 117 iterate_bdevs(fdatawait_one_bdev, NULL);
118 if (unlikely(laptop_mode)) 118 if (unlikely(laptop_mode))
119 laptop_sync_completion(); 119 laptop_sync_completion();
120}
121
122SYSCALL_DEFINE0(sync)
123{
124 ksys_sync();
120 return 0; 125 return 0;
121} 126}
122 127
@@ -280,8 +285,8 @@ SYSCALL_DEFINE1(fdatasync, unsigned int, fd)
280 * already-instantiated disk blocks, there are no guarantees here that the data 285 * already-instantiated disk blocks, there are no guarantees here that the data
281 * will be available after a crash. 286 * will be available after a crash.
282 */ 287 */
283SYSCALL_DEFINE4(sync_file_range, int, fd, loff_t, offset, loff_t, nbytes, 288int ksys_sync_file_range(int fd, loff_t offset, loff_t nbytes,
284 unsigned int, flags) 289 unsigned int flags)
285{ 290{
286 int ret; 291 int ret;
287 struct fd f; 292 struct fd f;
@@ -359,10 +364,16 @@ out:
359 return ret; 364 return ret;
360} 365}
361 366
367SYSCALL_DEFINE4(sync_file_range, int, fd, loff_t, offset, loff_t, nbytes,
368 unsigned int, flags)
369{
370 return ksys_sync_file_range(fd, offset, nbytes, flags);
371}
372
362/* It would be nice if people remember that not all the world's an i386 373/* It would be nice if people remember that not all the world's an i386
363 when they introduce new system calls */ 374 when they introduce new system calls */
364SYSCALL_DEFINE4(sync_file_range2, int, fd, unsigned int, flags, 375SYSCALL_DEFINE4(sync_file_range2, int, fd, unsigned int, flags,
365 loff_t, offset, loff_t, nbytes) 376 loff_t, offset, loff_t, nbytes)
366{ 377{
367 return sys_sync_file_range(fd, offset, nbytes, flags); 378 return ksys_sync_file_range(fd, offset, nbytes, flags);
368} 379}
diff --git a/fs/utimes.c b/fs/utimes.c
index e4b3d7c2c9f5..69d4b6ba1bfb 100644
--- a/fs/utimes.c
+++ b/fs/utimes.c
@@ -184,8 +184,8 @@ SYSCALL_DEFINE4(utimensat, int, dfd, const char __user *, filename,
184 return do_utimes(dfd, filename, utimes ? tstimes : NULL, flags); 184 return do_utimes(dfd, filename, utimes ? tstimes : NULL, flags);
185} 185}
186 186
187SYSCALL_DEFINE3(futimesat, int, dfd, const char __user *, filename, 187static long do_futimesat(int dfd, const char __user *filename,
188 struct timeval __user *, utimes) 188 struct timeval __user *utimes)
189{ 189{
190 struct timeval times[2]; 190 struct timeval times[2];
191 struct timespec64 tstimes[2]; 191 struct timespec64 tstimes[2];
@@ -212,10 +212,17 @@ SYSCALL_DEFINE3(futimesat, int, dfd, const char __user *, filename,
212 return do_utimes(dfd, filename, utimes ? tstimes : NULL, 0); 212 return do_utimes(dfd, filename, utimes ? tstimes : NULL, 0);
213} 213}
214 214
215
216SYSCALL_DEFINE3(futimesat, int, dfd, const char __user *, filename,
217 struct timeval __user *, utimes)
218{
219 return do_futimesat(dfd, filename, utimes);
220}
221
215SYSCALL_DEFINE2(utimes, char __user *, filename, 222SYSCALL_DEFINE2(utimes, char __user *, filename,
216 struct timeval __user *, utimes) 223 struct timeval __user *, utimes)
217{ 224{
218 return sys_futimesat(AT_FDCWD, filename, utimes); 225 return do_futimesat(AT_FDCWD, filename, utimes);
219} 226}
220 227
221#ifdef CONFIG_COMPAT 228#ifdef CONFIG_COMPAT
@@ -253,7 +260,8 @@ COMPAT_SYSCALL_DEFINE4(utimensat, unsigned int, dfd, const char __user *, filena
253 return do_utimes(dfd, filename, t ? tv : NULL, flags); 260 return do_utimes(dfd, filename, t ? tv : NULL, flags);
254} 261}
255 262
256COMPAT_SYSCALL_DEFINE3(futimesat, unsigned int, dfd, const char __user *, filename, struct compat_timeval __user *, t) 263static long do_compat_futimesat(unsigned int dfd, const char __user *filename,
264 struct compat_timeval __user *t)
257{ 265{
258 struct timespec64 tv[2]; 266 struct timespec64 tv[2];
259 267
@@ -272,8 +280,15 @@ COMPAT_SYSCALL_DEFINE3(futimesat, unsigned int, dfd, const char __user *, filena
272 return do_utimes(dfd, filename, t ? tv : NULL, 0); 280 return do_utimes(dfd, filename, t ? tv : NULL, 0);
273} 281}
274 282
283COMPAT_SYSCALL_DEFINE3(futimesat, unsigned int, dfd,
284 const char __user *, filename,
285 struct compat_timeval __user *, t)
286{
287 return do_compat_futimesat(dfd, filename, t);
288}
289
275COMPAT_SYSCALL_DEFINE2(utimes, const char __user *, filename, struct compat_timeval __user *, t) 290COMPAT_SYSCALL_DEFINE2(utimes, const char __user *, filename, struct compat_timeval __user *, t)
276{ 291{
277 return compat_sys_futimesat(AT_FDCWD, filename, t); 292 return do_compat_futimesat(AT_FDCWD, filename, t);
278} 293}
279#endif 294#endif
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 16c3027074a2..9847c5a013c3 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -33,6 +33,8 @@
33#endif 33#endif
34 34
35#define COMPAT_SYSCALL_DEFINE0(name) \ 35#define COMPAT_SYSCALL_DEFINE0(name) \
36 asmlinkage long compat_sys_##name(void); \
37 ALLOW_ERROR_INJECTION(compat_sys_##name, ERRNO); \
36 asmlinkage long compat_sys_##name(void) 38 asmlinkage long compat_sys_##name(void)
37 39
38#define COMPAT_SYSCALL_DEFINE1(name, ...) \ 40#define COMPAT_SYSCALL_DEFINE1(name, ...) \
@@ -49,8 +51,10 @@
49 COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__) 51 COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
50 52
51#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \ 53#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \
54 asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
52 asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))\ 55 asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))\
53 __attribute__((alias(__stringify(compat_SyS##name)))); \ 56 __attribute__((alias(__stringify(compat_SyS##name)))); \
57 ALLOW_ERROR_INJECTION(compat_sys##name, ERRNO); \
54 static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__));\ 58 static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
55 asmlinkage long compat_SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__));\ 59 asmlinkage long compat_SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__));\
56 asmlinkage long compat_SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__))\ 60 asmlinkage long compat_SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__))\
@@ -305,10 +309,6 @@ extern int put_compat_rusage(const struct rusage *,
305 309
306struct compat_siginfo; 310struct compat_siginfo;
307 311
308extern asmlinkage long compat_sys_waitid(int, compat_pid_t,
309 struct compat_siginfo __user *, int,
310 struct compat_rusage __user *);
311
312struct compat_dirent { 312struct compat_dirent {
313 u32 d_ino; 313 u32 d_ino;
314 compat_off_t d_off; 314 compat_off_t d_off;
@@ -422,87 +422,6 @@ struct compat_msgbuf;
422 422
423extern void compat_exit_robust_list(struct task_struct *curr); 423extern void compat_exit_robust_list(struct task_struct *curr);
424 424
425asmlinkage long
426compat_sys_set_robust_list(struct compat_robust_list_head __user *head,
427 compat_size_t len);
428asmlinkage long
429compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr,
430 compat_size_t __user *len_ptr);
431
432asmlinkage long compat_sys_ipc(u32, int, int, u32, compat_uptr_t, u32);
433asmlinkage long compat_sys_shmat(int shmid, compat_uptr_t shmaddr, int shmflg);
434asmlinkage long compat_sys_semctl(int semid, int semnum, int cmd, int arg);
435asmlinkage long compat_sys_msgsnd(int msqid, compat_uptr_t msgp,
436 compat_ssize_t msgsz, int msgflg);
437asmlinkage long compat_sys_msgrcv(int msqid, compat_uptr_t msgp,
438 compat_ssize_t msgsz, compat_long_t msgtyp, int msgflg);
439long compat_sys_msgctl(int first, int second, void __user *uptr);
440long compat_sys_shmctl(int first, int second, void __user *uptr);
441long compat_sys_semtimedop(int semid, struct sembuf __user *tsems,
442 unsigned nsems, const struct compat_timespec __user *timeout);
443asmlinkage long compat_sys_keyctl(u32 option,
444 u32 arg2, u32 arg3, u32 arg4, u32 arg5);
445asmlinkage long compat_sys_ustat(unsigned dev, struct compat_ustat __user *u32);
446
447asmlinkage ssize_t compat_sys_readv(compat_ulong_t fd,
448 const struct compat_iovec __user *vec, compat_ulong_t vlen);
449asmlinkage ssize_t compat_sys_writev(compat_ulong_t fd,
450 const struct compat_iovec __user *vec, compat_ulong_t vlen);
451asmlinkage ssize_t compat_sys_preadv(compat_ulong_t fd,
452 const struct compat_iovec __user *vec,
453 compat_ulong_t vlen, u32 pos_low, u32 pos_high);
454asmlinkage ssize_t compat_sys_pwritev(compat_ulong_t fd,
455 const struct compat_iovec __user *vec,
456 compat_ulong_t vlen, u32 pos_low, u32 pos_high);
457asmlinkage ssize_t compat_sys_preadv2(compat_ulong_t fd,
458 const struct compat_iovec __user *vec,
459 compat_ulong_t vlen, u32 pos_low, u32 pos_high, rwf_t flags);
460asmlinkage ssize_t compat_sys_pwritev2(compat_ulong_t fd,
461 const struct compat_iovec __user *vec,
462 compat_ulong_t vlen, u32 pos_low, u32 pos_high, rwf_t flags);
463
464#ifdef __ARCH_WANT_COMPAT_SYS_PREADV64
465asmlinkage long compat_sys_preadv64(unsigned long fd,
466 const struct compat_iovec __user *vec,
467 unsigned long vlen, loff_t pos);
468#endif
469
470#ifdef __ARCH_WANT_COMPAT_SYS_PWRITEV64
471asmlinkage long compat_sys_pwritev64(unsigned long fd,
472 const struct compat_iovec __user *vec,
473 unsigned long vlen, loff_t pos);
474#endif
475
476#ifdef __ARCH_WANT_COMPAT_SYS_PREADV64V2
477asmlinkage long compat_sys_readv64v2(unsigned long fd,
478 const struct compat_iovec __user *vec,
479 unsigned long vlen, loff_t pos, rwf_t flags);
480#endif
481
482#ifdef __ARCH_WANT_COMPAT_SYS_PWRITEV64V2
483asmlinkage long compat_sys_pwritev64v2(unsigned long fd,
484 const struct compat_iovec __user *vec,
485 unsigned long vlen, loff_t pos, rwf_t flags);
486#endif
487
488asmlinkage long compat_sys_lseek(unsigned int, compat_off_t, unsigned int);
489
490asmlinkage long compat_sys_execve(const char __user *filename, const compat_uptr_t __user *argv,
491 const compat_uptr_t __user *envp);
492asmlinkage long compat_sys_execveat(int dfd, const char __user *filename,
493 const compat_uptr_t __user *argv,
494 const compat_uptr_t __user *envp, int flags);
495
496asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp,
497 compat_ulong_t __user *outp, compat_ulong_t __user *exp,
498 struct compat_timeval __user *tvp);
499
500asmlinkage long compat_sys_old_select(struct compat_sel_arg_struct __user *arg);
501
502asmlinkage long compat_sys_wait4(compat_pid_t pid,
503 compat_uint_t __user *stat_addr, int options,
504 struct compat_rusage __user *ru);
505
506#define BITS_PER_COMPAT_LONG (8*sizeof(compat_long_t)) 425#define BITS_PER_COMPAT_LONG (8*sizeof(compat_long_t))
507 426
508#define BITS_TO_COMPAT_LONGS(bits) DIV_ROUND_UP(bits, BITS_PER_COMPAT_LONG) 427#define BITS_TO_COMPAT_LONGS(bits) DIV_ROUND_UP(bits, BITS_PER_COMPAT_LONG)
@@ -515,13 +434,6 @@ int copy_siginfo_from_user32(siginfo_t *to, const struct compat_siginfo __user *
515int copy_siginfo_to_user32(struct compat_siginfo __user *to, const siginfo_t *from); 434int copy_siginfo_to_user32(struct compat_siginfo __user *to, const siginfo_t *from);
516int get_compat_sigevent(struct sigevent *event, 435int get_compat_sigevent(struct sigevent *event,
517 const struct compat_sigevent __user *u_event); 436 const struct compat_sigevent __user *u_event);
518long compat_sys_rt_tgsigqueueinfo(compat_pid_t tgid, compat_pid_t pid, int sig,
519 struct compat_siginfo __user *uinfo);
520#ifdef CONFIG_COMPAT_OLD_SIGACTION
521asmlinkage long compat_sys_sigaction(int sig,
522 const struct compat_old_sigaction __user *act,
523 struct compat_old_sigaction __user *oact);
524#endif
525 437
526static inline int compat_timeval_compare(struct compat_timeval *lhs, 438static inline int compat_timeval_compare(struct compat_timeval *lhs,
527 struct compat_timeval *rhs) 439 struct compat_timeval *rhs)
@@ -543,13 +455,6 @@ static inline int compat_timespec_compare(struct compat_timespec *lhs,
543 return lhs->tv_nsec - rhs->tv_nsec; 455 return lhs->tv_nsec - rhs->tv_nsec;
544} 456}
545 457
546asmlinkage long compat_sys_gettimeofday(struct compat_timeval __user *tv,
547 struct timezone __user *tz);
548asmlinkage long compat_sys_settimeofday(struct compat_timeval __user *tv,
549 struct timezone __user *tz);
550
551asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp);
552
553extern int get_compat_sigset(sigset_t *set, const compat_sigset_t __user *compat); 458extern int get_compat_sigset(sigset_t *set, const compat_sigset_t __user *compat);
554 459
555/* 460/*
@@ -575,110 +480,132 @@ put_compat_sigset(compat_sigset_t __user *compat, const sigset_t *set,
575#endif 480#endif
576} 481}
577 482
578asmlinkage long compat_sys_migrate_pages(compat_pid_t pid,
579 compat_ulong_t maxnode, const compat_ulong_t __user *old_nodes,
580 const compat_ulong_t __user *new_nodes);
581
582extern int compat_ptrace_request(struct task_struct *child, 483extern int compat_ptrace_request(struct task_struct *child,
583 compat_long_t request, 484 compat_long_t request,
584 compat_ulong_t addr, compat_ulong_t data); 485 compat_ulong_t addr, compat_ulong_t data);
585 486
586extern long compat_arch_ptrace(struct task_struct *child, compat_long_t request, 487extern long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
587 compat_ulong_t addr, compat_ulong_t data); 488 compat_ulong_t addr, compat_ulong_t data);
588asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid,
589 compat_long_t addr, compat_long_t data);
590 489
591asmlinkage long compat_sys_lookup_dcookie(u32, u32, char __user *, compat_size_t); 490struct epoll_event; /* fortunately, this one is fixed-layout */
491
492extern ssize_t compat_rw_copy_check_uvector(int type,
493 const struct compat_iovec __user *uvector,
494 unsigned long nr_segs,
495 unsigned long fast_segs, struct iovec *fast_pointer,
496 struct iovec **ret_pointer);
497
498extern void __user *compat_alloc_user_space(unsigned long len);
499
500int compat_restore_altstack(const compat_stack_t __user *uss);
501int __compat_save_altstack(compat_stack_t __user *, unsigned long);
502#define compat_save_altstack_ex(uss, sp) do { \
503 compat_stack_t __user *__uss = uss; \
504 struct task_struct *t = current; \
505 put_user_ex(ptr_to_compat((void __user *)t->sas_ss_sp), &__uss->ss_sp); \
506 put_user_ex(t->sas_ss_flags, &__uss->ss_flags); \
507 put_user_ex(t->sas_ss_size, &__uss->ss_size); \
508 if (t->sas_ss_flags & SS_AUTODISARM) \
509 sas_ss_reset(t); \
510} while (0);
511
592/* 512/*
593 * epoll (fs/eventpoll.c) compat bits follow ... 513 * These syscall function prototypes are kept in the same order as
514 * include/uapi/asm-generic/unistd.h. Deprecated or obsolete system calls
515 * go below.
516 *
517 * Please note that these prototypes here are only provided for information
518 * purposes, for static analysis, and for linking from the syscall table.
519 * These functions should not be called elsewhere from kernel code.
594 */ 520 */
595struct epoll_event; /* fortunately, this one is fixed-layout */ 521asmlinkage long compat_sys_io_setup(unsigned nr_reqs, u32 __user *ctx32p);
522asmlinkage long compat_sys_io_submit(compat_aio_context_t ctx_id, int nr,
523 u32 __user *iocb);
524asmlinkage long compat_sys_io_getevents(compat_aio_context_t ctx_id,
525 compat_long_t min_nr,
526 compat_long_t nr,
527 struct io_event __user *events,
528 struct compat_timespec __user *timeout);
529
530/* fs/cookies.c */
531asmlinkage long compat_sys_lookup_dcookie(u32, u32, char __user *, compat_size_t);
532
533/* fs/eventpoll.c */
596asmlinkage long compat_sys_epoll_pwait(int epfd, 534asmlinkage long compat_sys_epoll_pwait(int epfd,
597 struct epoll_event __user *events, 535 struct epoll_event __user *events,
598 int maxevents, int timeout, 536 int maxevents, int timeout,
599 const compat_sigset_t __user *sigmask, 537 const compat_sigset_t __user *sigmask,
600 compat_size_t sigsetsize); 538 compat_size_t sigsetsize);
601 539
602asmlinkage long compat_sys_utime(const char __user *filename, 540/* fs/fcntl.c */
603 struct compat_utimbuf __user *t); 541asmlinkage long compat_sys_fcntl(unsigned int fd, unsigned int cmd,
604asmlinkage long compat_sys_utimensat(unsigned int dfd, 542 compat_ulong_t arg);
605 const char __user *filename, 543asmlinkage long compat_sys_fcntl64(unsigned int fd, unsigned int cmd,
606 struct compat_timespec __user *t, 544 compat_ulong_t arg);
607 int flags);
608 545
609asmlinkage long compat_sys_time(compat_time_t __user *tloc); 546/* fs/ioctl.c */
610asmlinkage long compat_sys_stime(compat_time_t __user *tptr); 547asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd,
611asmlinkage long compat_sys_signalfd(int ufd, 548 compat_ulong_t arg);
612 const compat_sigset_t __user *sigmask,
613 compat_size_t sigsetsize);
614asmlinkage long compat_sys_timerfd_settime(int ufd, int flags,
615 const struct compat_itimerspec __user *utmr,
616 struct compat_itimerspec __user *otmr);
617asmlinkage long compat_sys_timerfd_gettime(int ufd,
618 struct compat_itimerspec __user *otmr);
619 549
620asmlinkage long compat_sys_move_pages(pid_t pid, compat_ulong_t nr_pages, 550/* fs/namespace.c */
621 __u32 __user *pages, 551asmlinkage long compat_sys_mount(const char __user *dev_name,
622 const int __user *nodes, 552 const char __user *dir_name,
623 int __user *status, 553 const char __user *type, compat_ulong_t flags,
624 int flags); 554 const void __user *data);
625asmlinkage long compat_sys_futimesat(unsigned int dfd, 555
626 const char __user *filename, 556/* fs/open.c */
627 struct compat_timeval __user *t);
628asmlinkage long compat_sys_utimes(const char __user *filename,
629 struct compat_timeval __user *t);
630asmlinkage long compat_sys_newstat(const char __user *filename,
631 struct compat_stat __user *statbuf);
632asmlinkage long compat_sys_newlstat(const char __user *filename,
633 struct compat_stat __user *statbuf);
634asmlinkage long compat_sys_newfstatat(unsigned int dfd,
635 const char __user *filename,
636 struct compat_stat __user *statbuf,
637 int flag);
638asmlinkage long compat_sys_newfstat(unsigned int fd,
639 struct compat_stat __user *statbuf);
640asmlinkage long compat_sys_statfs(const char __user *pathname, 557asmlinkage long compat_sys_statfs(const char __user *pathname,
641 struct compat_statfs __user *buf); 558 struct compat_statfs __user *buf);
642asmlinkage long compat_sys_fstatfs(unsigned int fd,
643 struct compat_statfs __user *buf);
644asmlinkage long compat_sys_statfs64(const char __user *pathname, 559asmlinkage long compat_sys_statfs64(const char __user *pathname,
645 compat_size_t sz, 560 compat_size_t sz,
646 struct compat_statfs64 __user *buf); 561 struct compat_statfs64 __user *buf);
562asmlinkage long compat_sys_fstatfs(unsigned int fd,
563 struct compat_statfs __user *buf);
647asmlinkage long compat_sys_fstatfs64(unsigned int fd, compat_size_t sz, 564asmlinkage long compat_sys_fstatfs64(unsigned int fd, compat_size_t sz,
648 struct compat_statfs64 __user *buf); 565 struct compat_statfs64 __user *buf);
649asmlinkage long compat_sys_fcntl64(unsigned int fd, unsigned int cmd, 566asmlinkage long compat_sys_truncate(const char __user *, compat_off_t);
650 compat_ulong_t arg); 567asmlinkage long compat_sys_ftruncate(unsigned int, compat_ulong_t);
651asmlinkage long compat_sys_fcntl(unsigned int fd, unsigned int cmd, 568/* No generic prototype for truncate64, ftruncate64, fallocate */
652 compat_ulong_t arg); 569asmlinkage long compat_sys_openat(int dfd, const char __user *filename,
653asmlinkage long compat_sys_io_setup(unsigned nr_reqs, u32 __user *ctx32p); 570 int flags, umode_t mode);
654asmlinkage long compat_sys_io_getevents(compat_aio_context_t ctx_id, 571
655 compat_long_t min_nr, 572/* fs/readdir.c */
656 compat_long_t nr,
657 struct io_event __user *events,
658 struct compat_timespec __user *timeout);
659asmlinkage long compat_sys_io_submit(compat_aio_context_t ctx_id, int nr,
660 u32 __user *iocb);
661asmlinkage long compat_sys_mount(const char __user *dev_name,
662 const char __user *dir_name,
663 const char __user *type, compat_ulong_t flags,
664 const void __user *data);
665asmlinkage long compat_sys_old_readdir(unsigned int fd,
666 struct compat_old_linux_dirent __user *,
667 unsigned int count);
668asmlinkage long compat_sys_getdents(unsigned int fd, 573asmlinkage long compat_sys_getdents(unsigned int fd,
669 struct compat_linux_dirent __user *dirent, 574 struct compat_linux_dirent __user *dirent,
670 unsigned int count); 575 unsigned int count);
671asmlinkage long compat_sys_vmsplice(int fd, const struct compat_iovec __user *, 576
672 unsigned int nr_segs, unsigned int flags); 577/* fs/read_write.c */
673asmlinkage long compat_sys_open(const char __user *filename, int flags, 578asmlinkage long compat_sys_lseek(unsigned int, compat_off_t, unsigned int);
674 umode_t mode); 579asmlinkage ssize_t compat_sys_readv(compat_ulong_t fd,
675asmlinkage long compat_sys_openat(int dfd, const char __user *filename, 580 const struct compat_iovec __user *vec, compat_ulong_t vlen);
676 int flags, umode_t mode); 581asmlinkage ssize_t compat_sys_writev(compat_ulong_t fd,
677asmlinkage long compat_sys_open_by_handle_at(int mountdirfd, 582 const struct compat_iovec __user *vec, compat_ulong_t vlen);
678 struct file_handle __user *handle, 583/* No generic prototype for pread64 and pwrite64 */
679 int flags); 584asmlinkage ssize_t compat_sys_preadv(compat_ulong_t fd,
680asmlinkage long compat_sys_truncate(const char __user *, compat_off_t); 585 const struct compat_iovec __user *vec,
681asmlinkage long compat_sys_ftruncate(unsigned int, compat_ulong_t); 586 compat_ulong_t vlen, u32 pos_low, u32 pos_high);
587asmlinkage ssize_t compat_sys_pwritev(compat_ulong_t fd,
588 const struct compat_iovec __user *vec,
589 compat_ulong_t vlen, u32 pos_low, u32 pos_high);
590#ifdef __ARCH_WANT_COMPAT_SYS_PREADV64
591asmlinkage long compat_sys_preadv64(unsigned long fd,
592 const struct compat_iovec __user *vec,
593 unsigned long vlen, loff_t pos);
594#endif
595
596#ifdef __ARCH_WANT_COMPAT_SYS_PWRITEV64
597asmlinkage long compat_sys_pwritev64(unsigned long fd,
598 const struct compat_iovec __user *vec,
599 unsigned long vlen, loff_t pos);
600#endif
601
602/* fs/sendfile.c */
603asmlinkage long compat_sys_sendfile(int out_fd, int in_fd,
604 compat_off_t __user *offset, compat_size_t count);
605asmlinkage long compat_sys_sendfile64(int out_fd, int in_fd,
606 compat_loff_t __user *offset, compat_size_t count);
607
608/* fs/select.c */
682asmlinkage long compat_sys_pselect6(int n, compat_ulong_t __user *inp, 609asmlinkage long compat_sys_pselect6(int n, compat_ulong_t __user *inp,
683 compat_ulong_t __user *outp, 610 compat_ulong_t __user *outp,
684 compat_ulong_t __user *exp, 611 compat_ulong_t __user *exp,
@@ -689,110 +616,149 @@ asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds,
689 struct compat_timespec __user *tsp, 616 struct compat_timespec __user *tsp,
690 const compat_sigset_t __user *sigmask, 617 const compat_sigset_t __user *sigmask,
691 compat_size_t sigsetsize); 618 compat_size_t sigsetsize);
619
620/* fs/signalfd.c */
692asmlinkage long compat_sys_signalfd4(int ufd, 621asmlinkage long compat_sys_signalfd4(int ufd,
693 const compat_sigset_t __user *sigmask, 622 const compat_sigset_t __user *sigmask,
694 compat_size_t sigsetsize, int flags); 623 compat_size_t sigsetsize, int flags);
695asmlinkage long compat_sys_get_mempolicy(int __user *policy,
696 compat_ulong_t __user *nmask,
697 compat_ulong_t maxnode,
698 compat_ulong_t addr,
699 compat_ulong_t flags);
700asmlinkage long compat_sys_set_mempolicy(int mode, compat_ulong_t __user *nmask,
701 compat_ulong_t maxnode);
702asmlinkage long compat_sys_mbind(compat_ulong_t start, compat_ulong_t len,
703 compat_ulong_t mode,
704 compat_ulong_t __user *nmask,
705 compat_ulong_t maxnode, compat_ulong_t flags);
706 624
707asmlinkage long compat_sys_setsockopt(int fd, int level, int optname, 625/* fs/splice.c */
708 char __user *optval, unsigned int optlen); 626asmlinkage long compat_sys_vmsplice(int fd, const struct compat_iovec __user *,
709asmlinkage long compat_sys_sendmsg(int fd, struct compat_msghdr __user *msg, 627 unsigned int nr_segs, unsigned int flags);
710 unsigned flags); 628
711asmlinkage long compat_sys_sendmmsg(int fd, struct compat_mmsghdr __user *mmsg, 629/* fs/stat.c */
712 unsigned vlen, unsigned int flags); 630asmlinkage long compat_sys_newfstatat(unsigned int dfd,
713asmlinkage long compat_sys_recvmsg(int fd, struct compat_msghdr __user *msg, 631 const char __user *filename,
714 unsigned int flags); 632 struct compat_stat __user *statbuf,
715asmlinkage long compat_sys_recv(int fd, void __user *buf, compat_size_t len, 633 int flag);
716 unsigned flags); 634asmlinkage long compat_sys_newfstat(unsigned int fd,
717asmlinkage long compat_sys_recvfrom(int fd, void __user *buf, compat_size_t len, 635 struct compat_stat __user *statbuf);
718 unsigned flags, struct sockaddr __user *addr, 636
719 int __user *addrlen); 637/* fs/sync.c: No generic prototype for sync_file_range and sync_file_range2 */
720asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg, 638
721 unsigned vlen, unsigned int flags, 639/* fs/timerfd.c */
722 struct compat_timespec __user *timeout); 640asmlinkage long compat_sys_timerfd_gettime(int ufd,
641 struct compat_itimerspec __user *otmr);
642asmlinkage long compat_sys_timerfd_settime(int ufd, int flags,
643 const struct compat_itimerspec __user *utmr,
644 struct compat_itimerspec __user *otmr);
645
646/* fs/utimes.c */
647asmlinkage long compat_sys_utimensat(unsigned int dfd,
648 const char __user *filename,
649 struct compat_timespec __user *t,
650 int flags);
651
652/* kernel/exit.c */
653asmlinkage long compat_sys_waitid(int, compat_pid_t,
654 struct compat_siginfo __user *, int,
655 struct compat_rusage __user *);
656
657
658
659/* kernel/futex.c */
660asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, u32 val,
661 struct compat_timespec __user *utime, u32 __user *uaddr2,
662 u32 val3);
663asmlinkage long
664compat_sys_set_robust_list(struct compat_robust_list_head __user *head,
665 compat_size_t len);
666asmlinkage long
667compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr,
668 compat_size_t __user *len_ptr);
669
670/* kernel/hrtimer.c */
723asmlinkage long compat_sys_nanosleep(struct compat_timespec __user *rqtp, 671asmlinkage long compat_sys_nanosleep(struct compat_timespec __user *rqtp,
724 struct compat_timespec __user *rmtp); 672 struct compat_timespec __user *rmtp);
673
674/* kernel/itimer.c */
725asmlinkage long compat_sys_getitimer(int which, 675asmlinkage long compat_sys_getitimer(int which,
726 struct compat_itimerval __user *it); 676 struct compat_itimerval __user *it);
727asmlinkage long compat_sys_setitimer(int which, 677asmlinkage long compat_sys_setitimer(int which,
728 struct compat_itimerval __user *in, 678 struct compat_itimerval __user *in,
729 struct compat_itimerval __user *out); 679 struct compat_itimerval __user *out);
730asmlinkage long compat_sys_times(struct compat_tms __user *tbuf); 680
731asmlinkage long compat_sys_setrlimit(unsigned int resource, 681/* kernel/kexec.c */
732 struct compat_rlimit __user *rlim); 682asmlinkage long compat_sys_kexec_load(compat_ulong_t entry,
733asmlinkage long compat_sys_getrlimit(unsigned int resource, 683 compat_ulong_t nr_segments,
734 struct compat_rlimit __user *rlim); 684 struct compat_kexec_segment __user *,
735asmlinkage long compat_sys_getrusage(int who, struct compat_rusage __user *ru); 685 compat_ulong_t flags);
736asmlinkage long compat_sys_sched_setaffinity(compat_pid_t pid, 686
737 unsigned int len, 687/* kernel/posix-timers.c */
738 compat_ulong_t __user *user_mask_ptr);
739asmlinkage long compat_sys_sched_getaffinity(compat_pid_t pid,
740 unsigned int len,
741 compat_ulong_t __user *user_mask_ptr);
742asmlinkage long compat_sys_timer_create(clockid_t which_clock, 688asmlinkage long compat_sys_timer_create(clockid_t which_clock,
743 struct compat_sigevent __user *timer_event_spec, 689 struct compat_sigevent __user *timer_event_spec,
744 timer_t __user *created_timer_id); 690 timer_t __user *created_timer_id);
691asmlinkage long compat_sys_timer_gettime(timer_t timer_id,
692 struct compat_itimerspec __user *setting);
745asmlinkage long compat_sys_timer_settime(timer_t timer_id, int flags, 693asmlinkage long compat_sys_timer_settime(timer_t timer_id, int flags,
746 struct compat_itimerspec __user *new, 694 struct compat_itimerspec __user *new,
747 struct compat_itimerspec __user *old); 695 struct compat_itimerspec __user *old);
748asmlinkage long compat_sys_timer_gettime(timer_t timer_id,
749 struct compat_itimerspec __user *setting);
750asmlinkage long compat_sys_clock_settime(clockid_t which_clock, 696asmlinkage long compat_sys_clock_settime(clockid_t which_clock,
751 struct compat_timespec __user *tp); 697 struct compat_timespec __user *tp);
752asmlinkage long compat_sys_clock_gettime(clockid_t which_clock, 698asmlinkage long compat_sys_clock_gettime(clockid_t which_clock,
753 struct compat_timespec __user *tp); 699 struct compat_timespec __user *tp);
754asmlinkage long compat_sys_clock_adjtime(clockid_t which_clock,
755 struct compat_timex __user *tp);
756asmlinkage long compat_sys_clock_getres(clockid_t which_clock, 700asmlinkage long compat_sys_clock_getres(clockid_t which_clock,
757 struct compat_timespec __user *tp); 701 struct compat_timespec __user *tp);
758asmlinkage long compat_sys_clock_nanosleep(clockid_t which_clock, int flags, 702asmlinkage long compat_sys_clock_nanosleep(clockid_t which_clock, int flags,
759 struct compat_timespec __user *rqtp, 703 struct compat_timespec __user *rqtp,
760 struct compat_timespec __user *rmtp); 704 struct compat_timespec __user *rmtp);
761asmlinkage long compat_sys_rt_sigtimedwait(compat_sigset_t __user *uthese, 705
762 struct compat_siginfo __user *uinfo, 706/* kernel/ptrace.c */
763 struct compat_timespec __user *uts, compat_size_t sigsetsize); 707asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid,
708 compat_long_t addr, compat_long_t data);
709
710/* kernel/sched/core.c */
711asmlinkage long compat_sys_sched_setaffinity(compat_pid_t pid,
712 unsigned int len,
713 compat_ulong_t __user *user_mask_ptr);
714asmlinkage long compat_sys_sched_getaffinity(compat_pid_t pid,
715 unsigned int len,
716 compat_ulong_t __user *user_mask_ptr);
717asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid,
718 struct compat_timespec __user *interval);
719
720/* kernel/signal.c */
721asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr,
722 compat_stack_t __user *uoss_ptr);
764asmlinkage long compat_sys_rt_sigsuspend(compat_sigset_t __user *unewset, 723asmlinkage long compat_sys_rt_sigsuspend(compat_sigset_t __user *unewset,
765 compat_size_t sigsetsize); 724 compat_size_t sigsetsize);
766asmlinkage long compat_sys_rt_sigprocmask(int how, compat_sigset_t __user *set,
767 compat_sigset_t __user *oset,
768 compat_size_t sigsetsize);
769asmlinkage long compat_sys_rt_sigpending(compat_sigset_t __user *uset,
770 compat_size_t sigsetsize);
771#ifndef CONFIG_ODD_RT_SIGACTION 725#ifndef CONFIG_ODD_RT_SIGACTION
772asmlinkage long compat_sys_rt_sigaction(int, 726asmlinkage long compat_sys_rt_sigaction(int,
773 const struct compat_sigaction __user *, 727 const struct compat_sigaction __user *,
774 struct compat_sigaction __user *, 728 struct compat_sigaction __user *,
775 compat_size_t); 729 compat_size_t);
776#endif 730#endif
731asmlinkage long compat_sys_rt_sigprocmask(int how, compat_sigset_t __user *set,
732 compat_sigset_t __user *oset,
733 compat_size_t sigsetsize);
734asmlinkage long compat_sys_rt_sigpending(compat_sigset_t __user *uset,
735 compat_size_t sigsetsize);
736asmlinkage long compat_sys_rt_sigtimedwait(compat_sigset_t __user *uthese,
737 struct compat_siginfo __user *uinfo,
738 struct compat_timespec __user *uts, compat_size_t sigsetsize);
777asmlinkage long compat_sys_rt_sigqueueinfo(compat_pid_t pid, int sig, 739asmlinkage long compat_sys_rt_sigqueueinfo(compat_pid_t pid, int sig,
778 struct compat_siginfo __user *uinfo); 740 struct compat_siginfo __user *uinfo);
741/* No generic prototype for rt_sigreturn */
742
743/* kernel/sys.c */
744asmlinkage long compat_sys_times(struct compat_tms __user *tbuf);
745asmlinkage long compat_sys_getrlimit(unsigned int resource,
746 struct compat_rlimit __user *rlim);
747asmlinkage long compat_sys_setrlimit(unsigned int resource,
748 struct compat_rlimit __user *rlim);
749asmlinkage long compat_sys_getrusage(int who, struct compat_rusage __user *ru);
750
751/* kernel/time.c */
752asmlinkage long compat_sys_gettimeofday(struct compat_timeval __user *tv,
753 struct timezone __user *tz);
754asmlinkage long compat_sys_settimeofday(struct compat_timeval __user *tv,
755 struct timezone __user *tz);
756asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp);
757
758/* kernel/timer.c */
779asmlinkage long compat_sys_sysinfo(struct compat_sysinfo __user *info); 759asmlinkage long compat_sys_sysinfo(struct compat_sysinfo __user *info);
780asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd, 760
781 compat_ulong_t arg); 761/* ipc/mqueue.c */
782asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, u32 val,
783 struct compat_timespec __user *utime, u32 __user *uaddr2,
784 u32 val3);
785asmlinkage long compat_sys_getsockopt(int fd, int level, int optname,
786 char __user *optval, int __user *optlen);
787asmlinkage long compat_sys_kexec_load(compat_ulong_t entry,
788 compat_ulong_t nr_segments,
789 struct compat_kexec_segment __user *,
790 compat_ulong_t flags);
791asmlinkage long compat_sys_mq_getsetattr(mqd_t mqdes,
792 const struct compat_mq_attr __user *u_mqstat,
793 struct compat_mq_attr __user *u_omqstat);
794asmlinkage long compat_sys_mq_notify(mqd_t mqdes,
795 const struct compat_sigevent __user *u_notification);
796asmlinkage long compat_sys_mq_open(const char __user *u_name, 762asmlinkage long compat_sys_mq_open(const char __user *u_name,
797 int oflag, compat_mode_t mode, 763 int oflag, compat_mode_t mode,
798 struct compat_mq_attr __user *u_attr); 764 struct compat_mq_attr __user *u_attr);
@@ -804,17 +770,92 @@ asmlinkage ssize_t compat_sys_mq_timedreceive(mqd_t mqdes,
804 char __user *u_msg_ptr, 770 char __user *u_msg_ptr,
805 compat_size_t msg_len, unsigned int __user *u_msg_prio, 771 compat_size_t msg_len, unsigned int __user *u_msg_prio,
806 const struct compat_timespec __user *u_abs_timeout); 772 const struct compat_timespec __user *u_abs_timeout);
807asmlinkage long compat_sys_socketcall(int call, u32 __user *args); 773asmlinkage long compat_sys_mq_notify(mqd_t mqdes,
808asmlinkage long compat_sys_sysctl(struct compat_sysctl_args __user *args); 774 const struct compat_sigevent __user *u_notification);
775asmlinkage long compat_sys_mq_getsetattr(mqd_t mqdes,
776 const struct compat_mq_attr __user *u_mqstat,
777 struct compat_mq_attr __user *u_omqstat);
809 778
810extern ssize_t compat_rw_copy_check_uvector(int type, 779/* ipc/msg.c */
811 const struct compat_iovec __user *uvector, 780asmlinkage long compat_sys_msgctl(int first, int second, void __user *uptr);
812 unsigned long nr_segs, 781asmlinkage long compat_sys_msgrcv(int msqid, compat_uptr_t msgp,
813 unsigned long fast_segs, struct iovec *fast_pointer, 782 compat_ssize_t msgsz, compat_long_t msgtyp, int msgflg);
814 struct iovec **ret_pointer); 783asmlinkage long compat_sys_msgsnd(int msqid, compat_uptr_t msgp,
784 compat_ssize_t msgsz, int msgflg);
815 785
816extern void __user *compat_alloc_user_space(unsigned long len); 786/* ipc/sem.c */
787asmlinkage long compat_sys_semctl(int semid, int semnum, int cmd, int arg);
788asmlinkage long compat_sys_semtimedop(int semid, struct sembuf __user *tsems,
789 unsigned nsems, const struct compat_timespec __user *timeout);
817 790
791/* ipc/shm.c */
792asmlinkage long compat_sys_shmctl(int first, int second, void __user *uptr);
793asmlinkage long compat_sys_shmat(int shmid, compat_uptr_t shmaddr, int shmflg);
794
795/* net/socket.c */
796asmlinkage long compat_sys_recvfrom(int fd, void __user *buf, compat_size_t len,
797 unsigned flags, struct sockaddr __user *addr,
798 int __user *addrlen);
799asmlinkage long compat_sys_setsockopt(int fd, int level, int optname,
800 char __user *optval, unsigned int optlen);
801asmlinkage long compat_sys_getsockopt(int fd, int level, int optname,
802 char __user *optval, int __user *optlen);
803asmlinkage long compat_sys_sendmsg(int fd, struct compat_msghdr __user *msg,
804 unsigned flags);
805asmlinkage long compat_sys_recvmsg(int fd, struct compat_msghdr __user *msg,
806 unsigned int flags);
807
808/* mm/filemap.c: No generic prototype for readahead */
809
810/* security/keys/keyctl.c */
811asmlinkage long compat_sys_keyctl(u32 option,
812 u32 arg2, u32 arg3, u32 arg4, u32 arg5);
813
814/* arch/example/kernel/sys_example.c */
815asmlinkage long compat_sys_execve(const char __user *filename, const compat_uptr_t __user *argv,
816 const compat_uptr_t __user *envp);
817
818/* mm/fadvise.c: No generic prototype for fadvise64_64 */
819
820/* mm/, CONFIG_MMU only */
821asmlinkage long compat_sys_mbind(compat_ulong_t start, compat_ulong_t len,
822 compat_ulong_t mode,
823 compat_ulong_t __user *nmask,
824 compat_ulong_t maxnode, compat_ulong_t flags);
825asmlinkage long compat_sys_get_mempolicy(int __user *policy,
826 compat_ulong_t __user *nmask,
827 compat_ulong_t maxnode,
828 compat_ulong_t addr,
829 compat_ulong_t flags);
830asmlinkage long compat_sys_set_mempolicy(int mode, compat_ulong_t __user *nmask,
831 compat_ulong_t maxnode);
832asmlinkage long compat_sys_migrate_pages(compat_pid_t pid,
833 compat_ulong_t maxnode, const compat_ulong_t __user *old_nodes,
834 const compat_ulong_t __user *new_nodes);
835asmlinkage long compat_sys_move_pages(pid_t pid, compat_ulong_t nr_pages,
836 __u32 __user *pages,
837 const int __user *nodes,
838 int __user *status,
839 int flags);
840
841asmlinkage long compat_sys_rt_tgsigqueueinfo(compat_pid_t tgid,
842 compat_pid_t pid, int sig,
843 struct compat_siginfo __user *uinfo);
844asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg,
845 unsigned vlen, unsigned int flags,
846 struct compat_timespec __user *timeout);
847asmlinkage long compat_sys_wait4(compat_pid_t pid,
848 compat_uint_t __user *stat_addr, int options,
849 struct compat_rusage __user *ru);
850asmlinkage long compat_sys_fanotify_mark(int, unsigned int, __u32, __u32,
851 int, const char __user *);
852asmlinkage long compat_sys_open_by_handle_at(int mountdirfd,
853 struct file_handle __user *handle,
854 int flags);
855asmlinkage long compat_sys_clock_adjtime(clockid_t which_clock,
856 struct compat_timex __user *tp);
857asmlinkage long compat_sys_sendmmsg(int fd, struct compat_mmsghdr __user *mmsg,
858 unsigned vlen, unsigned int flags);
818asmlinkage ssize_t compat_sys_process_vm_readv(compat_pid_t pid, 859asmlinkage ssize_t compat_sys_process_vm_readv(compat_pid_t pid,
819 const struct compat_iovec __user *lvec, 860 const struct compat_iovec __user *lvec,
820 compat_ulong_t liovcnt, const struct compat_iovec __user *rvec, 861 compat_ulong_t liovcnt, const struct compat_iovec __user *rvec,
@@ -823,14 +864,77 @@ asmlinkage ssize_t compat_sys_process_vm_writev(compat_pid_t pid,
823 const struct compat_iovec __user *lvec, 864 const struct compat_iovec __user *lvec,
824 compat_ulong_t liovcnt, const struct compat_iovec __user *rvec, 865 compat_ulong_t liovcnt, const struct compat_iovec __user *rvec,
825 compat_ulong_t riovcnt, compat_ulong_t flags); 866 compat_ulong_t riovcnt, compat_ulong_t flags);
867asmlinkage long compat_sys_execveat(int dfd, const char __user *filename,
868 const compat_uptr_t __user *argv,
869 const compat_uptr_t __user *envp, int flags);
870asmlinkage ssize_t compat_sys_preadv2(compat_ulong_t fd,
871 const struct compat_iovec __user *vec,
872 compat_ulong_t vlen, u32 pos_low, u32 pos_high, rwf_t flags);
873asmlinkage ssize_t compat_sys_pwritev2(compat_ulong_t fd,
874 const struct compat_iovec __user *vec,
875 compat_ulong_t vlen, u32 pos_low, u32 pos_high, rwf_t flags);
876#ifdef __ARCH_WANT_COMPAT_SYS_PREADV64V2
877asmlinkage long compat_sys_readv64v2(unsigned long fd,
878 const struct compat_iovec __user *vec,
879 unsigned long vlen, loff_t pos, rwf_t flags);
880#endif
826 881
827asmlinkage long compat_sys_sendfile(int out_fd, int in_fd, 882#ifdef __ARCH_WANT_COMPAT_SYS_PWRITEV64V2
828 compat_off_t __user *offset, compat_size_t count); 883asmlinkage long compat_sys_pwritev64v2(unsigned long fd,
829asmlinkage long compat_sys_sendfile64(int out_fd, int in_fd, 884 const struct compat_iovec __user *vec,
830 compat_loff_t __user *offset, compat_size_t count); 885 unsigned long vlen, loff_t pos, rwf_t flags);
831asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr, 886#endif
832 compat_stack_t __user *uoss_ptr); 887
888
889/*
890 * Deprecated system calls which are still defined in
891 * include/uapi/asm-generic/unistd.h and wanted by >= 1 arch
892 */
893
894/* __ARCH_WANT_SYSCALL_NO_AT */
895asmlinkage long compat_sys_open(const char __user *filename, int flags,
896 umode_t mode);
897asmlinkage long compat_sys_utimes(const char __user *filename,
898 struct compat_timeval __user *t);
899
900/* __ARCH_WANT_SYSCALL_NO_FLAGS */
901asmlinkage long compat_sys_signalfd(int ufd,
902 const compat_sigset_t __user *sigmask,
903 compat_size_t sigsetsize);
904
905/* __ARCH_WANT_SYSCALL_OFF_T */
906asmlinkage long compat_sys_newstat(const char __user *filename,
907 struct compat_stat __user *statbuf);
908asmlinkage long compat_sys_newlstat(const char __user *filename,
909 struct compat_stat __user *statbuf);
910
911/* __ARCH_WANT_SYSCALL_DEPRECATED */
912asmlinkage long compat_sys_time(compat_time_t __user *tloc);
913asmlinkage long compat_sys_utime(const char __user *filename,
914 struct compat_utimbuf __user *t);
915asmlinkage long compat_sys_futimesat(unsigned int dfd,
916 const char __user *filename,
917 struct compat_timeval __user *t);
918asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp,
919 compat_ulong_t __user *outp, compat_ulong_t __user *exp,
920 struct compat_timeval __user *tvp);
921asmlinkage long compat_sys_ustat(unsigned dev, struct compat_ustat __user *u32);
922asmlinkage long compat_sys_recv(int fd, void __user *buf, compat_size_t len,
923 unsigned flags);
924asmlinkage long compat_sys_sysctl(struct compat_sysctl_args __user *args);
925
926/* obsolete: fs/readdir.c */
927asmlinkage long compat_sys_old_readdir(unsigned int fd,
928 struct compat_old_linux_dirent __user *,
929 unsigned int count);
930
931/* obsolete: fs/select.c */
932asmlinkage long compat_sys_old_select(struct compat_sel_arg_struct __user *arg);
933
934/* obsolete: ipc */
935asmlinkage long compat_sys_ipc(u32, int, int, u32, compat_uptr_t, u32);
833 936
937/* obsolete: kernel/signal.c */
834#ifdef __ARCH_WANT_SYS_SIGPENDING 938#ifdef __ARCH_WANT_SYS_SIGPENDING
835asmlinkage long compat_sys_sigpending(compat_old_sigset_t __user *set); 939asmlinkage long compat_sys_sigpending(compat_old_sigset_t __user *set);
836#endif 940#endif
@@ -839,26 +943,18 @@ asmlinkage long compat_sys_sigpending(compat_old_sigset_t __user *set);
839asmlinkage long compat_sys_sigprocmask(int how, compat_old_sigset_t __user *nset, 943asmlinkage long compat_sys_sigprocmask(int how, compat_old_sigset_t __user *nset,
840 compat_old_sigset_t __user *oset); 944 compat_old_sigset_t __user *oset);
841#endif 945#endif
946#ifdef CONFIG_COMPAT_OLD_SIGACTION
947asmlinkage long compat_sys_sigaction(int sig,
948 const struct compat_old_sigaction __user *act,
949 struct compat_old_sigaction __user *oact);
950#endif
842 951
843int compat_restore_altstack(const compat_stack_t __user *uss); 952/* obsolete: kernel/time/time.c */
844int __compat_save_altstack(compat_stack_t __user *, unsigned long); 953asmlinkage long compat_sys_stime(compat_time_t __user *tptr);
845#define compat_save_altstack_ex(uss, sp) do { \
846 compat_stack_t __user *__uss = uss; \
847 struct task_struct *t = current; \
848 put_user_ex(ptr_to_compat((void __user *)t->sas_ss_sp), &__uss->ss_sp); \
849 put_user_ex(t->sas_ss_flags, &__uss->ss_flags); \
850 put_user_ex(t->sas_ss_size, &__uss->ss_size); \
851 if (t->sas_ss_flags & SS_AUTODISARM) \
852 sas_ss_reset(t); \
853} while (0);
854
855asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid,
856 struct compat_timespec __user *interval);
857 954
858asmlinkage long compat_sys_fanotify_mark(int, unsigned int, __u32, __u32, 955/* obsolete: net/socket.c */
859 int, const char __user *); 956asmlinkage long compat_sys_socketcall(int call, u32 __user *args);
860 957
861asmlinkage long compat_sys_arch_prctl(int option, unsigned long arg2);
862 958
863/* 959/*
864 * For most but not all architectures, "am I in a compat syscall?" and 960 * For most but not all architectures, "am I in a compat syscall?" and
diff --git a/include/linux/futex.h b/include/linux/futex.h
index c0fb9a24bbd2..821ae502d3d8 100644
--- a/include/linux/futex.h
+++ b/include/linux/futex.h
@@ -9,9 +9,6 @@ struct inode;
9struct mm_struct; 9struct mm_struct;
10struct task_struct; 10struct task_struct;
11 11
12long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,
13 u32 __user *uaddr2, u32 val2, u32 val3);
14
15extern int 12extern int
16handle_futex_death(u32 __user *uaddr, struct task_struct *curr, int pi); 13handle_futex_death(u32 __user *uaddr, struct task_struct *curr, int pi);
17 14
@@ -55,6 +52,9 @@ union futex_key {
55 52
56#ifdef CONFIG_FUTEX 53#ifdef CONFIG_FUTEX
57extern void exit_robust_list(struct task_struct *curr); 54extern void exit_robust_list(struct task_struct *curr);
55
56long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,
57 u32 __user *uaddr2, u32 val2, u32 val3);
58#ifdef CONFIG_HAVE_FUTEX_CMPXCHG 58#ifdef CONFIG_HAVE_FUTEX_CMPXCHG
59#define futex_cmpxchg_enabled 1 59#define futex_cmpxchg_enabled 1
60#else 60#else
@@ -64,6 +64,13 @@ extern int futex_cmpxchg_enabled;
64static inline void exit_robust_list(struct task_struct *curr) 64static inline void exit_robust_list(struct task_struct *curr)
65{ 65{
66} 66}
67
68static inline long do_futex(u32 __user *uaddr, int op, u32 val,
69 ktime_t *timeout, u32 __user *uaddr2,
70 u32 val2, u32 val3)
71{
72 return -EINVAL;
73}
67#endif 74#endif
68 75
69#ifdef CONFIG_FUTEX_PI 76#ifdef CONFIG_FUTEX_PI
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index f16f6ceb3875..0ebcbeb21056 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -223,10 +223,6 @@ struct kimage {
223extern void machine_kexec(struct kimage *image); 223extern void machine_kexec(struct kimage *image);
224extern int machine_kexec_prepare(struct kimage *image); 224extern int machine_kexec_prepare(struct kimage *image);
225extern void machine_kexec_cleanup(struct kimage *image); 225extern void machine_kexec_cleanup(struct kimage *image);
226extern asmlinkage long sys_kexec_load(unsigned long entry,
227 unsigned long nr_segments,
228 struct kexec_segment __user *segments,
229 unsigned long flags);
230extern int kernel_kexec(void); 226extern int kernel_kexec(void);
231extern struct page *kimage_alloc_control_pages(struct kimage *image, 227extern struct page *kimage_alloc_control_pages(struct kimage *image,
232 unsigned int order); 228 unsigned int order);
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index 2fb6fb11132e..dc905a4ff8d7 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -27,6 +27,9 @@ static inline bool is_quota_modification(struct inode *inode, struct iattr *ia)
27 (ia->ia_valid & ATTR_GID && !gid_eq(ia->ia_gid, inode->i_gid)); 27 (ia->ia_valid & ATTR_GID && !gid_eq(ia->ia_gid, inode->i_gid));
28} 28}
29 29
30int kernel_quotactl(unsigned int cmd, const char __user *special,
31 qid_t id, void __user *addr);
32
30#if defined(CONFIG_QUOTA) 33#if defined(CONFIG_QUOTA)
31 34
32#define quota_error(sb, fmt, args...) \ 35#define quota_error(sb, fmt, args...) \
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 9286a5a8c60c..e2b6bd4fe977 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -346,11 +346,40 @@ extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data);
346 346
347struct timespec; 347struct timespec;
348 348
349/* The __sys_...msg variants allow MSG_CMSG_COMPAT */ 349/* The __sys_...msg variants allow MSG_CMSG_COMPAT iff
350extern long __sys_recvmsg(int fd, struct user_msghdr __user *msg, unsigned flags); 350 * forbid_cmsg_compat==false
351extern long __sys_sendmsg(int fd, struct user_msghdr __user *msg, unsigned flags); 351 */
352extern long __sys_recvmsg(int fd, struct user_msghdr __user *msg,
353 unsigned int flags, bool forbid_cmsg_compat);
354extern long __sys_sendmsg(int fd, struct user_msghdr __user *msg,
355 unsigned int flags, bool forbid_cmsg_compat);
352extern int __sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen, 356extern int __sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen,
353 unsigned int flags, struct timespec *timeout); 357 unsigned int flags, struct timespec *timeout);
354extern int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg, 358extern int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg,
355 unsigned int vlen, unsigned int flags); 359 unsigned int vlen, unsigned int flags,
360 bool forbid_cmsg_compat);
361
362/* helpers which do the actual work for syscalls */
363extern int __sys_recvfrom(int fd, void __user *ubuf, size_t size,
364 unsigned int flags, struct sockaddr __user *addr,
365 int __user *addr_len);
366extern int __sys_sendto(int fd, void __user *buff, size_t len,
367 unsigned int flags, struct sockaddr __user *addr,
368 int addr_len);
369extern int __sys_accept4(int fd, struct sockaddr __user *upeer_sockaddr,
370 int __user *upeer_addrlen, int flags);
371extern int __sys_socket(int family, int type, int protocol);
372extern int __sys_bind(int fd, struct sockaddr __user *umyaddr, int addrlen);
373extern int __sys_connect(int fd, struct sockaddr __user *uservaddr,
374 int addrlen);
375extern int __sys_listen(int fd, int backlog);
376extern int __sys_getsockname(int fd, struct sockaddr __user *usockaddr,
377 int __user *usockaddr_len);
378extern int __sys_getpeername(int fd, struct sockaddr __user *usockaddr,
379 int __user *usockaddr_len);
380extern int __sys_socketpair(int family, int type, int protocol,
381 int __user *usockvec);
382extern int __sys_shutdown(int fd, int how);
383
384
356#endif /* _LINUX_SOCKET_H */ 385#endif /* _LINUX_SOCKET_H */
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index a78186d826d7..b961184f597a 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -191,6 +191,8 @@ static inline int is_syscall_trace_event(struct trace_event_call *tp_event)
191 191
192#define SYSCALL_DEFINE0(sname) \ 192#define SYSCALL_DEFINE0(sname) \
193 SYSCALL_METADATA(_##sname, 0); \ 193 SYSCALL_METADATA(_##sname, 0); \
194 asmlinkage long sys_##sname(void); \
195 ALLOW_ERROR_INJECTION(sys_##sname, ERRNO); \
194 asmlinkage long sys_##sname(void) 196 asmlinkage long sys_##sname(void)
195 197
196#define SYSCALL_DEFINE1(name, ...) SYSCALL_DEFINEx(1, _##name, __VA_ARGS__) 198#define SYSCALL_DEFINE1(name, ...) SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
@@ -210,6 +212,7 @@ static inline int is_syscall_trace_event(struct trace_event_call *tp_event)
210#define __SYSCALL_DEFINEx(x, name, ...) \ 212#define __SYSCALL_DEFINEx(x, name, ...) \
211 asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \ 213 asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \
212 __attribute__((alias(__stringify(SyS##name)))); \ 214 __attribute__((alias(__stringify(SyS##name)))); \
215 ALLOW_ERROR_INJECTION(sys##name, ERRNO); \
213 static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \ 216 static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \
214 asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \ 217 asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \
215 asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \ 218 asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
@@ -241,63 +244,292 @@ static inline void addr_limit_user_check(void)
241#endif 244#endif
242} 245}
243 246
244asmlinkage long sys32_quotactl(unsigned int cmd, const char __user *special, 247/*
245 qid_t id, void __user *addr); 248 * These syscall function prototypes are kept in the same order as
246asmlinkage long sys_time(time_t __user *tloc); 249 * include/uapi/asm-generic/unistd.h. Architecture specific entries go below,
247asmlinkage long sys_stime(time_t __user *tptr); 250 * followed by deprecated or obsolete system calls.
248asmlinkage long sys_gettimeofday(struct timeval __user *tv, 251 *
249 struct timezone __user *tz); 252 * Please note that these prototypes here are only provided for information
250asmlinkage long sys_settimeofday(struct timeval __user *tv, 253 * purposes, for static analysis, and for linking from the syscall table.
251 struct timezone __user *tz); 254 * These functions should not be called elsewhere from kernel code.
252asmlinkage long sys_adjtimex(struct timex __user *txc_p); 255 */
256asmlinkage long sys_io_setup(unsigned nr_reqs, aio_context_t __user *ctx);
257asmlinkage long sys_io_destroy(aio_context_t ctx);
258asmlinkage long sys_io_submit(aio_context_t, long,
259 struct iocb __user * __user *);
260asmlinkage long sys_io_cancel(aio_context_t ctx_id, struct iocb __user *iocb,
261 struct io_event __user *result);
262asmlinkage long sys_io_getevents(aio_context_t ctx_id,
263 long min_nr,
264 long nr,
265 struct io_event __user *events,
266 struct timespec __user *timeout);
253 267
254asmlinkage long sys_times(struct tms __user *tbuf); 268/* fs/xattr.c */
269asmlinkage long sys_setxattr(const char __user *path, const char __user *name,
270 const void __user *value, size_t size, int flags);
271asmlinkage long sys_lsetxattr(const char __user *path, const char __user *name,
272 const void __user *value, size_t size, int flags);
273asmlinkage long sys_fsetxattr(int fd, const char __user *name,
274 const void __user *value, size_t size, int flags);
275asmlinkage long sys_getxattr(const char __user *path, const char __user *name,
276 void __user *value, size_t size);
277asmlinkage long sys_lgetxattr(const char __user *path, const char __user *name,
278 void __user *value, size_t size);
279asmlinkage long sys_fgetxattr(int fd, const char __user *name,
280 void __user *value, size_t size);
281asmlinkage long sys_listxattr(const char __user *path, char __user *list,
282 size_t size);
283asmlinkage long sys_llistxattr(const char __user *path, char __user *list,
284 size_t size);
285asmlinkage long sys_flistxattr(int fd, char __user *list, size_t size);
286asmlinkage long sys_removexattr(const char __user *path,
287 const char __user *name);
288asmlinkage long sys_lremovexattr(const char __user *path,
289 const char __user *name);
290asmlinkage long sys_fremovexattr(int fd, const char __user *name);
255 291
256asmlinkage long sys_gettid(void); 292/* fs/dcache.c */
257asmlinkage long sys_nanosleep(struct timespec __user *rqtp, struct timespec __user *rmtp); 293asmlinkage long sys_getcwd(char __user *buf, unsigned long size);
258asmlinkage long sys_alarm(unsigned int seconds);
259asmlinkage long sys_getpid(void);
260asmlinkage long sys_getppid(void);
261asmlinkage long sys_getuid(void);
262asmlinkage long sys_geteuid(void);
263asmlinkage long sys_getgid(void);
264asmlinkage long sys_getegid(void);
265asmlinkage long sys_getresuid(uid_t __user *ruid, uid_t __user *euid, uid_t __user *suid);
266asmlinkage long sys_getresgid(gid_t __user *rgid, gid_t __user *egid, gid_t __user *sgid);
267asmlinkage long sys_getpgid(pid_t pid);
268asmlinkage long sys_getpgrp(void);
269asmlinkage long sys_getsid(pid_t pid);
270asmlinkage long sys_getgroups(int gidsetsize, gid_t __user *grouplist);
271 294
272asmlinkage long sys_setregid(gid_t rgid, gid_t egid); 295/* fs/cookies.c */
273asmlinkage long sys_setgid(gid_t gid); 296asmlinkage long sys_lookup_dcookie(u64 cookie64, char __user *buf, size_t len);
274asmlinkage long sys_setreuid(uid_t ruid, uid_t euid); 297
275asmlinkage long sys_setuid(uid_t uid); 298/* fs/eventfd.c */
276asmlinkage long sys_setresuid(uid_t ruid, uid_t euid, uid_t suid); 299asmlinkage long sys_eventfd2(unsigned int count, int flags);
277asmlinkage long sys_setresgid(gid_t rgid, gid_t egid, gid_t sgid); 300
278asmlinkage long sys_setfsuid(uid_t uid); 301/* fs/eventpoll.c */
279asmlinkage long sys_setfsgid(gid_t gid); 302asmlinkage long sys_epoll_create1(int flags);
280asmlinkage long sys_setpgid(pid_t pid, pid_t pgid); 303asmlinkage long sys_epoll_ctl(int epfd, int op, int fd,
281asmlinkage long sys_setsid(void); 304 struct epoll_event __user *event);
282asmlinkage long sys_setgroups(int gidsetsize, gid_t __user *grouplist); 305asmlinkage long sys_epoll_pwait(int epfd, struct epoll_event __user *events,
306 int maxevents, int timeout,
307 const sigset_t __user *sigmask,
308 size_t sigsetsize);
309
310/* fs/fcntl.c */
311asmlinkage long sys_dup(unsigned int fildes);
312asmlinkage long sys_dup3(unsigned int oldfd, unsigned int newfd, int flags);
313asmlinkage long sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg);
314#if BITS_PER_LONG == 32
315asmlinkage long sys_fcntl64(unsigned int fd,
316 unsigned int cmd, unsigned long arg);
317#endif
318
319/* fs/inotify_user.c */
320asmlinkage long sys_inotify_init1(int flags);
321asmlinkage long sys_inotify_add_watch(int fd, const char __user *path,
322 u32 mask);
323asmlinkage long sys_inotify_rm_watch(int fd, __s32 wd);
324
325/* fs/ioctl.c */
326asmlinkage long sys_ioctl(unsigned int fd, unsigned int cmd,
327 unsigned long arg);
328
329/* fs/ioprio.c */
330asmlinkage long sys_ioprio_set(int which, int who, int ioprio);
331asmlinkage long sys_ioprio_get(int which, int who);
332
333/* fs/locks.c */
334asmlinkage long sys_flock(unsigned int fd, unsigned int cmd);
335
336/* fs/namei.c */
337asmlinkage long sys_mknodat(int dfd, const char __user * filename, umode_t mode,
338 unsigned dev);
339asmlinkage long sys_mkdirat(int dfd, const char __user * pathname, umode_t mode);
340asmlinkage long sys_unlinkat(int dfd, const char __user * pathname, int flag);
341asmlinkage long sys_symlinkat(const char __user * oldname,
342 int newdfd, const char __user * newname);
343asmlinkage long sys_linkat(int olddfd, const char __user *oldname,
344 int newdfd, const char __user *newname, int flags);
345asmlinkage long sys_renameat(int olddfd, const char __user * oldname,
346 int newdfd, const char __user * newname);
347
348/* fs/namespace.c */
349asmlinkage long sys_umount(char __user *name, int flags);
350asmlinkage long sys_mount(char __user *dev_name, char __user *dir_name,
351 char __user *type, unsigned long flags,
352 void __user *data);
353asmlinkage long sys_pivot_root(const char __user *new_root,
354 const char __user *put_old);
355
356/* fs/nfsctl.c */
283 357
358/* fs/open.c */
359asmlinkage long sys_statfs(const char __user * path,
360 struct statfs __user *buf);
361asmlinkage long sys_statfs64(const char __user *path, size_t sz,
362 struct statfs64 __user *buf);
363asmlinkage long sys_fstatfs(unsigned int fd, struct statfs __user *buf);
364asmlinkage long sys_fstatfs64(unsigned int fd, size_t sz,
365 struct statfs64 __user *buf);
366asmlinkage long sys_truncate(const char __user *path, long length);
367asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length);
368#if BITS_PER_LONG == 32
369asmlinkage long sys_truncate64(const char __user *path, loff_t length);
370asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length);
371#endif
372asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len);
373asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode);
374asmlinkage long sys_chdir(const char __user *filename);
375asmlinkage long sys_fchdir(unsigned int fd);
376asmlinkage long sys_chroot(const char __user *filename);
377asmlinkage long sys_fchmod(unsigned int fd, umode_t mode);
378asmlinkage long sys_fchmodat(int dfd, const char __user * filename,
379 umode_t mode);
380asmlinkage long sys_fchownat(int dfd, const char __user *filename, uid_t user,
381 gid_t group, int flag);
382asmlinkage long sys_fchown(unsigned int fd, uid_t user, gid_t group);
383asmlinkage long sys_openat(int dfd, const char __user *filename, int flags,
384 umode_t mode);
385asmlinkage long sys_close(unsigned int fd);
386asmlinkage long sys_vhangup(void);
387
388/* fs/pipe.c */
389asmlinkage long sys_pipe2(int __user *fildes, int flags);
390
391/* fs/quota.c */
392asmlinkage long sys_quotactl(unsigned int cmd, const char __user *special,
393 qid_t id, void __user *addr);
394
395/* fs/readdir.c */
396asmlinkage long sys_getdents64(unsigned int fd,
397 struct linux_dirent64 __user *dirent,
398 unsigned int count);
399
400/* fs/read_write.c */
401asmlinkage long sys_llseek(unsigned int fd, unsigned long offset_high,
402 unsigned long offset_low, loff_t __user *result,
403 unsigned int whence);
404asmlinkage long sys_lseek(unsigned int fd, off_t offset,
405 unsigned int whence);
406asmlinkage long sys_read(unsigned int fd, char __user *buf, size_t count);
407asmlinkage long sys_write(unsigned int fd, const char __user *buf,
408 size_t count);
409asmlinkage long sys_readv(unsigned long fd,
410 const struct iovec __user *vec,
411 unsigned long vlen);
412asmlinkage long sys_writev(unsigned long fd,
413 const struct iovec __user *vec,
414 unsigned long vlen);
415asmlinkage long sys_pread64(unsigned int fd, char __user *buf,
416 size_t count, loff_t pos);
417asmlinkage long sys_pwrite64(unsigned int fd, const char __user *buf,
418 size_t count, loff_t pos);
419asmlinkage long sys_preadv(unsigned long fd, const struct iovec __user *vec,
420 unsigned long vlen, unsigned long pos_l, unsigned long pos_h);
421asmlinkage long sys_pwritev(unsigned long fd, const struct iovec __user *vec,
422 unsigned long vlen, unsigned long pos_l, unsigned long pos_h);
423
424/* fs/sendfile.c */
425asmlinkage long sys_sendfile64(int out_fd, int in_fd,
426 loff_t __user *offset, size_t count);
427
428/* fs/select.c */
429asmlinkage long sys_pselect6(int, fd_set __user *, fd_set __user *,
430 fd_set __user *, struct timespec __user *,
431 void __user *);
432asmlinkage long sys_ppoll(struct pollfd __user *, unsigned int,
433 struct timespec __user *, const sigset_t __user *,
434 size_t);
435
436/* fs/signalfd.c */
437asmlinkage long sys_signalfd4(int ufd, sigset_t __user *user_mask, size_t sizemask, int flags);
438
439/* fs/splice.c */
440asmlinkage long sys_vmsplice(int fd, const struct iovec __user *iov,
441 unsigned long nr_segs, unsigned int flags);
442asmlinkage long sys_splice(int fd_in, loff_t __user *off_in,
443 int fd_out, loff_t __user *off_out,
444 size_t len, unsigned int flags);
445asmlinkage long sys_tee(int fdin, int fdout, size_t len, unsigned int flags);
446
447/* fs/stat.c */
448asmlinkage long sys_readlinkat(int dfd, const char __user *path, char __user *buf,
449 int bufsiz);
450asmlinkage long sys_newfstatat(int dfd, const char __user *filename,
451 struct stat __user *statbuf, int flag);
452asmlinkage long sys_newfstat(unsigned int fd, struct stat __user *statbuf);
453#if defined(__ARCH_WANT_STAT64) || defined(__ARCH_WANT_COMPAT_STAT64)
454asmlinkage long sys_fstat64(unsigned long fd, struct stat64 __user *statbuf);
455asmlinkage long sys_fstatat64(int dfd, const char __user *filename,
456 struct stat64 __user *statbuf, int flag);
457#endif
458
459/* fs/sync.c */
460asmlinkage long sys_sync(void);
461asmlinkage long sys_fsync(unsigned int fd);
462asmlinkage long sys_fdatasync(unsigned int fd);
463asmlinkage long sys_sync_file_range2(int fd, unsigned int flags,
464 loff_t offset, loff_t nbytes);
465asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t nbytes,
466 unsigned int flags);
467
468/* fs/timerfd.c */
469asmlinkage long sys_timerfd_create(int clockid, int flags);
470asmlinkage long sys_timerfd_settime(int ufd, int flags,
471 const struct itimerspec __user *utmr,
472 struct itimerspec __user *otmr);
473asmlinkage long sys_timerfd_gettime(int ufd, struct itimerspec __user *otmr);
474
475/* fs/utimes.c */
476asmlinkage long sys_utimensat(int dfd, const char __user *filename,
477 struct timespec __user *utimes, int flags);
478
479/* kernel/acct.c */
284asmlinkage long sys_acct(const char __user *name); 480asmlinkage long sys_acct(const char __user *name);
481
482/* kernel/capability.c */
285asmlinkage long sys_capget(cap_user_header_t header, 483asmlinkage long sys_capget(cap_user_header_t header,
286 cap_user_data_t dataptr); 484 cap_user_data_t dataptr);
287asmlinkage long sys_capset(cap_user_header_t header, 485asmlinkage long sys_capset(cap_user_header_t header,
288 const cap_user_data_t data); 486 const cap_user_data_t data);
487
488/* kernel/exec_domain.c */
289asmlinkage long sys_personality(unsigned int personality); 489asmlinkage long sys_personality(unsigned int personality);
290 490
291asmlinkage long sys_sigpending(old_sigset_t __user *set); 491/* kernel/exit.c */
292asmlinkage long sys_sigprocmask(int how, old_sigset_t __user *set, 492asmlinkage long sys_exit(int error_code);
293 old_sigset_t __user *oset); 493asmlinkage long sys_exit_group(int error_code);
294asmlinkage long sys_sigaltstack(const struct sigaltstack __user *uss, 494asmlinkage long sys_waitid(int which, pid_t pid,
295 struct sigaltstack __user *uoss); 495 struct siginfo __user *infop,
496 int options, struct rusage __user *ru);
296 497
498/* kernel/fork.c */
499asmlinkage long sys_set_tid_address(int __user *tidptr);
500asmlinkage long sys_unshare(unsigned long unshare_flags);
501
502/* kernel/futex.c */
503asmlinkage long sys_futex(u32 __user *uaddr, int op, u32 val,
504 struct timespec __user *utime, u32 __user *uaddr2,
505 u32 val3);
506asmlinkage long sys_get_robust_list(int pid,
507 struct robust_list_head __user * __user *head_ptr,
508 size_t __user *len_ptr);
509asmlinkage long sys_set_robust_list(struct robust_list_head __user *head,
510 size_t len);
511
512/* kernel/hrtimer.c */
513asmlinkage long sys_nanosleep(struct timespec __user *rqtp, struct timespec __user *rmtp);
514
515/* kernel/itimer.c */
297asmlinkage long sys_getitimer(int which, struct itimerval __user *value); 516asmlinkage long sys_getitimer(int which, struct itimerval __user *value);
298asmlinkage long sys_setitimer(int which, 517asmlinkage long sys_setitimer(int which,
299 struct itimerval __user *value, 518 struct itimerval __user *value,
300 struct itimerval __user *ovalue); 519 struct itimerval __user *ovalue);
520
521/* kernel/kexec.c */
522asmlinkage long sys_kexec_load(unsigned long entry, unsigned long nr_segments,
523 struct kexec_segment __user *segments,
524 unsigned long flags);
525
526/* kernel/module.c */
527asmlinkage long sys_init_module(void __user *umod, unsigned long len,
528 const char __user *uargs);
529asmlinkage long sys_delete_module(const char __user *name_user,
530 unsigned int flags);
531
532/* kernel/posix-timers.c */
301asmlinkage long sys_timer_create(clockid_t which_clock, 533asmlinkage long sys_timer_create(clockid_t which_clock,
302 struct sigevent __user *timer_event_spec, 534 struct sigevent __user *timer_event_spec,
303 timer_t __user * created_timer_id); 535 timer_t __user * created_timer_id);
@@ -312,29 +544,27 @@ asmlinkage long sys_clock_settime(clockid_t which_clock,
312 const struct timespec __user *tp); 544 const struct timespec __user *tp);
313asmlinkage long sys_clock_gettime(clockid_t which_clock, 545asmlinkage long sys_clock_gettime(clockid_t which_clock,
314 struct timespec __user *tp); 546 struct timespec __user *tp);
315asmlinkage long sys_clock_adjtime(clockid_t which_clock,
316 struct timex __user *tx);
317asmlinkage long sys_clock_getres(clockid_t which_clock, 547asmlinkage long sys_clock_getres(clockid_t which_clock,
318 struct timespec __user *tp); 548 struct timespec __user *tp);
319asmlinkage long sys_clock_nanosleep(clockid_t which_clock, int flags, 549asmlinkage long sys_clock_nanosleep(clockid_t which_clock, int flags,
320 const struct timespec __user *rqtp, 550 const struct timespec __user *rqtp,
321 struct timespec __user *rmtp); 551 struct timespec __user *rmtp);
322 552
323asmlinkage long sys_nice(int increment); 553/* kernel/printk.c */
324asmlinkage long sys_sched_setscheduler(pid_t pid, int policy, 554asmlinkage long sys_syslog(int type, char __user *buf, int len);
325 struct sched_param __user *param); 555
556/* kernel/ptrace.c */
557asmlinkage long sys_ptrace(long request, long pid, unsigned long addr,
558 unsigned long data);
559/* kernel/sched/core.c */
560
326asmlinkage long sys_sched_setparam(pid_t pid, 561asmlinkage long sys_sched_setparam(pid_t pid,
327 struct sched_param __user *param); 562 struct sched_param __user *param);
328asmlinkage long sys_sched_setattr(pid_t pid, 563asmlinkage long sys_sched_setscheduler(pid_t pid, int policy,
329 struct sched_attr __user *attr, 564 struct sched_param __user *param);
330 unsigned int flags);
331asmlinkage long sys_sched_getscheduler(pid_t pid); 565asmlinkage long sys_sched_getscheduler(pid_t pid);
332asmlinkage long sys_sched_getparam(pid_t pid, 566asmlinkage long sys_sched_getparam(pid_t pid,
333 struct sched_param __user *param); 567 struct sched_param __user *param);
334asmlinkage long sys_sched_getattr(pid_t pid,
335 struct sched_attr __user *attr,
336 unsigned int size,
337 unsigned int flags);
338asmlinkage long sys_sched_setaffinity(pid_t pid, unsigned int len, 568asmlinkage long sys_sched_setaffinity(pid_t pid, unsigned int len,
339 unsigned long __user *user_mask_ptr); 569 unsigned long __user *user_mask_ptr);
340asmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len, 570asmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len,
@@ -344,54 +574,15 @@ asmlinkage long sys_sched_get_priority_max(int policy);
344asmlinkage long sys_sched_get_priority_min(int policy); 574asmlinkage long sys_sched_get_priority_min(int policy);
345asmlinkage long sys_sched_rr_get_interval(pid_t pid, 575asmlinkage long sys_sched_rr_get_interval(pid_t pid,
346 struct timespec __user *interval); 576 struct timespec __user *interval);
347asmlinkage long sys_setpriority(int which, int who, int niceval);
348asmlinkage long sys_getpriority(int which, int who);
349 577
350asmlinkage long sys_shutdown(int, int); 578/* kernel/signal.c */
351asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd,
352 void __user *arg);
353asmlinkage long sys_restart_syscall(void); 579asmlinkage long sys_restart_syscall(void);
354asmlinkage long sys_kexec_load(unsigned long entry, unsigned long nr_segments, 580asmlinkage long sys_kill(pid_t pid, int sig);
355 struct kexec_segment __user *segments, 581asmlinkage long sys_tkill(pid_t pid, int sig);
356 unsigned long flags); 582asmlinkage long sys_tgkill(pid_t tgid, pid_t pid, int sig);
357asmlinkage long sys_kexec_file_load(int kernel_fd, int initrd_fd, 583asmlinkage long sys_sigaltstack(const struct sigaltstack __user *uss,
358 unsigned long cmdline_len, 584 struct sigaltstack __user *uoss);
359 const char __user *cmdline_ptr,
360 unsigned long flags);
361
362asmlinkage long sys_exit(int error_code);
363asmlinkage long sys_exit_group(int error_code);
364asmlinkage long sys_wait4(pid_t pid, int __user *stat_addr,
365 int options, struct rusage __user *ru);
366asmlinkage long sys_waitid(int which, pid_t pid,
367 struct siginfo __user *infop,
368 int options, struct rusage __user *ru);
369asmlinkage long sys_waitpid(pid_t pid, int __user *stat_addr, int options);
370asmlinkage long sys_set_tid_address(int __user *tidptr);
371asmlinkage long sys_futex(u32 __user *uaddr, int op, u32 val,
372 struct timespec __user *utime, u32 __user *uaddr2,
373 u32 val3);
374
375asmlinkage long sys_init_module(void __user *umod, unsigned long len,
376 const char __user *uargs);
377asmlinkage long sys_delete_module(const char __user *name_user,
378 unsigned int flags);
379
380#ifdef CONFIG_OLD_SIGSUSPEND
381asmlinkage long sys_sigsuspend(old_sigset_t mask);
382#endif
383
384#ifdef CONFIG_OLD_SIGSUSPEND3
385asmlinkage long sys_sigsuspend(int unused1, int unused2, old_sigset_t mask);
386#endif
387
388asmlinkage long sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize); 585asmlinkage long sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize);
389
390#ifdef CONFIG_OLD_SIGACTION
391asmlinkage long sys_sigaction(int, const struct old_sigaction __user *,
392 struct old_sigaction __user *);
393#endif
394
395#ifndef CONFIG_ODD_RT_SIGACTION 586#ifndef CONFIG_ODD_RT_SIGACTION
396asmlinkage long sys_rt_sigaction(int, 587asmlinkage long sys_rt_sigaction(int,
397 const struct sigaction __user *, 588 const struct sigaction __user *,
@@ -405,470 +596,136 @@ asmlinkage long sys_rt_sigtimedwait(const sigset_t __user *uthese,
405 siginfo_t __user *uinfo, 596 siginfo_t __user *uinfo,
406 const struct timespec __user *uts, 597 const struct timespec __user *uts,
407 size_t sigsetsize); 598 size_t sigsetsize);
408asmlinkage long sys_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig,
409 siginfo_t __user *uinfo);
410asmlinkage long sys_kill(pid_t pid, int sig);
411asmlinkage long sys_tgkill(pid_t tgid, pid_t pid, int sig);
412asmlinkage long sys_tkill(pid_t pid, int sig);
413asmlinkage long sys_rt_sigqueueinfo(pid_t pid, int sig, siginfo_t __user *uinfo); 599asmlinkage long sys_rt_sigqueueinfo(pid_t pid, int sig, siginfo_t __user *uinfo);
414asmlinkage long sys_sgetmask(void);
415asmlinkage long sys_ssetmask(int newmask);
416asmlinkage long sys_signal(int sig, __sighandler_t handler);
417asmlinkage long sys_pause(void);
418
419asmlinkage long sys_sync(void);
420asmlinkage long sys_fsync(unsigned int fd);
421asmlinkage long sys_fdatasync(unsigned int fd);
422asmlinkage long sys_bdflush(int func, long data);
423asmlinkage long sys_mount(char __user *dev_name, char __user *dir_name,
424 char __user *type, unsigned long flags,
425 void __user *data);
426asmlinkage long sys_umount(char __user *name, int flags);
427asmlinkage long sys_oldumount(char __user *name);
428asmlinkage long sys_truncate(const char __user *path, long length);
429asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length);
430asmlinkage long sys_stat(const char __user *filename,
431 struct __old_kernel_stat __user *statbuf);
432asmlinkage long sys_statfs(const char __user * path,
433 struct statfs __user *buf);
434asmlinkage long sys_statfs64(const char __user *path, size_t sz,
435 struct statfs64 __user *buf);
436asmlinkage long sys_fstatfs(unsigned int fd, struct statfs __user *buf);
437asmlinkage long sys_fstatfs64(unsigned int fd, size_t sz,
438 struct statfs64 __user *buf);
439asmlinkage long sys_lstat(const char __user *filename,
440 struct __old_kernel_stat __user *statbuf);
441asmlinkage long sys_fstat(unsigned int fd,
442 struct __old_kernel_stat __user *statbuf);
443asmlinkage long sys_newstat(const char __user *filename,
444 struct stat __user *statbuf);
445asmlinkage long sys_newlstat(const char __user *filename,
446 struct stat __user *statbuf);
447asmlinkage long sys_newfstat(unsigned int fd, struct stat __user *statbuf);
448asmlinkage long sys_ustat(unsigned dev, struct ustat __user *ubuf);
449#if defined(__ARCH_WANT_STAT64) || defined(__ARCH_WANT_COMPAT_STAT64)
450asmlinkage long sys_stat64(const char __user *filename,
451 struct stat64 __user *statbuf);
452asmlinkage long sys_fstat64(unsigned long fd, struct stat64 __user *statbuf);
453asmlinkage long sys_lstat64(const char __user *filename,
454 struct stat64 __user *statbuf);
455asmlinkage long sys_fstatat64(int dfd, const char __user *filename,
456 struct stat64 __user *statbuf, int flag);
457#endif
458#if BITS_PER_LONG == 32
459asmlinkage long sys_truncate64(const char __user *path, loff_t length);
460asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length);
461#endif
462
463asmlinkage long sys_setxattr(const char __user *path, const char __user *name,
464 const void __user *value, size_t size, int flags);
465asmlinkage long sys_lsetxattr(const char __user *path, const char __user *name,
466 const void __user *value, size_t size, int flags);
467asmlinkage long sys_fsetxattr(int fd, const char __user *name,
468 const void __user *value, size_t size, int flags);
469asmlinkage long sys_getxattr(const char __user *path, const char __user *name,
470 void __user *value, size_t size);
471asmlinkage long sys_lgetxattr(const char __user *path, const char __user *name,
472 void __user *value, size_t size);
473asmlinkage long sys_fgetxattr(int fd, const char __user *name,
474 void __user *value, size_t size);
475asmlinkage long sys_listxattr(const char __user *path, char __user *list,
476 size_t size);
477asmlinkage long sys_llistxattr(const char __user *path, char __user *list,
478 size_t size);
479asmlinkage long sys_flistxattr(int fd, char __user *list, size_t size);
480asmlinkage long sys_removexattr(const char __user *path,
481 const char __user *name);
482asmlinkage long sys_lremovexattr(const char __user *path,
483 const char __user *name);
484asmlinkage long sys_fremovexattr(int fd, const char __user *name);
485
486asmlinkage long sys_brk(unsigned long brk);
487asmlinkage long sys_mprotect(unsigned long start, size_t len,
488 unsigned long prot);
489asmlinkage long sys_mremap(unsigned long addr,
490 unsigned long old_len, unsigned long new_len,
491 unsigned long flags, unsigned long new_addr);
492asmlinkage long sys_remap_file_pages(unsigned long start, unsigned long size,
493 unsigned long prot, unsigned long pgoff,
494 unsigned long flags);
495asmlinkage long sys_msync(unsigned long start, size_t len, int flags);
496asmlinkage long sys_fadvise64(int fd, loff_t offset, size_t len, int advice);
497asmlinkage long sys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice);
498asmlinkage long sys_munmap(unsigned long addr, size_t len);
499asmlinkage long sys_mlock(unsigned long start, size_t len);
500asmlinkage long sys_munlock(unsigned long start, size_t len);
501asmlinkage long sys_mlockall(int flags);
502asmlinkage long sys_munlockall(void);
503asmlinkage long sys_madvise(unsigned long start, size_t len, int behavior);
504asmlinkage long sys_mincore(unsigned long start, size_t len,
505 unsigned char __user * vec);
506
507asmlinkage long sys_pivot_root(const char __user *new_root,
508 const char __user *put_old);
509asmlinkage long sys_chroot(const char __user *filename);
510asmlinkage long sys_mknod(const char __user *filename, umode_t mode,
511 unsigned dev);
512asmlinkage long sys_link(const char __user *oldname,
513 const char __user *newname);
514asmlinkage long sys_symlink(const char __user *old, const char __user *new);
515asmlinkage long sys_unlink(const char __user *pathname);
516asmlinkage long sys_rename(const char __user *oldname,
517 const char __user *newname);
518asmlinkage long sys_chmod(const char __user *filename, umode_t mode);
519asmlinkage long sys_fchmod(unsigned int fd, umode_t mode);
520
521asmlinkage long sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg);
522#if BITS_PER_LONG == 32
523asmlinkage long sys_fcntl64(unsigned int fd,
524 unsigned int cmd, unsigned long arg);
525#endif
526asmlinkage long sys_pipe(int __user *fildes);
527asmlinkage long sys_pipe2(int __user *fildes, int flags);
528asmlinkage long sys_dup(unsigned int fildes);
529asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd);
530asmlinkage long sys_dup3(unsigned int oldfd, unsigned int newfd, int flags);
531asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int on);
532asmlinkage long sys_ioctl(unsigned int fd, unsigned int cmd,
533 unsigned long arg);
534asmlinkage long sys_flock(unsigned int fd, unsigned int cmd);
535asmlinkage long sys_io_setup(unsigned nr_reqs, aio_context_t __user *ctx);
536asmlinkage long sys_io_destroy(aio_context_t ctx);
537asmlinkage long sys_io_getevents(aio_context_t ctx_id,
538 long min_nr,
539 long nr,
540 struct io_event __user *events,
541 struct timespec __user *timeout);
542asmlinkage long sys_io_submit(aio_context_t, long,
543 struct iocb __user * __user *);
544asmlinkage long sys_io_cancel(aio_context_t ctx_id, struct iocb __user *iocb,
545 struct io_event __user *result);
546asmlinkage long sys_sendfile(int out_fd, int in_fd,
547 off_t __user *offset, size_t count);
548asmlinkage long sys_sendfile64(int out_fd, int in_fd,
549 loff_t __user *offset, size_t count);
550asmlinkage long sys_readlink(const char __user *path,
551 char __user *buf, int bufsiz);
552asmlinkage long sys_creat(const char __user *pathname, umode_t mode);
553asmlinkage long sys_open(const char __user *filename,
554 int flags, umode_t mode);
555asmlinkage long sys_close(unsigned int fd);
556asmlinkage long sys_access(const char __user *filename, int mode);
557asmlinkage long sys_vhangup(void);
558asmlinkage long sys_chown(const char __user *filename,
559 uid_t user, gid_t group);
560asmlinkage long sys_lchown(const char __user *filename,
561 uid_t user, gid_t group);
562asmlinkage long sys_fchown(unsigned int fd, uid_t user, gid_t group);
563#ifdef CONFIG_HAVE_UID16
564asmlinkage long sys_chown16(const char __user *filename,
565 old_uid_t user, old_gid_t group);
566asmlinkage long sys_lchown16(const char __user *filename,
567 old_uid_t user, old_gid_t group);
568asmlinkage long sys_fchown16(unsigned int fd, old_uid_t user, old_gid_t group);
569asmlinkage long sys_setregid16(old_gid_t rgid, old_gid_t egid);
570asmlinkage long sys_setgid16(old_gid_t gid);
571asmlinkage long sys_setreuid16(old_uid_t ruid, old_uid_t euid);
572asmlinkage long sys_setuid16(old_uid_t uid);
573asmlinkage long sys_setresuid16(old_uid_t ruid, old_uid_t euid, old_uid_t suid);
574asmlinkage long sys_getresuid16(old_uid_t __user *ruid,
575 old_uid_t __user *euid, old_uid_t __user *suid);
576asmlinkage long sys_setresgid16(old_gid_t rgid, old_gid_t egid, old_gid_t sgid);
577asmlinkage long sys_getresgid16(old_gid_t __user *rgid,
578 old_gid_t __user *egid, old_gid_t __user *sgid);
579asmlinkage long sys_setfsuid16(old_uid_t uid);
580asmlinkage long sys_setfsgid16(old_gid_t gid);
581asmlinkage long sys_getgroups16(int gidsetsize, old_gid_t __user *grouplist);
582asmlinkage long sys_setgroups16(int gidsetsize, old_gid_t __user *grouplist);
583asmlinkage long sys_getuid16(void);
584asmlinkage long sys_geteuid16(void);
585asmlinkage long sys_getgid16(void);
586asmlinkage long sys_getegid16(void);
587#endif
588 600
589asmlinkage long sys_utime(char __user *filename, 601/* kernel/sys.c */
590 struct utimbuf __user *times); 602asmlinkage long sys_setpriority(int which, int who, int niceval);
591asmlinkage long sys_utimes(char __user *filename, 603asmlinkage long sys_getpriority(int which, int who);
592 struct timeval __user *utimes); 604asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd,
593asmlinkage long sys_lseek(unsigned int fd, off_t offset, 605 void __user *arg);
594 unsigned int whence); 606asmlinkage long sys_setregid(gid_t rgid, gid_t egid);
595asmlinkage long sys_llseek(unsigned int fd, unsigned long offset_high, 607asmlinkage long sys_setgid(gid_t gid);
596 unsigned long offset_low, loff_t __user *result, 608asmlinkage long sys_setreuid(uid_t ruid, uid_t euid);
597 unsigned int whence); 609asmlinkage long sys_setuid(uid_t uid);
598asmlinkage long sys_read(unsigned int fd, char __user *buf, size_t count); 610asmlinkage long sys_setresuid(uid_t ruid, uid_t euid, uid_t suid);
599asmlinkage long sys_readahead(int fd, loff_t offset, size_t count); 611asmlinkage long sys_getresuid(uid_t __user *ruid, uid_t __user *euid, uid_t __user *suid);
600asmlinkage long sys_readv(unsigned long fd, 612asmlinkage long sys_setresgid(gid_t rgid, gid_t egid, gid_t sgid);
601 const struct iovec __user *vec, 613asmlinkage long sys_getresgid(gid_t __user *rgid, gid_t __user *egid, gid_t __user *sgid);
602 unsigned long vlen); 614asmlinkage long sys_setfsuid(uid_t uid);
603asmlinkage long sys_write(unsigned int fd, const char __user *buf, 615asmlinkage long sys_setfsgid(gid_t gid);
604 size_t count); 616asmlinkage long sys_times(struct tms __user *tbuf);
605asmlinkage long sys_writev(unsigned long fd, 617asmlinkage long sys_setpgid(pid_t pid, pid_t pgid);
606 const struct iovec __user *vec, 618asmlinkage long sys_getpgid(pid_t pid);
607 unsigned long vlen); 619asmlinkage long sys_getsid(pid_t pid);
608asmlinkage long sys_pread64(unsigned int fd, char __user *buf, 620asmlinkage long sys_setsid(void);
609 size_t count, loff_t pos); 621asmlinkage long sys_getgroups(int gidsetsize, gid_t __user *grouplist);
610asmlinkage long sys_pwrite64(unsigned int fd, const char __user *buf, 622asmlinkage long sys_setgroups(int gidsetsize, gid_t __user *grouplist);
611 size_t count, loff_t pos); 623asmlinkage long sys_newuname(struct new_utsname __user *name);
612asmlinkage long sys_preadv(unsigned long fd, const struct iovec __user *vec,
613 unsigned long vlen, unsigned long pos_l, unsigned long pos_h);
614asmlinkage long sys_preadv2(unsigned long fd, const struct iovec __user *vec,
615 unsigned long vlen, unsigned long pos_l, unsigned long pos_h,
616 rwf_t flags);
617asmlinkage long sys_pwritev(unsigned long fd, const struct iovec __user *vec,
618 unsigned long vlen, unsigned long pos_l, unsigned long pos_h);
619asmlinkage long sys_pwritev2(unsigned long fd, const struct iovec __user *vec,
620 unsigned long vlen, unsigned long pos_l, unsigned long pos_h,
621 rwf_t flags);
622asmlinkage long sys_getcwd(char __user *buf, unsigned long size);
623asmlinkage long sys_mkdir(const char __user *pathname, umode_t mode);
624asmlinkage long sys_chdir(const char __user *filename);
625asmlinkage long sys_fchdir(unsigned int fd);
626asmlinkage long sys_rmdir(const char __user *pathname);
627asmlinkage long sys_lookup_dcookie(u64 cookie64, char __user *buf, size_t len);
628asmlinkage long sys_quotactl(unsigned int cmd, const char __user *special,
629 qid_t id, void __user *addr);
630asmlinkage long sys_getdents(unsigned int fd,
631 struct linux_dirent __user *dirent,
632 unsigned int count);
633asmlinkage long sys_getdents64(unsigned int fd,
634 struct linux_dirent64 __user *dirent,
635 unsigned int count);
636
637asmlinkage long sys_setsockopt(int fd, int level, int optname,
638 char __user *optval, int optlen);
639asmlinkage long sys_getsockopt(int fd, int level, int optname,
640 char __user *optval, int __user *optlen);
641asmlinkage long sys_bind(int, struct sockaddr __user *, int);
642asmlinkage long sys_connect(int, struct sockaddr __user *, int);
643asmlinkage long sys_accept(int, struct sockaddr __user *, int __user *);
644asmlinkage long sys_accept4(int, struct sockaddr __user *, int __user *, int);
645asmlinkage long sys_getsockname(int, struct sockaddr __user *, int __user *);
646asmlinkage long sys_getpeername(int, struct sockaddr __user *, int __user *);
647asmlinkage long sys_send(int, void __user *, size_t, unsigned);
648asmlinkage long sys_sendto(int, void __user *, size_t, unsigned,
649 struct sockaddr __user *, int);
650asmlinkage long sys_sendmsg(int fd, struct user_msghdr __user *msg, unsigned flags);
651asmlinkage long sys_sendmmsg(int fd, struct mmsghdr __user *msg,
652 unsigned int vlen, unsigned flags);
653asmlinkage long sys_recv(int, void __user *, size_t, unsigned);
654asmlinkage long sys_recvfrom(int, void __user *, size_t, unsigned,
655 struct sockaddr __user *, int __user *);
656asmlinkage long sys_recvmsg(int fd, struct user_msghdr __user *msg, unsigned flags);
657asmlinkage long sys_recvmmsg(int fd, struct mmsghdr __user *msg,
658 unsigned int vlen, unsigned flags,
659 struct timespec __user *timeout);
660asmlinkage long sys_socket(int, int, int);
661asmlinkage long sys_socketpair(int, int, int, int __user *);
662asmlinkage long sys_socketcall(int call, unsigned long __user *args);
663asmlinkage long sys_listen(int, int);
664asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds,
665 int timeout);
666asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp,
667 fd_set __user *exp, struct timeval __user *tvp);
668asmlinkage long sys_old_select(struct sel_arg_struct __user *arg);
669asmlinkage long sys_epoll_create(int size);
670asmlinkage long sys_epoll_create1(int flags);
671asmlinkage long sys_epoll_ctl(int epfd, int op, int fd,
672 struct epoll_event __user *event);
673asmlinkage long sys_epoll_wait(int epfd, struct epoll_event __user *events,
674 int maxevents, int timeout);
675asmlinkage long sys_epoll_pwait(int epfd, struct epoll_event __user *events,
676 int maxevents, int timeout,
677 const sigset_t __user *sigmask,
678 size_t sigsetsize);
679asmlinkage long sys_gethostname(char __user *name, int len);
680asmlinkage long sys_sethostname(char __user *name, int len); 624asmlinkage long sys_sethostname(char __user *name, int len);
681asmlinkage long sys_setdomainname(char __user *name, int len); 625asmlinkage long sys_setdomainname(char __user *name, int len);
682asmlinkage long sys_newuname(struct new_utsname __user *name);
683asmlinkage long sys_uname(struct old_utsname __user *);
684asmlinkage long sys_olduname(struct oldold_utsname __user *);
685
686asmlinkage long sys_getrlimit(unsigned int resource, 626asmlinkage long sys_getrlimit(unsigned int resource,
687 struct rlimit __user *rlim); 627 struct rlimit __user *rlim);
688#ifdef __ARCH_WANT_SYS_OLD_GETRLIMIT
689asmlinkage long sys_old_getrlimit(unsigned int resource, struct rlimit __user *rlim);
690#endif
691asmlinkage long sys_setrlimit(unsigned int resource, 628asmlinkage long sys_setrlimit(unsigned int resource,
692 struct rlimit __user *rlim); 629 struct rlimit __user *rlim);
693asmlinkage long sys_prlimit64(pid_t pid, unsigned int resource,
694 const struct rlimit64 __user *new_rlim,
695 struct rlimit64 __user *old_rlim);
696asmlinkage long sys_getrusage(int who, struct rusage __user *ru); 630asmlinkage long sys_getrusage(int who, struct rusage __user *ru);
697asmlinkage long sys_umask(int mask); 631asmlinkage long sys_umask(int mask);
632asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3,
633 unsigned long arg4, unsigned long arg5);
634asmlinkage long sys_getcpu(unsigned __user *cpu, unsigned __user *node, struct getcpu_cache __user *cache);
698 635
636/* kernel/time.c */
637asmlinkage long sys_gettimeofday(struct timeval __user *tv,
638 struct timezone __user *tz);
639asmlinkage long sys_settimeofday(struct timeval __user *tv,
640 struct timezone __user *tz);
641asmlinkage long sys_adjtimex(struct timex __user *txc_p);
642
643/* kernel/timer.c */
644asmlinkage long sys_getpid(void);
645asmlinkage long sys_getppid(void);
646asmlinkage long sys_getuid(void);
647asmlinkage long sys_geteuid(void);
648asmlinkage long sys_getgid(void);
649asmlinkage long sys_getegid(void);
650asmlinkage long sys_gettid(void);
651asmlinkage long sys_sysinfo(struct sysinfo __user *info);
652
653/* ipc/mqueue.c */
654asmlinkage long sys_mq_open(const char __user *name, int oflag, umode_t mode, struct mq_attr __user *attr);
655asmlinkage long sys_mq_unlink(const char __user *name);
656asmlinkage long sys_mq_timedsend(mqd_t mqdes, const char __user *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct timespec __user *abs_timeout);
657asmlinkage long sys_mq_timedreceive(mqd_t mqdes, char __user *msg_ptr, size_t msg_len, unsigned int __user *msg_prio, const struct timespec __user *abs_timeout);
658asmlinkage long sys_mq_notify(mqd_t mqdes, const struct sigevent __user *notification);
659asmlinkage long sys_mq_getsetattr(mqd_t mqdes, const struct mq_attr __user *mqstat, struct mq_attr __user *omqstat);
660
661/* ipc/msg.c */
699asmlinkage long sys_msgget(key_t key, int msgflg); 662asmlinkage long sys_msgget(key_t key, int msgflg);
700asmlinkage long sys_msgsnd(int msqid, struct msgbuf __user *msgp, 663asmlinkage long sys_msgctl(int msqid, int cmd, struct msqid_ds __user *buf);
701 size_t msgsz, int msgflg);
702asmlinkage long sys_msgrcv(int msqid, struct msgbuf __user *msgp, 664asmlinkage long sys_msgrcv(int msqid, struct msgbuf __user *msgp,
703 size_t msgsz, long msgtyp, int msgflg); 665 size_t msgsz, long msgtyp, int msgflg);
704asmlinkage long sys_msgctl(int msqid, int cmd, struct msqid_ds __user *buf); 666asmlinkage long sys_msgsnd(int msqid, struct msgbuf __user *msgp,
667 size_t msgsz, int msgflg);
705 668
669/* ipc/sem.c */
706asmlinkage long sys_semget(key_t key, int nsems, int semflg); 670asmlinkage long sys_semget(key_t key, int nsems, int semflg);
707asmlinkage long sys_semop(int semid, struct sembuf __user *sops,
708 unsigned nsops);
709asmlinkage long sys_semctl(int semid, int semnum, int cmd, unsigned long arg); 671asmlinkage long sys_semctl(int semid, int semnum, int cmd, unsigned long arg);
710asmlinkage long sys_semtimedop(int semid, struct sembuf __user *sops, 672asmlinkage long sys_semtimedop(int semid, struct sembuf __user *sops,
711 unsigned nsops, 673 unsigned nsops,
712 const struct timespec __user *timeout); 674 const struct timespec __user *timeout);
713asmlinkage long sys_shmat(int shmid, char __user *shmaddr, int shmflg); 675asmlinkage long sys_semop(int semid, struct sembuf __user *sops,
676 unsigned nsops);
677
678/* ipc/shm.c */
714asmlinkage long sys_shmget(key_t key, size_t size, int flag); 679asmlinkage long sys_shmget(key_t key, size_t size, int flag);
715asmlinkage long sys_shmdt(char __user *shmaddr);
716asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf); 680asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf);
717asmlinkage long sys_ipc(unsigned int call, int first, unsigned long second, 681asmlinkage long sys_shmat(int shmid, char __user *shmaddr, int shmflg);
718 unsigned long third, void __user *ptr, long fifth); 682asmlinkage long sys_shmdt(char __user *shmaddr);
719 683
720asmlinkage long sys_mq_open(const char __user *name, int oflag, umode_t mode, struct mq_attr __user *attr); 684/* net/socket.c */
721asmlinkage long sys_mq_unlink(const char __user *name); 685asmlinkage long sys_socket(int, int, int);
722asmlinkage long sys_mq_timedsend(mqd_t mqdes, const char __user *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct timespec __user *abs_timeout); 686asmlinkage long sys_socketpair(int, int, int, int __user *);
723asmlinkage long sys_mq_timedreceive(mqd_t mqdes, char __user *msg_ptr, size_t msg_len, unsigned int __user *msg_prio, const struct timespec __user *abs_timeout); 687asmlinkage long sys_bind(int, struct sockaddr __user *, int);
724asmlinkage long sys_mq_notify(mqd_t mqdes, const struct sigevent __user *notification); 688asmlinkage long sys_listen(int, int);
725asmlinkage long sys_mq_getsetattr(mqd_t mqdes, const struct mq_attr __user *mqstat, struct mq_attr __user *omqstat); 689asmlinkage long sys_accept(int, struct sockaddr __user *, int __user *);
690asmlinkage long sys_connect(int, struct sockaddr __user *, int);
691asmlinkage long sys_getsockname(int, struct sockaddr __user *, int __user *);
692asmlinkage long sys_getpeername(int, struct sockaddr __user *, int __user *);
693asmlinkage long sys_sendto(int, void __user *, size_t, unsigned,
694 struct sockaddr __user *, int);
695asmlinkage long sys_recvfrom(int, void __user *, size_t, unsigned,
696 struct sockaddr __user *, int __user *);
697asmlinkage long sys_setsockopt(int fd, int level, int optname,
698 char __user *optval, int optlen);
699asmlinkage long sys_getsockopt(int fd, int level, int optname,
700 char __user *optval, int __user *optlen);
701asmlinkage long sys_shutdown(int, int);
702asmlinkage long sys_sendmsg(int fd, struct user_msghdr __user *msg, unsigned flags);
703asmlinkage long sys_recvmsg(int fd, struct user_msghdr __user *msg, unsigned flags);
726 704
727asmlinkage long sys_pciconfig_iobase(long which, unsigned long bus, unsigned long devfn); 705/* mm/filemap.c */
728asmlinkage long sys_pciconfig_read(unsigned long bus, unsigned long dfn, 706asmlinkage long sys_readahead(int fd, loff_t offset, size_t count);
729 unsigned long off, unsigned long len,
730 void __user *buf);
731asmlinkage long sys_pciconfig_write(unsigned long bus, unsigned long dfn,
732 unsigned long off, unsigned long len,
733 void __user *buf);
734 707
735asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3, 708/* mm/nommu.c, also with MMU */
736 unsigned long arg4, unsigned long arg5); 709asmlinkage long sys_brk(unsigned long brk);
737asmlinkage long sys_swapon(const char __user *specialfile, int swap_flags); 710asmlinkage long sys_munmap(unsigned long addr, size_t len);
738asmlinkage long sys_swapoff(const char __user *specialfile); 711asmlinkage long sys_mremap(unsigned long addr,
739asmlinkage long sys_sysctl(struct __sysctl_args __user *args); 712 unsigned long old_len, unsigned long new_len,
740asmlinkage long sys_sysinfo(struct sysinfo __user *info); 713 unsigned long flags, unsigned long new_addr);
741asmlinkage long sys_sysfs(int option,
742 unsigned long arg1, unsigned long arg2);
743asmlinkage long sys_syslog(int type, char __user *buf, int len);
744asmlinkage long sys_uselib(const char __user *library);
745asmlinkage long sys_ni_syscall(void);
746asmlinkage long sys_ptrace(long request, long pid, unsigned long addr,
747 unsigned long data);
748 714
715/* security/keys/keyctl.c */
749asmlinkage long sys_add_key(const char __user *_type, 716asmlinkage long sys_add_key(const char __user *_type,
750 const char __user *_description, 717 const char __user *_description,
751 const void __user *_payload, 718 const void __user *_payload,
752 size_t plen, 719 size_t plen,
753 key_serial_t destringid); 720 key_serial_t destringid);
754
755asmlinkage long sys_request_key(const char __user *_type, 721asmlinkage long sys_request_key(const char __user *_type,
756 const char __user *_description, 722 const char __user *_description,
757 const char __user *_callout_info, 723 const char __user *_callout_info,
758 key_serial_t destringid); 724 key_serial_t destringid);
759
760asmlinkage long sys_keyctl(int cmd, unsigned long arg2, unsigned long arg3, 725asmlinkage long sys_keyctl(int cmd, unsigned long arg2, unsigned long arg3,
761 unsigned long arg4, unsigned long arg5); 726 unsigned long arg4, unsigned long arg5);
762 727
763asmlinkage long sys_ioprio_set(int which, int who, int ioprio); 728/* arch/example/kernel/sys_example.c */
764asmlinkage long sys_ioprio_get(int which, int who);
765asmlinkage long sys_set_mempolicy(int mode, const unsigned long __user *nmask,
766 unsigned long maxnode);
767asmlinkage long sys_migrate_pages(pid_t pid, unsigned long maxnode,
768 const unsigned long __user *from,
769 const unsigned long __user *to);
770asmlinkage long sys_move_pages(pid_t pid, unsigned long nr_pages,
771 const void __user * __user *pages,
772 const int __user *nodes,
773 int __user *status,
774 int flags);
775asmlinkage long sys_mbind(unsigned long start, unsigned long len,
776 unsigned long mode,
777 const unsigned long __user *nmask,
778 unsigned long maxnode,
779 unsigned flags);
780asmlinkage long sys_get_mempolicy(int __user *policy,
781 unsigned long __user *nmask,
782 unsigned long maxnode,
783 unsigned long addr, unsigned long flags);
784
785asmlinkage long sys_inotify_init(void);
786asmlinkage long sys_inotify_init1(int flags);
787asmlinkage long sys_inotify_add_watch(int fd, const char __user *path,
788 u32 mask);
789asmlinkage long sys_inotify_rm_watch(int fd, __s32 wd);
790
791asmlinkage long sys_spu_run(int fd, __u32 __user *unpc,
792 __u32 __user *ustatus);
793asmlinkage long sys_spu_create(const char __user *name,
794 unsigned int flags, umode_t mode, int fd);
795
796asmlinkage long sys_mknodat(int dfd, const char __user * filename, umode_t mode,
797 unsigned dev);
798asmlinkage long sys_mkdirat(int dfd, const char __user * pathname, umode_t mode);
799asmlinkage long sys_unlinkat(int dfd, const char __user * pathname, int flag);
800asmlinkage long sys_symlinkat(const char __user * oldname,
801 int newdfd, const char __user * newname);
802asmlinkage long sys_linkat(int olddfd, const char __user *oldname,
803 int newdfd, const char __user *newname, int flags);
804asmlinkage long sys_renameat(int olddfd, const char __user * oldname,
805 int newdfd, const char __user * newname);
806asmlinkage long sys_renameat2(int olddfd, const char __user *oldname,
807 int newdfd, const char __user *newname,
808 unsigned int flags);
809asmlinkage long sys_futimesat(int dfd, const char __user *filename,
810 struct timeval __user *utimes);
811asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode);
812asmlinkage long sys_fchmodat(int dfd, const char __user * filename,
813 umode_t mode);
814asmlinkage long sys_fchownat(int dfd, const char __user *filename, uid_t user,
815 gid_t group, int flag);
816asmlinkage long sys_openat(int dfd, const char __user *filename, int flags,
817 umode_t mode);
818asmlinkage long sys_newfstatat(int dfd, const char __user *filename,
819 struct stat __user *statbuf, int flag);
820asmlinkage long sys_readlinkat(int dfd, const char __user *path, char __user *buf,
821 int bufsiz);
822asmlinkage long sys_utimensat(int dfd, const char __user *filename,
823 struct timespec __user *utimes, int flags);
824asmlinkage long sys_unshare(unsigned long unshare_flags);
825
826asmlinkage long sys_splice(int fd_in, loff_t __user *off_in,
827 int fd_out, loff_t __user *off_out,
828 size_t len, unsigned int flags);
829
830asmlinkage long sys_vmsplice(int fd, const struct iovec __user *iov,
831 unsigned long nr_segs, unsigned int flags);
832
833asmlinkage long sys_tee(int fdin, int fdout, size_t len, unsigned int flags);
834
835asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t nbytes,
836 unsigned int flags);
837asmlinkage long sys_sync_file_range2(int fd, unsigned int flags,
838 loff_t offset, loff_t nbytes);
839asmlinkage long sys_get_robust_list(int pid,
840 struct robust_list_head __user * __user *head_ptr,
841 size_t __user *len_ptr);
842asmlinkage long sys_set_robust_list(struct robust_list_head __user *head,
843 size_t len);
844asmlinkage long sys_getcpu(unsigned __user *cpu, unsigned __user *node, struct getcpu_cache __user *cache);
845asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask, size_t sizemask);
846asmlinkage long sys_signalfd4(int ufd, sigset_t __user *user_mask, size_t sizemask, int flags);
847asmlinkage long sys_timerfd_create(int clockid, int flags);
848asmlinkage long sys_timerfd_settime(int ufd, int flags,
849 const struct itimerspec __user *utmr,
850 struct itimerspec __user *otmr);
851asmlinkage long sys_timerfd_gettime(int ufd, struct itimerspec __user *otmr);
852asmlinkage long sys_eventfd(unsigned int count);
853asmlinkage long sys_eventfd2(unsigned int count, int flags);
854asmlinkage long sys_memfd_create(const char __user *uname_ptr, unsigned int flags);
855asmlinkage long sys_userfaultfd(int flags);
856asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len);
857asmlinkage long sys_old_readdir(unsigned int, struct old_linux_dirent __user *, unsigned int);
858asmlinkage long sys_pselect6(int, fd_set __user *, fd_set __user *,
859 fd_set __user *, struct timespec __user *,
860 void __user *);
861asmlinkage long sys_ppoll(struct pollfd __user *, unsigned int,
862 struct timespec __user *, const sigset_t __user *,
863 size_t);
864asmlinkage long sys_fanotify_init(unsigned int flags, unsigned int event_f_flags);
865asmlinkage long sys_fanotify_mark(int fanotify_fd, unsigned int flags,
866 u64 mask, int fd,
867 const char __user *pathname);
868asmlinkage long sys_syncfs(int fd);
869
870asmlinkage long sys_fork(void);
871asmlinkage long sys_vfork(void);
872#ifdef CONFIG_CLONE_BACKWARDS 729#ifdef CONFIG_CLONE_BACKWARDS
873asmlinkage long sys_clone(unsigned long, unsigned long, int __user *, unsigned long, 730asmlinkage long sys_clone(unsigned long, unsigned long, int __user *, unsigned long,
874 int __user *); 731 int __user *);
@@ -881,26 +738,80 @@ asmlinkage long sys_clone(unsigned long, unsigned long, int __user *,
881 int __user *, unsigned long); 738 int __user *, unsigned long);
882#endif 739#endif
883#endif 740#endif
884
885asmlinkage long sys_execve(const char __user *filename, 741asmlinkage long sys_execve(const char __user *filename,
886 const char __user *const __user *argv, 742 const char __user *const __user *argv,
887 const char __user *const __user *envp); 743 const char __user *const __user *envp);
888 744
745/* mm/fadvise.c */
746asmlinkage long sys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice);
747
748/* mm/, CONFIG_MMU only */
749asmlinkage long sys_swapon(const char __user *specialfile, int swap_flags);
750asmlinkage long sys_swapoff(const char __user *specialfile);
751asmlinkage long sys_mprotect(unsigned long start, size_t len,
752 unsigned long prot);
753asmlinkage long sys_msync(unsigned long start, size_t len, int flags);
754asmlinkage long sys_mlock(unsigned long start, size_t len);
755asmlinkage long sys_munlock(unsigned long start, size_t len);
756asmlinkage long sys_mlockall(int flags);
757asmlinkage long sys_munlockall(void);
758asmlinkage long sys_mincore(unsigned long start, size_t len,
759 unsigned char __user * vec);
760asmlinkage long sys_madvise(unsigned long start, size_t len, int behavior);
761asmlinkage long sys_remap_file_pages(unsigned long start, unsigned long size,
762 unsigned long prot, unsigned long pgoff,
763 unsigned long flags);
764asmlinkage long sys_mbind(unsigned long start, unsigned long len,
765 unsigned long mode,
766 const unsigned long __user *nmask,
767 unsigned long maxnode,
768 unsigned flags);
769asmlinkage long sys_get_mempolicy(int __user *policy,
770 unsigned long __user *nmask,
771 unsigned long maxnode,
772 unsigned long addr, unsigned long flags);
773asmlinkage long sys_set_mempolicy(int mode, const unsigned long __user *nmask,
774 unsigned long maxnode);
775asmlinkage long sys_migrate_pages(pid_t pid, unsigned long maxnode,
776 const unsigned long __user *from,
777 const unsigned long __user *to);
778asmlinkage long sys_move_pages(pid_t pid, unsigned long nr_pages,
779 const void __user * __user *pages,
780 const int __user *nodes,
781 int __user *status,
782 int flags);
783
784asmlinkage long sys_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig,
785 siginfo_t __user *uinfo);
889asmlinkage long sys_perf_event_open( 786asmlinkage long sys_perf_event_open(
890 struct perf_event_attr __user *attr_uptr, 787 struct perf_event_attr __user *attr_uptr,
891 pid_t pid, int cpu, int group_fd, unsigned long flags); 788 pid_t pid, int cpu, int group_fd, unsigned long flags);
789asmlinkage long sys_accept4(int, struct sockaddr __user *, int __user *, int);
790asmlinkage long sys_recvmmsg(int fd, struct mmsghdr __user *msg,
791 unsigned int vlen, unsigned flags,
792 struct timespec __user *timeout);
892 793
893asmlinkage long sys_mmap_pgoff(unsigned long addr, unsigned long len, 794asmlinkage long sys_wait4(pid_t pid, int __user *stat_addr,
894 unsigned long prot, unsigned long flags, 795 int options, struct rusage __user *ru);
895 unsigned long fd, unsigned long pgoff); 796asmlinkage long sys_prlimit64(pid_t pid, unsigned int resource,
896asmlinkage long sys_old_mmap(struct mmap_arg_struct __user *arg); 797 const struct rlimit64 __user *new_rlim,
798 struct rlimit64 __user *old_rlim);
799asmlinkage long sys_fanotify_init(unsigned int flags, unsigned int event_f_flags);
800asmlinkage long sys_fanotify_mark(int fanotify_fd, unsigned int flags,
801 u64 mask, int fd,
802 const char __user *pathname);
897asmlinkage long sys_name_to_handle_at(int dfd, const char __user *name, 803asmlinkage long sys_name_to_handle_at(int dfd, const char __user *name,
898 struct file_handle __user *handle, 804 struct file_handle __user *handle,
899 int __user *mnt_id, int flag); 805 int __user *mnt_id, int flag);
900asmlinkage long sys_open_by_handle_at(int mountdirfd, 806asmlinkage long sys_open_by_handle_at(int mountdirfd,
901 struct file_handle __user *handle, 807 struct file_handle __user *handle,
902 int flags); 808 int flags);
809asmlinkage long sys_clock_adjtime(clockid_t which_clock,
810 struct timex __user *tx);
811asmlinkage long sys_syncfs(int fd);
903asmlinkage long sys_setns(int fd, int nstype); 812asmlinkage long sys_setns(int fd, int nstype);
813asmlinkage long sys_sendmmsg(int fd, struct mmsghdr __user *msg,
814 unsigned int vlen, unsigned flags);
904asmlinkage long sys_process_vm_readv(pid_t pid, 815asmlinkage long sys_process_vm_readv(pid_t pid,
905 const struct iovec __user *lvec, 816 const struct iovec __user *lvec,
906 unsigned long liovcnt, 817 unsigned long liovcnt,
@@ -913,27 +824,40 @@ asmlinkage long sys_process_vm_writev(pid_t pid,
913 const struct iovec __user *rvec, 824 const struct iovec __user *rvec,
914 unsigned long riovcnt, 825 unsigned long riovcnt,
915 unsigned long flags); 826 unsigned long flags);
916
917asmlinkage long sys_kcmp(pid_t pid1, pid_t pid2, int type, 827asmlinkage long sys_kcmp(pid_t pid1, pid_t pid2, int type,
918 unsigned long idx1, unsigned long idx2); 828 unsigned long idx1, unsigned long idx2);
919asmlinkage long sys_finit_module(int fd, const char __user *uargs, int flags); 829asmlinkage long sys_finit_module(int fd, const char __user *uargs, int flags);
830asmlinkage long sys_sched_setattr(pid_t pid,
831 struct sched_attr __user *attr,
832 unsigned int flags);
833asmlinkage long sys_sched_getattr(pid_t pid,
834 struct sched_attr __user *attr,
835 unsigned int size,
836 unsigned int flags);
837asmlinkage long sys_renameat2(int olddfd, const char __user *oldname,
838 int newdfd, const char __user *newname,
839 unsigned int flags);
920asmlinkage long sys_seccomp(unsigned int op, unsigned int flags, 840asmlinkage long sys_seccomp(unsigned int op, unsigned int flags,
921 const char __user *uargs); 841 const char __user *uargs);
922asmlinkage long sys_getrandom(char __user *buf, size_t count, 842asmlinkage long sys_getrandom(char __user *buf, size_t count,
923 unsigned int flags); 843 unsigned int flags);
844asmlinkage long sys_memfd_create(const char __user *uname_ptr, unsigned int flags);
924asmlinkage long sys_bpf(int cmd, union bpf_attr *attr, unsigned int size); 845asmlinkage long sys_bpf(int cmd, union bpf_attr *attr, unsigned int size);
925
926asmlinkage long sys_execveat(int dfd, const char __user *filename, 846asmlinkage long sys_execveat(int dfd, const char __user *filename,
927 const char __user *const __user *argv, 847 const char __user *const __user *argv,
928 const char __user *const __user *envp, int flags); 848 const char __user *const __user *envp, int flags);
929 849asmlinkage long sys_userfaultfd(int flags);
930asmlinkage long sys_membarrier(int cmd, int flags); 850asmlinkage long sys_membarrier(int cmd, int flags);
851asmlinkage long sys_mlock2(unsigned long start, size_t len, int flags);
931asmlinkage long sys_copy_file_range(int fd_in, loff_t __user *off_in, 852asmlinkage long sys_copy_file_range(int fd_in, loff_t __user *off_in,
932 int fd_out, loff_t __user *off_out, 853 int fd_out, loff_t __user *off_out,
933 size_t len, unsigned int flags); 854 size_t len, unsigned int flags);
934 855asmlinkage long sys_preadv2(unsigned long fd, const struct iovec __user *vec,
935asmlinkage long sys_mlock2(unsigned long start, size_t len, int flags); 856 unsigned long vlen, unsigned long pos_l, unsigned long pos_h,
936 857 rwf_t flags);
858asmlinkage long sys_pwritev2(unsigned long fd, const struct iovec __user *vec,
859 unsigned long vlen, unsigned long pos_l, unsigned long pos_h,
860 rwf_t flags);
937asmlinkage long sys_pkey_mprotect(unsigned long start, size_t len, 861asmlinkage long sys_pkey_mprotect(unsigned long start, size_t len,
938 unsigned long prot, int pkey); 862 unsigned long prot, int pkey);
939asmlinkage long sys_pkey_alloc(unsigned long flags, unsigned long init_val); 863asmlinkage long sys_pkey_alloc(unsigned long flags, unsigned long init_val);
@@ -941,4 +865,379 @@ asmlinkage long sys_pkey_free(int pkey);
941asmlinkage long sys_statx(int dfd, const char __user *path, unsigned flags, 865asmlinkage long sys_statx(int dfd, const char __user *path, unsigned flags,
942 unsigned mask, struct statx __user *buffer); 866 unsigned mask, struct statx __user *buffer);
943 867
868
869/*
870 * Architecture-specific system calls
871 */
872
873/* arch/x86/kernel/ioport.c */
874asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int on);
875
876/* pciconfig: alpha, arm, arm64, ia64, sparc */
877asmlinkage long sys_pciconfig_read(unsigned long bus, unsigned long dfn,
878 unsigned long off, unsigned long len,
879 void __user *buf);
880asmlinkage long sys_pciconfig_write(unsigned long bus, unsigned long dfn,
881 unsigned long off, unsigned long len,
882 void __user *buf);
883asmlinkage long sys_pciconfig_iobase(long which, unsigned long bus, unsigned long devfn);
884
885/* powerpc */
886asmlinkage long sys_spu_run(int fd, __u32 __user *unpc,
887 __u32 __user *ustatus);
888asmlinkage long sys_spu_create(const char __user *name,
889 unsigned int flags, umode_t mode, int fd);
890
891
892/*
893 * Deprecated system calls which are still defined in
894 * include/uapi/asm-generic/unistd.h and wanted by >= 1 arch
895 */
896
897/* __ARCH_WANT_SYSCALL_NO_AT */
898asmlinkage long sys_open(const char __user *filename,
899 int flags, umode_t mode);
900asmlinkage long sys_link(const char __user *oldname,
901 const char __user *newname);
902asmlinkage long sys_unlink(const char __user *pathname);
903asmlinkage long sys_mknod(const char __user *filename, umode_t mode,
904 unsigned dev);
905asmlinkage long sys_chmod(const char __user *filename, umode_t mode);
906asmlinkage long sys_chown(const char __user *filename,
907 uid_t user, gid_t group);
908asmlinkage long sys_mkdir(const char __user *pathname, umode_t mode);
909asmlinkage long sys_rmdir(const char __user *pathname);
910asmlinkage long sys_lchown(const char __user *filename,
911 uid_t user, gid_t group);
912asmlinkage long sys_access(const char __user *filename, int mode);
913asmlinkage long sys_rename(const char __user *oldname,
914 const char __user *newname);
915asmlinkage long sys_symlink(const char __user *old, const char __user *new);
916asmlinkage long sys_utimes(char __user *filename,
917 struct timeval __user *utimes);
918#if defined(__ARCH_WANT_STAT64) || defined(__ARCH_WANT_COMPAT_STAT64)
919asmlinkage long sys_stat64(const char __user *filename,
920 struct stat64 __user *statbuf);
921asmlinkage long sys_lstat64(const char __user *filename,
922 struct stat64 __user *statbuf);
923#endif
924
925/* __ARCH_WANT_SYSCALL_NO_FLAGS */
926asmlinkage long sys_pipe(int __user *fildes);
927asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd);
928asmlinkage long sys_epoll_create(int size);
929asmlinkage long sys_inotify_init(void);
930asmlinkage long sys_eventfd(unsigned int count);
931asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask, size_t sizemask);
932
933/* __ARCH_WANT_SYSCALL_OFF_T */
934asmlinkage long sys_sendfile(int out_fd, int in_fd,
935 off_t __user *offset, size_t count);
936asmlinkage long sys_newstat(const char __user *filename,
937 struct stat __user *statbuf);
938asmlinkage long sys_newlstat(const char __user *filename,
939 struct stat __user *statbuf);
940asmlinkage long sys_fadvise64(int fd, loff_t offset, size_t len, int advice);
941
942/* __ARCH_WANT_SYSCALL_DEPRECATED */
943asmlinkage long sys_alarm(unsigned int seconds);
944asmlinkage long sys_getpgrp(void);
945asmlinkage long sys_pause(void);
946asmlinkage long sys_time(time_t __user *tloc);
947asmlinkage long sys_utime(char __user *filename,
948 struct utimbuf __user *times);
949asmlinkage long sys_creat(const char __user *pathname, umode_t mode);
950asmlinkage long sys_getdents(unsigned int fd,
951 struct linux_dirent __user *dirent,
952 unsigned int count);
953asmlinkage long sys_futimesat(int dfd, const char __user *filename,
954 struct timeval __user *utimes);
955asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp,
956 fd_set __user *exp, struct timeval __user *tvp);
957asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds,
958 int timeout);
959asmlinkage long sys_epoll_wait(int epfd, struct epoll_event __user *events,
960 int maxevents, int timeout);
961asmlinkage long sys_ustat(unsigned dev, struct ustat __user *ubuf);
962asmlinkage long sys_vfork(void);
963asmlinkage long sys_recv(int, void __user *, size_t, unsigned);
964asmlinkage long sys_send(int, void __user *, size_t, unsigned);
965asmlinkage long sys_bdflush(int func, long data);
966asmlinkage long sys_oldumount(char __user *name);
967asmlinkage long sys_uselib(const char __user *library);
968asmlinkage long sys_sysctl(struct __sysctl_args __user *args);
969asmlinkage long sys_sysfs(int option,
970 unsigned long arg1, unsigned long arg2);
971asmlinkage long sys_fork(void);
972
973/* obsolete: kernel/time/time.c */
974asmlinkage long sys_stime(time_t __user *tptr);
975
976/* obsolete: kernel/signal.c */
977asmlinkage long sys_sigpending(old_sigset_t __user *uset);
978asmlinkage long sys_sigprocmask(int how, old_sigset_t __user *set,
979 old_sigset_t __user *oset);
980#ifdef CONFIG_OLD_SIGSUSPEND
981asmlinkage long sys_sigsuspend(old_sigset_t mask);
982#endif
983
984#ifdef CONFIG_OLD_SIGSUSPEND3
985asmlinkage long sys_sigsuspend(int unused1, int unused2, old_sigset_t mask);
986#endif
987
988#ifdef CONFIG_OLD_SIGACTION
989asmlinkage long sys_sigaction(int, const struct old_sigaction __user *,
990 struct old_sigaction __user *);
991#endif
992asmlinkage long sys_sgetmask(void);
993asmlinkage long sys_ssetmask(int newmask);
994asmlinkage long sys_signal(int sig, __sighandler_t handler);
995
996/* obsolete: kernel/sched/core.c */
997asmlinkage long sys_nice(int increment);
998
999/* obsolete: kernel/kexec_file.c */
1000asmlinkage long sys_kexec_file_load(int kernel_fd, int initrd_fd,
1001 unsigned long cmdline_len,
1002 const char __user *cmdline_ptr,
1003 unsigned long flags);
1004
1005/* obsolete: kernel/exit.c */
1006asmlinkage long sys_waitpid(pid_t pid, int __user *stat_addr, int options);
1007
1008/* obsolete: kernel/uid16.c */
1009#ifdef CONFIG_HAVE_UID16
1010asmlinkage long sys_chown16(const char __user *filename,
1011 old_uid_t user, old_gid_t group);
1012asmlinkage long sys_lchown16(const char __user *filename,
1013 old_uid_t user, old_gid_t group);
1014asmlinkage long sys_fchown16(unsigned int fd, old_uid_t user, old_gid_t group);
1015asmlinkage long sys_setregid16(old_gid_t rgid, old_gid_t egid);
1016asmlinkage long sys_setgid16(old_gid_t gid);
1017asmlinkage long sys_setreuid16(old_uid_t ruid, old_uid_t euid);
1018asmlinkage long sys_setuid16(old_uid_t uid);
1019asmlinkage long sys_setresuid16(old_uid_t ruid, old_uid_t euid, old_uid_t suid);
1020asmlinkage long sys_getresuid16(old_uid_t __user *ruid,
1021 old_uid_t __user *euid, old_uid_t __user *suid);
1022asmlinkage long sys_setresgid16(old_gid_t rgid, old_gid_t egid, old_gid_t sgid);
1023asmlinkage long sys_getresgid16(old_gid_t __user *rgid,
1024 old_gid_t __user *egid, old_gid_t __user *sgid);
1025asmlinkage long sys_setfsuid16(old_uid_t uid);
1026asmlinkage long sys_setfsgid16(old_gid_t gid);
1027asmlinkage long sys_getgroups16(int gidsetsize, old_gid_t __user *grouplist);
1028asmlinkage long sys_setgroups16(int gidsetsize, old_gid_t __user *grouplist);
1029asmlinkage long sys_getuid16(void);
1030asmlinkage long sys_geteuid16(void);
1031asmlinkage long sys_getgid16(void);
1032asmlinkage long sys_getegid16(void);
1033#endif
1034
1035/* obsolete: net/socket.c */
1036asmlinkage long sys_socketcall(int call, unsigned long __user *args);
1037
1038/* obsolete: fs/stat.c */
1039asmlinkage long sys_stat(const char __user *filename,
1040 struct __old_kernel_stat __user *statbuf);
1041asmlinkage long sys_lstat(const char __user *filename,
1042 struct __old_kernel_stat __user *statbuf);
1043asmlinkage long sys_fstat(unsigned int fd,
1044 struct __old_kernel_stat __user *statbuf);
1045asmlinkage long sys_readlink(const char __user *path,
1046 char __user *buf, int bufsiz);
1047
1048/* obsolete: fs/select.c */
1049asmlinkage long sys_old_select(struct sel_arg_struct __user *arg);
1050
1051/* obsolete: fs/readdir.c */
1052asmlinkage long sys_old_readdir(unsigned int, struct old_linux_dirent __user *, unsigned int);
1053
1054/* obsolete: kernel/sys.c */
1055asmlinkage long sys_gethostname(char __user *name, int len);
1056asmlinkage long sys_uname(struct old_utsname __user *);
1057asmlinkage long sys_olduname(struct oldold_utsname __user *);
1058#ifdef __ARCH_WANT_SYS_OLD_GETRLIMIT
1059asmlinkage long sys_old_getrlimit(unsigned int resource, struct rlimit __user *rlim);
1060#endif
1061
1062/* obsolete: ipc */
1063asmlinkage long sys_ipc(unsigned int call, int first, unsigned long second,
1064 unsigned long third, void __user *ptr, long fifth);
1065
1066/* obsolete: mm/ */
1067asmlinkage long sys_mmap_pgoff(unsigned long addr, unsigned long len,
1068 unsigned long prot, unsigned long flags,
1069 unsigned long fd, unsigned long pgoff);
1070asmlinkage long sys_old_mmap(struct mmap_arg_struct __user *arg);
1071
1072
1073/*
1074 * Not a real system call, but a placeholder for syscalls which are
1075 * not implemented -- see kernel/sys_ni.c
1076 */
1077asmlinkage long sys_ni_syscall(void);
1078
1079
1080/*
1081 * Kernel code should not call syscalls (i.e., sys_xyzyyz()) directly.
1082 * Instead, use one of the functions which work equivalently, such as
1083 * the ksys_xyzyyz() functions prototyped below.
1084 */
1085
1086int ksys_mount(char __user *dev_name, char __user *dir_name, char __user *type,
1087 unsigned long flags, void __user *data);
1088int ksys_umount(char __user *name, int flags);
1089int ksys_dup(unsigned int fildes);
1090int ksys_chroot(const char __user *filename);
1091ssize_t ksys_write(unsigned int fd, const char __user *buf, size_t count);
1092int ksys_chdir(const char __user *filename);
1093int ksys_fchmod(unsigned int fd, umode_t mode);
1094int ksys_fchown(unsigned int fd, uid_t user, gid_t group);
1095int ksys_getdents64(unsigned int fd, struct linux_dirent64 __user *dirent,
1096 unsigned int count);
1097int ksys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg);
1098off_t ksys_lseek(unsigned int fd, off_t offset, unsigned int whence);
1099ssize_t ksys_read(unsigned int fd, char __user *buf, size_t count);
1100void ksys_sync(void);
1101int ksys_unshare(unsigned long unshare_flags);
1102int ksys_setsid(void);
1103int ksys_sync_file_range(int fd, loff_t offset, loff_t nbytes,
1104 unsigned int flags);
1105ssize_t ksys_pread64(unsigned int fd, char __user *buf, size_t count,
1106 loff_t pos);
1107ssize_t ksys_pwrite64(unsigned int fd, const char __user *buf,
1108 size_t count, loff_t pos);
1109int ksys_fallocate(int fd, int mode, loff_t offset, loff_t len);
1110#ifdef CONFIG_ADVISE_SYSCALLS
1111int ksys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice);
1112#else
1113static inline int ksys_fadvise64_64(int fd, loff_t offset, loff_t len,
1114 int advice)
1115{
1116 return -EINVAL;
1117}
1118#endif
1119unsigned long ksys_mmap_pgoff(unsigned long addr, unsigned long len,
1120 unsigned long prot, unsigned long flags,
1121 unsigned long fd, unsigned long pgoff);
1122ssize_t ksys_readahead(int fd, loff_t offset, size_t count);
1123
1124/*
1125 * The following kernel syscall equivalents are just wrappers to fs-internal
1126 * functions. Therefore, provide stubs to be inlined at the callsites.
1127 */
1128extern long do_unlinkat(int dfd, struct filename *name);
1129
1130static inline long ksys_unlink(const char __user *pathname)
1131{
1132 return do_unlinkat(AT_FDCWD, getname(pathname));
1133}
1134
1135extern long do_rmdir(int dfd, const char __user *pathname);
1136
1137static inline long ksys_rmdir(const char __user *pathname)
1138{
1139 return do_rmdir(AT_FDCWD, pathname);
1140}
1141
1142extern long do_mkdirat(int dfd, const char __user *pathname, umode_t mode);
1143
1144static inline long ksys_mkdir(const char __user *pathname, umode_t mode)
1145{
1146 return do_mkdirat(AT_FDCWD, pathname, mode);
1147}
1148
1149extern long do_symlinkat(const char __user *oldname, int newdfd,
1150 const char __user *newname);
1151
1152static inline long ksys_symlink(const char __user *oldname,
1153 const char __user *newname)
1154{
1155 return do_symlinkat(oldname, AT_FDCWD, newname);
1156}
1157
1158extern long do_mknodat(int dfd, const char __user *filename, umode_t mode,
1159 unsigned int dev);
1160
1161static inline long ksys_mknod(const char __user *filename, umode_t mode,
1162 unsigned int dev)
1163{
1164 return do_mknodat(AT_FDCWD, filename, mode, dev);
1165}
1166
1167extern int do_linkat(int olddfd, const char __user *oldname, int newdfd,
1168 const char __user *newname, int flags);
1169
1170static inline long ksys_link(const char __user *oldname,
1171 const char __user *newname)
1172{
1173 return do_linkat(AT_FDCWD, oldname, AT_FDCWD, newname, 0);
1174}
1175
1176extern int do_fchmodat(int dfd, const char __user *filename, umode_t mode);
1177
1178static inline int ksys_chmod(const char __user *filename, umode_t mode)
1179{
1180 return do_fchmodat(AT_FDCWD, filename, mode);
1181}
1182
1183extern long do_faccessat(int dfd, const char __user *filename, int mode);
1184
1185static inline long ksys_access(const char __user *filename, int mode)
1186{
1187 return do_faccessat(AT_FDCWD, filename, mode);
1188}
1189
1190extern int do_fchownat(int dfd, const char __user *filename, uid_t user,
1191 gid_t group, int flag);
1192
1193static inline long ksys_chown(const char __user *filename, uid_t user,
1194 gid_t group)
1195{
1196 return do_fchownat(AT_FDCWD, filename, user, group, 0);
1197}
1198
1199static inline long ksys_lchown(const char __user *filename, uid_t user,
1200 gid_t group)
1201{
1202 return do_fchownat(AT_FDCWD, filename, user, group,
1203 AT_SYMLINK_NOFOLLOW);
1204}
1205
1206extern long do_sys_ftruncate(unsigned int fd, loff_t length, int small);
1207
1208static inline long ksys_ftruncate(unsigned int fd, unsigned long length)
1209{
1210 return do_sys_ftruncate(fd, length, 1);
1211}
1212
1213extern int __close_fd(struct files_struct *files, unsigned int fd);
1214
1215/*
1216 * In contrast to sys_close(), this stub does not check whether the syscall
1217 * should or should not be restarted, but returns the raw error codes from
1218 * __close_fd().
1219 */
1220static inline int ksys_close(unsigned int fd)
1221{
1222 return __close_fd(current->files, fd);
1223}
1224
1225extern long do_sys_open(int dfd, const char __user *filename, int flags,
1226 umode_t mode);
1227
1228static inline long ksys_open(const char __user *filename, int flags,
1229 umode_t mode)
1230{
1231 if (force_o_largefile())
1232 flags |= O_LARGEFILE;
1233 return do_sys_open(AT_FDCWD, filename, flags, mode);
1234}
1235
1236extern long do_sys_truncate(const char __user *pathname, loff_t length);
1237
1238static inline long ksys_truncate(const char __user *pathname, loff_t length)
1239{
1240 return do_sys_truncate(pathname, length);
1241}
1242
944#endif 1243#endif
diff --git a/include/net/compat.h b/include/net/compat.h
index a91bea80b9fc..4c6d75612b6c 100644
--- a/include/net/compat.h
+++ b/include/net/compat.h
@@ -44,17 +44,6 @@ int compat_sock_get_timestampns(struct sock *, struct timespec __user *);
44int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *, 44int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *,
45 struct sockaddr __user **, struct iovec **); 45 struct sockaddr __user **, struct iovec **);
46struct sock_fprog __user *get_compat_bpf_fprog(char __user *optval); 46struct sock_fprog __user *get_compat_bpf_fprog(char __user *optval);
47asmlinkage long compat_sys_sendmsg(int, struct compat_msghdr __user *,
48 unsigned int);
49asmlinkage long compat_sys_sendmmsg(int, struct compat_mmsghdr __user *,
50 unsigned int, unsigned int);
51asmlinkage long compat_sys_recvmsg(int, struct compat_msghdr __user *,
52 unsigned int);
53asmlinkage long compat_sys_recvmmsg(int, struct compat_mmsghdr __user *,
54 unsigned int, unsigned int,
55 struct compat_timespec __user *);
56asmlinkage long compat_sys_getsockopt(int, int, int, char __user *,
57 int __user *);
58int put_cmsg_compat(struct msghdr*, int, int, int, void *); 47int put_cmsg_compat(struct msghdr*, int, int, int, void *);
59 48
60int cmsghdr_from_user_compat_to_kern(struct msghdr *, struct sock *, 49int cmsghdr_from_user_compat_to_kern(struct msghdr *, struct sock *,
diff --git a/init/do_mounts.c b/init/do_mounts.c
index 7cf4f6dafd5f..2c71dabe5626 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -363,11 +363,11 @@ static void __init get_fs_names(char *page)
363static int __init do_mount_root(char *name, char *fs, int flags, void *data) 363static int __init do_mount_root(char *name, char *fs, int flags, void *data)
364{ 364{
365 struct super_block *s; 365 struct super_block *s;
366 int err = sys_mount(name, "/root", fs, flags, data); 366 int err = ksys_mount(name, "/root", fs, flags, data);
367 if (err) 367 if (err)
368 return err; 368 return err;
369 369
370 sys_chdir("/root"); 370 ksys_chdir("/root");
371 s = current->fs->pwd.dentry->d_sb; 371 s = current->fs->pwd.dentry->d_sb;
372 ROOT_DEV = s->s_dev; 372 ROOT_DEV = s->s_dev;
373 printk(KERN_INFO 373 printk(KERN_INFO
@@ -489,21 +489,21 @@ void __init change_floppy(char *fmt, ...)
489 va_start(args, fmt); 489 va_start(args, fmt);
490 vsprintf(buf, fmt, args); 490 vsprintf(buf, fmt, args);
491 va_end(args); 491 va_end(args);
492 fd = sys_open("/dev/root", O_RDWR | O_NDELAY, 0); 492 fd = ksys_open("/dev/root", O_RDWR | O_NDELAY, 0);
493 if (fd >= 0) { 493 if (fd >= 0) {
494 sys_ioctl(fd, FDEJECT, 0); 494 ksys_ioctl(fd, FDEJECT, 0);
495 sys_close(fd); 495 ksys_close(fd);
496 } 496 }
497 printk(KERN_NOTICE "VFS: Insert %s and press ENTER\n", buf); 497 printk(KERN_NOTICE "VFS: Insert %s and press ENTER\n", buf);
498 fd = sys_open("/dev/console", O_RDWR, 0); 498 fd = ksys_open("/dev/console", O_RDWR, 0);
499 if (fd >= 0) { 499 if (fd >= 0) {
500 sys_ioctl(fd, TCGETS, (long)&termios); 500 ksys_ioctl(fd, TCGETS, (long)&termios);
501 termios.c_lflag &= ~ICANON; 501 termios.c_lflag &= ~ICANON;
502 sys_ioctl(fd, TCSETSF, (long)&termios); 502 ksys_ioctl(fd, TCSETSF, (long)&termios);
503 sys_read(fd, &c, 1); 503 ksys_read(fd, &c, 1);
504 termios.c_lflag |= ICANON; 504 termios.c_lflag |= ICANON;
505 sys_ioctl(fd, TCSETSF, (long)&termios); 505 ksys_ioctl(fd, TCSETSF, (long)&termios);
506 sys_close(fd); 506 ksys_close(fd);
507 } 507 }
508} 508}
509#endif 509#endif
@@ -599,8 +599,8 @@ void __init prepare_namespace(void)
599 mount_root(); 599 mount_root();
600out: 600out:
601 devtmpfs_mount("dev"); 601 devtmpfs_mount("dev");
602 sys_mount(".", "/", NULL, MS_MOVE, NULL); 602 ksys_mount(".", "/", NULL, MS_MOVE, NULL);
603 sys_chroot("."); 603 ksys_chroot(".");
604} 604}
605 605
606static bool is_tmpfs; 606static bool is_tmpfs;
diff --git a/init/do_mounts.h b/init/do_mounts.h
index 5b05c8f93f47..0bb0806de4ce 100644
--- a/init/do_mounts.h
+++ b/init/do_mounts.h
@@ -16,8 +16,8 @@ extern int root_mountflags;
16 16
17static inline int create_dev(char *name, dev_t dev) 17static inline int create_dev(char *name, dev_t dev)
18{ 18{
19 sys_unlink(name); 19 ksys_unlink(name);
20 return sys_mknod(name, S_IFBLK|0600, new_encode_dev(dev)); 20 return ksys_mknod(name, S_IFBLK|0600, new_encode_dev(dev));
21} 21}
22 22
23static inline u32 bstat(char *name) 23static inline u32 bstat(char *name)
diff --git a/init/do_mounts_initrd.c b/init/do_mounts_initrd.c
index 53d4f0f326e7..5a91aefa7305 100644
--- a/init/do_mounts_initrd.c
+++ b/init/do_mounts_initrd.c
@@ -36,16 +36,16 @@ __setup("noinitrd", no_initrd);
36 36
37static int init_linuxrc(struct subprocess_info *info, struct cred *new) 37static int init_linuxrc(struct subprocess_info *info, struct cred *new)
38{ 38{
39 sys_unshare(CLONE_FS | CLONE_FILES); 39 ksys_unshare(CLONE_FS | CLONE_FILES);
40 /* stdin/stdout/stderr for /linuxrc */ 40 /* stdin/stdout/stderr for /linuxrc */
41 sys_open("/dev/console", O_RDWR, 0); 41 ksys_open("/dev/console", O_RDWR, 0);
42 sys_dup(0); 42 ksys_dup(0);
43 sys_dup(0); 43 ksys_dup(0);
44 /* move initrd over / and chdir/chroot in initrd root */ 44 /* move initrd over / and chdir/chroot in initrd root */
45 sys_chdir("/root"); 45 ksys_chdir("/root");
46 sys_mount(".", "/", NULL, MS_MOVE, NULL); 46 ksys_mount(".", "/", NULL, MS_MOVE, NULL);
47 sys_chroot("."); 47 ksys_chroot(".");
48 sys_setsid(); 48 ksys_setsid();
49 return 0; 49 return 0;
50} 50}
51 51
@@ -60,8 +60,8 @@ static void __init handle_initrd(void)
60 create_dev("/dev/root.old", Root_RAM0); 60 create_dev("/dev/root.old", Root_RAM0);
61 /* mount initrd on rootfs' /root */ 61 /* mount initrd on rootfs' /root */
62 mount_block_root("/dev/root.old", root_mountflags & ~MS_RDONLY); 62 mount_block_root("/dev/root.old", root_mountflags & ~MS_RDONLY);
63 sys_mkdir("/old", 0700); 63 ksys_mkdir("/old", 0700);
64 sys_chdir("/old"); 64 ksys_chdir("/old");
65 65
66 /* try loading default modules from initrd */ 66 /* try loading default modules from initrd */
67 load_default_modules(); 67 load_default_modules();
@@ -81,37 +81,37 @@ static void __init handle_initrd(void)
81 current->flags &= ~PF_FREEZER_SKIP; 81 current->flags &= ~PF_FREEZER_SKIP;
82 82
83 /* move initrd to rootfs' /old */ 83 /* move initrd to rootfs' /old */
84 sys_mount("..", ".", NULL, MS_MOVE, NULL); 84 ksys_mount("..", ".", NULL, MS_MOVE, NULL);
85 /* switch root and cwd back to / of rootfs */ 85 /* switch root and cwd back to / of rootfs */
86 sys_chroot(".."); 86 ksys_chroot("..");
87 87
88 if (new_decode_dev(real_root_dev) == Root_RAM0) { 88 if (new_decode_dev(real_root_dev) == Root_RAM0) {
89 sys_chdir("/old"); 89 ksys_chdir("/old");
90 return; 90 return;
91 } 91 }
92 92
93 sys_chdir("/"); 93 ksys_chdir("/");
94 ROOT_DEV = new_decode_dev(real_root_dev); 94 ROOT_DEV = new_decode_dev(real_root_dev);
95 mount_root(); 95 mount_root();
96 96
97 printk(KERN_NOTICE "Trying to move old root to /initrd ... "); 97 printk(KERN_NOTICE "Trying to move old root to /initrd ... ");
98 error = sys_mount("/old", "/root/initrd", NULL, MS_MOVE, NULL); 98 error = ksys_mount("/old", "/root/initrd", NULL, MS_MOVE, NULL);
99 if (!error) 99 if (!error)
100 printk("okay\n"); 100 printk("okay\n");
101 else { 101 else {
102 int fd = sys_open("/dev/root.old", O_RDWR, 0); 102 int fd = ksys_open("/dev/root.old", O_RDWR, 0);
103 if (error == -ENOENT) 103 if (error == -ENOENT)
104 printk("/initrd does not exist. Ignored.\n"); 104 printk("/initrd does not exist. Ignored.\n");
105 else 105 else
106 printk("failed\n"); 106 printk("failed\n");
107 printk(KERN_NOTICE "Unmounting old root\n"); 107 printk(KERN_NOTICE "Unmounting old root\n");
108 sys_umount("/old", MNT_DETACH); 108 ksys_umount("/old", MNT_DETACH);
109 printk(KERN_NOTICE "Trying to free ramdisk memory ... "); 109 printk(KERN_NOTICE "Trying to free ramdisk memory ... ");
110 if (fd < 0) { 110 if (fd < 0) {
111 error = fd; 111 error = fd;
112 } else { 112 } else {
113 error = sys_ioctl(fd, BLKFLSBUF, 0); 113 error = ksys_ioctl(fd, BLKFLSBUF, 0);
114 sys_close(fd); 114 ksys_close(fd);
115 } 115 }
116 printk(!error ? "okay\n" : "failed\n"); 116 printk(!error ? "okay\n" : "failed\n");
117 } 117 }
@@ -128,11 +128,11 @@ bool __init initrd_load(void)
128 * mounted in the normal path. 128 * mounted in the normal path.
129 */ 129 */
130 if (rd_load_image("/initrd.image") && ROOT_DEV != Root_RAM0) { 130 if (rd_load_image("/initrd.image") && ROOT_DEV != Root_RAM0) {
131 sys_unlink("/initrd.image"); 131 ksys_unlink("/initrd.image");
132 handle_initrd(); 132 handle_initrd();
133 return true; 133 return true;
134 } 134 }
135 } 135 }
136 sys_unlink("/initrd.image"); 136 ksys_unlink("/initrd.image");
137 return false; 137 return false;
138} 138}
diff --git a/init/do_mounts_md.c b/init/do_mounts_md.c
index 3f733c760a8c..7d85d172bc7e 100644
--- a/init/do_mounts_md.c
+++ b/init/do_mounts_md.c
@@ -181,17 +181,17 @@ static void __init md_setup_drive(void)
181 partitioned ? "_d" : "", minor, 181 partitioned ? "_d" : "", minor,
182 md_setup_args[ent].device_names); 182 md_setup_args[ent].device_names);
183 183
184 fd = sys_open(name, 0, 0); 184 fd = ksys_open(name, 0, 0);
185 if (fd < 0) { 185 if (fd < 0) {
186 printk(KERN_ERR "md: open failed - cannot start " 186 printk(KERN_ERR "md: open failed - cannot start "
187 "array %s\n", name); 187 "array %s\n", name);
188 continue; 188 continue;
189 } 189 }
190 if (sys_ioctl(fd, SET_ARRAY_INFO, 0) == -EBUSY) { 190 if (ksys_ioctl(fd, SET_ARRAY_INFO, 0) == -EBUSY) {
191 printk(KERN_WARNING 191 printk(KERN_WARNING
192 "md: Ignoring md=%d, already autodetected. (Use raid=noautodetect)\n", 192 "md: Ignoring md=%d, already autodetected. (Use raid=noautodetect)\n",
193 minor); 193 minor);
194 sys_close(fd); 194 ksys_close(fd);
195 continue; 195 continue;
196 } 196 }
197 197
@@ -210,7 +210,7 @@ static void __init md_setup_drive(void)
210 ainfo.state = (1 << MD_SB_CLEAN); 210 ainfo.state = (1 << MD_SB_CLEAN);
211 ainfo.layout = 0; 211 ainfo.layout = 0;
212 ainfo.chunk_size = md_setup_args[ent].chunk; 212 ainfo.chunk_size = md_setup_args[ent].chunk;
213 err = sys_ioctl(fd, SET_ARRAY_INFO, (long)&ainfo); 213 err = ksys_ioctl(fd, SET_ARRAY_INFO, (long)&ainfo);
214 for (i = 0; !err && i <= MD_SB_DISKS; i++) { 214 for (i = 0; !err && i <= MD_SB_DISKS; i++) {
215 dev = devices[i]; 215 dev = devices[i];
216 if (!dev) 216 if (!dev)
@@ -220,7 +220,8 @@ static void __init md_setup_drive(void)
220 dinfo.state = (1<<MD_DISK_ACTIVE)|(1<<MD_DISK_SYNC); 220 dinfo.state = (1<<MD_DISK_ACTIVE)|(1<<MD_DISK_SYNC);
221 dinfo.major = MAJOR(dev); 221 dinfo.major = MAJOR(dev);
222 dinfo.minor = MINOR(dev); 222 dinfo.minor = MINOR(dev);
223 err = sys_ioctl(fd, ADD_NEW_DISK, (long)&dinfo); 223 err = ksys_ioctl(fd, ADD_NEW_DISK,
224 (long)&dinfo);
224 } 225 }
225 } else { 226 } else {
226 /* persistent */ 227 /* persistent */
@@ -230,11 +231,11 @@ static void __init md_setup_drive(void)
230 break; 231 break;
231 dinfo.major = MAJOR(dev); 232 dinfo.major = MAJOR(dev);
232 dinfo.minor = MINOR(dev); 233 dinfo.minor = MINOR(dev);
233 sys_ioctl(fd, ADD_NEW_DISK, (long)&dinfo); 234 ksys_ioctl(fd, ADD_NEW_DISK, (long)&dinfo);
234 } 235 }
235 } 236 }
236 if (!err) 237 if (!err)
237 err = sys_ioctl(fd, RUN_ARRAY, 0); 238 err = ksys_ioctl(fd, RUN_ARRAY, 0);
238 if (err) 239 if (err)
239 printk(KERN_WARNING "md: starting md%d failed\n", minor); 240 printk(KERN_WARNING "md: starting md%d failed\n", minor);
240 else { 241 else {
@@ -243,11 +244,11 @@ static void __init md_setup_drive(void)
243 * boot a kernel with devfs compiled in from partitioned md 244 * boot a kernel with devfs compiled in from partitioned md
244 * array without it 245 * array without it
245 */ 246 */
246 sys_close(fd); 247 ksys_close(fd);
247 fd = sys_open(name, 0, 0); 248 fd = ksys_open(name, 0, 0);
248 sys_ioctl(fd, BLKRRPART, 0); 249 ksys_ioctl(fd, BLKRRPART, 0);
249 } 250 }
250 sys_close(fd); 251 ksys_close(fd);
251 } 252 }
252} 253}
253 254
@@ -294,10 +295,10 @@ static void __init autodetect_raid(void)
294 295
295 wait_for_device_probe(); 296 wait_for_device_probe();
296 297
297 fd = sys_open("/dev/md0", 0, 0); 298 fd = ksys_open("/dev/md0", 0, 0);
298 if (fd >= 0) { 299 if (fd >= 0) {
299 sys_ioctl(fd, RAID_AUTORUN, raid_autopart); 300 ksys_ioctl(fd, RAID_AUTORUN, raid_autopart);
300 sys_close(fd); 301 ksys_close(fd);
301 } 302 }
302} 303}
303 304
diff --git a/init/do_mounts_rd.c b/init/do_mounts_rd.c
index 99e0b649fc0e..12c159824c7b 100644
--- a/init/do_mounts_rd.c
+++ b/init/do_mounts_rd.c
@@ -90,8 +90,8 @@ identify_ramdisk_image(int fd, int start_block, decompress_fn *decompressor)
90 /* 90 /*
91 * Read block 0 to test for compressed kernel 91 * Read block 0 to test for compressed kernel
92 */ 92 */
93 sys_lseek(fd, start_block * BLOCK_SIZE, 0); 93 ksys_lseek(fd, start_block * BLOCK_SIZE, 0);
94 sys_read(fd, buf, size); 94 ksys_read(fd, buf, size);
95 95
96 *decompressor = decompress_method(buf, size, &compress_name); 96 *decompressor = decompress_method(buf, size, &compress_name);
97 if (compress_name) { 97 if (compress_name) {
@@ -136,8 +136,8 @@ identify_ramdisk_image(int fd, int start_block, decompress_fn *decompressor)
136 /* 136 /*
137 * Read 512 bytes further to check if cramfs is padded 137 * Read 512 bytes further to check if cramfs is padded
138 */ 138 */
139 sys_lseek(fd, start_block * BLOCK_SIZE + 0x200, 0); 139 ksys_lseek(fd, start_block * BLOCK_SIZE + 0x200, 0);
140 sys_read(fd, buf, size); 140 ksys_read(fd, buf, size);
141 141
142 if (cramfsb->magic == CRAMFS_MAGIC) { 142 if (cramfsb->magic == CRAMFS_MAGIC) {
143 printk(KERN_NOTICE 143 printk(KERN_NOTICE
@@ -150,8 +150,8 @@ identify_ramdisk_image(int fd, int start_block, decompress_fn *decompressor)
150 /* 150 /*
151 * Read block 1 to test for minix and ext2 superblock 151 * Read block 1 to test for minix and ext2 superblock
152 */ 152 */
153 sys_lseek(fd, (start_block+1) * BLOCK_SIZE, 0); 153 ksys_lseek(fd, (start_block+1) * BLOCK_SIZE, 0);
154 sys_read(fd, buf, size); 154 ksys_read(fd, buf, size);
155 155
156 /* Try minix */ 156 /* Try minix */
157 if (minixsb->s_magic == MINIX_SUPER_MAGIC || 157 if (minixsb->s_magic == MINIX_SUPER_MAGIC ||
@@ -178,7 +178,7 @@ identify_ramdisk_image(int fd, int start_block, decompress_fn *decompressor)
178 start_block); 178 start_block);
179 179
180done: 180done:
181 sys_lseek(fd, start_block * BLOCK_SIZE, 0); 181 ksys_lseek(fd, start_block * BLOCK_SIZE, 0);
182 kfree(buf); 182 kfree(buf);
183 return nblocks; 183 return nblocks;
184} 184}
@@ -196,11 +196,11 @@ int __init rd_load_image(char *from)
196 char rotator[4] = { '|' , '/' , '-' , '\\' }; 196 char rotator[4] = { '|' , '/' , '-' , '\\' };
197#endif 197#endif
198 198
199 out_fd = sys_open("/dev/ram", O_RDWR, 0); 199 out_fd = ksys_open("/dev/ram", O_RDWR, 0);
200 if (out_fd < 0) 200 if (out_fd < 0)
201 goto out; 201 goto out;
202 202
203 in_fd = sys_open(from, O_RDONLY, 0); 203 in_fd = ksys_open(from, O_RDONLY, 0);
204 if (in_fd < 0) 204 if (in_fd < 0)
205 goto noclose_input; 205 goto noclose_input;
206 206
@@ -218,7 +218,7 @@ int __init rd_load_image(char *from)
218 * NOTE NOTE: nblocks is not actually blocks but 218 * NOTE NOTE: nblocks is not actually blocks but
219 * the number of kibibytes of data to load into a ramdisk. 219 * the number of kibibytes of data to load into a ramdisk.
220 */ 220 */
221 if (sys_ioctl(out_fd, BLKGETSIZE, (unsigned long)&rd_blocks) < 0) 221 if (ksys_ioctl(out_fd, BLKGETSIZE, (unsigned long)&rd_blocks) < 0)
222 rd_blocks = 0; 222 rd_blocks = 0;
223 else 223 else
224 rd_blocks >>= 1; 224 rd_blocks >>= 1;
@@ -232,7 +232,7 @@ int __init rd_load_image(char *from)
232 /* 232 /*
233 * OK, time to copy in the data 233 * OK, time to copy in the data
234 */ 234 */
235 if (sys_ioctl(in_fd, BLKGETSIZE, (unsigned long)&devblocks) < 0) 235 if (ksys_ioctl(in_fd, BLKGETSIZE, (unsigned long)&devblocks) < 0)
236 devblocks = 0; 236 devblocks = 0;
237 else 237 else
238 devblocks >>= 1; 238 devblocks >>= 1;
@@ -257,20 +257,20 @@ int __init rd_load_image(char *from)
257 if (i && (i % devblocks == 0)) { 257 if (i && (i % devblocks == 0)) {
258 printk("done disk #%d.\n", disk++); 258 printk("done disk #%d.\n", disk++);
259 rotate = 0; 259 rotate = 0;
260 if (sys_close(in_fd)) { 260 if (ksys_close(in_fd)) {
261 printk("Error closing the disk.\n"); 261 printk("Error closing the disk.\n");
262 goto noclose_input; 262 goto noclose_input;
263 } 263 }
264 change_floppy("disk #%d", disk); 264 change_floppy("disk #%d", disk);
265 in_fd = sys_open(from, O_RDONLY, 0); 265 in_fd = ksys_open(from, O_RDONLY, 0);
266 if (in_fd < 0) { 266 if (in_fd < 0) {
267 printk("Error opening disk.\n"); 267 printk("Error opening disk.\n");
268 goto noclose_input; 268 goto noclose_input;
269 } 269 }
270 printk("Loading disk #%d... ", disk); 270 printk("Loading disk #%d... ", disk);
271 } 271 }
272 sys_read(in_fd, buf, BLOCK_SIZE); 272 ksys_read(in_fd, buf, BLOCK_SIZE);
273 sys_write(out_fd, buf, BLOCK_SIZE); 273 ksys_write(out_fd, buf, BLOCK_SIZE);
274#if !defined(CONFIG_S390) 274#if !defined(CONFIG_S390)
275 if (!(i % 16)) { 275 if (!(i % 16)) {
276 pr_cont("%c\b", rotator[rotate & 0x3]); 276 pr_cont("%c\b", rotator[rotate & 0x3]);
@@ -283,12 +283,12 @@ int __init rd_load_image(char *from)
283successful_load: 283successful_load:
284 res = 1; 284 res = 1;
285done: 285done:
286 sys_close(in_fd); 286 ksys_close(in_fd);
287noclose_input: 287noclose_input:
288 sys_close(out_fd); 288 ksys_close(out_fd);
289out: 289out:
290 kfree(buf); 290 kfree(buf);
291 sys_unlink("/dev/ram"); 291 ksys_unlink("/dev/ram");
292 return res; 292 return res;
293} 293}
294 294
@@ -307,7 +307,7 @@ static int crd_infd, crd_outfd;
307 307
308static long __init compr_fill(void *buf, unsigned long len) 308static long __init compr_fill(void *buf, unsigned long len)
309{ 309{
310 long r = sys_read(crd_infd, buf, len); 310 long r = ksys_read(crd_infd, buf, len);
311 if (r < 0) 311 if (r < 0)
312 printk(KERN_ERR "RAMDISK: error while reading compressed data"); 312 printk(KERN_ERR "RAMDISK: error while reading compressed data");
313 else if (r == 0) 313 else if (r == 0)
@@ -317,7 +317,7 @@ static long __init compr_fill(void *buf, unsigned long len)
317 317
318static long __init compr_flush(void *window, unsigned long outcnt) 318static long __init compr_flush(void *window, unsigned long outcnt)
319{ 319{
320 long written = sys_write(crd_outfd, window, outcnt); 320 long written = ksys_write(crd_outfd, window, outcnt);
321 if (written != outcnt) { 321 if (written != outcnt) {
322 if (decompress_error == 0) 322 if (decompress_error == 0)
323 printk(KERN_ERR 323 printk(KERN_ERR
diff --git a/init/initramfs.c b/init/initramfs.c
index 7e99a0038942..13643c46ebab 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -27,7 +27,7 @@ static ssize_t __init xwrite(int fd, const char *p, size_t count)
27 27
28 /* sys_write only can write MAX_RW_COUNT aka 2G-4K bytes at most */ 28 /* sys_write only can write MAX_RW_COUNT aka 2G-4K bytes at most */
29 while (count) { 29 while (count) {
30 ssize_t rv = sys_write(fd, p, count); 30 ssize_t rv = ksys_write(fd, p, count);
31 31
32 if (rv < 0) { 32 if (rv < 0) {
33 if (rv == -EINTR || rv == -EAGAIN) 33 if (rv == -EINTR || rv == -EAGAIN)
@@ -306,7 +306,7 @@ static int __init maybe_link(void)
306 if (nlink >= 2) { 306 if (nlink >= 2) {
307 char *old = find_link(major, minor, ino, mode, collected); 307 char *old = find_link(major, minor, ino, mode, collected);
308 if (old) 308 if (old)
309 return (sys_link(old, collected) < 0) ? -1 : 1; 309 return (ksys_link(old, collected) < 0) ? -1 : 1;
310 } 310 }
311 return 0; 311 return 0;
312} 312}
@@ -317,9 +317,9 @@ static void __init clean_path(char *path, umode_t fmode)
317 317
318 if (!vfs_lstat(path, &st) && (st.mode ^ fmode) & S_IFMT) { 318 if (!vfs_lstat(path, &st) && (st.mode ^ fmode) & S_IFMT) {
319 if (S_ISDIR(st.mode)) 319 if (S_ISDIR(st.mode))
320 sys_rmdir(path); 320 ksys_rmdir(path);
321 else 321 else
322 sys_unlink(path); 322 ksys_unlink(path);
323 } 323 }
324} 324}
325 325
@@ -340,28 +340,28 @@ static int __init do_name(void)
340 int openflags = O_WRONLY|O_CREAT; 340 int openflags = O_WRONLY|O_CREAT;
341 if (ml != 1) 341 if (ml != 1)
342 openflags |= O_TRUNC; 342 openflags |= O_TRUNC;
343 wfd = sys_open(collected, openflags, mode); 343 wfd = ksys_open(collected, openflags, mode);
344 344
345 if (wfd >= 0) { 345 if (wfd >= 0) {
346 sys_fchown(wfd, uid, gid); 346 ksys_fchown(wfd, uid, gid);
347 sys_fchmod(wfd, mode); 347 ksys_fchmod(wfd, mode);
348 if (body_len) 348 if (body_len)
349 sys_ftruncate(wfd, body_len); 349 ksys_ftruncate(wfd, body_len);
350 vcollected = kstrdup(collected, GFP_KERNEL); 350 vcollected = kstrdup(collected, GFP_KERNEL);
351 state = CopyFile; 351 state = CopyFile;
352 } 352 }
353 } 353 }
354 } else if (S_ISDIR(mode)) { 354 } else if (S_ISDIR(mode)) {
355 sys_mkdir(collected, mode); 355 ksys_mkdir(collected, mode);
356 sys_chown(collected, uid, gid); 356 ksys_chown(collected, uid, gid);
357 sys_chmod(collected, mode); 357 ksys_chmod(collected, mode);
358 dir_add(collected, mtime); 358 dir_add(collected, mtime);
359 } else if (S_ISBLK(mode) || S_ISCHR(mode) || 359 } else if (S_ISBLK(mode) || S_ISCHR(mode) ||
360 S_ISFIFO(mode) || S_ISSOCK(mode)) { 360 S_ISFIFO(mode) || S_ISSOCK(mode)) {
361 if (maybe_link() == 0) { 361 if (maybe_link() == 0) {
362 sys_mknod(collected, mode, rdev); 362 ksys_mknod(collected, mode, rdev);
363 sys_chown(collected, uid, gid); 363 ksys_chown(collected, uid, gid);
364 sys_chmod(collected, mode); 364 ksys_chmod(collected, mode);
365 do_utime(collected, mtime); 365 do_utime(collected, mtime);
366 } 366 }
367 } 367 }
@@ -373,7 +373,7 @@ static int __init do_copy(void)
373 if (byte_count >= body_len) { 373 if (byte_count >= body_len) {
374 if (xwrite(wfd, victim, body_len) != body_len) 374 if (xwrite(wfd, victim, body_len) != body_len)
375 error("write error"); 375 error("write error");
376 sys_close(wfd); 376 ksys_close(wfd);
377 do_utime(vcollected, mtime); 377 do_utime(vcollected, mtime);
378 kfree(vcollected); 378 kfree(vcollected);
379 eat(body_len); 379 eat(body_len);
@@ -392,8 +392,8 @@ static int __init do_symlink(void)
392{ 392{
393 collected[N_ALIGN(name_len) + body_len] = '\0'; 393 collected[N_ALIGN(name_len) + body_len] = '\0';
394 clean_path(collected, 0); 394 clean_path(collected, 0);
395 sys_symlink(collected + N_ALIGN(name_len), collected); 395 ksys_symlink(collected + N_ALIGN(name_len), collected);
396 sys_lchown(collected, uid, gid); 396 ksys_lchown(collected, uid, gid);
397 do_utime(collected, mtime); 397 do_utime(collected, mtime);
398 state = SkipIt; 398 state = SkipIt;
399 next_state = Reset; 399 next_state = Reset;
@@ -567,19 +567,19 @@ static void __init clean_rootfs(void)
567 struct linux_dirent64 *dirp; 567 struct linux_dirent64 *dirp;
568 int num; 568 int num;
569 569
570 fd = sys_open("/", O_RDONLY, 0); 570 fd = ksys_open("/", O_RDONLY, 0);
571 WARN_ON(fd < 0); 571 WARN_ON(fd < 0);
572 if (fd < 0) 572 if (fd < 0)
573 return; 573 return;
574 buf = kzalloc(BUF_SIZE, GFP_KERNEL); 574 buf = kzalloc(BUF_SIZE, GFP_KERNEL);
575 WARN_ON(!buf); 575 WARN_ON(!buf);
576 if (!buf) { 576 if (!buf) {
577 sys_close(fd); 577 ksys_close(fd);
578 return; 578 return;
579 } 579 }
580 580
581 dirp = buf; 581 dirp = buf;
582 num = sys_getdents64(fd, dirp, BUF_SIZE); 582 num = ksys_getdents64(fd, dirp, BUF_SIZE);
583 while (num > 0) { 583 while (num > 0) {
584 while (num > 0) { 584 while (num > 0) {
585 struct kstat st; 585 struct kstat st;
@@ -589,9 +589,9 @@ static void __init clean_rootfs(void)
589 WARN_ON_ONCE(ret); 589 WARN_ON_ONCE(ret);
590 if (!ret) { 590 if (!ret) {
591 if (S_ISDIR(st.mode)) 591 if (S_ISDIR(st.mode))
592 sys_rmdir(dirp->d_name); 592 ksys_rmdir(dirp->d_name);
593 else 593 else
594 sys_unlink(dirp->d_name); 594 ksys_unlink(dirp->d_name);
595 } 595 }
596 596
597 num -= dirp->d_reclen; 597 num -= dirp->d_reclen;
@@ -599,10 +599,10 @@ static void __init clean_rootfs(void)
599 } 599 }
600 dirp = buf; 600 dirp = buf;
601 memset(buf, 0, BUF_SIZE); 601 memset(buf, 0, BUF_SIZE);
602 num = sys_getdents64(fd, dirp, BUF_SIZE); 602 num = ksys_getdents64(fd, dirp, BUF_SIZE);
603 } 603 }
604 604
605 sys_close(fd); 605 ksys_close(fd);
606 kfree(buf); 606 kfree(buf);
607} 607}
608#endif 608#endif
@@ -629,7 +629,7 @@ static int __init populate_rootfs(void)
629 } 629 }
630 printk(KERN_INFO "rootfs image is not initramfs (%s)" 630 printk(KERN_INFO "rootfs image is not initramfs (%s)"
631 "; looks like an initrd\n", err); 631 "; looks like an initrd\n", err);
632 fd = sys_open("/initrd.image", 632 fd = ksys_open("/initrd.image",
633 O_WRONLY|O_CREAT, 0700); 633 O_WRONLY|O_CREAT, 0700);
634 if (fd >= 0) { 634 if (fd >= 0) {
635 ssize_t written = xwrite(fd, (char *)initrd_start, 635 ssize_t written = xwrite(fd, (char *)initrd_start,
@@ -639,7 +639,7 @@ static int __init populate_rootfs(void)
639 pr_err("/initrd.image: incomplete write (%zd != %ld)\n", 639 pr_err("/initrd.image: incomplete write (%zd != %ld)\n",
640 written, initrd_end - initrd_start); 640 written, initrd_end - initrd_start);
641 641
642 sys_close(fd); 642 ksys_close(fd);
643 free_initrd(); 643 free_initrd();
644 } 644 }
645 done: 645 done:
diff --git a/init/main.c b/init/main.c
index 21efbf6ace93..e4a3160991ea 100644
--- a/init/main.c
+++ b/init/main.c
@@ -1074,11 +1074,11 @@ static noinline void __init kernel_init_freeable(void)
1074 do_basic_setup(); 1074 do_basic_setup();
1075 1075
1076 /* Open the /dev/console on the rootfs, this should never fail */ 1076 /* Open the /dev/console on the rootfs, this should never fail */
1077 if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) 1077 if (ksys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)
1078 pr_err("Warning: unable to open an initial console.\n"); 1078 pr_err("Warning: unable to open an initial console.\n");
1079 1079
1080 (void) sys_dup(0); 1080 (void) ksys_dup(0);
1081 (void) sys_dup(0); 1081 (void) ksys_dup(0);
1082 /* 1082 /*
1083 * check if there is an early userspace init. If yes, let it do all 1083 * check if there is an early userspace init. If yes, let it do all
1084 * the work 1084 * the work
@@ -1087,7 +1087,8 @@ static noinline void __init kernel_init_freeable(void)
1087 if (!ramdisk_execute_command) 1087 if (!ramdisk_execute_command)
1088 ramdisk_execute_command = "/init"; 1088 ramdisk_execute_command = "/init";
1089 1089
1090 if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) { 1090 if (ksys_access((const char __user *)
1091 ramdisk_execute_command, 0) != 0) {
1091 ramdisk_execute_command = NULL; 1092 ramdisk_execute_command = NULL;
1092 prepare_namespace(); 1093 prepare_namespace();
1093 } 1094 }
diff --git a/init/noinitramfs.c b/init/noinitramfs.c
index 267739d85179..f4bad8436c93 100644
--- a/init/noinitramfs.c
+++ b/init/noinitramfs.c
@@ -29,17 +29,17 @@ static int __init default_rootfs(void)
29{ 29{
30 int err; 30 int err;
31 31
32 err = sys_mkdir((const char __user __force *) "/dev", 0755); 32 err = ksys_mkdir((const char __user __force *) "/dev", 0755);
33 if (err < 0) 33 if (err < 0)
34 goto out; 34 goto out;
35 35
36 err = sys_mknod((const char __user __force *) "/dev/console", 36 err = ksys_mknod((const char __user __force *) "/dev/console",
37 S_IFCHR | S_IRUSR | S_IWUSR, 37 S_IFCHR | S_IRUSR | S_IWUSR,
38 new_encode_dev(MKDEV(5, 1))); 38 new_encode_dev(MKDEV(5, 1)));
39 if (err < 0) 39 if (err < 0)
40 goto out; 40 goto out;
41 41
42 err = sys_mkdir((const char __user __force *) "/root", 0700); 42 err = ksys_mkdir((const char __user __force *) "/root", 0700);
43 if (err < 0) 43 if (err < 0)
44 goto out; 44 goto out;
45 45
diff --git a/ipc/msg.c b/ipc/msg.c
index 0dcc6699dc53..9de48065c1ac 100644
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -263,7 +263,7 @@ static inline int msg_security(struct kern_ipc_perm *ipcp, int msgflg)
263 return security_msg_queue_associate(msq, msgflg); 263 return security_msg_queue_associate(msq, msgflg);
264} 264}
265 265
266SYSCALL_DEFINE2(msgget, key_t, key, int, msgflg) 266long ksys_msgget(key_t key, int msgflg)
267{ 267{
268 struct ipc_namespace *ns; 268 struct ipc_namespace *ns;
269 static const struct ipc_ops msg_ops = { 269 static const struct ipc_ops msg_ops = {
@@ -280,6 +280,11 @@ SYSCALL_DEFINE2(msgget, key_t, key, int, msgflg)
280 return ipcget(ns, &msg_ids(ns), &msg_ops, &msg_params); 280 return ipcget(ns, &msg_ids(ns), &msg_ops, &msg_params);
281} 281}
282 282
283SYSCALL_DEFINE2(msgget, key_t, key, int, msgflg)
284{
285 return ksys_msgget(key, msgflg);
286}
287
283static inline unsigned long 288static inline unsigned long
284copy_msqid_to_user(void __user *buf, struct msqid64_ds *in, int version) 289copy_msqid_to_user(void __user *buf, struct msqid64_ds *in, int version)
285{ 290{
@@ -533,7 +538,7 @@ out_unlock:
533 return err; 538 return err;
534} 539}
535 540
536SYSCALL_DEFINE3(msgctl, int, msqid, int, cmd, struct msqid_ds __user *, buf) 541long ksys_msgctl(int msqid, int cmd, struct msqid_ds __user *buf)
537{ 542{
538 int version; 543 int version;
539 struct ipc_namespace *ns; 544 struct ipc_namespace *ns;
@@ -576,6 +581,11 @@ SYSCALL_DEFINE3(msgctl, int, msqid, int, cmd, struct msqid_ds __user *, buf)
576 } 581 }
577} 582}
578 583
584SYSCALL_DEFINE3(msgctl, int, msqid, int, cmd, struct msqid_ds __user *, buf)
585{
586 return ksys_msgctl(msqid, cmd, buf);
587}
588
579#ifdef CONFIG_COMPAT 589#ifdef CONFIG_COMPAT
580 590
581struct compat_msqid_ds { 591struct compat_msqid_ds {
@@ -646,7 +656,7 @@ static int copy_compat_msqid_to_user(void __user *buf, struct msqid64_ds *in,
646 } 656 }
647} 657}
648 658
649COMPAT_SYSCALL_DEFINE3(msgctl, int, msqid, int, cmd, void __user *, uptr) 659long compat_ksys_msgctl(int msqid, int cmd, void __user *uptr)
650{ 660{
651 struct ipc_namespace *ns; 661 struct ipc_namespace *ns;
652 int err; 662 int err;
@@ -687,6 +697,11 @@ COMPAT_SYSCALL_DEFINE3(msgctl, int, msqid, int, cmd, void __user *, uptr)
687 return -EINVAL; 697 return -EINVAL;
688 } 698 }
689} 699}
700
701COMPAT_SYSCALL_DEFINE3(msgctl, int, msqid, int, cmd, void __user *, uptr)
702{
703 return compat_ksys_msgctl(msqid, cmd, uptr);
704}
690#endif 705#endif
691 706
692static int testmsg(struct msg_msg *msg, long type, int mode) 707static int testmsg(struct msg_msg *msg, long type, int mode)
@@ -852,8 +867,8 @@ out_unlock1:
852 return err; 867 return err;
853} 868}
854 869
855SYSCALL_DEFINE4(msgsnd, int, msqid, struct msgbuf __user *, msgp, size_t, msgsz, 870long ksys_msgsnd(int msqid, struct msgbuf __user *msgp, size_t msgsz,
856 int, msgflg) 871 int msgflg)
857{ 872{
858 long mtype; 873 long mtype;
859 874
@@ -862,6 +877,12 @@ SYSCALL_DEFINE4(msgsnd, int, msqid, struct msgbuf __user *, msgp, size_t, msgsz,
862 return do_msgsnd(msqid, mtype, msgp->mtext, msgsz, msgflg); 877 return do_msgsnd(msqid, mtype, msgp->mtext, msgsz, msgflg);
863} 878}
864 879
880SYSCALL_DEFINE4(msgsnd, int, msqid, struct msgbuf __user *, msgp, size_t, msgsz,
881 int, msgflg)
882{
883 return ksys_msgsnd(msqid, msgp, msgsz, msgflg);
884}
885
865#ifdef CONFIG_COMPAT 886#ifdef CONFIG_COMPAT
866 887
867struct compat_msgbuf { 888struct compat_msgbuf {
@@ -869,8 +890,8 @@ struct compat_msgbuf {
869 char mtext[1]; 890 char mtext[1];
870}; 891};
871 892
872COMPAT_SYSCALL_DEFINE4(msgsnd, int, msqid, compat_uptr_t, msgp, 893long compat_ksys_msgsnd(int msqid, compat_uptr_t msgp,
873 compat_ssize_t, msgsz, int, msgflg) 894 compat_ssize_t msgsz, int msgflg)
874{ 895{
875 struct compat_msgbuf __user *up = compat_ptr(msgp); 896 struct compat_msgbuf __user *up = compat_ptr(msgp);
876 compat_long_t mtype; 897 compat_long_t mtype;
@@ -879,6 +900,12 @@ COMPAT_SYSCALL_DEFINE4(msgsnd, int, msqid, compat_uptr_t, msgp,
879 return -EFAULT; 900 return -EFAULT;
880 return do_msgsnd(msqid, mtype, up->mtext, (ssize_t)msgsz, msgflg); 901 return do_msgsnd(msqid, mtype, up->mtext, (ssize_t)msgsz, msgflg);
881} 902}
903
904COMPAT_SYSCALL_DEFINE4(msgsnd, int, msqid, compat_uptr_t, msgp,
905 compat_ssize_t, msgsz, int, msgflg)
906{
907 return compat_ksys_msgsnd(msqid, msgp, msgsz, msgflg);
908}
882#endif 909#endif
883 910
884static inline int convert_mode(long *msgtyp, int msgflg) 911static inline int convert_mode(long *msgtyp, int msgflg)
@@ -1135,10 +1162,16 @@ out_unlock1:
1135 return bufsz; 1162 return bufsz;
1136} 1163}
1137 1164
1165long ksys_msgrcv(int msqid, struct msgbuf __user *msgp, size_t msgsz,
1166 long msgtyp, int msgflg)
1167{
1168 return do_msgrcv(msqid, msgp, msgsz, msgtyp, msgflg, do_msg_fill);
1169}
1170
1138SYSCALL_DEFINE5(msgrcv, int, msqid, struct msgbuf __user *, msgp, size_t, msgsz, 1171SYSCALL_DEFINE5(msgrcv, int, msqid, struct msgbuf __user *, msgp, size_t, msgsz,
1139 long, msgtyp, int, msgflg) 1172 long, msgtyp, int, msgflg)
1140{ 1173{
1141 return do_msgrcv(msqid, msgp, msgsz, msgtyp, msgflg, do_msg_fill); 1174 return ksys_msgrcv(msqid, msgp, msgsz, msgtyp, msgflg);
1142} 1175}
1143 1176
1144#ifdef CONFIG_COMPAT 1177#ifdef CONFIG_COMPAT
@@ -1156,12 +1189,19 @@ static long compat_do_msg_fill(void __user *dest, struct msg_msg *msg, size_t bu
1156 return msgsz; 1189 return msgsz;
1157} 1190}
1158 1191
1159COMPAT_SYSCALL_DEFINE5(msgrcv, int, msqid, compat_uptr_t, msgp, 1192long compat_ksys_msgrcv(int msqid, compat_uptr_t msgp, compat_ssize_t msgsz,
1160 compat_ssize_t, msgsz, compat_long_t, msgtyp, int, msgflg) 1193 compat_long_t msgtyp, int msgflg)
1161{ 1194{
1162 return do_msgrcv(msqid, compat_ptr(msgp), (ssize_t)msgsz, (long)msgtyp, 1195 return do_msgrcv(msqid, compat_ptr(msgp), (ssize_t)msgsz, (long)msgtyp,
1163 msgflg, compat_do_msg_fill); 1196 msgflg, compat_do_msg_fill);
1164} 1197}
1198
1199COMPAT_SYSCALL_DEFINE5(msgrcv, int, msqid, compat_uptr_t, msgp,
1200 compat_ssize_t, msgsz, compat_long_t, msgtyp,
1201 int, msgflg)
1202{
1203 return compat_ksys_msgrcv(msqid, msgp, msgsz, msgtyp, msgflg);
1204}
1165#endif 1205#endif
1166 1206
1167int msg_init_ns(struct ipc_namespace *ns) 1207int msg_init_ns(struct ipc_namespace *ns)
diff --git a/ipc/sem.c b/ipc/sem.c
index a4af04979fd2..1cf56279a84c 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -556,7 +556,7 @@ static inline int sem_more_checks(struct kern_ipc_perm *ipcp,
556 return 0; 556 return 0;
557} 557}
558 558
559SYSCALL_DEFINE3(semget, key_t, key, int, nsems, int, semflg) 559long ksys_semget(key_t key, int nsems, int semflg)
560{ 560{
561 struct ipc_namespace *ns; 561 struct ipc_namespace *ns;
562 static const struct ipc_ops sem_ops = { 562 static const struct ipc_ops sem_ops = {
@@ -578,6 +578,11 @@ SYSCALL_DEFINE3(semget, key_t, key, int, nsems, int, semflg)
578 return ipcget(ns, &sem_ids(ns), &sem_ops, &sem_params); 578 return ipcget(ns, &sem_ids(ns), &sem_ops, &sem_params);
579} 579}
580 580
581SYSCALL_DEFINE3(semget, key_t, key, int, nsems, int, semflg)
582{
583 return ksys_semget(key, nsems, semflg);
584}
585
581/** 586/**
582 * perform_atomic_semop[_slow] - Attempt to perform semaphore 587 * perform_atomic_semop[_slow] - Attempt to perform semaphore
583 * operations on a given array. 588 * operations on a given array.
@@ -1576,7 +1581,7 @@ out_up:
1576 return err; 1581 return err;
1577} 1582}
1578 1583
1579SYSCALL_DEFINE4(semctl, int, semid, int, semnum, int, cmd, unsigned long, arg) 1584long ksys_semctl(int semid, int semnum, int cmd, unsigned long arg)
1580{ 1585{
1581 int version; 1586 int version;
1582 struct ipc_namespace *ns; 1587 struct ipc_namespace *ns;
@@ -1630,6 +1635,11 @@ SYSCALL_DEFINE4(semctl, int, semid, int, semnum, int, cmd, unsigned long, arg)
1630 } 1635 }
1631} 1636}
1632 1637
1638SYSCALL_DEFINE4(semctl, int, semid, int, semnum, int, cmd, unsigned long, arg)
1639{
1640 return ksys_semctl(semid, semnum, cmd, arg);
1641}
1642
1633#ifdef CONFIG_COMPAT 1643#ifdef CONFIG_COMPAT
1634 1644
1635struct compat_semid_ds { 1645struct compat_semid_ds {
@@ -1678,7 +1688,7 @@ static int copy_compat_semid_to_user(void __user *buf, struct semid64_ds *in,
1678 } 1688 }
1679} 1689}
1680 1690
1681COMPAT_SYSCALL_DEFINE4(semctl, int, semid, int, semnum, int, cmd, int, arg) 1691long compat_ksys_semctl(int semid, int semnum, int cmd, int arg)
1682{ 1692{
1683 void __user *p = compat_ptr(arg); 1693 void __user *p = compat_ptr(arg);
1684 struct ipc_namespace *ns; 1694 struct ipc_namespace *ns;
@@ -1722,6 +1732,11 @@ COMPAT_SYSCALL_DEFINE4(semctl, int, semid, int, semnum, int, cmd, int, arg)
1722 return -EINVAL; 1732 return -EINVAL;
1723 } 1733 }
1724} 1734}
1735
1736COMPAT_SYSCALL_DEFINE4(semctl, int, semid, int, semnum, int, cmd, int, arg)
1737{
1738 return compat_ksys_semctl(semid, semnum, cmd, arg);
1739}
1725#endif 1740#endif
1726 1741
1727/* If the task doesn't already have a undo_list, then allocate one 1742/* If the task doesn't already have a undo_list, then allocate one
@@ -2120,8 +2135,8 @@ out_free:
2120 return error; 2135 return error;
2121} 2136}
2122 2137
2123SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsops, 2138long ksys_semtimedop(int semid, struct sembuf __user *tsops,
2124 unsigned, nsops, const struct timespec __user *, timeout) 2139 unsigned int nsops, const struct timespec __user *timeout)
2125{ 2140{
2126 if (timeout) { 2141 if (timeout) {
2127 struct timespec64 ts; 2142 struct timespec64 ts;
@@ -2132,10 +2147,16 @@ SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsops,
2132 return do_semtimedop(semid, tsops, nsops, NULL); 2147 return do_semtimedop(semid, tsops, nsops, NULL);
2133} 2148}
2134 2149
2150SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsops,
2151 unsigned int, nsops, const struct timespec __user *, timeout)
2152{
2153 return ksys_semtimedop(semid, tsops, nsops, timeout);
2154}
2155
2135#ifdef CONFIG_COMPAT 2156#ifdef CONFIG_COMPAT
2136COMPAT_SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsems, 2157long compat_ksys_semtimedop(int semid, struct sembuf __user *tsems,
2137 unsigned, nsops, 2158 unsigned int nsops,
2138 const struct compat_timespec __user *, timeout) 2159 const struct compat_timespec __user *timeout)
2139{ 2160{
2140 if (timeout) { 2161 if (timeout) {
2141 struct timespec64 ts; 2162 struct timespec64 ts;
@@ -2145,6 +2166,13 @@ COMPAT_SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsems,
2145 } 2166 }
2146 return do_semtimedop(semid, tsems, nsops, NULL); 2167 return do_semtimedop(semid, tsems, nsops, NULL);
2147} 2168}
2169
2170COMPAT_SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsems,
2171 unsigned int, nsops,
2172 const struct compat_timespec __user *, timeout)
2173{
2174 return compat_ksys_semtimedop(semid, tsems, nsops, timeout);
2175}
2148#endif 2176#endif
2149 2177
2150SYSCALL_DEFINE3(semop, int, semid, struct sembuf __user *, tsops, 2178SYSCALL_DEFINE3(semop, int, semid, struct sembuf __user *, tsops,
diff --git a/ipc/shm.c b/ipc/shm.c
index 93e0e3a4d009..c38c8425a89e 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -668,7 +668,7 @@ static inline int shm_more_checks(struct kern_ipc_perm *ipcp,
668 return 0; 668 return 0;
669} 669}
670 670
671SYSCALL_DEFINE3(shmget, key_t, key, size_t, size, int, shmflg) 671long ksys_shmget(key_t key, size_t size, int shmflg)
672{ 672{
673 struct ipc_namespace *ns; 673 struct ipc_namespace *ns;
674 static const struct ipc_ops shm_ops = { 674 static const struct ipc_ops shm_ops = {
@@ -687,6 +687,11 @@ SYSCALL_DEFINE3(shmget, key_t, key, size_t, size, int, shmflg)
687 return ipcget(ns, &shm_ids(ns), &shm_ops, &shm_params); 687 return ipcget(ns, &shm_ids(ns), &shm_ops, &shm_params);
688} 688}
689 689
690SYSCALL_DEFINE3(shmget, key_t, key, size_t, size, int, shmflg)
691{
692 return ksys_shmget(key, size, shmflg);
693}
694
690static inline unsigned long copy_shmid_to_user(void __user *buf, struct shmid64_ds *in, int version) 695static inline unsigned long copy_shmid_to_user(void __user *buf, struct shmid64_ds *in, int version)
691{ 696{
692 switch (version) { 697 switch (version) {
@@ -1052,7 +1057,7 @@ out_unlock1:
1052 return err; 1057 return err;
1053} 1058}
1054 1059
1055SYSCALL_DEFINE3(shmctl, int, shmid, int, cmd, struct shmid_ds __user *, buf) 1060long ksys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf)
1056{ 1061{
1057 int err, version; 1062 int err, version;
1058 struct ipc_namespace *ns; 1063 struct ipc_namespace *ns;
@@ -1106,6 +1111,11 @@ SYSCALL_DEFINE3(shmctl, int, shmid, int, cmd, struct shmid_ds __user *, buf)
1106 } 1111 }
1107} 1112}
1108 1113
1114SYSCALL_DEFINE3(shmctl, int, shmid, int, cmd, struct shmid_ds __user *, buf)
1115{
1116 return ksys_shmctl(shmid, cmd, buf);
1117}
1118
1109#ifdef CONFIG_COMPAT 1119#ifdef CONFIG_COMPAT
1110 1120
1111struct compat_shmid_ds { 1121struct compat_shmid_ds {
@@ -1225,7 +1235,7 @@ static int copy_compat_shmid_from_user(struct shmid64_ds *out, void __user *buf,
1225 } 1235 }
1226} 1236}
1227 1237
1228COMPAT_SYSCALL_DEFINE3(shmctl, int, shmid, int, cmd, void __user *, uptr) 1238long compat_ksys_shmctl(int shmid, int cmd, void __user *uptr)
1229{ 1239{
1230 struct ipc_namespace *ns; 1240 struct ipc_namespace *ns;
1231 struct shmid64_ds sem64; 1241 struct shmid64_ds sem64;
@@ -1280,6 +1290,11 @@ COMPAT_SYSCALL_DEFINE3(shmctl, int, shmid, int, cmd, void __user *, uptr)
1280 } 1290 }
1281 return err; 1291 return err;
1282} 1292}
1293
1294COMPAT_SYSCALL_DEFINE3(shmctl, int, shmid, int, cmd, void __user *, uptr)
1295{
1296 return compat_ksys_shmctl(shmid, cmd, uptr);
1297}
1283#endif 1298#endif
1284 1299
1285/* 1300/*
@@ -1488,7 +1503,7 @@ COMPAT_SYSCALL_DEFINE3(shmat, int, shmid, compat_uptr_t, shmaddr, int, shmflg)
1488 * detach and kill segment if marked destroyed. 1503 * detach and kill segment if marked destroyed.
1489 * The work is done in shm_close. 1504 * The work is done in shm_close.
1490 */ 1505 */
1491SYSCALL_DEFINE1(shmdt, char __user *, shmaddr) 1506long ksys_shmdt(char __user *shmaddr)
1492{ 1507{
1493 struct mm_struct *mm = current->mm; 1508 struct mm_struct *mm = current->mm;
1494 struct vm_area_struct *vma; 1509 struct vm_area_struct *vma;
@@ -1595,6 +1610,11 @@ SYSCALL_DEFINE1(shmdt, char __user *, shmaddr)
1595 return retval; 1610 return retval;
1596} 1611}
1597 1612
1613SYSCALL_DEFINE1(shmdt, char __user *, shmaddr)
1614{
1615 return ksys_shmdt(shmaddr);
1616}
1617
1598#ifdef CONFIG_PROC_FS 1618#ifdef CONFIG_PROC_FS
1599static int sysvipc_shm_proc_show(struct seq_file *s, void *it) 1619static int sysvipc_shm_proc_show(struct seq_file *s, void *it)
1600{ 1620{
diff --git a/ipc/syscall.c b/ipc/syscall.c
index 3763b4293b74..77a883ef2eca 100644
--- a/ipc/syscall.c
+++ b/ipc/syscall.c
@@ -7,6 +7,9 @@
7 */ 7 */
8#include <linux/unistd.h> 8#include <linux/unistd.h>
9#include <linux/syscalls.h> 9#include <linux/syscalls.h>
10#include <linux/security.h>
11#include <linux/ipc_namespace.h>
12#include "util.h"
10 13
11#ifdef __ARCH_WANT_SYS_IPC 14#ifdef __ARCH_WANT_SYS_IPC
12#include <linux/errno.h> 15#include <linux/errno.h>
@@ -24,26 +27,26 @@ SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, unsigned long, second,
24 27
25 switch (call) { 28 switch (call) {
26 case SEMOP: 29 case SEMOP:
27 return sys_semtimedop(first, (struct sembuf __user *)ptr, 30 return ksys_semtimedop(first, (struct sembuf __user *)ptr,
28 second, NULL); 31 second, NULL);
29 case SEMTIMEDOP: 32 case SEMTIMEDOP:
30 return sys_semtimedop(first, (struct sembuf __user *)ptr, 33 return ksys_semtimedop(first, (struct sembuf __user *)ptr,
31 second, 34 second,
32 (const struct timespec __user *)fifth); 35 (const struct timespec __user *)fifth);
33 36
34 case SEMGET: 37 case SEMGET:
35 return sys_semget(first, second, third); 38 return ksys_semget(first, second, third);
36 case SEMCTL: { 39 case SEMCTL: {
37 unsigned long arg; 40 unsigned long arg;
38 if (!ptr) 41 if (!ptr)
39 return -EINVAL; 42 return -EINVAL;
40 if (get_user(arg, (unsigned long __user *) ptr)) 43 if (get_user(arg, (unsigned long __user *) ptr))
41 return -EFAULT; 44 return -EFAULT;
42 return sys_semctl(first, second, third, arg); 45 return ksys_semctl(first, second, third, arg);
43 } 46 }
44 47
45 case MSGSND: 48 case MSGSND:
46 return sys_msgsnd(first, (struct msgbuf __user *) ptr, 49 return ksys_msgsnd(first, (struct msgbuf __user *) ptr,
47 second, third); 50 second, third);
48 case MSGRCV: 51 case MSGRCV:
49 switch (version) { 52 switch (version) {
@@ -56,18 +59,19 @@ SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, unsigned long, second,
56 (struct ipc_kludge __user *) ptr, 59 (struct ipc_kludge __user *) ptr,
57 sizeof(tmp))) 60 sizeof(tmp)))
58 return -EFAULT; 61 return -EFAULT;
59 return sys_msgrcv(first, tmp.msgp, second, 62 return ksys_msgrcv(first, tmp.msgp, second,
60 tmp.msgtyp, third); 63 tmp.msgtyp, third);
61 } 64 }
62 default: 65 default:
63 return sys_msgrcv(first, 66 return ksys_msgrcv(first,
64 (struct msgbuf __user *) ptr, 67 (struct msgbuf __user *) ptr,
65 second, fifth, third); 68 second, fifth, third);
66 } 69 }
67 case MSGGET: 70 case MSGGET:
68 return sys_msgget((key_t) first, second); 71 return ksys_msgget((key_t) first, second);
69 case MSGCTL: 72 case MSGCTL:
70 return sys_msgctl(first, second, (struct msqid_ds __user *)ptr); 73 return ksys_msgctl(first, second,
74 (struct msqid_ds __user *)ptr);
71 75
72 case SHMAT: 76 case SHMAT:
73 switch (version) { 77 switch (version) {
@@ -87,11 +91,11 @@ SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, unsigned long, second,
87 return -EINVAL; 91 return -EINVAL;
88 } 92 }
89 case SHMDT: 93 case SHMDT:
90 return sys_shmdt((char __user *)ptr); 94 return ksys_shmdt((char __user *)ptr);
91 case SHMGET: 95 case SHMGET:
92 return sys_shmget(first, second, third); 96 return ksys_shmget(first, second, third);
93 case SHMCTL: 97 case SHMCTL:
94 return sys_shmctl(first, second, 98 return ksys_shmctl(first, second,
95 (struct shmid_ds __user *) ptr); 99 (struct shmid_ds __user *) ptr);
96 default: 100 default:
97 return -ENOSYS; 101 return -ENOSYS;
@@ -124,21 +128,21 @@ COMPAT_SYSCALL_DEFINE6(ipc, u32, call, int, first, int, second,
124 switch (call) { 128 switch (call) {
125 case SEMOP: 129 case SEMOP:
126 /* struct sembuf is the same on 32 and 64bit :)) */ 130 /* struct sembuf is the same on 32 and 64bit :)) */
127 return sys_semtimedop(first, compat_ptr(ptr), second, NULL); 131 return ksys_semtimedop(first, compat_ptr(ptr), second, NULL);
128 case SEMTIMEDOP: 132 case SEMTIMEDOP:
129 return compat_sys_semtimedop(first, compat_ptr(ptr), second, 133 return compat_ksys_semtimedop(first, compat_ptr(ptr), second,
130 compat_ptr(fifth)); 134 compat_ptr(fifth));
131 case SEMGET: 135 case SEMGET:
132 return sys_semget(first, second, third); 136 return ksys_semget(first, second, third);
133 case SEMCTL: 137 case SEMCTL:
134 if (!ptr) 138 if (!ptr)
135 return -EINVAL; 139 return -EINVAL;
136 if (get_user(pad, (u32 __user *) compat_ptr(ptr))) 140 if (get_user(pad, (u32 __user *) compat_ptr(ptr)))
137 return -EFAULT; 141 return -EFAULT;
138 return compat_sys_semctl(first, second, third, pad); 142 return compat_ksys_semctl(first, second, third, pad);
139 143
140 case MSGSND: 144 case MSGSND:
141 return compat_sys_msgsnd(first, ptr, second, third); 145 return compat_ksys_msgsnd(first, ptr, second, third);
142 146
143 case MSGRCV: { 147 case MSGRCV: {
144 void __user *uptr = compat_ptr(ptr); 148 void __user *uptr = compat_ptr(ptr);
@@ -152,15 +156,15 @@ COMPAT_SYSCALL_DEFINE6(ipc, u32, call, int, first, int, second,
152 return -EINVAL; 156 return -EINVAL;
153 if (copy_from_user(&ipck, uptr, sizeof(ipck))) 157 if (copy_from_user(&ipck, uptr, sizeof(ipck)))
154 return -EFAULT; 158 return -EFAULT;
155 return compat_sys_msgrcv(first, ipck.msgp, second, 159 return compat_ksys_msgrcv(first, ipck.msgp, second,
156 ipck.msgtyp, third); 160 ipck.msgtyp, third);
157 } 161 }
158 return compat_sys_msgrcv(first, ptr, second, fifth, third); 162 return compat_ksys_msgrcv(first, ptr, second, fifth, third);
159 } 163 }
160 case MSGGET: 164 case MSGGET:
161 return sys_msgget(first, second); 165 return ksys_msgget(first, second);
162 case MSGCTL: 166 case MSGCTL:
163 return compat_sys_msgctl(first, second, compat_ptr(ptr)); 167 return compat_ksys_msgctl(first, second, compat_ptr(ptr));
164 168
165 case SHMAT: { 169 case SHMAT: {
166 int err; 170 int err;
@@ -175,11 +179,11 @@ COMPAT_SYSCALL_DEFINE6(ipc, u32, call, int, first, int, second,
175 return put_user(raddr, (compat_ulong_t __user *)compat_ptr(third)); 179 return put_user(raddr, (compat_ulong_t __user *)compat_ptr(third));
176 } 180 }
177 case SHMDT: 181 case SHMDT:
178 return sys_shmdt(compat_ptr(ptr)); 182 return ksys_shmdt(compat_ptr(ptr));
179 case SHMGET: 183 case SHMGET:
180 return sys_shmget(first, (unsigned)second, third); 184 return ksys_shmget(first, (unsigned int)second, third);
181 case SHMCTL: 185 case SHMCTL:
182 return compat_sys_shmctl(first, second, compat_ptr(ptr)); 186 return compat_ksys_shmctl(first, second, compat_ptr(ptr));
183 } 187 }
184 188
185 return -ENOSYS; 189 return -ENOSYS;
diff --git a/ipc/util.h b/ipc/util.h
index 89b8ec176fc4..51853dc2f340 100644
--- a/ipc/util.h
+++ b/ipc/util.h
@@ -235,4 +235,35 @@ static inline int compat_ipc_parse_version(int *cmd)
235#endif 235#endif
236} 236}
237#endif 237#endif
238
239/* for __ARCH_WANT_SYS_IPC */
240long ksys_semtimedop(int semid, struct sembuf __user *tsops,
241 unsigned int nsops,
242 const struct timespec __user *timeout);
243long ksys_semget(key_t key, int nsems, int semflg);
244long ksys_semctl(int semid, int semnum, int cmd, unsigned long arg);
245long ksys_msgget(key_t key, int msgflg);
246long ksys_msgctl(int msqid, int cmd, struct msqid_ds __user *buf);
247long ksys_msgrcv(int msqid, struct msgbuf __user *msgp, size_t msgsz,
248 long msgtyp, int msgflg);
249long ksys_msgsnd(int msqid, struct msgbuf __user *msgp, size_t msgsz,
250 int msgflg);
251long ksys_shmget(key_t key, size_t size, int shmflg);
252long ksys_shmdt(char __user *shmaddr);
253long ksys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf);
254
255/* for CONFIG_ARCH_WANT_OLD_COMPAT_IPC */
256#ifdef CONFIG_COMPAT
257long compat_ksys_semtimedop(int semid, struct sembuf __user *tsems,
258 unsigned int nsops,
259 const struct compat_timespec __user *timeout);
260long compat_ksys_semctl(int semid, int semnum, int cmd, int arg);
261long compat_ksys_msgctl(int msqid, int cmd, void __user *uptr);
262long compat_ksys_msgrcv(int msqid, compat_uptr_t msgp, compat_ssize_t msgsz,
263 compat_long_t msgtyp, int msgflg);
264long compat_ksys_msgsnd(int msqid, compat_uptr_t msgp,
265 compat_ssize_t msgsz, int msgflg);
266long compat_ksys_shmctl(int shmid, int cmd, void __user *uptr);
267#endif /* CONFIG_COMPAT */
268
238#endif 269#endif
diff --git a/kernel/compat.c b/kernel/compat.c
index 3f5fa8902e7d..6d21894806b4 100644
--- a/kernel/compat.c
+++ b/kernel/compat.c
@@ -488,61 +488,6 @@ get_compat_sigset(sigset_t *set, const compat_sigset_t __user *compat)
488} 488}
489EXPORT_SYMBOL_GPL(get_compat_sigset); 489EXPORT_SYMBOL_GPL(get_compat_sigset);
490 490
491#ifdef CONFIG_NUMA
492COMPAT_SYSCALL_DEFINE6(move_pages, pid_t, pid, compat_ulong_t, nr_pages,
493 compat_uptr_t __user *, pages32,
494 const int __user *, nodes,
495 int __user *, status,
496 int, flags)
497{
498 const void __user * __user *pages;
499 int i;
500
501 pages = compat_alloc_user_space(nr_pages * sizeof(void *));
502 for (i = 0; i < nr_pages; i++) {
503 compat_uptr_t p;
504
505 if (get_user(p, pages32 + i) ||
506 put_user(compat_ptr(p), pages + i))
507 return -EFAULT;
508 }
509 return sys_move_pages(pid, nr_pages, pages, nodes, status, flags);
510}
511
512COMPAT_SYSCALL_DEFINE4(migrate_pages, compat_pid_t, pid,
513 compat_ulong_t, maxnode,
514 const compat_ulong_t __user *, old_nodes,
515 const compat_ulong_t __user *, new_nodes)
516{
517 unsigned long __user *old = NULL;
518 unsigned long __user *new = NULL;
519 nodemask_t tmp_mask;
520 unsigned long nr_bits;
521 unsigned long size;
522
523 nr_bits = min_t(unsigned long, maxnode - 1, MAX_NUMNODES);
524 size = ALIGN(nr_bits, BITS_PER_LONG) / 8;
525 if (old_nodes) {
526 if (compat_get_bitmap(nodes_addr(tmp_mask), old_nodes, nr_bits))
527 return -EFAULT;
528 old = compat_alloc_user_space(new_nodes ? size * 2 : size);
529 if (new_nodes)
530 new = old + size / sizeof(unsigned long);
531 if (copy_to_user(old, nodes_addr(tmp_mask), size))
532 return -EFAULT;
533 }
534 if (new_nodes) {
535 if (compat_get_bitmap(nodes_addr(tmp_mask), new_nodes, nr_bits))
536 return -EFAULT;
537 if (new == NULL)
538 new = compat_alloc_user_space(size);
539 if (copy_to_user(new, nodes_addr(tmp_mask), size))
540 return -EFAULT;
541 }
542 return sys_migrate_pages(pid, nr_bits + 1, old, new);
543}
544#endif
545
546/* 491/*
547 * Allocate user-space memory for the duration of a single system call, 492 * Allocate user-space memory for the duration of a single system call,
548 * in order to marshall parameters inside a compat thunk. 493 * in order to marshall parameters inside a compat thunk.
diff --git a/kernel/exit.c b/kernel/exit.c
index 995453d9fb55..c3c7ac560114 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -1691,7 +1691,7 @@ SYSCALL_DEFINE4(wait4, pid_t, upid, int __user *, stat_addr,
1691 */ 1691 */
1692SYSCALL_DEFINE3(waitpid, pid_t, pid, int __user *, stat_addr, int, options) 1692SYSCALL_DEFINE3(waitpid, pid_t, pid, int __user *, stat_addr, int, options)
1693{ 1693{
1694 return sys_wait4(pid, stat_addr, options, NULL); 1694 return kernel_wait4(pid, stat_addr, options, NULL);
1695} 1695}
1696 1696
1697#endif 1697#endif
diff --git a/kernel/fork.c b/kernel/fork.c
index e5d9d405ae4e..f71b67dc156d 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1198,8 +1198,8 @@ void mm_release(struct task_struct *tsk, struct mm_struct *mm)
1198 * not set up a proper pointer then tough luck. 1198 * not set up a proper pointer then tough luck.
1199 */ 1199 */
1200 put_user(0, tsk->clear_child_tid); 1200 put_user(0, tsk->clear_child_tid);
1201 sys_futex(tsk->clear_child_tid, FUTEX_WAKE, 1201 do_futex(tsk->clear_child_tid, FUTEX_WAKE,
1202 1, NULL, NULL, 0); 1202 1, NULL, NULL, 0, 0);
1203 } 1203 }
1204 tsk->clear_child_tid = NULL; 1204 tsk->clear_child_tid = NULL;
1205 } 1205 }
@@ -2354,7 +2354,7 @@ static int unshare_fd(unsigned long unshare_flags, struct files_struct **new_fdp
2354 * constructed. Here we are modifying the current, active, 2354 * constructed. Here we are modifying the current, active,
2355 * task_struct. 2355 * task_struct.
2356 */ 2356 */
2357SYSCALL_DEFINE1(unshare, unsigned long, unshare_flags) 2357int ksys_unshare(unsigned long unshare_flags)
2358{ 2358{
2359 struct fs_struct *fs, *new_fs = NULL; 2359 struct fs_struct *fs, *new_fs = NULL;
2360 struct files_struct *fd, *new_fd = NULL; 2360 struct files_struct *fd, *new_fd = NULL;
@@ -2470,6 +2470,11 @@ bad_unshare_out:
2470 return err; 2470 return err;
2471} 2471}
2472 2472
2473SYSCALL_DEFINE1(unshare, unsigned long, unshare_flags)
2474{
2475 return ksys_unshare(unshare_flags);
2476}
2477
2473/* 2478/*
2474 * Helper to unshare the files of the current task. 2479 * Helper to unshare the files of the current task.
2475 * We don't want to expose copy_files internals to 2480 * We don't want to expose copy_files internals to
diff --git a/kernel/kexec.c b/kernel/kexec.c
index e62ec4dc6620..aed8fb2564b3 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -192,11 +192,9 @@ out:
192 * that to happen you need to do that yourself. 192 * that to happen you need to do that yourself.
193 */ 193 */
194 194
195SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments, 195static inline int kexec_load_check(unsigned long nr_segments,
196 struct kexec_segment __user *, segments, unsigned long, flags) 196 unsigned long flags)
197{ 197{
198 int result;
199
200 /* We only trust the superuser with rebooting the system. */ 198 /* We only trust the superuser with rebooting the system. */
201 if (!capable(CAP_SYS_BOOT) || kexec_load_disabled) 199 if (!capable(CAP_SYS_BOOT) || kexec_load_disabled)
202 return -EPERM; 200 return -EPERM;
@@ -208,17 +206,29 @@ SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments,
208 if ((flags & KEXEC_FLAGS) != (flags & ~KEXEC_ARCH_MASK)) 206 if ((flags & KEXEC_FLAGS) != (flags & ~KEXEC_ARCH_MASK))
209 return -EINVAL; 207 return -EINVAL;
210 208
211 /* Verify we are on the appropriate architecture */
212 if (((flags & KEXEC_ARCH_MASK) != KEXEC_ARCH) &&
213 ((flags & KEXEC_ARCH_MASK) != KEXEC_ARCH_DEFAULT))
214 return -EINVAL;
215
216 /* Put an artificial cap on the number 209 /* Put an artificial cap on the number
217 * of segments passed to kexec_load. 210 * of segments passed to kexec_load.
218 */ 211 */
219 if (nr_segments > KEXEC_SEGMENT_MAX) 212 if (nr_segments > KEXEC_SEGMENT_MAX)
220 return -EINVAL; 213 return -EINVAL;
221 214
215 return 0;
216}
217
218SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments,
219 struct kexec_segment __user *, segments, unsigned long, flags)
220{
221 int result;
222
223 result = kexec_load_check(nr_segments, flags);
224 if (result)
225 return result;
226
227 /* Verify we are on the appropriate architecture */
228 if (((flags & KEXEC_ARCH_MASK) != KEXEC_ARCH) &&
229 ((flags & KEXEC_ARCH_MASK) != KEXEC_ARCH_DEFAULT))
230 return -EINVAL;
231
222 /* Because we write directly to the reserved memory 232 /* Because we write directly to the reserved memory
223 * region when loading crash kernels we need a mutex here to 233 * region when loading crash kernels we need a mutex here to
224 * prevent multiple crash kernels from attempting to load 234 * prevent multiple crash kernels from attempting to load
@@ -247,15 +257,16 @@ COMPAT_SYSCALL_DEFINE4(kexec_load, compat_ulong_t, entry,
247 struct kexec_segment out, __user *ksegments; 257 struct kexec_segment out, __user *ksegments;
248 unsigned long i, result; 258 unsigned long i, result;
249 259
260 result = kexec_load_check(nr_segments, flags);
261 if (result)
262 return result;
263
250 /* Don't allow clients that don't understand the native 264 /* Don't allow clients that don't understand the native
251 * architecture to do anything. 265 * architecture to do anything.
252 */ 266 */
253 if ((flags & KEXEC_ARCH_MASK) == KEXEC_ARCH_DEFAULT) 267 if ((flags & KEXEC_ARCH_MASK) == KEXEC_ARCH_DEFAULT)
254 return -EINVAL; 268 return -EINVAL;
255 269
256 if (nr_segments > KEXEC_SEGMENT_MAX)
257 return -EINVAL;
258
259 ksegments = compat_alloc_user_space(nr_segments * sizeof(out)); 270 ksegments = compat_alloc_user_space(nr_segments * sizeof(out));
260 for (i = 0; i < nr_segments; i++) { 271 for (i = 0; i < nr_segments; i++) {
261 result = copy_from_user(&in, &segments[i], sizeof(in)); 272 result = copy_from_user(&in, &segments[i], sizeof(in));
@@ -272,6 +283,21 @@ COMPAT_SYSCALL_DEFINE4(kexec_load, compat_ulong_t, entry,
272 return -EFAULT; 283 return -EFAULT;
273 } 284 }
274 285
275 return sys_kexec_load(entry, nr_segments, ksegments, flags); 286 /* Because we write directly to the reserved memory
287 * region when loading crash kernels we need a mutex here to
288 * prevent multiple crash kernels from attempting to load
289 * simultaneously, and to prevent a crash kernel from loading
290 * over the top of a in use crash kernel.
291 *
292 * KISS: always take the mutex.
293 */
294 if (!mutex_trylock(&kexec_mutex))
295 return -EBUSY;
296
297 result = do_kexec_load(entry, nr_segments, ksegments, flags);
298
299 mutex_unlock(&kexec_mutex);
300
301 return result;
276} 302}
277#endif 303#endif
diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c
index 0b53eef7d34b..93b57f026688 100644
--- a/kernel/pid_namespace.c
+++ b/kernel/pid_namespace.c
@@ -242,16 +242,16 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns)
242 242
243 /* 243 /*
244 * Reap the EXIT_ZOMBIE children we had before we ignored SIGCHLD. 244 * Reap the EXIT_ZOMBIE children we had before we ignored SIGCHLD.
245 * sys_wait4() will also block until our children traced from the 245 * kernel_wait4() will also block until our children traced from the
246 * parent namespace are detached and become EXIT_DEAD. 246 * parent namespace are detached and become EXIT_DEAD.
247 */ 247 */
248 do { 248 do {
249 clear_thread_flag(TIF_SIGPENDING); 249 clear_thread_flag(TIF_SIGPENDING);
250 rc = sys_wait4(-1, NULL, __WALL, NULL); 250 rc = kernel_wait4(-1, NULL, __WALL, NULL);
251 } while (rc != -ECHILD); 251 } while (rc != -ECHILD);
252 252
253 /* 253 /*
254 * sys_wait4() above can't reap the EXIT_DEAD children but we do not 254 * kernel_wait4() above can't reap the EXIT_DEAD children but we do not
255 * really care, we could reparent them to the global init. We could 255 * really care, we could reparent them to the global init. We could
256 * exit and reap ->child_reaper even if it is not the last thread in 256 * exit and reap ->child_reaper even if it is not the last thread in
257 * this pid_ns, free_pid(pid_allocated == 0) calls proc_cleanup_work(), 257 * this pid_ns, free_pid(pid_allocated == 0) calls proc_cleanup_work(),
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index a5c36e9c56a6..4710f1b142fc 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -701,7 +701,7 @@ int hibernate(void)
701 } 701 }
702 702
703 pr_info("Syncing filesystems ... \n"); 703 pr_info("Syncing filesystems ... \n");
704 sys_sync(); 704 ksys_sync();
705 pr_info("done.\n"); 705 pr_info("done.\n");
706 706
707 error = freeze_processes(); 707 error = freeze_processes();
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index 0685c4499431..4c10be0f4843 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -560,7 +560,7 @@ static int enter_state(suspend_state_t state)
560#ifndef CONFIG_SUSPEND_SKIP_SYNC 560#ifndef CONFIG_SUSPEND_SKIP_SYNC
561 trace_suspend_resume(TPS("sync_filesystems"), 0, true); 561 trace_suspend_resume(TPS("sync_filesystems"), 0, true);
562 pr_info("Syncing filesystems ... "); 562 pr_info("Syncing filesystems ... ");
563 sys_sync(); 563 ksys_sync();
564 pr_cont("done.\n"); 564 pr_cont("done.\n");
565 trace_suspend_resume(TPS("sync_filesystems"), 0, false); 565 trace_suspend_resume(TPS("sync_filesystems"), 0, false);
566#endif 566#endif
diff --git a/kernel/power/user.c b/kernel/power/user.c
index 22df9f7ff672..75c959de4b29 100644
--- a/kernel/power/user.c
+++ b/kernel/power/user.c
@@ -224,7 +224,7 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
224 break; 224 break;
225 225
226 printk("Syncing filesystems ... "); 226 printk("Syncing filesystems ... ");
227 sys_sync(); 227 ksys_sync();
228 printk("done.\n"); 228 printk("done.\n");
229 229
230 error = freeze_processes(); 230 error = freeze_processes();
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index de440456f15c..28b68995a417 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -4942,7 +4942,7 @@ SYSCALL_DEFINE3(sched_getaffinity, pid_t, pid, unsigned int, len,
4942 * 4942 *
4943 * Return: 0. 4943 * Return: 0.
4944 */ 4944 */
4945SYSCALL_DEFINE0(sched_yield) 4945static void do_sched_yield(void)
4946{ 4946{
4947 struct rq_flags rf; 4947 struct rq_flags rf;
4948 struct rq *rq; 4948 struct rq *rq;
@@ -4963,7 +4963,11 @@ SYSCALL_DEFINE0(sched_yield)
4963 sched_preempt_enable_no_resched(); 4963 sched_preempt_enable_no_resched();
4964 4964
4965 schedule(); 4965 schedule();
4966}
4966 4967
4968SYSCALL_DEFINE0(sched_yield)
4969{
4970 do_sched_yield();
4967 return 0; 4971 return 0;
4968} 4972}
4969 4973
@@ -5047,7 +5051,7 @@ EXPORT_SYMBOL(__cond_resched_softirq);
5047void __sched yield(void) 5051void __sched yield(void)
5048{ 5052{
5049 set_current_state(TASK_RUNNING); 5053 set_current_state(TASK_RUNNING);
5050 sys_sched_yield(); 5054 do_sched_yield();
5051} 5055}
5052EXPORT_SYMBOL(yield); 5056EXPORT_SYMBOL(yield);
5053 5057
diff --git a/kernel/signal.c b/kernel/signal.c
index c6e4c83dc090..f04466655238 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -3573,9 +3573,8 @@ int __save_altstack(stack_t __user *uss, unsigned long sp)
3573} 3573}
3574 3574
3575#ifdef CONFIG_COMPAT 3575#ifdef CONFIG_COMPAT
3576COMPAT_SYSCALL_DEFINE2(sigaltstack, 3576static int do_compat_sigaltstack(const compat_stack_t __user *uss_ptr,
3577 const compat_stack_t __user *, uss_ptr, 3577 compat_stack_t __user *uoss_ptr)
3578 compat_stack_t __user *, uoss_ptr)
3579{ 3578{
3580 stack_t uss, uoss; 3579 stack_t uss, uoss;
3581 int ret; 3580 int ret;
@@ -3602,9 +3601,16 @@ COMPAT_SYSCALL_DEFINE2(sigaltstack,
3602 return ret; 3601 return ret;
3603} 3602}
3604 3603
3604COMPAT_SYSCALL_DEFINE2(sigaltstack,
3605 const compat_stack_t __user *, uss_ptr,
3606 compat_stack_t __user *, uoss_ptr)
3607{
3608 return do_compat_sigaltstack(uss_ptr, uoss_ptr);
3609}
3610
3605int compat_restore_altstack(const compat_stack_t __user *uss) 3611int compat_restore_altstack(const compat_stack_t __user *uss)
3606{ 3612{
3607 int err = compat_sys_sigaltstack(uss, NULL); 3613 int err = do_compat_sigaltstack(uss, NULL);
3608 /* squash all but -EFAULT for now */ 3614 /* squash all but -EFAULT for now */
3609 return err == -EFAULT ? err : 0; 3615 return err == -EFAULT ? err : 0;
3610} 3616}
@@ -3629,11 +3635,20 @@ int __compat_save_altstack(compat_stack_t __user *uss, unsigned long sp)
3629 3635
3630/** 3636/**
3631 * sys_sigpending - examine pending signals 3637 * sys_sigpending - examine pending signals
3632 * @set: where mask of pending signal is returned 3638 * @uset: where mask of pending signal is returned
3633 */ 3639 */
3634SYSCALL_DEFINE1(sigpending, old_sigset_t __user *, set) 3640SYSCALL_DEFINE1(sigpending, old_sigset_t __user *, uset)
3635{ 3641{
3636 return sys_rt_sigpending((sigset_t __user *)set, sizeof(old_sigset_t)); 3642 sigset_t set;
3643 int err;
3644
3645 if (sizeof(old_sigset_t) > sizeof(*uset))
3646 return -EINVAL;
3647
3648 err = do_sigpending(&set);
3649 if (!err && copy_to_user(uset, &set, sizeof(old_sigset_t)))
3650 err = -EFAULT;
3651 return err;
3637} 3652}
3638 3653
3639#ifdef CONFIG_COMPAT 3654#ifdef CONFIG_COMPAT
diff --git a/kernel/sys.c b/kernel/sys.c
index f2289de20e19..ad692183dfe9 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -69,6 +69,8 @@
69#include <asm/io.h> 69#include <asm/io.h>
70#include <asm/unistd.h> 70#include <asm/unistd.h>
71 71
72#include "uid16.h"
73
72#ifndef SET_UNALIGN_CTL 74#ifndef SET_UNALIGN_CTL
73# define SET_UNALIGN_CTL(a, b) (-EINVAL) 75# define SET_UNALIGN_CTL(a, b) (-EINVAL)
74#endif 76#endif
@@ -340,7 +342,7 @@ out_unlock:
340 * operations (as far as semantic preservation is concerned). 342 * operations (as far as semantic preservation is concerned).
341 */ 343 */
342#ifdef CONFIG_MULTIUSER 344#ifdef CONFIG_MULTIUSER
343SYSCALL_DEFINE2(setregid, gid_t, rgid, gid_t, egid) 345long __sys_setregid(gid_t rgid, gid_t egid)
344{ 346{
345 struct user_namespace *ns = current_user_ns(); 347 struct user_namespace *ns = current_user_ns();
346 const struct cred *old; 348 const struct cred *old;
@@ -392,12 +394,17 @@ error:
392 return retval; 394 return retval;
393} 395}
394 396
397SYSCALL_DEFINE2(setregid, gid_t, rgid, gid_t, egid)
398{
399 return __sys_setregid(rgid, egid);
400}
401
395/* 402/*
396 * setgid() is implemented like SysV w/ SAVED_IDS 403 * setgid() is implemented like SysV w/ SAVED_IDS
397 * 404 *
398 * SMP: Same implicit races as above. 405 * SMP: Same implicit races as above.
399 */ 406 */
400SYSCALL_DEFINE1(setgid, gid_t, gid) 407long __sys_setgid(gid_t gid)
401{ 408{
402 struct user_namespace *ns = current_user_ns(); 409 struct user_namespace *ns = current_user_ns();
403 const struct cred *old; 410 const struct cred *old;
@@ -429,6 +436,11 @@ error:
429 return retval; 436 return retval;
430} 437}
431 438
439SYSCALL_DEFINE1(setgid, gid_t, gid)
440{
441 return __sys_setgid(gid);
442}
443
432/* 444/*
433 * change the user struct in a credentials set to match the new UID 445 * change the user struct in a credentials set to match the new UID
434 */ 446 */
@@ -473,7 +485,7 @@ static int set_user(struct cred *new)
473 * 100% compatible with BSD. A program which uses just setuid() will be 485 * 100% compatible with BSD. A program which uses just setuid() will be
474 * 100% compatible with POSIX with saved IDs. 486 * 100% compatible with POSIX with saved IDs.
475 */ 487 */
476SYSCALL_DEFINE2(setreuid, uid_t, ruid, uid_t, euid) 488long __sys_setreuid(uid_t ruid, uid_t euid)
477{ 489{
478 struct user_namespace *ns = current_user_ns(); 490 struct user_namespace *ns = current_user_ns();
479 const struct cred *old; 491 const struct cred *old;
@@ -533,6 +545,11 @@ error:
533 return retval; 545 return retval;
534} 546}
535 547
548SYSCALL_DEFINE2(setreuid, uid_t, ruid, uid_t, euid)
549{
550 return __sys_setreuid(ruid, euid);
551}
552
536/* 553/*
537 * setuid() is implemented like SysV with SAVED_IDS 554 * setuid() is implemented like SysV with SAVED_IDS
538 * 555 *
@@ -544,7 +561,7 @@ error:
544 * will allow a root program to temporarily drop privileges and be able to 561 * will allow a root program to temporarily drop privileges and be able to
545 * regain them by swapping the real and effective uid. 562 * regain them by swapping the real and effective uid.
546 */ 563 */
547SYSCALL_DEFINE1(setuid, uid_t, uid) 564long __sys_setuid(uid_t uid)
548{ 565{
549 struct user_namespace *ns = current_user_ns(); 566 struct user_namespace *ns = current_user_ns();
550 const struct cred *old; 567 const struct cred *old;
@@ -586,12 +603,17 @@ error:
586 return retval; 603 return retval;
587} 604}
588 605
606SYSCALL_DEFINE1(setuid, uid_t, uid)
607{
608 return __sys_setuid(uid);
609}
610
589 611
590/* 612/*
591 * This function implements a generic ability to update ruid, euid, 613 * This function implements a generic ability to update ruid, euid,
592 * and suid. This allows you to implement the 4.4 compatible seteuid(). 614 * and suid. This allows you to implement the 4.4 compatible seteuid().
593 */ 615 */
594SYSCALL_DEFINE3(setresuid, uid_t, ruid, uid_t, euid, uid_t, suid) 616long __sys_setresuid(uid_t ruid, uid_t euid, uid_t suid)
595{ 617{
596 struct user_namespace *ns = current_user_ns(); 618 struct user_namespace *ns = current_user_ns();
597 const struct cred *old; 619 const struct cred *old;
@@ -656,6 +678,11 @@ error:
656 return retval; 678 return retval;
657} 679}
658 680
681SYSCALL_DEFINE3(setresuid, uid_t, ruid, uid_t, euid, uid_t, suid)
682{
683 return __sys_setresuid(ruid, euid, suid);
684}
685
659SYSCALL_DEFINE3(getresuid, uid_t __user *, ruidp, uid_t __user *, euidp, uid_t __user *, suidp) 686SYSCALL_DEFINE3(getresuid, uid_t __user *, ruidp, uid_t __user *, euidp, uid_t __user *, suidp)
660{ 687{
661 const struct cred *cred = current_cred(); 688 const struct cred *cred = current_cred();
@@ -678,7 +705,7 @@ SYSCALL_DEFINE3(getresuid, uid_t __user *, ruidp, uid_t __user *, euidp, uid_t _
678/* 705/*
679 * Same as above, but for rgid, egid, sgid. 706 * Same as above, but for rgid, egid, sgid.
680 */ 707 */
681SYSCALL_DEFINE3(setresgid, gid_t, rgid, gid_t, egid, gid_t, sgid) 708long __sys_setresgid(gid_t rgid, gid_t egid, gid_t sgid)
682{ 709{
683 struct user_namespace *ns = current_user_ns(); 710 struct user_namespace *ns = current_user_ns();
684 const struct cred *old; 711 const struct cred *old;
@@ -730,6 +757,11 @@ error:
730 return retval; 757 return retval;
731} 758}
732 759
760SYSCALL_DEFINE3(setresgid, gid_t, rgid, gid_t, egid, gid_t, sgid)
761{
762 return __sys_setresgid(rgid, egid, sgid);
763}
764
733SYSCALL_DEFINE3(getresgid, gid_t __user *, rgidp, gid_t __user *, egidp, gid_t __user *, sgidp) 765SYSCALL_DEFINE3(getresgid, gid_t __user *, rgidp, gid_t __user *, egidp, gid_t __user *, sgidp)
734{ 766{
735 const struct cred *cred = current_cred(); 767 const struct cred *cred = current_cred();
@@ -757,7 +789,7 @@ SYSCALL_DEFINE3(getresgid, gid_t __user *, rgidp, gid_t __user *, egidp, gid_t _
757 * whatever uid it wants to). It normally shadows "euid", except when 789 * whatever uid it wants to). It normally shadows "euid", except when
758 * explicitly set by setfsuid() or for access.. 790 * explicitly set by setfsuid() or for access..
759 */ 791 */
760SYSCALL_DEFINE1(setfsuid, uid_t, uid) 792long __sys_setfsuid(uid_t uid)
761{ 793{
762 const struct cred *old; 794 const struct cred *old;
763 struct cred *new; 795 struct cred *new;
@@ -793,10 +825,15 @@ change_okay:
793 return old_fsuid; 825 return old_fsuid;
794} 826}
795 827
828SYSCALL_DEFINE1(setfsuid, uid_t, uid)
829{
830 return __sys_setfsuid(uid);
831}
832
796/* 833/*
797 * Samma på svenska.. 834 * Samma på svenska..
798 */ 835 */
799SYSCALL_DEFINE1(setfsgid, gid_t, gid) 836long __sys_setfsgid(gid_t gid)
800{ 837{
801 const struct cred *old; 838 const struct cred *old;
802 struct cred *new; 839 struct cred *new;
@@ -830,6 +867,11 @@ change_okay:
830 commit_creds(new); 867 commit_creds(new);
831 return old_fsgid; 868 return old_fsgid;
832} 869}
870
871SYSCALL_DEFINE1(setfsgid, gid_t, gid)
872{
873 return __sys_setfsgid(gid);
874}
833#endif /* CONFIG_MULTIUSER */ 875#endif /* CONFIG_MULTIUSER */
834 876
835/** 877/**
@@ -1027,7 +1069,7 @@ out:
1027 return err; 1069 return err;
1028} 1070}
1029 1071
1030SYSCALL_DEFINE1(getpgid, pid_t, pid) 1072static int do_getpgid(pid_t pid)
1031{ 1073{
1032 struct task_struct *p; 1074 struct task_struct *p;
1033 struct pid *grp; 1075 struct pid *grp;
@@ -1055,11 +1097,16 @@ out:
1055 return retval; 1097 return retval;
1056} 1098}
1057 1099
1100SYSCALL_DEFINE1(getpgid, pid_t, pid)
1101{
1102 return do_getpgid(pid);
1103}
1104
1058#ifdef __ARCH_WANT_SYS_GETPGRP 1105#ifdef __ARCH_WANT_SYS_GETPGRP
1059 1106
1060SYSCALL_DEFINE0(getpgrp) 1107SYSCALL_DEFINE0(getpgrp)
1061{ 1108{
1062 return sys_getpgid(0); 1109 return do_getpgid(0);
1063} 1110}
1064 1111
1065#endif 1112#endif
@@ -1103,7 +1150,7 @@ static void set_special_pids(struct pid *pid)
1103 change_pid(curr, PIDTYPE_PGID, pid); 1150 change_pid(curr, PIDTYPE_PGID, pid);
1104} 1151}
1105 1152
1106SYSCALL_DEFINE0(setsid) 1153int ksys_setsid(void)
1107{ 1154{
1108 struct task_struct *group_leader = current->group_leader; 1155 struct task_struct *group_leader = current->group_leader;
1109 struct pid *sid = task_pid(group_leader); 1156 struct pid *sid = task_pid(group_leader);
@@ -1136,6 +1183,11 @@ out:
1136 return err; 1183 return err;
1137} 1184}
1138 1185
1186SYSCALL_DEFINE0(setsid)
1187{
1188 return ksys_setsid();
1189}
1190
1139DECLARE_RWSEM(uts_sem); 1191DECLARE_RWSEM(uts_sem);
1140 1192
1141#ifdef COMPAT_UTS_MACHINE 1193#ifdef COMPAT_UTS_MACHINE
diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c
index b5189762d275..6cafc008f6db 100644
--- a/kernel/sys_ni.c
+++ b/kernel/sys_ni.c
@@ -17,245 +17,406 @@ asmlinkage long sys_ni_syscall(void)
17 return -ENOSYS; 17 return -ENOSYS;
18} 18}
19 19
20cond_syscall(sys_quotactl); 20#define COND_SYSCALL(name) cond_syscall(sys_##name)
21cond_syscall(sys32_quotactl); 21#define COND_SYSCALL_COMPAT(name) cond_syscall(compat_sys_##name)
22cond_syscall(sys_acct); 22
23cond_syscall(sys_lookup_dcookie); 23/*
24cond_syscall(compat_sys_lookup_dcookie); 24 * This list is kept in the same order as include/uapi/asm-generic/unistd.h.
25cond_syscall(sys_swapon); 25 * Architecture specific entries go below, followed by deprecated or obsolete
26cond_syscall(sys_swapoff); 26 * system calls.
27cond_syscall(sys_kexec_load); 27 */
28cond_syscall(compat_sys_kexec_load); 28
29cond_syscall(sys_kexec_file_load); 29COND_SYSCALL(io_setup);
30cond_syscall(sys_init_module); 30COND_SYSCALL_COMPAT(io_setup);
31cond_syscall(sys_finit_module); 31COND_SYSCALL(io_destroy);
32cond_syscall(sys_delete_module); 32COND_SYSCALL(io_submit);
33cond_syscall(sys_socketpair); 33COND_SYSCALL_COMPAT(io_submit);
34cond_syscall(sys_bind); 34COND_SYSCALL(io_cancel);
35cond_syscall(sys_listen); 35COND_SYSCALL(io_getevents);
36cond_syscall(sys_accept); 36COND_SYSCALL_COMPAT(io_getevents);
37cond_syscall(sys_accept4); 37
38cond_syscall(sys_connect); 38/* fs/xattr.c */
39cond_syscall(sys_getsockname); 39
40cond_syscall(sys_getpeername); 40/* fs/dcache.c */
41cond_syscall(sys_sendto); 41
42cond_syscall(sys_send); 42/* fs/cookies.c */
43cond_syscall(sys_recvfrom); 43COND_SYSCALL(lookup_dcookie);
44cond_syscall(sys_recv); 44COND_SYSCALL_COMPAT(lookup_dcookie);
45cond_syscall(sys_socket); 45
46cond_syscall(sys_setsockopt); 46/* fs/eventfd.c */
47cond_syscall(compat_sys_setsockopt); 47COND_SYSCALL(eventfd2);
48cond_syscall(sys_getsockopt); 48
49cond_syscall(compat_sys_getsockopt); 49/* fs/eventfd.c */
50cond_syscall(sys_shutdown); 50COND_SYSCALL(epoll_create1);
51cond_syscall(sys_sendmsg); 51COND_SYSCALL(epoll_ctl);
52cond_syscall(sys_sendmmsg); 52COND_SYSCALL(epoll_pwait);
53cond_syscall(compat_sys_sendmsg); 53COND_SYSCALL_COMPAT(epoll_pwait);
54cond_syscall(compat_sys_sendmmsg); 54
55cond_syscall(sys_recvmsg); 55/* fs/fcntl.c */
56cond_syscall(sys_recvmmsg); 56
57cond_syscall(compat_sys_recvmsg); 57/* fs/inotify_user.c */
58cond_syscall(compat_sys_recv); 58COND_SYSCALL(inotify_init1);
59cond_syscall(compat_sys_recvfrom); 59COND_SYSCALL(inotify_add_watch);
60cond_syscall(compat_sys_recvmmsg); 60COND_SYSCALL(inotify_rm_watch);
61cond_syscall(sys_socketcall); 61
62cond_syscall(sys_futex); 62/* fs/ioctl.c */
63cond_syscall(compat_sys_futex); 63
64cond_syscall(sys_set_robust_list); 64/* fs/ioprio.c */
65cond_syscall(compat_sys_set_robust_list); 65COND_SYSCALL(ioprio_set);
66cond_syscall(sys_get_robust_list); 66COND_SYSCALL(ioprio_get);
67cond_syscall(compat_sys_get_robust_list); 67
68cond_syscall(sys_epoll_create); 68/* fs/locks.c */
69cond_syscall(sys_epoll_create1); 69COND_SYSCALL(flock);
70cond_syscall(sys_epoll_ctl); 70
71cond_syscall(sys_epoll_wait); 71/* fs/namei.c */
72cond_syscall(sys_epoll_pwait); 72
73cond_syscall(compat_sys_epoll_pwait); 73/* fs/namespace.c */
74cond_syscall(sys_semget); 74
75cond_syscall(sys_semop); 75/* fs/nfsctl.c */
76cond_syscall(sys_semtimedop); 76
77cond_syscall(compat_sys_semtimedop); 77/* fs/open.c */
78cond_syscall(sys_semctl); 78
79cond_syscall(compat_sys_semctl); 79/* fs/pipe.c */
80cond_syscall(sys_msgget); 80
81cond_syscall(sys_msgsnd); 81/* fs/quota.c */
82cond_syscall(compat_sys_msgsnd); 82COND_SYSCALL(quotactl);
83cond_syscall(sys_msgrcv); 83
84cond_syscall(compat_sys_msgrcv); 84/* fs/readdir.c */
85cond_syscall(sys_msgctl); 85
86cond_syscall(compat_sys_msgctl); 86/* fs/read_write.c */
87cond_syscall(sys_shmget); 87
88cond_syscall(sys_shmat); 88/* fs/sendfile.c */
89cond_syscall(compat_sys_shmat); 89
90cond_syscall(sys_shmdt); 90/* fs/select.c */
91cond_syscall(sys_shmctl); 91
92cond_syscall(compat_sys_shmctl); 92/* fs/signalfd.c */
93cond_syscall(sys_mq_open); 93COND_SYSCALL(signalfd4);
94cond_syscall(sys_mq_unlink); 94COND_SYSCALL_COMPAT(signalfd4);
95cond_syscall(sys_mq_timedsend); 95
96cond_syscall(sys_mq_timedreceive); 96/* fs/splice.c */
97cond_syscall(sys_mq_notify); 97
98cond_syscall(sys_mq_getsetattr); 98/* fs/stat.c */
99cond_syscall(compat_sys_mq_open); 99
100cond_syscall(compat_sys_mq_timedsend); 100/* fs/sync.c */
101cond_syscall(compat_sys_mq_timedreceive); 101
102cond_syscall(compat_sys_mq_notify); 102/* fs/timerfd.c */
103cond_syscall(compat_sys_mq_getsetattr); 103COND_SYSCALL(timerfd_create);
104cond_syscall(sys_mbind); 104COND_SYSCALL(timerfd_settime);
105cond_syscall(sys_get_mempolicy); 105COND_SYSCALL_COMPAT(timerfd_settime);
106cond_syscall(sys_set_mempolicy); 106COND_SYSCALL(timerfd_gettime);
107cond_syscall(compat_sys_mbind); 107COND_SYSCALL_COMPAT(timerfd_gettime);
108cond_syscall(compat_sys_get_mempolicy); 108
109cond_syscall(compat_sys_set_mempolicy); 109/* fs/utimes.c */
110cond_syscall(sys_add_key); 110
111cond_syscall(sys_request_key); 111/* kernel/acct.c */
112cond_syscall(sys_keyctl); 112COND_SYSCALL(acct);
113cond_syscall(compat_sys_keyctl); 113
114cond_syscall(compat_sys_socketcall); 114/* kernel/capability.c */
115cond_syscall(sys_inotify_init); 115COND_SYSCALL(capget);
116cond_syscall(sys_inotify_init1); 116COND_SYSCALL(capset);
117cond_syscall(sys_inotify_add_watch); 117
118cond_syscall(sys_inotify_rm_watch); 118/* kernel/exec_domain.c */
119cond_syscall(sys_migrate_pages); 119
120cond_syscall(sys_move_pages); 120/* kernel/exit.c */
121cond_syscall(sys_chown16); 121
122cond_syscall(sys_fchown16); 122/* kernel/fork.c */
123cond_syscall(sys_getegid16); 123
124cond_syscall(sys_geteuid16); 124/* kernel/futex.c */
125cond_syscall(sys_getgid16); 125COND_SYSCALL(futex);
126cond_syscall(sys_getgroups16); 126COND_SYSCALL_COMPAT(futex);
127cond_syscall(sys_getresgid16); 127COND_SYSCALL(set_robust_list);
128cond_syscall(sys_getresuid16); 128COND_SYSCALL_COMPAT(set_robust_list);
129cond_syscall(sys_getuid16); 129COND_SYSCALL(get_robust_list);
130cond_syscall(sys_lchown16); 130COND_SYSCALL_COMPAT(get_robust_list);
131cond_syscall(sys_setfsgid16); 131
132cond_syscall(sys_setfsuid16); 132/* kernel/hrtimer.c */
133cond_syscall(sys_setgid16); 133
134cond_syscall(sys_setgroups16); 134/* kernel/itimer.c */
135cond_syscall(sys_setregid16); 135
136cond_syscall(sys_setresgid16); 136/* kernel/kexec.c */
137cond_syscall(sys_setresuid16); 137COND_SYSCALL(kexec_load);
138cond_syscall(sys_setreuid16); 138COND_SYSCALL_COMPAT(kexec_load);
139cond_syscall(sys_setuid16); 139
140cond_syscall(sys_sgetmask); 140/* kernel/module.c */
141cond_syscall(sys_ssetmask); 141COND_SYSCALL(init_module);
142cond_syscall(sys_vm86old); 142COND_SYSCALL(delete_module);
143cond_syscall(sys_vm86); 143
144cond_syscall(sys_modify_ldt); 144/* kernel/posix-timers.c */
145cond_syscall(sys_ipc); 145
146cond_syscall(compat_sys_ipc); 146/* kernel/printk.c */
147cond_syscall(compat_sys_sysctl); 147COND_SYSCALL(syslog);
148cond_syscall(sys_flock); 148
149cond_syscall(sys_io_setup); 149/* kernel/ptrace.c */
150cond_syscall(sys_io_destroy); 150
151cond_syscall(sys_io_submit); 151/* kernel/sched/core.c */
152cond_syscall(sys_io_cancel); 152
153cond_syscall(sys_io_getevents); 153/* kernel/signal.c */
154cond_syscall(compat_sys_io_setup); 154
155cond_syscall(compat_sys_io_submit); 155/* kernel/sys.c */
156cond_syscall(compat_sys_io_getevents); 156COND_SYSCALL(setregid);
157cond_syscall(sys_sysfs); 157COND_SYSCALL(setgid);
158cond_syscall(sys_syslog); 158COND_SYSCALL(setreuid);
159cond_syscall(sys_process_vm_readv); 159COND_SYSCALL(setuid);
160cond_syscall(sys_process_vm_writev); 160COND_SYSCALL(setresuid);
161cond_syscall(compat_sys_process_vm_readv); 161COND_SYSCALL(getresuid);
162cond_syscall(compat_sys_process_vm_writev); 162COND_SYSCALL(setresgid);
163cond_syscall(sys_uselib); 163COND_SYSCALL(getresgid);
164cond_syscall(sys_fadvise64); 164COND_SYSCALL(setfsuid);
165cond_syscall(sys_fadvise64_64); 165COND_SYSCALL(setfsgid);
166cond_syscall(sys_madvise); 166COND_SYSCALL(setgroups);
167cond_syscall(sys_setuid); 167COND_SYSCALL(getgroups);
168cond_syscall(sys_setregid); 168
169cond_syscall(sys_setgid); 169/* kernel/time.c */
170cond_syscall(sys_setreuid); 170
171cond_syscall(sys_setresuid); 171/* kernel/timer.c */
172cond_syscall(sys_getresuid); 172
173cond_syscall(sys_setresgid); 173/* ipc/mqueue.c */
174cond_syscall(sys_getresgid); 174COND_SYSCALL(mq_open);
175cond_syscall(sys_setgroups); 175COND_SYSCALL_COMPAT(mq_open);
176cond_syscall(sys_getgroups); 176COND_SYSCALL(mq_unlink);
177cond_syscall(sys_setfsuid); 177COND_SYSCALL(mq_timedsend);
178cond_syscall(sys_setfsgid); 178COND_SYSCALL_COMPAT(mq_timedsend);
179cond_syscall(sys_capget); 179COND_SYSCALL(mq_timedreceive);
180cond_syscall(sys_capset); 180COND_SYSCALL_COMPAT(mq_timedreceive);
181cond_syscall(sys_copy_file_range); 181COND_SYSCALL(mq_notify);
182 182COND_SYSCALL_COMPAT(mq_notify);
183/* arch-specific weak syscall entries */ 183COND_SYSCALL(mq_getsetattr);
184cond_syscall(sys_pciconfig_read); 184COND_SYSCALL_COMPAT(mq_getsetattr);
185cond_syscall(sys_pciconfig_write); 185
186cond_syscall(sys_pciconfig_iobase); 186/* ipc/msg.c */
187cond_syscall(compat_sys_s390_ipc); 187COND_SYSCALL(msgget);
188cond_syscall(ppc_rtas); 188COND_SYSCALL(msgctl);
189cond_syscall(sys_spu_run); 189COND_SYSCALL_COMPAT(msgctl);
190cond_syscall(sys_spu_create); 190COND_SYSCALL(msgrcv);
191cond_syscall(sys_subpage_prot); 191COND_SYSCALL_COMPAT(msgrcv);
192cond_syscall(sys_s390_pci_mmio_read); 192COND_SYSCALL(msgsnd);
193cond_syscall(sys_s390_pci_mmio_write); 193COND_SYSCALL_COMPAT(msgsnd);
194 194
195/* mmu depending weak syscall entries */ 195/* ipc/sem.c */
196cond_syscall(sys_mprotect); 196COND_SYSCALL(semget);
197cond_syscall(sys_msync); 197COND_SYSCALL(semctl);
198cond_syscall(sys_mlock); 198COND_SYSCALL_COMPAT(semctl);
199cond_syscall(sys_munlock); 199COND_SYSCALL(semtimedop);
200cond_syscall(sys_mlockall); 200COND_SYSCALL_COMPAT(semtimedop);
201cond_syscall(sys_munlockall); 201COND_SYSCALL(semop);
202cond_syscall(sys_mlock2); 202
203cond_syscall(sys_mincore); 203/* ipc/shm.c */
204cond_syscall(sys_madvise); 204COND_SYSCALL(shmget);
205cond_syscall(sys_mremap); 205COND_SYSCALL(shmctl);
206cond_syscall(sys_remap_file_pages); 206COND_SYSCALL_COMPAT(shmctl);
207cond_syscall(compat_sys_move_pages); 207COND_SYSCALL(shmat);
208cond_syscall(compat_sys_migrate_pages); 208COND_SYSCALL_COMPAT(shmat);
209 209COND_SYSCALL(shmdt);
210/* block-layer dependent */ 210
211cond_syscall(sys_bdflush); 211/* net/socket.c */
212cond_syscall(sys_ioprio_set); 212COND_SYSCALL(socket);
213cond_syscall(sys_ioprio_get); 213COND_SYSCALL(socketpair);
214 214COND_SYSCALL(bind);
215/* New file descriptors */ 215COND_SYSCALL(listen);
216cond_syscall(sys_signalfd); 216COND_SYSCALL(accept);
217cond_syscall(sys_signalfd4); 217COND_SYSCALL(connect);
218cond_syscall(compat_sys_signalfd); 218COND_SYSCALL(getsockname);
219cond_syscall(compat_sys_signalfd4); 219COND_SYSCALL(getpeername);
220cond_syscall(sys_timerfd_create); 220COND_SYSCALL(setsockopt);
221cond_syscall(sys_timerfd_settime); 221COND_SYSCALL_COMPAT(setsockopt);
222cond_syscall(sys_timerfd_gettime); 222COND_SYSCALL(getsockopt);
223cond_syscall(compat_sys_timerfd_settime); 223COND_SYSCALL_COMPAT(getsockopt);
224cond_syscall(compat_sys_timerfd_gettime); 224COND_SYSCALL(sendto);
225cond_syscall(sys_eventfd); 225COND_SYSCALL(shutdown);
226cond_syscall(sys_eventfd2); 226COND_SYSCALL(recvfrom);
227cond_syscall(sys_memfd_create); 227COND_SYSCALL_COMPAT(recvfrom);
228cond_syscall(sys_userfaultfd); 228COND_SYSCALL(sendmsg);
229 229COND_SYSCALL_COMPAT(sendmsg);
230/* performance counters: */ 230COND_SYSCALL(recvmsg);
231cond_syscall(sys_perf_event_open); 231COND_SYSCALL_COMPAT(recvmsg);
232 232
233/* fanotify! */ 233/* mm/filemap.c */
234cond_syscall(sys_fanotify_init); 234
235cond_syscall(sys_fanotify_mark); 235/* mm/nommu.c, also with MMU */
236cond_syscall(compat_sys_fanotify_mark); 236COND_SYSCALL(mremap);
237
238/* security/keys/keyctl.c */
239COND_SYSCALL(add_key);
240COND_SYSCALL(request_key);
241COND_SYSCALL(keyctl);
242COND_SYSCALL_COMPAT(keyctl);
243
244/* arch/example/kernel/sys_example.c */
245
246/* mm/fadvise.c */
247COND_SYSCALL(fadvise64_64);
248
249/* mm/, CONFIG_MMU only */
250COND_SYSCALL(swapon);
251COND_SYSCALL(swapoff);
252COND_SYSCALL(mprotect);
253COND_SYSCALL(msync);
254COND_SYSCALL(mlock);
255COND_SYSCALL(munlock);
256COND_SYSCALL(mlockall);
257COND_SYSCALL(munlockall);
258COND_SYSCALL(mincore);
259COND_SYSCALL(madvise);
260COND_SYSCALL(remap_file_pages);
261COND_SYSCALL(mbind);
262COND_SYSCALL_COMPAT(mbind);
263COND_SYSCALL(get_mempolicy);
264COND_SYSCALL_COMPAT(get_mempolicy);
265COND_SYSCALL(set_mempolicy);
266COND_SYSCALL_COMPAT(set_mempolicy);
267COND_SYSCALL(migrate_pages);
268COND_SYSCALL_COMPAT(migrate_pages);
269COND_SYSCALL(move_pages);
270COND_SYSCALL_COMPAT(move_pages);
271
272COND_SYSCALL(perf_event_open);
273COND_SYSCALL(accept4);
274COND_SYSCALL(recvmmsg);
275COND_SYSCALL_COMPAT(recvmmsg);
276
277/*
278 * Architecture specific syscalls: see further below
279 */
280
281/* fanotify */
282COND_SYSCALL(fanotify_init);
283COND_SYSCALL(fanotify_mark);
237 284
238/* open by handle */ 285/* open by handle */
239cond_syscall(sys_name_to_handle_at); 286COND_SYSCALL(name_to_handle_at);
240cond_syscall(sys_open_by_handle_at); 287COND_SYSCALL(open_by_handle_at);
241cond_syscall(compat_sys_open_by_handle_at); 288COND_SYSCALL_COMPAT(open_by_handle_at);
289
290COND_SYSCALL(sendmmsg);
291COND_SYSCALL_COMPAT(sendmmsg);
292COND_SYSCALL(process_vm_readv);
293COND_SYSCALL_COMPAT(process_vm_readv);
294COND_SYSCALL(process_vm_writev);
295COND_SYSCALL_COMPAT(process_vm_writev);
242 296
243/* compare kernel pointers */ 297/* compare kernel pointers */
244cond_syscall(sys_kcmp); 298COND_SYSCALL(kcmp);
299
300COND_SYSCALL(finit_module);
245 301
246/* operate on Secure Computing state */ 302/* operate on Secure Computing state */
247cond_syscall(sys_seccomp); 303COND_SYSCALL(seccomp);
304
305COND_SYSCALL(memfd_create);
248 306
249/* access BPF programs and maps */ 307/* access BPF programs and maps */
250cond_syscall(sys_bpf); 308COND_SYSCALL(bpf);
251 309
252/* execveat */ 310/* execveat */
253cond_syscall(sys_execveat); 311COND_SYSCALL(execveat);
312
313COND_SYSCALL(userfaultfd);
254 314
255/* membarrier */ 315/* membarrier */
256cond_syscall(sys_membarrier); 316COND_SYSCALL(membarrier);
317
318COND_SYSCALL(mlock2);
319
320COND_SYSCALL(copy_file_range);
257 321
258/* memory protection keys */ 322/* memory protection keys */
259cond_syscall(sys_pkey_mprotect); 323COND_SYSCALL(pkey_mprotect);
260cond_syscall(sys_pkey_alloc); 324COND_SYSCALL(pkey_alloc);
261cond_syscall(sys_pkey_free); 325COND_SYSCALL(pkey_free);
326
327
328/*
329 * Architecture specific weak syscall entries.
330 */
331
332/* pciconfig: alpha, arm, arm64, ia64, sparc */
333COND_SYSCALL(pciconfig_read);
334COND_SYSCALL(pciconfig_write);
335COND_SYSCALL(pciconfig_iobase);
336
337/* sys_socketcall: arm, mips, x86, ... */
338COND_SYSCALL(socketcall);
339COND_SYSCALL_COMPAT(socketcall);
340
341/* compat syscalls for arm64, x86, ... */
342COND_SYSCALL_COMPAT(sysctl);
343COND_SYSCALL_COMPAT(fanotify_mark);
344
345/* x86 */
346COND_SYSCALL(vm86old);
347COND_SYSCALL(modify_ldt);
348COND_SYSCALL_COMPAT(quotactl32);
349COND_SYSCALL(vm86);
350COND_SYSCALL(kexec_file_load);
351
352/* s390 */
353COND_SYSCALL(s390_pci_mmio_read);
354COND_SYSCALL(s390_pci_mmio_write);
355COND_SYSCALL_COMPAT(s390_ipc);
356
357/* powerpc */
358cond_syscall(ppc_rtas);
359COND_SYSCALL(spu_run);
360COND_SYSCALL(spu_create);
361COND_SYSCALL(subpage_prot);
362
363
364/*
365 * Deprecated system calls which are still defined in
366 * include/uapi/asm-generic/unistd.h and wanted by >= 1 arch
367 */
368
369/* __ARCH_WANT_SYSCALL_NO_FLAGS */
370COND_SYSCALL(epoll_create);
371COND_SYSCALL(inotify_init);
372COND_SYSCALL(eventfd);
373COND_SYSCALL(signalfd);
374COND_SYSCALL_COMPAT(signalfd);
375
376/* __ARCH_WANT_SYSCALL_OFF_T */
377COND_SYSCALL(fadvise64);
378
379/* __ARCH_WANT_SYSCALL_DEPRECATED */
380COND_SYSCALL(epoll_wait);
381COND_SYSCALL(recv);
382COND_SYSCALL_COMPAT(recv);
383COND_SYSCALL(send);
384COND_SYSCALL(bdflush);
385COND_SYSCALL(uselib);
386
387
388/*
389 * The syscalls below are not found in include/uapi/asm-generic/unistd.h
390 */
391
392/* obsolete: SGETMASK_SYSCALL */
393COND_SYSCALL(sgetmask);
394COND_SYSCALL(ssetmask);
395
396/* obsolete: SYSFS_SYSCALL */
397COND_SYSCALL(sysfs);
398
399/* obsolete: __ARCH_WANT_SYS_IPC */
400COND_SYSCALL(ipc);
401COND_SYSCALL_COMPAT(ipc);
402
403/* obsolete: UID16 */
404COND_SYSCALL(chown16);
405COND_SYSCALL(fchown16);
406COND_SYSCALL(getegid16);
407COND_SYSCALL(geteuid16);
408COND_SYSCALL(getgid16);
409COND_SYSCALL(getgroups16);
410COND_SYSCALL(getresgid16);
411COND_SYSCALL(getresuid16);
412COND_SYSCALL(getuid16);
413COND_SYSCALL(lchown16);
414COND_SYSCALL(setfsgid16);
415COND_SYSCALL(setfsuid16);
416COND_SYSCALL(setgid16);
417COND_SYSCALL(setgroups16);
418COND_SYSCALL(setregid16);
419COND_SYSCALL(setresgid16);
420COND_SYSCALL(setresuid16);
421COND_SYSCALL(setreuid16);
422COND_SYSCALL(setuid16);
diff --git a/kernel/uid16.c b/kernel/uid16.c
index ef1da2a5f9bd..af6925d8599b 100644
--- a/kernel/uid16.c
+++ b/kernel/uid16.c
@@ -18,44 +18,46 @@
18 18
19#include <linux/uaccess.h> 19#include <linux/uaccess.h>
20 20
21#include "uid16.h"
22
21SYSCALL_DEFINE3(chown16, const char __user *, filename, old_uid_t, user, old_gid_t, group) 23SYSCALL_DEFINE3(chown16, const char __user *, filename, old_uid_t, user, old_gid_t, group)
22{ 24{
23 return sys_chown(filename, low2highuid(user), low2highgid(group)); 25 return ksys_chown(filename, low2highuid(user), low2highgid(group));
24} 26}
25 27
26SYSCALL_DEFINE3(lchown16, const char __user *, filename, old_uid_t, user, old_gid_t, group) 28SYSCALL_DEFINE3(lchown16, const char __user *, filename, old_uid_t, user, old_gid_t, group)
27{ 29{
28 return sys_lchown(filename, low2highuid(user), low2highgid(group)); 30 return ksys_lchown(filename, low2highuid(user), low2highgid(group));
29} 31}
30 32
31SYSCALL_DEFINE3(fchown16, unsigned int, fd, old_uid_t, user, old_gid_t, group) 33SYSCALL_DEFINE3(fchown16, unsigned int, fd, old_uid_t, user, old_gid_t, group)
32{ 34{
33 return sys_fchown(fd, low2highuid(user), low2highgid(group)); 35 return ksys_fchown(fd, low2highuid(user), low2highgid(group));
34} 36}
35 37
36SYSCALL_DEFINE2(setregid16, old_gid_t, rgid, old_gid_t, egid) 38SYSCALL_DEFINE2(setregid16, old_gid_t, rgid, old_gid_t, egid)
37{ 39{
38 return sys_setregid(low2highgid(rgid), low2highgid(egid)); 40 return __sys_setregid(low2highgid(rgid), low2highgid(egid));
39} 41}
40 42
41SYSCALL_DEFINE1(setgid16, old_gid_t, gid) 43SYSCALL_DEFINE1(setgid16, old_gid_t, gid)
42{ 44{
43 return sys_setgid(low2highgid(gid)); 45 return __sys_setgid(low2highgid(gid));
44} 46}
45 47
46SYSCALL_DEFINE2(setreuid16, old_uid_t, ruid, old_uid_t, euid) 48SYSCALL_DEFINE2(setreuid16, old_uid_t, ruid, old_uid_t, euid)
47{ 49{
48 return sys_setreuid(low2highuid(ruid), low2highuid(euid)); 50 return __sys_setreuid(low2highuid(ruid), low2highuid(euid));
49} 51}
50 52
51SYSCALL_DEFINE1(setuid16, old_uid_t, uid) 53SYSCALL_DEFINE1(setuid16, old_uid_t, uid)
52{ 54{
53 return sys_setuid(low2highuid(uid)); 55 return __sys_setuid(low2highuid(uid));
54} 56}
55 57
56SYSCALL_DEFINE3(setresuid16, old_uid_t, ruid, old_uid_t, euid, old_uid_t, suid) 58SYSCALL_DEFINE3(setresuid16, old_uid_t, ruid, old_uid_t, euid, old_uid_t, suid)
57{ 59{
58 return sys_setresuid(low2highuid(ruid), low2highuid(euid), 60 return __sys_setresuid(low2highuid(ruid), low2highuid(euid),
59 low2highuid(suid)); 61 low2highuid(suid));
60} 62}
61 63
@@ -78,11 +80,10 @@ SYSCALL_DEFINE3(getresuid16, old_uid_t __user *, ruidp, old_uid_t __user *, euid
78 80
79SYSCALL_DEFINE3(setresgid16, old_gid_t, rgid, old_gid_t, egid, old_gid_t, sgid) 81SYSCALL_DEFINE3(setresgid16, old_gid_t, rgid, old_gid_t, egid, old_gid_t, sgid)
80{ 82{
81 return sys_setresgid(low2highgid(rgid), low2highgid(egid), 83 return __sys_setresgid(low2highgid(rgid), low2highgid(egid),
82 low2highgid(sgid)); 84 low2highgid(sgid));
83} 85}
84 86
85
86SYSCALL_DEFINE3(getresgid16, old_gid_t __user *, rgidp, old_gid_t __user *, egidp, old_gid_t __user *, sgidp) 87SYSCALL_DEFINE3(getresgid16, old_gid_t __user *, rgidp, old_gid_t __user *, egidp, old_gid_t __user *, sgidp)
87{ 88{
88 const struct cred *cred = current_cred(); 89 const struct cred *cred = current_cred();
@@ -102,12 +103,12 @@ SYSCALL_DEFINE3(getresgid16, old_gid_t __user *, rgidp, old_gid_t __user *, egid
102 103
103SYSCALL_DEFINE1(setfsuid16, old_uid_t, uid) 104SYSCALL_DEFINE1(setfsuid16, old_uid_t, uid)
104{ 105{
105 return sys_setfsuid(low2highuid(uid)); 106 return __sys_setfsuid(low2highuid(uid));
106} 107}
107 108
108SYSCALL_DEFINE1(setfsgid16, old_gid_t, gid) 109SYSCALL_DEFINE1(setfsgid16, old_gid_t, gid)
109{ 110{
110 return sys_setfsgid(low2highgid(gid)); 111 return __sys_setfsgid(low2highgid(gid));
111} 112}
112 113
113static int groups16_to_user(old_gid_t __user *grouplist, 114static int groups16_to_user(old_gid_t __user *grouplist,
diff --git a/kernel/uid16.h b/kernel/uid16.h
new file mode 100644
index 000000000000..cdca040f7602
--- /dev/null
+++ b/kernel/uid16.h
@@ -0,0 +1,14 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef LINUX_UID16_H
3#define LINUX_UID16_H
4
5long __sys_setuid(uid_t uid);
6long __sys_setgid(gid_t gid);
7long __sys_setreuid(uid_t ruid, uid_t euid);
8long __sys_setregid(gid_t rgid, gid_t egid);
9long __sys_setresuid(uid_t ruid, uid_t euid, uid_t suid);
10long __sys_setresgid(gid_t rgid, gid_t egid, gid_t sgid);
11long __sys_setfsuid(uid_t uid);
12long __sys_setfsgid(gid_t gid);
13
14#endif /* LINUX_UID16_H */
diff --git a/kernel/umh.c b/kernel/umh.c
index 18e5fa4b0e71..f76b3ff876cf 100644
--- a/kernel/umh.c
+++ b/kernel/umh.c
@@ -118,7 +118,7 @@ static void call_usermodehelper_exec_sync(struct subprocess_info *sub_info)
118{ 118{
119 pid_t pid; 119 pid_t pid;
120 120
121 /* If SIGCLD is ignored sys_wait4 won't populate the status. */ 121 /* If SIGCLD is ignored kernel_wait4 won't populate the status. */
122 kernel_sigaction(SIGCHLD, SIG_DFL); 122 kernel_sigaction(SIGCHLD, SIG_DFL);
123 pid = kernel_thread(call_usermodehelper_exec_async, sub_info, SIGCHLD); 123 pid = kernel_thread(call_usermodehelper_exec_async, sub_info, SIGCHLD);
124 if (pid < 0) { 124 if (pid < 0) {
@@ -135,7 +135,7 @@ static void call_usermodehelper_exec_sync(struct subprocess_info *sub_info)
135 * 135 *
136 * Thus the __user pointer cast is valid here. 136 * Thus the __user pointer cast is valid here.
137 */ 137 */
138 sys_wait4(pid, (int __user *)&ret, 0, NULL); 138 kernel_wait4(pid, (int __user *)&ret, 0, NULL);
139 139
140 /* 140 /*
141 * If ret is 0, either call_usermodehelper_exec_async failed and 141 * If ret is 0, either call_usermodehelper_exec_async failed and
diff --git a/mm/fadvise.c b/mm/fadvise.c
index 767887f5f3bf..afa41491d324 100644
--- a/mm/fadvise.c
+++ b/mm/fadvise.c
@@ -26,7 +26,8 @@
26 * POSIX_FADV_WILLNEED could set PG_Referenced, and POSIX_FADV_NOREUSE could 26 * POSIX_FADV_WILLNEED could set PG_Referenced, and POSIX_FADV_NOREUSE could
27 * deactivate the pages and clear PG_Referenced. 27 * deactivate the pages and clear PG_Referenced.
28 */ 28 */
29SYSCALL_DEFINE4(fadvise64_64, int, fd, loff_t, offset, loff_t, len, int, advice) 29
30int ksys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice)
30{ 31{
31 struct fd f = fdget(fd); 32 struct fd f = fdget(fd);
32 struct inode *inode; 33 struct inode *inode;
@@ -185,11 +186,16 @@ out:
185 return ret; 186 return ret;
186} 187}
187 188
189SYSCALL_DEFINE4(fadvise64_64, int, fd, loff_t, offset, loff_t, len, int, advice)
190{
191 return ksys_fadvise64_64(fd, offset, len, advice);
192}
193
188#ifdef __ARCH_WANT_SYS_FADVISE64 194#ifdef __ARCH_WANT_SYS_FADVISE64
189 195
190SYSCALL_DEFINE4(fadvise64, int, fd, loff_t, offset, size_t, len, int, advice) 196SYSCALL_DEFINE4(fadvise64, int, fd, loff_t, offset, size_t, len, int, advice)
191{ 197{
192 return sys_fadvise64_64(fd, offset, len, advice); 198 return ksys_fadvise64_64(fd, offset, len, advice);
193} 199}
194 200
195#endif 201#endif
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 32cba0332787..01cbb7078d6c 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1336,9 +1336,9 @@ static int copy_nodes_to_user(unsigned long __user *mask, unsigned long maxnode,
1336 return copy_to_user(mask, nodes_addr(*nodes), copy) ? -EFAULT : 0; 1336 return copy_to_user(mask, nodes_addr(*nodes), copy) ? -EFAULT : 0;
1337} 1337}
1338 1338
1339SYSCALL_DEFINE6(mbind, unsigned long, start, unsigned long, len, 1339static long kernel_mbind(unsigned long start, unsigned long len,
1340 unsigned long, mode, const unsigned long __user *, nmask, 1340 unsigned long mode, const unsigned long __user *nmask,
1341 unsigned long, maxnode, unsigned, flags) 1341 unsigned long maxnode, unsigned int flags)
1342{ 1342{
1343 nodemask_t nodes; 1343 nodemask_t nodes;
1344 int err; 1344 int err;
@@ -1357,9 +1357,16 @@ SYSCALL_DEFINE6(mbind, unsigned long, start, unsigned long, len,
1357 return do_mbind(start, len, mode, mode_flags, &nodes, flags); 1357 return do_mbind(start, len, mode, mode_flags, &nodes, flags);
1358} 1358}
1359 1359
1360SYSCALL_DEFINE6(mbind, unsigned long, start, unsigned long, len,
1361 unsigned long, mode, const unsigned long __user *, nmask,
1362 unsigned long, maxnode, unsigned int, flags)
1363{
1364 return kernel_mbind(start, len, mode, nmask, maxnode, flags);
1365}
1366
1360/* Set the process memory policy */ 1367/* Set the process memory policy */
1361SYSCALL_DEFINE3(set_mempolicy, int, mode, const unsigned long __user *, nmask, 1368static long kernel_set_mempolicy(int mode, const unsigned long __user *nmask,
1362 unsigned long, maxnode) 1369 unsigned long maxnode)
1363{ 1370{
1364 int err; 1371 int err;
1365 nodemask_t nodes; 1372 nodemask_t nodes;
@@ -1377,9 +1384,15 @@ SYSCALL_DEFINE3(set_mempolicy, int, mode, const unsigned long __user *, nmask,
1377 return do_set_mempolicy(mode, flags, &nodes); 1384 return do_set_mempolicy(mode, flags, &nodes);
1378} 1385}
1379 1386
1380SYSCALL_DEFINE4(migrate_pages, pid_t, pid, unsigned long, maxnode, 1387SYSCALL_DEFINE3(set_mempolicy, int, mode, const unsigned long __user *, nmask,
1381 const unsigned long __user *, old_nodes, 1388 unsigned long, maxnode)
1382 const unsigned long __user *, new_nodes) 1389{
1390 return kernel_set_mempolicy(mode, nmask, maxnode);
1391}
1392
1393static int kernel_migrate_pages(pid_t pid, unsigned long maxnode,
1394 const unsigned long __user *old_nodes,
1395 const unsigned long __user *new_nodes)
1383{ 1396{
1384 struct mm_struct *mm = NULL; 1397 struct mm_struct *mm = NULL;
1385 struct task_struct *task; 1398 struct task_struct *task;
@@ -1469,11 +1482,20 @@ out_put:
1469 1482
1470} 1483}
1471 1484
1485SYSCALL_DEFINE4(migrate_pages, pid_t, pid, unsigned long, maxnode,
1486 const unsigned long __user *, old_nodes,
1487 const unsigned long __user *, new_nodes)
1488{
1489 return kernel_migrate_pages(pid, maxnode, old_nodes, new_nodes);
1490}
1491
1472 1492
1473/* Retrieve NUMA policy */ 1493/* Retrieve NUMA policy */
1474SYSCALL_DEFINE5(get_mempolicy, int __user *, policy, 1494static int kernel_get_mempolicy(int __user *policy,
1475 unsigned long __user *, nmask, unsigned long, maxnode, 1495 unsigned long __user *nmask,
1476 unsigned long, addr, unsigned long, flags) 1496 unsigned long maxnode,
1497 unsigned long addr,
1498 unsigned long flags)
1477{ 1499{
1478 int err; 1500 int err;
1479 int uninitialized_var(pval); 1501 int uninitialized_var(pval);
@@ -1496,6 +1518,13 @@ SYSCALL_DEFINE5(get_mempolicy, int __user *, policy,
1496 return err; 1518 return err;
1497} 1519}
1498 1520
1521SYSCALL_DEFINE5(get_mempolicy, int __user *, policy,
1522 unsigned long __user *, nmask, unsigned long, maxnode,
1523 unsigned long, addr, unsigned long, flags)
1524{
1525 return kernel_get_mempolicy(policy, nmask, maxnode, addr, flags);
1526}
1527
1499#ifdef CONFIG_COMPAT 1528#ifdef CONFIG_COMPAT
1500 1529
1501COMPAT_SYSCALL_DEFINE5(get_mempolicy, int __user *, policy, 1530COMPAT_SYSCALL_DEFINE5(get_mempolicy, int __user *, policy,
@@ -1514,7 +1543,7 @@ COMPAT_SYSCALL_DEFINE5(get_mempolicy, int __user *, policy,
1514 if (nmask) 1543 if (nmask)
1515 nm = compat_alloc_user_space(alloc_size); 1544 nm = compat_alloc_user_space(alloc_size);
1516 1545
1517 err = sys_get_mempolicy(policy, nm, nr_bits+1, addr, flags); 1546 err = kernel_get_mempolicy(policy, nm, nr_bits+1, addr, flags);
1518 1547
1519 if (!err && nmask) { 1548 if (!err && nmask) {
1520 unsigned long copy_size; 1549 unsigned long copy_size;
@@ -1546,7 +1575,7 @@ COMPAT_SYSCALL_DEFINE3(set_mempolicy, int, mode, compat_ulong_t __user *, nmask,
1546 return -EFAULT; 1575 return -EFAULT;
1547 } 1576 }
1548 1577
1549 return sys_set_mempolicy(mode, nm, nr_bits+1); 1578 return kernel_set_mempolicy(mode, nm, nr_bits+1);
1550} 1579}
1551 1580
1552COMPAT_SYSCALL_DEFINE6(mbind, compat_ulong_t, start, compat_ulong_t, len, 1581COMPAT_SYSCALL_DEFINE6(mbind, compat_ulong_t, start, compat_ulong_t, len,
@@ -1568,10 +1597,43 @@ COMPAT_SYSCALL_DEFINE6(mbind, compat_ulong_t, start, compat_ulong_t, len,
1568 return -EFAULT; 1597 return -EFAULT;
1569 } 1598 }
1570 1599
1571 return sys_mbind(start, len, mode, nm, nr_bits+1, flags); 1600 return kernel_mbind(start, len, mode, nm, nr_bits+1, flags);
1572} 1601}
1573 1602
1574#endif 1603COMPAT_SYSCALL_DEFINE4(migrate_pages, compat_pid_t, pid,
1604 compat_ulong_t, maxnode,
1605 const compat_ulong_t __user *, old_nodes,
1606 const compat_ulong_t __user *, new_nodes)
1607{
1608 unsigned long __user *old = NULL;
1609 unsigned long __user *new = NULL;
1610 nodemask_t tmp_mask;
1611 unsigned long nr_bits;
1612 unsigned long size;
1613
1614 nr_bits = min_t(unsigned long, maxnode - 1, MAX_NUMNODES);
1615 size = ALIGN(nr_bits, BITS_PER_LONG) / 8;
1616 if (old_nodes) {
1617 if (compat_get_bitmap(nodes_addr(tmp_mask), old_nodes, nr_bits))
1618 return -EFAULT;
1619 old = compat_alloc_user_space(new_nodes ? size * 2 : size);
1620 if (new_nodes)
1621 new = old + size / sizeof(unsigned long);
1622 if (copy_to_user(old, nodes_addr(tmp_mask), size))
1623 return -EFAULT;
1624 }
1625 if (new_nodes) {
1626 if (compat_get_bitmap(nodes_addr(tmp_mask), new_nodes, nr_bits))
1627 return -EFAULT;
1628 if (new == NULL)
1629 new = compat_alloc_user_space(size);
1630 if (copy_to_user(new, nodes_addr(tmp_mask), size))
1631 return -EFAULT;
1632 }
1633 return kernel_migrate_pages(pid, nr_bits + 1, old, new);
1634}
1635
1636#endif /* CONFIG_COMPAT */
1575 1637
1576struct mempolicy *__get_vma_policy(struct vm_area_struct *vma, 1638struct mempolicy *__get_vma_policy(struct vm_area_struct *vma,
1577 unsigned long addr) 1639 unsigned long addr)
diff --git a/mm/migrate.c b/mm/migrate.c
index 1e5525a25691..003886606a22 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -34,6 +34,7 @@
34#include <linux/backing-dev.h> 34#include <linux/backing-dev.h>
35#include <linux/compaction.h> 35#include <linux/compaction.h>
36#include <linux/syscalls.h> 36#include <linux/syscalls.h>
37#include <linux/compat.h>
37#include <linux/hugetlb.h> 38#include <linux/hugetlb.h>
38#include <linux/hugetlb_cgroup.h> 39#include <linux/hugetlb_cgroup.h>
39#include <linux/gfp.h> 40#include <linux/gfp.h>
@@ -1745,10 +1746,10 @@ static int do_pages_stat(struct mm_struct *mm, unsigned long nr_pages,
1745 * Move a list of pages in the address space of the currently executing 1746 * Move a list of pages in the address space of the currently executing
1746 * process. 1747 * process.
1747 */ 1748 */
1748SYSCALL_DEFINE6(move_pages, pid_t, pid, unsigned long, nr_pages, 1749static int kernel_move_pages(pid_t pid, unsigned long nr_pages,
1749 const void __user * __user *, pages, 1750 const void __user * __user *pages,
1750 const int __user *, nodes, 1751 const int __user *nodes,
1751 int __user *, status, int, flags) 1752 int __user *status, int flags)
1752{ 1753{
1753 struct task_struct *task; 1754 struct task_struct *task;
1754 struct mm_struct *mm; 1755 struct mm_struct *mm;
@@ -1807,6 +1808,36 @@ out:
1807 return err; 1808 return err;
1808} 1809}
1809 1810
1811SYSCALL_DEFINE6(move_pages, pid_t, pid, unsigned long, nr_pages,
1812 const void __user * __user *, pages,
1813 const int __user *, nodes,
1814 int __user *, status, int, flags)
1815{
1816 return kernel_move_pages(pid, nr_pages, pages, nodes, status, flags);
1817}
1818
1819#ifdef CONFIG_COMPAT
1820COMPAT_SYSCALL_DEFINE6(move_pages, pid_t, pid, compat_ulong_t, nr_pages,
1821 compat_uptr_t __user *, pages32,
1822 const int __user *, nodes,
1823 int __user *, status,
1824 int, flags)
1825{
1826 const void __user * __user *pages;
1827 int i;
1828
1829 pages = compat_alloc_user_space(nr_pages * sizeof(void *));
1830 for (i = 0; i < nr_pages; i++) {
1831 compat_uptr_t p;
1832
1833 if (get_user(p, pages32 + i) ||
1834 put_user(compat_ptr(p), pages + i))
1835 return -EFAULT;
1836 }
1837 return kernel_move_pages(pid, nr_pages, pages, nodes, status, flags);
1838}
1839#endif /* CONFIG_COMPAT */
1840
1810#ifdef CONFIG_NUMA_BALANCING 1841#ifdef CONFIG_NUMA_BALANCING
1811/* 1842/*
1812 * Returns true if this is a safe migration target node for misplaced NUMA 1843 * Returns true if this is a safe migration target node for misplaced NUMA
diff --git a/mm/mmap.c b/mm/mmap.c
index 9efdc021ad22..aa0dc8231c0d 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1488,9 +1488,9 @@ unsigned long do_mmap(struct file *file, unsigned long addr,
1488 return addr; 1488 return addr;
1489} 1489}
1490 1490
1491SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len, 1491unsigned long ksys_mmap_pgoff(unsigned long addr, unsigned long len,
1492 unsigned long, prot, unsigned long, flags, 1492 unsigned long prot, unsigned long flags,
1493 unsigned long, fd, unsigned long, pgoff) 1493 unsigned long fd, unsigned long pgoff)
1494{ 1494{
1495 struct file *file = NULL; 1495 struct file *file = NULL;
1496 unsigned long retval; 1496 unsigned long retval;
@@ -1537,6 +1537,13 @@ out_fput:
1537 return retval; 1537 return retval;
1538} 1538}
1539 1539
1540SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len,
1541 unsigned long, prot, unsigned long, flags,
1542 unsigned long, fd, unsigned long, pgoff)
1543{
1544 return ksys_mmap_pgoff(addr, len, prot, flags, fd, pgoff);
1545}
1546
1540#ifdef __ARCH_WANT_SYS_OLD_MMAP 1547#ifdef __ARCH_WANT_SYS_OLD_MMAP
1541struct mmap_arg_struct { 1548struct mmap_arg_struct {
1542 unsigned long addr; 1549 unsigned long addr;
@@ -1556,8 +1563,8 @@ SYSCALL_DEFINE1(old_mmap, struct mmap_arg_struct __user *, arg)
1556 if (offset_in_page(a.offset)) 1563 if (offset_in_page(a.offset))
1557 return -EINVAL; 1564 return -EINVAL;
1558 1565
1559 return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, 1566 return ksys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd,
1560 a.offset >> PAGE_SHIFT); 1567 a.offset >> PAGE_SHIFT);
1561} 1568}
1562#endif /* __ARCH_WANT_SYS_OLD_MMAP */ 1569#endif /* __ARCH_WANT_SYS_OLD_MMAP */
1563 1570
diff --git a/mm/nommu.c b/mm/nommu.c
index 838a8fdec5c2..4f8720243ae7 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -1403,9 +1403,9 @@ error_getting_region:
1403 return -ENOMEM; 1403 return -ENOMEM;
1404} 1404}
1405 1405
1406SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len, 1406unsigned long ksys_mmap_pgoff(unsigned long addr, unsigned long len,
1407 unsigned long, prot, unsigned long, flags, 1407 unsigned long prot, unsigned long flags,
1408 unsigned long, fd, unsigned long, pgoff) 1408 unsigned long fd, unsigned long pgoff)
1409{ 1409{
1410 struct file *file = NULL; 1410 struct file *file = NULL;
1411 unsigned long retval = -EBADF; 1411 unsigned long retval = -EBADF;
@@ -1427,6 +1427,13 @@ out:
1427 return retval; 1427 return retval;
1428} 1428}
1429 1429
1430SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len,
1431 unsigned long, prot, unsigned long, flags,
1432 unsigned long, fd, unsigned long, pgoff)
1433{
1434 return ksys_mmap_pgoff(addr, len, prot, flags, fd, pgoff);
1435}
1436
1430#ifdef __ARCH_WANT_SYS_OLD_MMAP 1437#ifdef __ARCH_WANT_SYS_OLD_MMAP
1431struct mmap_arg_struct { 1438struct mmap_arg_struct {
1432 unsigned long addr; 1439 unsigned long addr;
@@ -1446,8 +1453,8 @@ SYSCALL_DEFINE1(old_mmap, struct mmap_arg_struct __user *, arg)
1446 if (offset_in_page(a.offset)) 1453 if (offset_in_page(a.offset))
1447 return -EINVAL; 1454 return -EINVAL;
1448 1455
1449 return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, 1456 return ksys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd,
1450 a.offset >> PAGE_SHIFT); 1457 a.offset >> PAGE_SHIFT);
1451} 1458}
1452#endif /* __ARCH_WANT_SYS_OLD_MMAP */ 1459#endif /* __ARCH_WANT_SYS_OLD_MMAP */
1453 1460
diff --git a/mm/readahead.c b/mm/readahead.c
index c4ca70239233..4d57b4644f98 100644
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@ -573,7 +573,7 @@ do_readahead(struct address_space *mapping, struct file *filp,
573 return force_page_cache_readahead(mapping, filp, index, nr); 573 return force_page_cache_readahead(mapping, filp, index, nr);
574} 574}
575 575
576SYSCALL_DEFINE3(readahead, int, fd, loff_t, offset, size_t, count) 576ssize_t ksys_readahead(int fd, loff_t offset, size_t count)
577{ 577{
578 ssize_t ret; 578 ssize_t ret;
579 struct fd f; 579 struct fd f;
@@ -592,3 +592,8 @@ SYSCALL_DEFINE3(readahead, int, fd, loff_t, offset, size_t, count)
592 } 592 }
593 return ret; 593 return ret;
594} 594}
595
596SYSCALL_DEFINE3(readahead, int, fd, loff_t, offset, size_t, count)
597{
598 return ksys_readahead(fd, offset, count);
599}
diff --git a/net/compat.c b/net/compat.c
index 22381719718c..5ae7437d3853 100644
--- a/net/compat.c
+++ b/net/compat.c
@@ -383,8 +383,8 @@ static int compat_sock_setsockopt(struct socket *sock, int level, int optname,
383 return sock_setsockopt(sock, level, optname, optval, optlen); 383 return sock_setsockopt(sock, level, optname, optval, optlen);
384} 384}
385 385
386COMPAT_SYSCALL_DEFINE5(setsockopt, int, fd, int, level, int, optname, 386static int __compat_sys_setsockopt(int fd, int level, int optname,
387 char __user *, optval, unsigned int, optlen) 387 char __user *optval, unsigned int optlen)
388{ 388{
389 int err; 389 int err;
390 struct socket *sock = sockfd_lookup(fd, &err); 390 struct socket *sock = sockfd_lookup(fd, &err);
@@ -410,6 +410,12 @@ COMPAT_SYSCALL_DEFINE5(setsockopt, int, fd, int, level, int, optname,
410 return err; 410 return err;
411} 411}
412 412
413COMPAT_SYSCALL_DEFINE5(setsockopt, int, fd, int, level, int, optname,
414 char __user *, optval, unsigned int, optlen)
415{
416 return __compat_sys_setsockopt(fd, level, optname, optval, optlen);
417}
418
413static int do_get_sock_timeout(struct socket *sock, int level, int optname, 419static int do_get_sock_timeout(struct socket *sock, int level, int optname,
414 char __user *optval, int __user *optlen) 420 char __user *optval, int __user *optlen)
415{ 421{
@@ -503,8 +509,9 @@ int compat_sock_get_timestampns(struct sock *sk, struct timespec __user *usersta
503} 509}
504EXPORT_SYMBOL(compat_sock_get_timestampns); 510EXPORT_SYMBOL(compat_sock_get_timestampns);
505 511
506COMPAT_SYSCALL_DEFINE5(getsockopt, int, fd, int, level, int, optname, 512static int __compat_sys_getsockopt(int fd, int level, int optname,
507 char __user *, optval, int __user *, optlen) 513 char __user *optval,
514 int __user *optlen)
508{ 515{
509 int err; 516 int err;
510 struct socket *sock = sockfd_lookup(fd, &err); 517 struct socket *sock = sockfd_lookup(fd, &err);
@@ -530,6 +537,12 @@ COMPAT_SYSCALL_DEFINE5(getsockopt, int, fd, int, level, int, optname,
530 return err; 537 return err;
531} 538}
532 539
540COMPAT_SYSCALL_DEFINE5(getsockopt, int, fd, int, level, int, optname,
541 char __user *, optval, int __user *, optlen)
542{
543 return __compat_sys_getsockopt(fd, level, optname, optval, optlen);
544}
545
533struct compat_group_req { 546struct compat_group_req {
534 __u32 gr_interface; 547 __u32 gr_interface;
535 struct __kernel_sockaddr_storage gr_group 548 struct __kernel_sockaddr_storage gr_group
@@ -734,38 +747,72 @@ static unsigned char nas[21] = {
734}; 747};
735#undef AL 748#undef AL
736 749
737COMPAT_SYSCALL_DEFINE3(sendmsg, int, fd, struct compat_msghdr __user *, msg, unsigned int, flags) 750static inline long __compat_sys_sendmsg(int fd,
751 struct compat_msghdr __user *msg,
752 unsigned int flags)
738{ 753{
739 return __sys_sendmsg(fd, (struct user_msghdr __user *)msg, flags | MSG_CMSG_COMPAT); 754 return __sys_sendmsg(fd, (struct user_msghdr __user *)msg,
755 flags | MSG_CMSG_COMPAT, false);
756}
757
758COMPAT_SYSCALL_DEFINE3(sendmsg, int, fd, struct compat_msghdr __user *, msg,
759 unsigned int, flags)
760{
761 return __compat_sys_sendmsg(fd, msg, flags);
762}
763
764static inline long __compat_sys_sendmmsg(int fd,
765 struct compat_mmsghdr __user *mmsg,
766 unsigned int vlen, unsigned int flags)
767{
768 return __sys_sendmmsg(fd, (struct mmsghdr __user *)mmsg, vlen,
769 flags | MSG_CMSG_COMPAT, false);
740} 770}
741 771
742COMPAT_SYSCALL_DEFINE4(sendmmsg, int, fd, struct compat_mmsghdr __user *, mmsg, 772COMPAT_SYSCALL_DEFINE4(sendmmsg, int, fd, struct compat_mmsghdr __user *, mmsg,
743 unsigned int, vlen, unsigned int, flags) 773 unsigned int, vlen, unsigned int, flags)
744{ 774{
745 return __sys_sendmmsg(fd, (struct mmsghdr __user *)mmsg, vlen, 775 return __compat_sys_sendmmsg(fd, mmsg, vlen, flags);
746 flags | MSG_CMSG_COMPAT); 776}
777
778static inline long __compat_sys_recvmsg(int fd,
779 struct compat_msghdr __user *msg,
780 unsigned int flags)
781{
782 return __sys_recvmsg(fd, (struct user_msghdr __user *)msg,
783 flags | MSG_CMSG_COMPAT, false);
784}
785
786COMPAT_SYSCALL_DEFINE3(recvmsg, int, fd, struct compat_msghdr __user *, msg,
787 unsigned int, flags)
788{
789 return __compat_sys_recvmsg(fd, msg, flags);
747} 790}
748 791
749COMPAT_SYSCALL_DEFINE3(recvmsg, int, fd, struct compat_msghdr __user *, msg, unsigned int, flags) 792static inline long __compat_sys_recvfrom(int fd, void __user *buf,
793 compat_size_t len, unsigned int flags,
794 struct sockaddr __user *addr,
795 int __user *addrlen)
750{ 796{
751 return __sys_recvmsg(fd, (struct user_msghdr __user *)msg, flags | MSG_CMSG_COMPAT); 797 return __sys_recvfrom(fd, buf, len, flags | MSG_CMSG_COMPAT, addr,
798 addrlen);
752} 799}
753 800
754COMPAT_SYSCALL_DEFINE4(recv, int, fd, void __user *, buf, compat_size_t, len, unsigned int, flags) 801COMPAT_SYSCALL_DEFINE4(recv, int, fd, void __user *, buf, compat_size_t, len, unsigned int, flags)
755{ 802{
756 return sys_recv(fd, buf, len, flags | MSG_CMSG_COMPAT); 803 return __compat_sys_recvfrom(fd, buf, len, flags, NULL, NULL);
757} 804}
758 805
759COMPAT_SYSCALL_DEFINE6(recvfrom, int, fd, void __user *, buf, compat_size_t, len, 806COMPAT_SYSCALL_DEFINE6(recvfrom, int, fd, void __user *, buf, compat_size_t, len,
760 unsigned int, flags, struct sockaddr __user *, addr, 807 unsigned int, flags, struct sockaddr __user *, addr,
761 int __user *, addrlen) 808 int __user *, addrlen)
762{ 809{
763 return sys_recvfrom(fd, buf, len, flags | MSG_CMSG_COMPAT, addr, addrlen); 810 return __compat_sys_recvfrom(fd, buf, len, flags, addr, addrlen);
764} 811}
765 812
766COMPAT_SYSCALL_DEFINE5(recvmmsg, int, fd, struct compat_mmsghdr __user *, mmsg, 813static int __compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg,
767 unsigned int, vlen, unsigned int, flags, 814 unsigned int vlen, unsigned int flags,
768 struct compat_timespec __user *, timeout) 815 struct compat_timespec __user *timeout)
769{ 816{
770 int datagrams; 817 int datagrams;
771 struct timespec ktspec; 818 struct timespec ktspec;
@@ -785,6 +832,13 @@ COMPAT_SYSCALL_DEFINE5(recvmmsg, int, fd, struct compat_mmsghdr __user *, mmsg,
785 return datagrams; 832 return datagrams;
786} 833}
787 834
835COMPAT_SYSCALL_DEFINE5(recvmmsg, int, fd, struct compat_mmsghdr __user *, mmsg,
836 unsigned int, vlen, unsigned int, flags,
837 struct compat_timespec __user *, timeout)
838{
839 return __compat_sys_recvmmsg(fd, mmsg, vlen, flags, timeout);
840}
841
788COMPAT_SYSCALL_DEFINE2(socketcall, int, call, u32 __user *, args) 842COMPAT_SYSCALL_DEFINE2(socketcall, int, call, u32 __user *, args)
789{ 843{
790 u32 a[AUDITSC_ARGS]; 844 u32 a[AUDITSC_ARGS];
@@ -810,68 +864,72 @@ COMPAT_SYSCALL_DEFINE2(socketcall, int, call, u32 __user *, args)
810 864
811 switch (call) { 865 switch (call) {
812 case SYS_SOCKET: 866 case SYS_SOCKET:
813 ret = sys_socket(a0, a1, a[2]); 867 ret = __sys_socket(a0, a1, a[2]);
814 break; 868 break;
815 case SYS_BIND: 869 case SYS_BIND:
816 ret = sys_bind(a0, compat_ptr(a1), a[2]); 870 ret = __sys_bind(a0, compat_ptr(a1), a[2]);
817 break; 871 break;
818 case SYS_CONNECT: 872 case SYS_CONNECT:
819 ret = sys_connect(a0, compat_ptr(a1), a[2]); 873 ret = __sys_connect(a0, compat_ptr(a1), a[2]);
820 break; 874 break;
821 case SYS_LISTEN: 875 case SYS_LISTEN:
822 ret = sys_listen(a0, a1); 876 ret = __sys_listen(a0, a1);
823 break; 877 break;
824 case SYS_ACCEPT: 878 case SYS_ACCEPT:
825 ret = sys_accept4(a0, compat_ptr(a1), compat_ptr(a[2]), 0); 879 ret = __sys_accept4(a0, compat_ptr(a1), compat_ptr(a[2]), 0);
826 break; 880 break;
827 case SYS_GETSOCKNAME: 881 case SYS_GETSOCKNAME:
828 ret = sys_getsockname(a0, compat_ptr(a1), compat_ptr(a[2])); 882 ret = __sys_getsockname(a0, compat_ptr(a1), compat_ptr(a[2]));
829 break; 883 break;
830 case SYS_GETPEERNAME: 884 case SYS_GETPEERNAME:
831 ret = sys_getpeername(a0, compat_ptr(a1), compat_ptr(a[2])); 885 ret = __sys_getpeername(a0, compat_ptr(a1), compat_ptr(a[2]));
832 break; 886 break;
833 case SYS_SOCKETPAIR: 887 case SYS_SOCKETPAIR:
834 ret = sys_socketpair(a0, a1, a[2], compat_ptr(a[3])); 888 ret = __sys_socketpair(a0, a1, a[2], compat_ptr(a[3]));
835 break; 889 break;
836 case SYS_SEND: 890 case SYS_SEND:
837 ret = sys_send(a0, compat_ptr(a1), a[2], a[3]); 891 ret = __sys_sendto(a0, compat_ptr(a1), a[2], a[3], NULL, 0);
838 break; 892 break;
839 case SYS_SENDTO: 893 case SYS_SENDTO:
840 ret = sys_sendto(a0, compat_ptr(a1), a[2], a[3], compat_ptr(a[4]), a[5]); 894 ret = __sys_sendto(a0, compat_ptr(a1), a[2], a[3],
895 compat_ptr(a[4]), a[5]);
841 break; 896 break;
842 case SYS_RECV: 897 case SYS_RECV:
843 ret = compat_sys_recv(a0, compat_ptr(a1), a[2], a[3]); 898 ret = __compat_sys_recvfrom(a0, compat_ptr(a1), a[2], a[3],
899 NULL, NULL);
844 break; 900 break;
845 case SYS_RECVFROM: 901 case SYS_RECVFROM:
846 ret = compat_sys_recvfrom(a0, compat_ptr(a1), a[2], a[3], 902 ret = __compat_sys_recvfrom(a0, compat_ptr(a1), a[2], a[3],
847 compat_ptr(a[4]), compat_ptr(a[5])); 903 compat_ptr(a[4]),
904 compat_ptr(a[5]));
848 break; 905 break;
849 case SYS_SHUTDOWN: 906 case SYS_SHUTDOWN:
850 ret = sys_shutdown(a0, a1); 907 ret = __sys_shutdown(a0, a1);
851 break; 908 break;
852 case SYS_SETSOCKOPT: 909 case SYS_SETSOCKOPT:
853 ret = compat_sys_setsockopt(a0, a1, a[2], 910 ret = __compat_sys_setsockopt(a0, a1, a[2],
854 compat_ptr(a[3]), a[4]); 911 compat_ptr(a[3]), a[4]);
855 break; 912 break;
856 case SYS_GETSOCKOPT: 913 case SYS_GETSOCKOPT:
857 ret = compat_sys_getsockopt(a0, a1, a[2], 914 ret = __compat_sys_getsockopt(a0, a1, a[2],
858 compat_ptr(a[3]), compat_ptr(a[4])); 915 compat_ptr(a[3]),
916 compat_ptr(a[4]));
859 break; 917 break;
860 case SYS_SENDMSG: 918 case SYS_SENDMSG:
861 ret = compat_sys_sendmsg(a0, compat_ptr(a1), a[2]); 919 ret = __compat_sys_sendmsg(a0, compat_ptr(a1), a[2]);
862 break; 920 break;
863 case SYS_SENDMMSG: 921 case SYS_SENDMMSG:
864 ret = compat_sys_sendmmsg(a0, compat_ptr(a1), a[2], a[3]); 922 ret = __compat_sys_sendmmsg(a0, compat_ptr(a1), a[2], a[3]);
865 break; 923 break;
866 case SYS_RECVMSG: 924 case SYS_RECVMSG:
867 ret = compat_sys_recvmsg(a0, compat_ptr(a1), a[2]); 925 ret = __compat_sys_recvmsg(a0, compat_ptr(a1), a[2]);
868 break; 926 break;
869 case SYS_RECVMMSG: 927 case SYS_RECVMMSG:
870 ret = compat_sys_recvmmsg(a0, compat_ptr(a1), a[2], a[3], 928 ret = __compat_sys_recvmmsg(a0, compat_ptr(a1), a[2], a[3],
871 compat_ptr(a[4])); 929 compat_ptr(a[4]));
872 break; 930 break;
873 case SYS_ACCEPT4: 931 case SYS_ACCEPT4:
874 ret = sys_accept4(a0, compat_ptr(a1), compat_ptr(a[2]), a[3]); 932 ret = __sys_accept4(a0, compat_ptr(a1), compat_ptr(a[2]), a[3]);
875 break; 933 break;
876 default: 934 default:
877 ret = -EINVAL; 935 ret = -EINVAL;
diff --git a/net/socket.c b/net/socket.c
index 08847c3b8c39..4ba9fc631c43 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1332,7 +1332,7 @@ int sock_create_kern(struct net *net, int family, int type, int protocol, struct
1332} 1332}
1333EXPORT_SYMBOL(sock_create_kern); 1333EXPORT_SYMBOL(sock_create_kern);
1334 1334
1335SYSCALL_DEFINE3(socket, int, family, int, type, int, protocol) 1335int __sys_socket(int family, int type, int protocol)
1336{ 1336{
1337 int retval; 1337 int retval;
1338 struct socket *sock; 1338 struct socket *sock;
@@ -1359,12 +1359,16 @@ SYSCALL_DEFINE3(socket, int, family, int, type, int, protocol)
1359 return sock_map_fd(sock, flags & (O_CLOEXEC | O_NONBLOCK)); 1359 return sock_map_fd(sock, flags & (O_CLOEXEC | O_NONBLOCK));
1360} 1360}
1361 1361
1362SYSCALL_DEFINE3(socket, int, family, int, type, int, protocol)
1363{
1364 return __sys_socket(family, type, protocol);
1365}
1366
1362/* 1367/*
1363 * Create a pair of connected sockets. 1368 * Create a pair of connected sockets.
1364 */ 1369 */
1365 1370
1366SYSCALL_DEFINE4(socketpair, int, family, int, type, int, protocol, 1371int __sys_socketpair(int family, int type, int protocol, int __user *usockvec)
1367 int __user *, usockvec)
1368{ 1372{
1369 struct socket *sock1, *sock2; 1373 struct socket *sock1, *sock2;
1370 int fd1, fd2, err; 1374 int fd1, fd2, err;
@@ -1449,6 +1453,12 @@ out:
1449 return err; 1453 return err;
1450} 1454}
1451 1455
1456SYSCALL_DEFINE4(socketpair, int, family, int, type, int, protocol,
1457 int __user *, usockvec)
1458{
1459 return __sys_socketpair(family, type, protocol, usockvec);
1460}
1461
1452/* 1462/*
1453 * Bind a name to a socket. Nothing much to do here since it's 1463 * Bind a name to a socket. Nothing much to do here since it's
1454 * the protocol's responsibility to handle the local address. 1464 * the protocol's responsibility to handle the local address.
@@ -1457,7 +1467,7 @@ out:
1457 * the protocol layer (having also checked the address is ok). 1467 * the protocol layer (having also checked the address is ok).
1458 */ 1468 */
1459 1469
1460SYSCALL_DEFINE3(bind, int, fd, struct sockaddr __user *, umyaddr, int, addrlen) 1470int __sys_bind(int fd, struct sockaddr __user *umyaddr, int addrlen)
1461{ 1471{
1462 struct socket *sock; 1472 struct socket *sock;
1463 struct sockaddr_storage address; 1473 struct sockaddr_storage address;
@@ -1480,13 +1490,18 @@ SYSCALL_DEFINE3(bind, int, fd, struct sockaddr __user *, umyaddr, int, addrlen)
1480 return err; 1490 return err;
1481} 1491}
1482 1492
1493SYSCALL_DEFINE3(bind, int, fd, struct sockaddr __user *, umyaddr, int, addrlen)
1494{
1495 return __sys_bind(fd, umyaddr, addrlen);
1496}
1497
1483/* 1498/*
1484 * Perform a listen. Basically, we allow the protocol to do anything 1499 * Perform a listen. Basically, we allow the protocol to do anything
1485 * necessary for a listen, and if that works, we mark the socket as 1500 * necessary for a listen, and if that works, we mark the socket as
1486 * ready for listening. 1501 * ready for listening.
1487 */ 1502 */
1488 1503
1489SYSCALL_DEFINE2(listen, int, fd, int, backlog) 1504int __sys_listen(int fd, int backlog)
1490{ 1505{
1491 struct socket *sock; 1506 struct socket *sock;
1492 int err, fput_needed; 1507 int err, fput_needed;
@@ -1507,6 +1522,11 @@ SYSCALL_DEFINE2(listen, int, fd, int, backlog)
1507 return err; 1522 return err;
1508} 1523}
1509 1524
1525SYSCALL_DEFINE2(listen, int, fd, int, backlog)
1526{
1527 return __sys_listen(fd, backlog);
1528}
1529
1510/* 1530/*
1511 * For accept, we attempt to create a new socket, set up the link 1531 * For accept, we attempt to create a new socket, set up the link
1512 * with the client, wake up the client, then return the new 1532 * with the client, wake up the client, then return the new
@@ -1519,8 +1539,8 @@ SYSCALL_DEFINE2(listen, int, fd, int, backlog)
1519 * clean when we restucture accept also. 1539 * clean when we restucture accept also.
1520 */ 1540 */
1521 1541
1522SYSCALL_DEFINE4(accept4, int, fd, struct sockaddr __user *, upeer_sockaddr, 1542int __sys_accept4(int fd, struct sockaddr __user *upeer_sockaddr,
1523 int __user *, upeer_addrlen, int, flags) 1543 int __user *upeer_addrlen, int flags)
1524{ 1544{
1525 struct socket *sock, *newsock; 1545 struct socket *sock, *newsock;
1526 struct file *newfile; 1546 struct file *newfile;
@@ -1599,10 +1619,16 @@ out_fd:
1599 goto out_put; 1619 goto out_put;
1600} 1620}
1601 1621
1622SYSCALL_DEFINE4(accept4, int, fd, struct sockaddr __user *, upeer_sockaddr,
1623 int __user *, upeer_addrlen, int, flags)
1624{
1625 return __sys_accept4(fd, upeer_sockaddr, upeer_addrlen, flags);
1626}
1627
1602SYSCALL_DEFINE3(accept, int, fd, struct sockaddr __user *, upeer_sockaddr, 1628SYSCALL_DEFINE3(accept, int, fd, struct sockaddr __user *, upeer_sockaddr,
1603 int __user *, upeer_addrlen) 1629 int __user *, upeer_addrlen)
1604{ 1630{
1605 return sys_accept4(fd, upeer_sockaddr, upeer_addrlen, 0); 1631 return __sys_accept4(fd, upeer_sockaddr, upeer_addrlen, 0);
1606} 1632}
1607 1633
1608/* 1634/*
@@ -1617,8 +1643,7 @@ SYSCALL_DEFINE3(accept, int, fd, struct sockaddr __user *, upeer_sockaddr,
1617 * include the -EINPROGRESS status for such sockets. 1643 * include the -EINPROGRESS status for such sockets.
1618 */ 1644 */
1619 1645
1620SYSCALL_DEFINE3(connect, int, fd, struct sockaddr __user *, uservaddr, 1646int __sys_connect(int fd, struct sockaddr __user *uservaddr, int addrlen)
1621 int, addrlen)
1622{ 1647{
1623 struct socket *sock; 1648 struct socket *sock;
1624 struct sockaddr_storage address; 1649 struct sockaddr_storage address;
@@ -1644,13 +1669,19 @@ out:
1644 return err; 1669 return err;
1645} 1670}
1646 1671
1672SYSCALL_DEFINE3(connect, int, fd, struct sockaddr __user *, uservaddr,
1673 int, addrlen)
1674{
1675 return __sys_connect(fd, uservaddr, addrlen);
1676}
1677
1647/* 1678/*
1648 * Get the local address ('name') of a socket object. Move the obtained 1679 * Get the local address ('name') of a socket object. Move the obtained
1649 * name to user space. 1680 * name to user space.
1650 */ 1681 */
1651 1682
1652SYSCALL_DEFINE3(getsockname, int, fd, struct sockaddr __user *, usockaddr, 1683int __sys_getsockname(int fd, struct sockaddr __user *usockaddr,
1653 int __user *, usockaddr_len) 1684 int __user *usockaddr_len)
1654{ 1685{
1655 struct socket *sock; 1686 struct socket *sock;
1656 struct sockaddr_storage address; 1687 struct sockaddr_storage address;
@@ -1675,13 +1706,19 @@ out:
1675 return err; 1706 return err;
1676} 1707}
1677 1708
1709SYSCALL_DEFINE3(getsockname, int, fd, struct sockaddr __user *, usockaddr,
1710 int __user *, usockaddr_len)
1711{
1712 return __sys_getsockname(fd, usockaddr, usockaddr_len);
1713}
1714
1678/* 1715/*
1679 * Get the remote address ('name') of a socket object. Move the obtained 1716 * Get the remote address ('name') of a socket object. Move the obtained
1680 * name to user space. 1717 * name to user space.
1681 */ 1718 */
1682 1719
1683SYSCALL_DEFINE3(getpeername, int, fd, struct sockaddr __user *, usockaddr, 1720int __sys_getpeername(int fd, struct sockaddr __user *usockaddr,
1684 int __user *, usockaddr_len) 1721 int __user *usockaddr_len)
1685{ 1722{
1686 struct socket *sock; 1723 struct socket *sock;
1687 struct sockaddr_storage address; 1724 struct sockaddr_storage address;
@@ -1706,15 +1743,19 @@ SYSCALL_DEFINE3(getpeername, int, fd, struct sockaddr __user *, usockaddr,
1706 return err; 1743 return err;
1707} 1744}
1708 1745
1746SYSCALL_DEFINE3(getpeername, int, fd, struct sockaddr __user *, usockaddr,
1747 int __user *, usockaddr_len)
1748{
1749 return __sys_getpeername(fd, usockaddr, usockaddr_len);
1750}
1751
1709/* 1752/*
1710 * Send a datagram to a given address. We move the address into kernel 1753 * Send a datagram to a given address. We move the address into kernel
1711 * space and check the user space data area is readable before invoking 1754 * space and check the user space data area is readable before invoking
1712 * the protocol. 1755 * the protocol.
1713 */ 1756 */
1714 1757int __sys_sendto(int fd, void __user *buff, size_t len, unsigned int flags,
1715SYSCALL_DEFINE6(sendto, int, fd, void __user *, buff, size_t, len, 1758 struct sockaddr __user *addr, int addr_len)
1716 unsigned int, flags, struct sockaddr __user *, addr,
1717 int, addr_len)
1718{ 1759{
1719 struct socket *sock; 1760 struct socket *sock;
1720 struct sockaddr_storage address; 1761 struct sockaddr_storage address;
@@ -1752,6 +1793,13 @@ out:
1752 return err; 1793 return err;
1753} 1794}
1754 1795
1796SYSCALL_DEFINE6(sendto, int, fd, void __user *, buff, size_t, len,
1797 unsigned int, flags, struct sockaddr __user *, addr,
1798 int, addr_len)
1799{
1800 return __sys_sendto(fd, buff, len, flags, addr, addr_len);
1801}
1802
1755/* 1803/*
1756 * Send a datagram down a socket. 1804 * Send a datagram down a socket.
1757 */ 1805 */
@@ -1759,7 +1807,7 @@ out:
1759SYSCALL_DEFINE4(send, int, fd, void __user *, buff, size_t, len, 1807SYSCALL_DEFINE4(send, int, fd, void __user *, buff, size_t, len,
1760 unsigned int, flags) 1808 unsigned int, flags)
1761{ 1809{
1762 return sys_sendto(fd, buff, len, flags, NULL, 0); 1810 return __sys_sendto(fd, buff, len, flags, NULL, 0);
1763} 1811}
1764 1812
1765/* 1813/*
@@ -1767,10 +1815,8 @@ SYSCALL_DEFINE4(send, int, fd, void __user *, buff, size_t, len,
1767 * sender. We verify the buffers are writable and if needed move the 1815 * sender. We verify the buffers are writable and if needed move the
1768 * sender address from kernel to user space. 1816 * sender address from kernel to user space.
1769 */ 1817 */
1770 1818int __sys_recvfrom(int fd, void __user *ubuf, size_t size, unsigned int flags,
1771SYSCALL_DEFINE6(recvfrom, int, fd, void __user *, ubuf, size_t, size, 1819 struct sockaddr __user *addr, int __user *addr_len)
1772 unsigned int, flags, struct sockaddr __user *, addr,
1773 int __user *, addr_len)
1774{ 1820{
1775 struct socket *sock; 1821 struct socket *sock;
1776 struct iovec iov; 1822 struct iovec iov;
@@ -1810,6 +1856,13 @@ out:
1810 return err; 1856 return err;
1811} 1857}
1812 1858
1859SYSCALL_DEFINE6(recvfrom, int, fd, void __user *, ubuf, size_t, size,
1860 unsigned int, flags, struct sockaddr __user *, addr,
1861 int __user *, addr_len)
1862{
1863 return __sys_recvfrom(fd, ubuf, size, flags, addr, addr_len);
1864}
1865
1813/* 1866/*
1814 * Receive a datagram from a socket. 1867 * Receive a datagram from a socket.
1815 */ 1868 */
@@ -1817,7 +1870,7 @@ out:
1817SYSCALL_DEFINE4(recv, int, fd, void __user *, ubuf, size_t, size, 1870SYSCALL_DEFINE4(recv, int, fd, void __user *, ubuf, size_t, size,
1818 unsigned int, flags) 1871 unsigned int, flags)
1819{ 1872{
1820 return sys_recvfrom(fd, ubuf, size, flags, NULL, NULL); 1873 return __sys_recvfrom(fd, ubuf, size, flags, NULL, NULL);
1821} 1874}
1822 1875
1823/* 1876/*
@@ -1825,8 +1878,8 @@ SYSCALL_DEFINE4(recv, int, fd, void __user *, ubuf, size_t, size,
1825 * to pass the user mode parameter for the protocols to sort out. 1878 * to pass the user mode parameter for the protocols to sort out.
1826 */ 1879 */
1827 1880
1828SYSCALL_DEFINE5(setsockopt, int, fd, int, level, int, optname, 1881static int __sys_setsockopt(int fd, int level, int optname,
1829 char __user *, optval, int, optlen) 1882 char __user *optval, int optlen)
1830{ 1883{
1831 int err, fput_needed; 1884 int err, fput_needed;
1832 struct socket *sock; 1885 struct socket *sock;
@@ -1854,13 +1907,19 @@ out_put:
1854 return err; 1907 return err;
1855} 1908}
1856 1909
1910SYSCALL_DEFINE5(setsockopt, int, fd, int, level, int, optname,
1911 char __user *, optval, int, optlen)
1912{
1913 return __sys_setsockopt(fd, level, optname, optval, optlen);
1914}
1915
1857/* 1916/*
1858 * Get a socket option. Because we don't know the option lengths we have 1917 * Get a socket option. Because we don't know the option lengths we have
1859 * to pass a user mode parameter for the protocols to sort out. 1918 * to pass a user mode parameter for the protocols to sort out.
1860 */ 1919 */
1861 1920
1862SYSCALL_DEFINE5(getsockopt, int, fd, int, level, int, optname, 1921static int __sys_getsockopt(int fd, int level, int optname,
1863 char __user *, optval, int __user *, optlen) 1922 char __user *optval, int __user *optlen)
1864{ 1923{
1865 int err, fput_needed; 1924 int err, fput_needed;
1866 struct socket *sock; 1925 struct socket *sock;
@@ -1885,11 +1944,17 @@ out_put:
1885 return err; 1944 return err;
1886} 1945}
1887 1946
1947SYSCALL_DEFINE5(getsockopt, int, fd, int, level, int, optname,
1948 char __user *, optval, int __user *, optlen)
1949{
1950 return __sys_getsockopt(fd, level, optname, optval, optlen);
1951}
1952
1888/* 1953/*
1889 * Shutdown a socket. 1954 * Shutdown a socket.
1890 */ 1955 */
1891 1956
1892SYSCALL_DEFINE2(shutdown, int, fd, int, how) 1957int __sys_shutdown(int fd, int how)
1893{ 1958{
1894 int err, fput_needed; 1959 int err, fput_needed;
1895 struct socket *sock; 1960 struct socket *sock;
@@ -1904,6 +1969,11 @@ SYSCALL_DEFINE2(shutdown, int, fd, int, how)
1904 return err; 1969 return err;
1905} 1970}
1906 1971
1972SYSCALL_DEFINE2(shutdown, int, fd, int, how)
1973{
1974 return __sys_shutdown(fd, how);
1975}
1976
1907/* A couple of helpful macros for getting the address of the 32/64 bit 1977/* A couple of helpful macros for getting the address of the 32/64 bit
1908 * fields which are the same type (int / unsigned) on our platforms. 1978 * fields which are the same type (int / unsigned) on our platforms.
1909 */ 1979 */
@@ -2067,12 +2137,16 @@ out_freeiov:
2067 * BSD sendmsg interface 2137 * BSD sendmsg interface
2068 */ 2138 */
2069 2139
2070long __sys_sendmsg(int fd, struct user_msghdr __user *msg, unsigned flags) 2140long __sys_sendmsg(int fd, struct user_msghdr __user *msg, unsigned int flags,
2141 bool forbid_cmsg_compat)
2071{ 2142{
2072 int fput_needed, err; 2143 int fput_needed, err;
2073 struct msghdr msg_sys; 2144 struct msghdr msg_sys;
2074 struct socket *sock; 2145 struct socket *sock;
2075 2146
2147 if (forbid_cmsg_compat && (flags & MSG_CMSG_COMPAT))
2148 return -EINVAL;
2149
2076 sock = sockfd_lookup_light(fd, &err, &fput_needed); 2150 sock = sockfd_lookup_light(fd, &err, &fput_needed);
2077 if (!sock) 2151 if (!sock)
2078 goto out; 2152 goto out;
@@ -2086,9 +2160,7 @@ out:
2086 2160
2087SYSCALL_DEFINE3(sendmsg, int, fd, struct user_msghdr __user *, msg, unsigned int, flags) 2161SYSCALL_DEFINE3(sendmsg, int, fd, struct user_msghdr __user *, msg, unsigned int, flags)
2088{ 2162{
2089 if (flags & MSG_CMSG_COMPAT) 2163 return __sys_sendmsg(fd, msg, flags, true);
2090 return -EINVAL;
2091 return __sys_sendmsg(fd, msg, flags);
2092} 2164}
2093 2165
2094/* 2166/*
@@ -2096,7 +2168,7 @@ SYSCALL_DEFINE3(sendmsg, int, fd, struct user_msghdr __user *, msg, unsigned int
2096 */ 2168 */
2097 2169
2098int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen, 2170int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen,
2099 unsigned int flags) 2171 unsigned int flags, bool forbid_cmsg_compat)
2100{ 2172{
2101 int fput_needed, err, datagrams; 2173 int fput_needed, err, datagrams;
2102 struct socket *sock; 2174 struct socket *sock;
@@ -2106,6 +2178,9 @@ int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen,
2106 struct used_address used_address; 2178 struct used_address used_address;
2107 unsigned int oflags = flags; 2179 unsigned int oflags = flags;
2108 2180
2181 if (forbid_cmsg_compat && (flags & MSG_CMSG_COMPAT))
2182 return -EINVAL;
2183
2109 if (vlen > UIO_MAXIOV) 2184 if (vlen > UIO_MAXIOV)
2110 vlen = UIO_MAXIOV; 2185 vlen = UIO_MAXIOV;
2111 2186
@@ -2162,9 +2237,7 @@ int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen,
2162SYSCALL_DEFINE4(sendmmsg, int, fd, struct mmsghdr __user *, mmsg, 2237SYSCALL_DEFINE4(sendmmsg, int, fd, struct mmsghdr __user *, mmsg,
2163 unsigned int, vlen, unsigned int, flags) 2238 unsigned int, vlen, unsigned int, flags)
2164{ 2239{
2165 if (flags & MSG_CMSG_COMPAT) 2240 return __sys_sendmmsg(fd, mmsg, vlen, flags, true);
2166 return -EINVAL;
2167 return __sys_sendmmsg(fd, mmsg, vlen, flags);
2168} 2241}
2169 2242
2170static int ___sys_recvmsg(struct socket *sock, struct user_msghdr __user *msg, 2243static int ___sys_recvmsg(struct socket *sock, struct user_msghdr __user *msg,
@@ -2237,12 +2310,16 @@ out_freeiov:
2237 * BSD recvmsg interface 2310 * BSD recvmsg interface
2238 */ 2311 */
2239 2312
2240long __sys_recvmsg(int fd, struct user_msghdr __user *msg, unsigned flags) 2313long __sys_recvmsg(int fd, struct user_msghdr __user *msg, unsigned int flags,
2314 bool forbid_cmsg_compat)
2241{ 2315{
2242 int fput_needed, err; 2316 int fput_needed, err;
2243 struct msghdr msg_sys; 2317 struct msghdr msg_sys;
2244 struct socket *sock; 2318 struct socket *sock;
2245 2319
2320 if (forbid_cmsg_compat && (flags & MSG_CMSG_COMPAT))
2321 return -EINVAL;
2322
2246 sock = sockfd_lookup_light(fd, &err, &fput_needed); 2323 sock = sockfd_lookup_light(fd, &err, &fput_needed);
2247 if (!sock) 2324 if (!sock)
2248 goto out; 2325 goto out;
@@ -2257,9 +2334,7 @@ out:
2257SYSCALL_DEFINE3(recvmsg, int, fd, struct user_msghdr __user *, msg, 2334SYSCALL_DEFINE3(recvmsg, int, fd, struct user_msghdr __user *, msg,
2258 unsigned int, flags) 2335 unsigned int, flags)
2259{ 2336{
2260 if (flags & MSG_CMSG_COMPAT) 2337 return __sys_recvmsg(fd, msg, flags, true);
2261 return -EINVAL;
2262 return __sys_recvmsg(fd, msg, flags);
2263} 2338}
2264 2339
2265/* 2340/*
@@ -2375,9 +2450,9 @@ out_put:
2375 return datagrams; 2450 return datagrams;
2376} 2451}
2377 2452
2378SYSCALL_DEFINE5(recvmmsg, int, fd, struct mmsghdr __user *, mmsg, 2453static int do_sys_recvmmsg(int fd, struct mmsghdr __user *mmsg,
2379 unsigned int, vlen, unsigned int, flags, 2454 unsigned int vlen, unsigned int flags,
2380 struct timespec __user *, timeout) 2455 struct timespec __user *timeout)
2381{ 2456{
2382 int datagrams; 2457 int datagrams;
2383 struct timespec timeout_sys; 2458 struct timespec timeout_sys;
@@ -2400,6 +2475,13 @@ SYSCALL_DEFINE5(recvmmsg, int, fd, struct mmsghdr __user *, mmsg,
2400 return datagrams; 2475 return datagrams;
2401} 2476}
2402 2477
2478SYSCALL_DEFINE5(recvmmsg, int, fd, struct mmsghdr __user *, mmsg,
2479 unsigned int, vlen, unsigned int, flags,
2480 struct timespec __user *, timeout)
2481{
2482 return do_sys_recvmmsg(fd, mmsg, vlen, flags, timeout);
2483}
2484
2403#ifdef __ARCH_WANT_SYS_SOCKETCALL 2485#ifdef __ARCH_WANT_SYS_SOCKETCALL
2404/* Argument list sizes for sys_socketcall */ 2486/* Argument list sizes for sys_socketcall */
2405#define AL(x) ((x) * sizeof(unsigned long)) 2487#define AL(x) ((x) * sizeof(unsigned long))
@@ -2447,76 +2529,82 @@ SYSCALL_DEFINE2(socketcall, int, call, unsigned long __user *, args)
2447 2529
2448 switch (call) { 2530 switch (call) {
2449 case SYS_SOCKET: 2531 case SYS_SOCKET:
2450 err = sys_socket(a0, a1, a[2]); 2532 err = __sys_socket(a0, a1, a[2]);
2451 break; 2533 break;
2452 case SYS_BIND: 2534 case SYS_BIND:
2453 err = sys_bind(a0, (struct sockaddr __user *)a1, a[2]); 2535 err = __sys_bind(a0, (struct sockaddr __user *)a1, a[2]);
2454 break; 2536 break;
2455 case SYS_CONNECT: 2537 case SYS_CONNECT:
2456 err = sys_connect(a0, (struct sockaddr __user *)a1, a[2]); 2538 err = __sys_connect(a0, (struct sockaddr __user *)a1, a[2]);
2457 break; 2539 break;
2458 case SYS_LISTEN: 2540 case SYS_LISTEN:
2459 err = sys_listen(a0, a1); 2541 err = __sys_listen(a0, a1);
2460 break; 2542 break;
2461 case SYS_ACCEPT: 2543 case SYS_ACCEPT:
2462 err = sys_accept4(a0, (struct sockaddr __user *)a1, 2544 err = __sys_accept4(a0, (struct sockaddr __user *)a1,
2463 (int __user *)a[2], 0); 2545 (int __user *)a[2], 0);
2464 break; 2546 break;
2465 case SYS_GETSOCKNAME: 2547 case SYS_GETSOCKNAME:
2466 err = 2548 err =
2467 sys_getsockname(a0, (struct sockaddr __user *)a1, 2549 __sys_getsockname(a0, (struct sockaddr __user *)a1,
2468 (int __user *)a[2]); 2550 (int __user *)a[2]);
2469 break; 2551 break;
2470 case SYS_GETPEERNAME: 2552 case SYS_GETPEERNAME:
2471 err = 2553 err =
2472 sys_getpeername(a0, (struct sockaddr __user *)a1, 2554 __sys_getpeername(a0, (struct sockaddr __user *)a1,
2473 (int __user *)a[2]); 2555 (int __user *)a[2]);
2474 break; 2556 break;
2475 case SYS_SOCKETPAIR: 2557 case SYS_SOCKETPAIR:
2476 err = sys_socketpair(a0, a1, a[2], (int __user *)a[3]); 2558 err = __sys_socketpair(a0, a1, a[2], (int __user *)a[3]);
2477 break; 2559 break;
2478 case SYS_SEND: 2560 case SYS_SEND:
2479 err = sys_send(a0, (void __user *)a1, a[2], a[3]); 2561 err = __sys_sendto(a0, (void __user *)a1, a[2], a[3],
2562 NULL, 0);
2480 break; 2563 break;
2481 case SYS_SENDTO: 2564 case SYS_SENDTO:
2482 err = sys_sendto(a0, (void __user *)a1, a[2], a[3], 2565 err = __sys_sendto(a0, (void __user *)a1, a[2], a[3],
2483 (struct sockaddr __user *)a[4], a[5]); 2566 (struct sockaddr __user *)a[4], a[5]);
2484 break; 2567 break;
2485 case SYS_RECV: 2568 case SYS_RECV:
2486 err = sys_recv(a0, (void __user *)a1, a[2], a[3]); 2569 err = __sys_recvfrom(a0, (void __user *)a1, a[2], a[3],
2570 NULL, NULL);
2487 break; 2571 break;
2488 case SYS_RECVFROM: 2572 case SYS_RECVFROM:
2489 err = sys_recvfrom(a0, (void __user *)a1, a[2], a[3], 2573 err = __sys_recvfrom(a0, (void __user *)a1, a[2], a[3],
2490 (struct sockaddr __user *)a[4], 2574 (struct sockaddr __user *)a[4],
2491 (int __user *)a[5]); 2575 (int __user *)a[5]);
2492 break; 2576 break;
2493 case SYS_SHUTDOWN: 2577 case SYS_SHUTDOWN:
2494 err = sys_shutdown(a0, a1); 2578 err = __sys_shutdown(a0, a1);
2495 break; 2579 break;
2496 case SYS_SETSOCKOPT: 2580 case SYS_SETSOCKOPT:
2497 err = sys_setsockopt(a0, a1, a[2], (char __user *)a[3], a[4]); 2581 err = __sys_setsockopt(a0, a1, a[2], (char __user *)a[3],
2582 a[4]);
2498 break; 2583 break;
2499 case SYS_GETSOCKOPT: 2584 case SYS_GETSOCKOPT:
2500 err = 2585 err =
2501 sys_getsockopt(a0, a1, a[2], (char __user *)a[3], 2586 __sys_getsockopt(a0, a1, a[2], (char __user *)a[3],
2502 (int __user *)a[4]); 2587 (int __user *)a[4]);
2503 break; 2588 break;
2504 case SYS_SENDMSG: 2589 case SYS_SENDMSG:
2505 err = sys_sendmsg(a0, (struct user_msghdr __user *)a1, a[2]); 2590 err = __sys_sendmsg(a0, (struct user_msghdr __user *)a1,
2591 a[2], true);
2506 break; 2592 break;
2507 case SYS_SENDMMSG: 2593 case SYS_SENDMMSG:
2508 err = sys_sendmmsg(a0, (struct mmsghdr __user *)a1, a[2], a[3]); 2594 err = __sys_sendmmsg(a0, (struct mmsghdr __user *)a1, a[2],
2595 a[3], true);
2509 break; 2596 break;
2510 case SYS_RECVMSG: 2597 case SYS_RECVMSG:
2511 err = sys_recvmsg(a0, (struct user_msghdr __user *)a1, a[2]); 2598 err = __sys_recvmsg(a0, (struct user_msghdr __user *)a1,
2599 a[2], true);
2512 break; 2600 break;
2513 case SYS_RECVMMSG: 2601 case SYS_RECVMMSG:
2514 err = sys_recvmmsg(a0, (struct mmsghdr __user *)a1, a[2], a[3], 2602 err = do_sys_recvmmsg(a0, (struct mmsghdr __user *)a1, a[2],
2515 (struct timespec __user *)a[4]); 2603 a[3], (struct timespec __user *)a[4]);
2516 break; 2604 break;
2517 case SYS_ACCEPT4: 2605 case SYS_ACCEPT4:
2518 err = sys_accept4(a0, (struct sockaddr __user *)a1, 2606 err = __sys_accept4(a0, (struct sockaddr __user *)a1,
2519 (int __user *)a[2], a[3]); 2607 (int __user *)a[2], a[3]);
2520 break; 2608 break;
2521 default: 2609 default:
2522 err = -EINVAL; 2610 err = -EINVAL;