aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-05-01 10:21:43 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-05-01 10:21:43 -0400
commit08d76760832993050ad8c25e63b56773ef2ca303 (patch)
treeabdcf148dfe43cd49f30f204f1dac6978107a508
parent5f56886521d6ddd3648777fae44d82382dd8c87f (diff)
parent99e621f796d7f0341a51e8cdf32b81663b10b448 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal
Pull compat cleanup from Al Viro: "Mostly about syscall wrappers this time; there will be another pile with patches in the same general area from various people, but I'd rather push those after both that and vfs.git pile are in." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal: syscalls.h: slightly reduce the jungles of macros get rid of union semop in sys_semctl(2) arguments make do_mremap() static sparc: no need to sign-extend in sync_file_range() wrapper ppc compat wrappers for add_key(2) and request_key(2) are pointless x86: trim sys_ia32.h x86: sys32_kill and sys32_mprotect are pointless get rid of compat_sys_semctl() and friends in case of ARCH_WANT_OLD_COMPAT_IPC merge compat sys_ipc instances consolidate compat lookup_dcookie() convert vmsplice to COMPAT_SYSCALL_DEFINE switch getrusage() to COMPAT_SYSCALL_DEFINE switch epoll_pwait to COMPAT_SYSCALL_DEFINE convert sendfile{,64} to COMPAT_SYSCALL_DEFINE switch signalfd{,4}() to COMPAT_SYSCALL_DEFINE make SYSCALL_DEFINE<n>-generated wrappers do asmlinkage_protect make HAVE_SYSCALL_WRAPPERS unconditional consolidate cond_syscall and SYSCALL_ALIAS declarations teach SYSCALL_DEFINE<n> how to deal with long long/unsigned long long get rid of duplicate logics in __SC_....[1-6] definitions
-rw-r--r--arch/Kconfig3
-rw-r--r--arch/alpha/Kconfig1
-rw-r--r--arch/alpha/include/asm/linkage.h4
-rw-r--r--arch/alpha/include/asm/unistd.h12
-rw-r--r--arch/arm/include/asm/unistd.h8
-rw-r--r--arch/arm64/kernel/sys32.S7
-rw-r--r--arch/avr32/include/asm/unistd.h8
-rw-r--r--arch/blackfin/include/asm/unistd.h8
-rw-r--r--arch/cris/include/asm/unistd.h8
-rw-r--r--arch/frv/include/asm/unistd.h10
-rw-r--r--arch/h8300/include/asm/linkage.h2
-rw-r--r--arch/h8300/include/asm/unistd.h7
-rw-r--r--arch/ia64/include/asm/linkage.h4
-rw-r--r--arch/ia64/include/asm/unistd.h10
-rw-r--r--arch/m32r/include/asm/unistd.h10
-rw-r--r--arch/m68k/include/asm/unistd.h8
-rw-r--r--arch/microblaze/include/asm/unistd.h8
-rw-r--r--arch/mips/Kconfig1
-rw-r--r--arch/mips/include/asm/linkage.h3
-rw-r--r--arch/mips/include/asm/unistd.h8
-rw-r--r--arch/mips/kernel/linux32.c119
-rw-r--r--arch/mips/kernel/scall64-n32.S8
-rw-r--r--arch/mips/kernel/scall64-o32.S6
-rw-r--r--arch/mn10300/include/asm/unistd.h10
-rw-r--r--arch/parisc/include/asm/unistd.h8
-rw-r--r--arch/parisc/kernel/sys_parisc32.c41
-rw-r--r--arch/parisc/kernel/syscall_table.S8
-rw-r--r--arch/powerpc/Kconfig1
-rw-r--r--arch/powerpc/include/asm/linkage.h13
-rw-r--r--arch/powerpc/include/asm/systbl.h10
-rw-r--r--arch/powerpc/include/asm/unistd.h6
-rw-r--r--arch/powerpc/include/uapi/asm/linkage.h6
-rw-r--r--arch/powerpc/kernel/sys_ppc32.c109
-rw-r--r--arch/s390/Kconfig1
-rw-r--r--arch/s390/include/asm/unistd.h8
-rw-r--r--arch/s390/kernel/compat_linux.c86
-rw-r--r--arch/s390/kernel/compat_linux.h5
-rw-r--r--arch/s390/kernel/compat_wrapper.S64
-rw-r--r--arch/s390/kernel/sys_s390.c14
-rw-r--r--arch/s390/kernel/syscalls.S18
-rw-r--r--arch/sh/include/asm/unistd.h8
-rw-r--r--arch/sparc/Kconfig1
-rw-r--r--arch/sparc/include/asm/unistd.h8
-rw-r--r--arch/sparc/kernel/sys32.S4
-rw-r--r--arch/sparc/kernel/sys_sparc32.c75
-rw-r--r--arch/sparc/kernel/sys_sparc_64.c6
-rw-r--r--arch/sparc/kernel/systbls_64.S8
-rw-r--r--arch/tile/Kconfig1
-rw-r--r--arch/tile/kernel/compat.c6
-rw-r--r--arch/x86/ia32/Makefile3
-rw-r--r--arch/x86/ia32/ipc32.c54
-rw-r--r--arch/x86/ia32/sys_ia32.c37
-rw-r--r--arch/x86/include/asm/sys_ia32.h12
-rw-r--r--arch/x86/include/asm/syscalls.h4
-rw-r--r--arch/x86/include/asm/unistd.h8
-rw-r--r--arch/x86/kernel/tls.c14
-rw-r--r--arch/x86/syscalls/syscall_32.tbl10
-rw-r--r--arch/x86/um/tls_32.c5
-rw-r--r--arch/xtensa/include/asm/unistd.h8
-rw-r--r--fs/aio.c2
-rw-r--r--fs/compat.c121
-rw-r--r--fs/dcookies.c15
-rw-r--r--fs/eventpoll.c47
-rw-r--r--fs/notify/fanotify/fanotify_user.c17
-rw-r--r--fs/open.c52
-rw-r--r--fs/read_write.c68
-rw-r--r--fs/read_write.h2
-rw-r--r--fs/signalfd.c31
-rw-r--r--fs/splice.c22
-rw-r--r--fs/sync.c26
-rw-r--r--include/asm-generic/unistd.h17
-rw-r--r--include/linux/compat.h51
-rw-r--r--include/linux/linkage.h21
-rw-r--r--include/linux/mm.h3
-rw-r--r--include/linux/syscalls.h156
-rw-r--r--ipc/compat.c174
-rw-r--r--ipc/sem.c123
-rw-r--r--ipc/syscall.c6
-rw-r--r--kernel/compat.c19
-rw-r--r--kernel/exit.c5
-rw-r--r--kernel/fork.c5
-rw-r--r--kernel/sys.c14
-rw-r--r--kernel/sys_ni.c3
-rw-r--r--kernel/uid16.c55
-rw-r--r--mm/fadvise.c18
-rw-r--r--mm/nommu.c3
-rw-r--r--mm/readahead.c9
87 files changed, 539 insertions, 1489 deletions
diff --git a/arch/Kconfig b/arch/Kconfig
index 1455579791ec..99f0e17df429 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -157,9 +157,6 @@ config ARCH_USE_BUILTIN_BSWAP
157 instructions should set this. And it shouldn't hurt to set it 157 instructions should set this. And it shouldn't hurt to set it
158 on architectures that don't have such instructions. 158 on architectures that don't have such instructions.
159 159
160config HAVE_SYSCALL_WRAPPERS
161 bool
162
163config KRETPROBES 160config KRETPROBES
164 def_bool y 161 def_bool y
165 depends on KPROBES && HAVE_KRETPROBES 162 depends on KPROBES && HAVE_KRETPROBES
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 8a33ba01301f..8629127640cf 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -4,7 +4,6 @@ config ALPHA
4 select HAVE_AOUT 4 select HAVE_AOUT
5 select HAVE_IDE 5 select HAVE_IDE
6 select HAVE_OPROFILE 6 select HAVE_OPROFILE
7 select HAVE_SYSCALL_WRAPPERS
8 select HAVE_PCSPKR_PLATFORM 7 select HAVE_PCSPKR_PLATFORM
9 select HAVE_PERF_EVENTS 8 select HAVE_PERF_EVENTS
10 select HAVE_DMA_ATTRS 9 select HAVE_DMA_ATTRS
diff --git a/arch/alpha/include/asm/linkage.h b/arch/alpha/include/asm/linkage.h
index 291c2d01c44f..7cfd06e8c935 100644
--- a/arch/alpha/include/asm/linkage.h
+++ b/arch/alpha/include/asm/linkage.h
@@ -1,6 +1,8 @@
1#ifndef __ASM_LINKAGE_H 1#ifndef __ASM_LINKAGE_H
2#define __ASM_LINKAGE_H 2#define __ASM_LINKAGE_H
3 3
4/* Nothing to see here... */ 4#define cond_syscall(x) asm(".weak\t" #x "\n" #x " = sys_ni_syscall")
5#define SYSCALL_ALIAS(alias, name) \
6 asm ( #alias " = " #name "\n\t.globl " #alias)
5 7
6#endif 8#endif
diff --git a/arch/alpha/include/asm/unistd.h b/arch/alpha/include/asm/unistd.h
index 6d6fe7ab5473..43baee17acdf 100644
--- a/arch/alpha/include/asm/unistd.h
+++ b/arch/alpha/include/asm/unistd.h
@@ -18,16 +18,4 @@
18#define __ARCH_WANT_SYS_VFORK 18#define __ARCH_WANT_SYS_VFORK
19#define __ARCH_WANT_SYS_CLONE 19#define __ARCH_WANT_SYS_CLONE
20 20
21/* "Conditional" syscalls. What we want is
22
23 __attribute__((weak,alias("sys_ni_syscall")))
24
25 but that raises the problem of what type to give the symbol. If we use
26 a prototype, it'll conflict with the definition given in this file and
27 others. If we use __typeof, we discover that not all symbols actually
28 have declarations. If we use no prototype, then we get warnings from
29 -Wstrict-prototypes. Ho hum. */
30
31#define cond_syscall(x) asm(".weak\t" #x "\n" #x " = sys_ni_syscall")
32
33#endif /* _ALPHA_UNISTD_H */ 21#endif /* _ALPHA_UNISTD_H */
diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h
index e4ddfb39ca34..141baa3f9a72 100644
--- a/arch/arm/include/asm/unistd.h
+++ b/arch/arm/include/asm/unistd.h
@@ -44,14 +44,6 @@
44#define __ARCH_WANT_SYS_CLONE 44#define __ARCH_WANT_SYS_CLONE
45 45
46/* 46/*
47 * "Conditional" syscalls
48 *
49 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
50 * but it doesn't work on all toolchains, so we just do it by hand
51 */
52#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
53
54/*
55 * Unimplemented (or alternatively implemented) syscalls 47 * Unimplemented (or alternatively implemented) syscalls
56 */ 48 */
57#define __IGNORE_fadvise64_64 49#define __IGNORE_fadvise64_64
diff --git a/arch/arm64/kernel/sys32.S b/arch/arm64/kernel/sys32.S
index 9416d045a687..db01aa978c41 100644
--- a/arch/arm64/kernel/sys32.S
+++ b/arch/arm64/kernel/sys32.S
@@ -84,13 +84,6 @@ compat_sys_readahead_wrapper:
84 b sys_readahead 84 b sys_readahead
85ENDPROC(compat_sys_readahead_wrapper) 85ENDPROC(compat_sys_readahead_wrapper)
86 86
87compat_sys_lookup_dcookie:
88 orr x0, x0, x1, lsl #32
89 mov w1, w2
90 mov w2, w3
91 b sys_lookup_dcookie
92ENDPROC(compat_sys_lookup_dcookie)
93
94compat_sys_fadvise64_64_wrapper: 87compat_sys_fadvise64_64_wrapper:
95 mov w6, w1 88 mov w6, w1
96 orr x1, x2, x3, lsl #32 89 orr x1, x2, x3, lsl #32
diff --git a/arch/avr32/include/asm/unistd.h b/arch/avr32/include/asm/unistd.h
index dc4d5a931112..c1eb080e45fe 100644
--- a/arch/avr32/include/asm/unistd.h
+++ b/arch/avr32/include/asm/unistd.h
@@ -41,12 +41,4 @@
41#define __ARCH_WANT_SYS_VFORK 41#define __ARCH_WANT_SYS_VFORK
42#define __ARCH_WANT_SYS_CLONE 42#define __ARCH_WANT_SYS_CLONE
43 43
44/*
45 * "Conditional" syscalls
46 *
47 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
48 * but it doesn't work on all toolchains, so we just do it by hand
49 */
50#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall");
51
52#endif /* __ASM_AVR32_UNISTD_H */ 44#endif /* __ASM_AVR32_UNISTD_H */
diff --git a/arch/blackfin/include/asm/unistd.h b/arch/blackfin/include/asm/unistd.h
index 04e83ea8d5cc..c35414bdf7bd 100644
--- a/arch/blackfin/include/asm/unistd.h
+++ b/arch/blackfin/include/asm/unistd.h
@@ -20,12 +20,4 @@
20#define __ARCH_WANT_SYS_NICE 20#define __ARCH_WANT_SYS_NICE
21#define __ARCH_WANT_SYS_VFORK 21#define __ARCH_WANT_SYS_VFORK
22 22
23/*
24 * "Conditional" syscalls
25 *
26 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
27 * but it doesn't work on all toolchains, so we just do it by hand
28 */
29#define cond_syscall(x) asm(".weak\t_" #x "\n\t.set\t_" #x ",_sys_ni_syscall");
30
31#endif /* __ASM_BFIN_UNISTD_H */ 23#endif /* __ASM_BFIN_UNISTD_H */
diff --git a/arch/cris/include/asm/unistd.h b/arch/cris/include/asm/unistd.h
index be57a988bfb9..0ff3f6889842 100644
--- a/arch/cris/include/asm/unistd.h
+++ b/arch/cris/include/asm/unistd.h
@@ -34,12 +34,4 @@
34#define __ARCH_WANT_SYS_VFORK 34#define __ARCH_WANT_SYS_VFORK
35#define __ARCH_WANT_SYS_CLONE 35#define __ARCH_WANT_SYS_CLONE
36 36
37/*
38 * "Conditional" syscalls
39 *
40 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
41 * but it doesn't work on all toolchains, so we just do it by hand
42 */
43#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
44
45#endif /* _ASM_CRIS_UNISTD_H_ */ 37#endif /* _ASM_CRIS_UNISTD_H_ */
diff --git a/arch/frv/include/asm/unistd.h b/arch/frv/include/asm/unistd.h
index 4cfcc7bba25a..70ec7293dce7 100644
--- a/arch/frv/include/asm/unistd.h
+++ b/arch/frv/include/asm/unistd.h
@@ -31,14 +31,4 @@
31#define __ARCH_WANT_SYS_VFORK 31#define __ARCH_WANT_SYS_VFORK
32#define __ARCH_WANT_SYS_CLONE 32#define __ARCH_WANT_SYS_CLONE
33 33
34/*
35 * "Conditional" syscalls
36 *
37 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
38 * but it doesn't work on all toolchains, so we just do it by hand
39 */
40#ifndef cond_syscall
41#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
42#endif
43
44#endif /* _ASM_UNISTD_H_ */ 34#endif /* _ASM_UNISTD_H_ */
diff --git a/arch/h8300/include/asm/linkage.h b/arch/h8300/include/asm/linkage.h
index 6f4df7d46180..1d81604fb0ad 100644
--- a/arch/h8300/include/asm/linkage.h
+++ b/arch/h8300/include/asm/linkage.h
@@ -2,7 +2,5 @@
2#define _H8300_LINKAGE_H 2#define _H8300_LINKAGE_H
3 3
4#undef SYMBOL_NAME_LABEL 4#undef SYMBOL_NAME_LABEL
5#undef SYMBOL_NAME
6#define SYMBOL_NAME_LABEL(_name_) _##_name_##: 5#define SYMBOL_NAME_LABEL(_name_) _##_name_##:
7#define SYMBOL_NAME(_name_) _##_name_
8#endif 6#endif
diff --git a/arch/h8300/include/asm/unistd.h b/arch/h8300/include/asm/unistd.h
index 6721856d841b..ab671ecf5196 100644
--- a/arch/h8300/include/asm/unistd.h
+++ b/arch/h8300/include/asm/unistd.h
@@ -33,11 +33,4 @@
33#define __ARCH_WANT_SYS_VFORK 33#define __ARCH_WANT_SYS_VFORK
34#define __ARCH_WANT_SYS_CLONE 34#define __ARCH_WANT_SYS_CLONE
35 35
36/*
37 * "Conditional" syscalls
38 */
39#define cond_syscall(name) \
40 asm (".weak\t_" #name "\n" \
41 ".set\t_" #name ",_sys_ni_syscall");
42
43#endif /* _ASM_H8300_UNISTD_H_ */ 36#endif /* _ASM_H8300_UNISTD_H_ */
diff --git a/arch/ia64/include/asm/linkage.h b/arch/ia64/include/asm/linkage.h
index ef22a45c1890..787575701f1c 100644
--- a/arch/ia64/include/asm/linkage.h
+++ b/arch/ia64/include/asm/linkage.h
@@ -11,4 +11,8 @@
11 11
12#endif 12#endif
13 13
14#define cond_syscall(x) asm(".weak\t" #x "#\n" #x "#\t=\tsys_ni_syscall#")
15#define SYSCALL_ALIAS(alias, name) \
16 asm ( #alias "# = " #name "#\n\t.globl " #alias "#")
17
14#endif 18#endif
diff --git a/arch/ia64/include/asm/unistd.h b/arch/ia64/include/asm/unistd.h
index 096373800f73..afd45e0d552e 100644
--- a/arch/ia64/include/asm/unistd.h
+++ b/arch/ia64/include/asm/unistd.h
@@ -46,15 +46,5 @@ asmlinkage unsigned long sys_mmap2(
46struct pt_regs; 46struct pt_regs;
47asmlinkage long sys_ia64_pipe(void); 47asmlinkage long sys_ia64_pipe(void);
48 48
49/*
50 * "Conditional" syscalls
51 *
52 * Note, this macro can only be used in the file which defines sys_ni_syscall, i.e., in
53 * kernel/sys_ni.c. This version causes warnings because the declaration isn't a
54 * proper prototype, but we can't use __typeof__ either, because not all cond_syscall()
55 * declarations have prototypes at the moment.
56 */
57#define cond_syscall(x) asmlinkage long x (void) __attribute__((weak,alias("sys_ni_syscall")))
58
59#endif /* !__ASSEMBLY__ */ 49#endif /* !__ASSEMBLY__ */
60#endif /* _ASM_IA64_UNISTD_H */ 50#endif /* _ASM_IA64_UNISTD_H */
diff --git a/arch/m32r/include/asm/unistd.h b/arch/m32r/include/asm/unistd.h
index 555629b05267..59db80193454 100644
--- a/arch/m32r/include/asm/unistd.h
+++ b/arch/m32r/include/asm/unistd.h
@@ -48,14 +48,4 @@
48#define __IGNORE_getresgid 48#define __IGNORE_getresgid
49#define __IGNORE_chown 49#define __IGNORE_chown
50 50
51/*
52 * "Conditional" syscalls
53 *
54 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
55 * but it doesn't work on all toolchains, so we just do it by hand
56 */
57#ifndef cond_syscall
58#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
59#endif
60
61#endif /* _ASM_M32R_UNISTD_H */ 51#endif /* _ASM_M32R_UNISTD_H */
diff --git a/arch/m68k/include/asm/unistd.h b/arch/m68k/include/asm/unistd.h
index 6cd92671ca5e..014f288fc813 100644
--- a/arch/m68k/include/asm/unistd.h
+++ b/arch/m68k/include/asm/unistd.h
@@ -32,12 +32,4 @@
32#define __ARCH_WANT_SYS_FORK 32#define __ARCH_WANT_SYS_FORK
33#define __ARCH_WANT_SYS_VFORK 33#define __ARCH_WANT_SYS_VFORK
34 34
35/*
36 * "Conditional" syscalls
37 *
38 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
39 * but it doesn't work on all toolchains, so we just do it by hand
40 */
41#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
42
43#endif /* _ASM_M68K_UNISTD_H_ */ 35#endif /* _ASM_M68K_UNISTD_H_ */
diff --git a/arch/microblaze/include/asm/unistd.h b/arch/microblaze/include/asm/unistd.h
index b3778391d9cc..6dece2d002dc 100644
--- a/arch/microblaze/include/asm/unistd.h
+++ b/arch/microblaze/include/asm/unistd.h
@@ -37,13 +37,5 @@
37#define __ARCH_WANT_SYS_VFORK 37#define __ARCH_WANT_SYS_VFORK
38#define __ARCH_WANT_SYS_FORK 38#define __ARCH_WANT_SYS_FORK
39 39
40/*
41 * "Conditional" syscalls
42 *
43 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
44 * but it doesn't work on all toolchains, so we just do it by hand
45 */
46#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall");
47
48#endif /* __ASSEMBLY__ */ 40#endif /* __ASSEMBLY__ */
49#endif /* _ASM_MICROBLAZE_UNISTD_H */ 41#endif /* _ASM_MICROBLAZE_UNISTD_H */
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 007a917a980d..e5f3794744f1 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1739,7 +1739,6 @@ config 32BIT
1739config 64BIT 1739config 64BIT
1740 bool "64-bit kernel" 1740 bool "64-bit kernel"
1741 depends on CPU_SUPPORTS_64BIT_KERNEL && SYS_SUPPORTS_64BIT_KERNEL 1741 depends on CPU_SUPPORTS_64BIT_KERNEL && SYS_SUPPORTS_64BIT_KERNEL
1742 select HAVE_SYSCALL_WRAPPERS
1743 help 1742 help
1744 Select this option if you want to build a 64-bit kernel. 1743 Select this option if you want to build a 64-bit kernel.
1745 1744
diff --git a/arch/mips/include/asm/linkage.h b/arch/mips/include/asm/linkage.h
index e9a940d1b0c6..2767dda9e309 100644
--- a/arch/mips/include/asm/linkage.h
+++ b/arch/mips/include/asm/linkage.h
@@ -6,5 +6,8 @@
6#endif 6#endif
7 7
8#define __weak __attribute__((weak)) 8#define __weak __attribute__((weak))
9#define cond_syscall(x) asm(".weak\t" #x "\n" #x "\t=\tsys_ni_syscall")
10#define SYSCALL_ALIAS(alias, name) \
11 asm ( #alias " = " #name "\n\t.globl " #alias)
9 12
10#endif 13#endif
diff --git a/arch/mips/include/asm/unistd.h b/arch/mips/include/asm/unistd.h
index 64f661e32879..63c9c886173a 100644
--- a/arch/mips/include/asm/unistd.h
+++ b/arch/mips/include/asm/unistd.h
@@ -63,12 +63,4 @@
63 63
64#endif /* !__ASSEMBLY__ */ 64#endif /* !__ASSEMBLY__ */
65 65
66/*
67 * "Conditional" syscalls
68 *
69 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
70 * but it doesn't work on all toolchains, so we just do it by hand
71 */
72#define cond_syscall(x) asm(".weak\t" #x "\n" #x "\t=\tsys_ni_syscall")
73
74#endif /* _ASM_UNISTD_H */ 66#endif /* _ASM_UNISTD_H */
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index db9655f08892..d1d576b765f5 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -119,99 +119,6 @@ SYSCALL_DEFINE6(32_pwrite, unsigned int, fd, const char __user *, buf,
119 return sys_pwrite64(fd, buf, count, merge_64(a4, a5)); 119 return sys_pwrite64(fd, buf, count, merge_64(a4, a5));
120} 120}
121 121
122#ifdef CONFIG_SYSVIPC
123
124SYSCALL_DEFINE6(32_ipc, u32, call, long, first, long, second, long, third,
125 unsigned long, ptr, unsigned long, fifth)
126{
127 int version, err;
128
129 version = call >> 16; /* hack for backward compatibility */
130 call &= 0xffff;
131
132 switch (call) {
133 case SEMOP:
134 /* struct sembuf is the same on 32 and 64bit :)) */
135 err = sys_semtimedop(first, compat_ptr(ptr), second, NULL);
136 break;
137 case SEMTIMEDOP:
138 err = compat_sys_semtimedop(first, compat_ptr(ptr), second,
139 compat_ptr(fifth));
140 break;
141 case SEMGET:
142 err = sys_semget(first, second, third);
143 break;
144 case SEMCTL:
145 err = compat_sys_semctl(first, second, third, compat_ptr(ptr));
146 break;
147 case MSGSND:
148 err = compat_sys_msgsnd(first, second, third, compat_ptr(ptr));
149 break;
150 case MSGRCV:
151 err = compat_sys_msgrcv(first, second, fifth, third,
152 version, compat_ptr(ptr));
153 break;
154 case MSGGET:
155 err = sys_msgget((key_t) first, second);
156 break;
157 case MSGCTL:
158 err = compat_sys_msgctl(first, second, compat_ptr(ptr));
159 break;
160 case SHMAT:
161 err = compat_sys_shmat(first, second, third, version,
162 compat_ptr(ptr));
163 break;
164 case SHMDT:
165 err = sys_shmdt(compat_ptr(ptr));
166 break;
167 case SHMGET:
168 err = sys_shmget(first, (unsigned)second, third);
169 break;
170 case SHMCTL:
171 err = compat_sys_shmctl(first, second, compat_ptr(ptr));
172 break;
173 default:
174 err = -ENOSYS;
175 break;
176 }
177
178 return err;
179}
180
181#else
182
183SYSCALL_DEFINE6(32_ipc, u32, call, int, first, int, second, int, third,
184 u32, ptr, u32, fifth)
185{
186 return -ENOSYS;
187}
188
189#endif /* CONFIG_SYSVIPC */
190
191#ifdef CONFIG_MIPS32_N32
192SYSCALL_DEFINE4(n32_semctl, int, semid, int, semnum, int, cmd, u32, arg)
193{
194 /* compat_sys_semctl expects a pointer to union semun */
195 u32 __user *uptr = compat_alloc_user_space(sizeof(u32));
196 if (put_user(arg, uptr))
197 return -EFAULT;
198 return compat_sys_semctl(semid, semnum, cmd, uptr);
199}
200
201SYSCALL_DEFINE4(n32_msgsnd, int, msqid, u32, msgp, unsigned int, msgsz,
202 int, msgflg)
203{
204 return compat_sys_msgsnd(msqid, msgsz, msgflg, compat_ptr(msgp));
205}
206
207SYSCALL_DEFINE5(n32_msgrcv, int, msqid, u32, msgp, size_t, msgsz,
208 int, msgtyp, int, msgflg)
209{
210 return compat_sys_msgrcv(msqid, msgsz, msgtyp, msgflg, IPC_64,
211 compat_ptr(msgp));
212}
213#endif
214
215SYSCALL_DEFINE1(32_personality, unsigned long, personality) 122SYSCALL_DEFINE1(32_personality, unsigned long, personality)
216{ 123{
217 unsigned int p = personality & 0xffffffff; 124 unsigned int p = personality & 0xffffffff;
@@ -226,26 +133,6 @@ SYSCALL_DEFINE1(32_personality, unsigned long, personality)
226 return ret; 133 return ret;
227} 134}
228 135
229SYSCALL_DEFINE4(32_sendfile, long, out_fd, long, in_fd,
230 compat_off_t __user *, offset, s32, count)
231{
232 mm_segment_t old_fs = get_fs();
233 int ret;
234 off_t of;
235
236 if (offset && get_user(of, offset))
237 return -EFAULT;
238
239 set_fs(KERNEL_DS);
240 ret = sys_sendfile(out_fd, in_fd, offset ? (off_t __user *)&of : NULL, count);
241 set_fs(old_fs);
242
243 if (offset && put_user(of, offset))
244 return -EFAULT;
245
246 return ret;
247}
248
249asmlinkage ssize_t sys32_readahead(int fd, u32 pad0, u64 a2, u64 a3, 136asmlinkage ssize_t sys32_readahead(int fd, u32 pad0, u64 a2, u64 a3,
250 size_t count) 137 size_t count)
251{ 138{
@@ -279,12 +166,6 @@ asmlinkage long sys32_fallocate(int fd, int mode, unsigned offset_a2,
279 merge_64(len_a4, len_a5)); 166 merge_64(len_a4, len_a5));
280} 167}
281 168
282asmlinkage long sys32_lookup_dcookie(u32 a0, u32 a1, char __user *buf,
283 size_t len)
284{
285 return sys_lookup_dcookie(merge_64(a0, a1), buf, len);
286}
287
288SYSCALL_DEFINE6(32_fanotify_mark, int, fanotify_fd, unsigned int, flags, 169SYSCALL_DEFINE6(32_fanotify_mark, int, fanotify_fd, unsigned int, flags,
289 u64, a3, u64, a4, int, dfd, const char __user *, pathname) 170 u64, a3, u64, a4, int, dfd, const char __user *, pathname)
290{ 171{
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index 693d60b0855f..edcb6594e7b5 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -143,7 +143,7 @@ EXPORT(sysn32_call_table)
143 PTR compat_sys_setitimer 143 PTR compat_sys_setitimer
144 PTR sys_alarm 144 PTR sys_alarm
145 PTR sys_getpid 145 PTR sys_getpid
146 PTR sys_32_sendfile 146 PTR compat_sys_sendfile
147 PTR sys_socket /* 6040 */ 147 PTR sys_socket /* 6040 */
148 PTR sys_connect 148 PTR sys_connect
149 PTR sys_accept 149 PTR sys_accept
@@ -168,11 +168,11 @@ EXPORT(sysn32_call_table)
168 PTR sys_newuname 168 PTR sys_newuname
169 PTR sys_semget 169 PTR sys_semget
170 PTR sys_semop 170 PTR sys_semop
171 PTR sys_n32_semctl 171 PTR compat_sys_semctl
172 PTR sys_shmdt /* 6065 */ 172 PTR sys_shmdt /* 6065 */
173 PTR sys_msgget 173 PTR sys_msgget
174 PTR sys_n32_msgsnd 174 PTR compat_sys_msgsnd
175 PTR sys_n32_msgrcv 175 PTR compat_sys_msgrcv
176 PTR compat_sys_msgctl 176 PTR compat_sys_msgctl
177 PTR compat_sys_fcntl /* 6070 */ 177 PTR compat_sys_fcntl /* 6070 */
178 PTR sys_flock 178 PTR sys_flock
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index af8887f779f1..103bfe570fe8 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -309,7 +309,7 @@ sys_call_table:
309 PTR compat_sys_wait4 309 PTR compat_sys_wait4
310 PTR sys_swapoff /* 4115 */ 310 PTR sys_swapoff /* 4115 */
311 PTR compat_sys_sysinfo 311 PTR compat_sys_sysinfo
312 PTR sys_32_ipc 312 PTR compat_sys_ipc
313 PTR sys_fsync 313 PTR sys_fsync
314 PTR sys32_sigreturn 314 PTR sys32_sigreturn
315 PTR __sys_clone /* 4120 */ 315 PTR __sys_clone /* 4120 */
@@ -399,7 +399,7 @@ sys_call_table:
399 PTR sys_capget 399 PTR sys_capget
400 PTR sys_capset /* 4205 */ 400 PTR sys_capset /* 4205 */
401 PTR compat_sys_sigaltstack 401 PTR compat_sys_sigaltstack
402 PTR sys_32_sendfile 402 PTR compat_sys_sendfile
403 PTR sys_ni_syscall 403 PTR sys_ni_syscall
404 PTR sys_ni_syscall 404 PTR sys_ni_syscall
405 PTR sys_mips_mmap2 /* 4210 */ 405 PTR sys_mips_mmap2 /* 4210 */
@@ -439,7 +439,7 @@ sys_call_table:
439 PTR compat_sys_io_submit 439 PTR compat_sys_io_submit
440 PTR sys_io_cancel /* 4245 */ 440 PTR sys_io_cancel /* 4245 */
441 PTR sys_exit_group 441 PTR sys_exit_group
442 PTR sys32_lookup_dcookie 442 PTR compat_sys_lookup_dcookie
443 PTR sys_epoll_create 443 PTR sys_epoll_create
444 PTR sys_epoll_ctl 444 PTR sys_epoll_ctl
445 PTR sys_epoll_wait /* 4250 */ 445 PTR sys_epoll_wait /* 4250 */
diff --git a/arch/mn10300/include/asm/unistd.h b/arch/mn10300/include/asm/unistd.h
index 7f9d9adfa51e..9d4e2d1ef90e 100644
--- a/arch/mn10300/include/asm/unistd.h
+++ b/arch/mn10300/include/asm/unistd.h
@@ -45,14 +45,4 @@
45#define __ARCH_WANT_SYS_VFORK 45#define __ARCH_WANT_SYS_VFORK
46#define __ARCH_WANT_SYS_CLONE 46#define __ARCH_WANT_SYS_CLONE
47 47
48/*
49 * "Conditional" syscalls
50 *
51 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
52 * but it doesn't work on all toolchains, so we just do it by hand
53 */
54#ifndef cond_syscall
55#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall");
56#endif
57
58#endif /* _ASM_UNISTD_H */ 48#endif /* _ASM_UNISTD_H */
diff --git a/arch/parisc/include/asm/unistd.h b/arch/parisc/include/asm/unistd.h
index ae9a46cbfd92..74d835820ee7 100644
--- a/arch/parisc/include/asm/unistd.h
+++ b/arch/parisc/include/asm/unistd.h
@@ -170,12 +170,4 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \
170 170
171#undef STR 171#undef STR
172 172
173/*
174 * "Conditional" syscalls
175 *
176 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
177 * but it doesn't work on all toolchains, so we just do it by hand
178 */
179#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
180
181#endif /* _ASM_PARISC_UNISTD_H_ */ 173#endif /* _ASM_PARISC_UNISTD_H_ */
diff --git a/arch/parisc/kernel/sys_parisc32.c b/arch/parisc/kernel/sys_parisc32.c
index 051c8b90231f..f517e08e7f0d 100644
--- a/arch/parisc/kernel/sys_parisc32.c
+++ b/arch/parisc/kernel/sys_parisc32.c
@@ -60,47 +60,6 @@ asmlinkage long sys32_unimplemented(int r26, int r25, int r24, int r23,
60 return -ENOSYS; 60 return -ENOSYS;
61} 61}
62 62
63/* Note: it is necessary to treat out_fd and in_fd as unsigned ints, with the
64 * corresponding cast to a signed int to insure that the proper conversion
65 * (sign extension) between the register representation of a signed int (msr in
66 * 32-bit mode) and the register representation of a signed int (msr in 64-bit
67 * mode) is performed.
68 */
69asmlinkage long sys32_sendfile(u32 out_fd, u32 in_fd,
70 compat_off_t __user *offset, compat_size_t count)
71{
72 return compat_sys_sendfile((int)out_fd, (int)in_fd, offset, count);
73}
74
75asmlinkage long sys32_sendfile64(u32 out_fd, u32 in_fd,
76 compat_loff_t __user *offset, compat_size_t count)
77{
78 return sys_sendfile64((int)out_fd, (int)in_fd,
79 (loff_t __user *)offset, count);
80}
81
82asmlinkage long sys32_semctl(int semid, int semnum, int cmd, union semun arg)
83{
84 union semun u;
85
86 if (cmd == SETVAL) {
87 /* Ugh. arg is a union of int,ptr,ptr,ptr, so is 8 bytes.
88 * The int should be in the first 4, but our argument
89 * frobbing has left it in the last 4.
90 */
91 u.val = *((int *)&arg + 1);
92 return sys_semctl (semid, semnum, cmd, u);
93 }
94 return sys_semctl (semid, semnum, cmd, arg);
95}
96
97long sys32_lookup_dcookie(u32 cookie_high, u32 cookie_low, char __user *buf,
98 size_t len)
99{
100 return sys_lookup_dcookie((u64)cookie_high << 32 | cookie_low,
101 buf, len);
102}
103
104asmlinkage long compat_sys_fanotify_mark(int fan_fd, int flags, u32 mask_hi, 63asmlinkage long compat_sys_fanotify_mark(int fan_fd, int flags, u32 mask_hi,
105 u32 mask_lo, int fd, 64 u32 mask_lo, int fd,
106 const char __user *pathname) 65 const char __user *pathname)
diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S
index f57dc137b8dd..0c9107285e66 100644
--- a/arch/parisc/kernel/syscall_table.S
+++ b/arch/parisc/kernel/syscall_table.S
@@ -198,7 +198,7 @@
198 ENTRY_SAME(madvise) 198 ENTRY_SAME(madvise)
199 ENTRY_SAME(clone_wrapper) /* 120 */ 199 ENTRY_SAME(clone_wrapper) /* 120 */
200 ENTRY_SAME(setdomainname) 200 ENTRY_SAME(setdomainname)
201 ENTRY_DIFF(sendfile) 201 ENTRY_COMP(sendfile)
202 /* struct sockaddr... */ 202 /* struct sockaddr... */
203 ENTRY_SAME(recvfrom) 203 ENTRY_SAME(recvfrom)
204 /* struct timex contains longs */ 204 /* struct timex contains longs */
@@ -282,7 +282,7 @@
282 ENTRY_COMP(recvmsg) 282 ENTRY_COMP(recvmsg)
283 ENTRY_SAME(semop) /* 185 */ 283 ENTRY_SAME(semop) /* 185 */
284 ENTRY_SAME(semget) 284 ENTRY_SAME(semget)
285 ENTRY_DIFF(semctl) 285 ENTRY_COMP(semctl)
286 ENTRY_COMP(msgsnd) 286 ENTRY_COMP(msgsnd)
287 ENTRY_COMP(msgrcv) 287 ENTRY_COMP(msgrcv)
288 ENTRY_SAME(msgget) /* 190 */ 288 ENTRY_SAME(msgget) /* 190 */
@@ -304,7 +304,7 @@
304 ENTRY_SAME(gettid) 304 ENTRY_SAME(gettid)
305 ENTRY_OURS(readahead) 305 ENTRY_OURS(readahead)
306 ENTRY_SAME(tkill) 306 ENTRY_SAME(tkill)
307 ENTRY_DIFF(sendfile64) 307 ENTRY_COMP(sendfile64)
308 ENTRY_COMP(futex) /* 210 */ 308 ENTRY_COMP(futex) /* 210 */
309 ENTRY_COMP(sched_setaffinity) 309 ENTRY_COMP(sched_setaffinity)
310 ENTRY_COMP(sched_getaffinity) 310 ENTRY_COMP(sched_getaffinity)
@@ -318,7 +318,7 @@
318 ENTRY_SAME(alloc_hugepages) /* 220 */ 318 ENTRY_SAME(alloc_hugepages) /* 220 */
319 ENTRY_SAME(free_hugepages) 319 ENTRY_SAME(free_hugepages)
320 ENTRY_SAME(exit_group) 320 ENTRY_SAME(exit_group)
321 ENTRY_DIFF(lookup_dcookie) 321 ENTRY_COMP(lookup_dcookie)
322 ENTRY_SAME(epoll_create) 322 ENTRY_SAME(epoll_create)
323 ENTRY_SAME(epoll_ctl) /* 225 */ 323 ENTRY_SAME(epoll_ctl) /* 225 */
324 ENTRY_SAME(epoll_wait) 324 ENTRY_SAME(epoll_wait)
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index ea5bb045983a..a0259edae5c9 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -114,7 +114,6 @@ config PPC
114 select USE_GENERIC_SMP_HELPERS if SMP 114 select USE_GENERIC_SMP_HELPERS if SMP
115 select HAVE_OPROFILE 115 select HAVE_OPROFILE
116 select HAVE_DEBUG_KMEMLEAK 116 select HAVE_DEBUG_KMEMLEAK
117 select HAVE_SYSCALL_WRAPPERS if PPC64
118 select GENERIC_ATOMIC64 if PPC32 117 select GENERIC_ATOMIC64 if PPC32
119 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE 118 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
120 select HAVE_PERF_EVENTS 119 select HAVE_PERF_EVENTS
diff --git a/arch/powerpc/include/asm/linkage.h b/arch/powerpc/include/asm/linkage.h
new file mode 100644
index 000000000000..b36f650a13ff
--- /dev/null
+++ b/arch/powerpc/include/asm/linkage.h
@@ -0,0 +1,13 @@
1#ifndef _ASM_POWERPC_LINKAGE_H
2#define _ASM_POWERPC_LINKAGE_H
3
4#ifdef CONFIG_PPC64
5#define cond_syscall(x) \
6 asm ("\t.weak " #x "\n\t.set " #x ", sys_ni_syscall\n" \
7 "\t.weak ." #x "\n\t.set ." #x ", .sys_ni_syscall\n")
8#define SYSCALL_ALIAS(alias, name) \
9 asm ("\t.globl " #alias "\n\t.set " #alias ", " #name "\n" \
10 "\t.globl ." #alias "\n\t.set ." #alias ", ." #name)
11#endif
12
13#endif /* _ASM_POWERPC_LINKAGE_H */
diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h
index ebbec52d21bd..43523fe0d8b4 100644
--- a/arch/powerpc/include/asm/systbl.h
+++ b/arch/powerpc/include/asm/systbl.h
@@ -190,7 +190,7 @@ SYSCALL_SPU(getcwd)
190SYSCALL_SPU(capget) 190SYSCALL_SPU(capget)
191SYSCALL_SPU(capset) 191SYSCALL_SPU(capset)
192COMPAT_SYS(sigaltstack) 192COMPAT_SYS(sigaltstack)
193SYSX_SPU(sys_sendfile,compat_sys_sendfile_wrapper,sys_sendfile) 193COMPAT_SYS_SPU(sendfile)
194SYSCALL(ni_syscall) 194SYSCALL(ni_syscall)
195SYSCALL(ni_syscall) 195SYSCALL(ni_syscall)
196PPC_SYS(vfork) 196PPC_SYS(vfork)
@@ -230,7 +230,7 @@ COMPAT_SYS_SPU(sched_setaffinity)
230COMPAT_SYS_SPU(sched_getaffinity) 230COMPAT_SYS_SPU(sched_getaffinity)
231SYSCALL(ni_syscall) 231SYSCALL(ni_syscall)
232SYSCALL(ni_syscall) 232SYSCALL(ni_syscall)
233SYSX(sys_ni_syscall,compat_sys_sendfile64_wrapper,sys_sendfile64) 233SYS32ONLY(sendfile64)
234COMPAT_SYS_SPU(io_setup) 234COMPAT_SYS_SPU(io_setup)
235SYSCALL_SPU(io_destroy) 235SYSCALL_SPU(io_destroy)
236COMPAT_SYS_SPU(io_getevents) 236COMPAT_SYS_SPU(io_getevents)
@@ -239,7 +239,7 @@ SYSCALL_SPU(io_cancel)
239SYSCALL(set_tid_address) 239SYSCALL(set_tid_address)
240SYSX_SPU(sys_fadvise64,ppc32_fadvise64,sys_fadvise64) 240SYSX_SPU(sys_fadvise64,ppc32_fadvise64,sys_fadvise64)
241SYSCALL(exit_group) 241SYSCALL(exit_group)
242SYSX(sys_lookup_dcookie,ppc32_lookup_dcookie,sys_lookup_dcookie) 242COMPAT_SYS(lookup_dcookie)
243SYSCALL_SPU(epoll_create) 243SYSCALL_SPU(epoll_create)
244SYSCALL_SPU(epoll_ctl) 244SYSCALL_SPU(epoll_ctl)
245SYSCALL_SPU(epoll_wait) 245SYSCALL_SPU(epoll_wait)
@@ -273,8 +273,8 @@ COMPAT_SYS(mq_timedreceive)
273COMPAT_SYS(mq_notify) 273COMPAT_SYS(mq_notify)
274COMPAT_SYS(mq_getsetattr) 274COMPAT_SYS(mq_getsetattr)
275COMPAT_SYS(kexec_load) 275COMPAT_SYS(kexec_load)
276COMPAT_SYS(add_key) 276SYSCALL(add_key)
277COMPAT_SYS(request_key) 277SYSCALL(request_key)
278COMPAT_SYS(keyctl) 278COMPAT_SYS(keyctl)
279COMPAT_SYS(waitid) 279COMPAT_SYS(waitid)
280SYSCALL(ioprio_set) 280SYSCALL(ioprio_set)
diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h
index 1487f0f12293..3ca819f541bf 100644
--- a/arch/powerpc/include/asm/unistd.h
+++ b/arch/powerpc/include/asm/unistd.h
@@ -56,11 +56,5 @@
56#define __ARCH_WANT_SYS_VFORK 56#define __ARCH_WANT_SYS_VFORK
57#define __ARCH_WANT_SYS_CLONE 57#define __ARCH_WANT_SYS_CLONE
58 58
59/*
60 * "Conditional" syscalls
61 */
62#define cond_syscall(x) \
63 asmlinkage long x (void) __attribute__((weak,alias("sys_ni_syscall")))
64
65#endif /* __ASSEMBLY__ */ 59#endif /* __ASSEMBLY__ */
66#endif /* _ASM_POWERPC_UNISTD_H_ */ 60#endif /* _ASM_POWERPC_UNISTD_H_ */
diff --git a/arch/powerpc/include/uapi/asm/linkage.h b/arch/powerpc/include/uapi/asm/linkage.h
deleted file mode 100644
index e1c4ac1cc4ba..000000000000
--- a/arch/powerpc/include/uapi/asm/linkage.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_POWERPC_LINKAGE_H
2#define _ASM_POWERPC_LINKAGE_H
3
4/* Nothing to see here... */
5
6#endif /* _ASM_POWERPC_LINKAGE_H */
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
index d0bafc0cdf06..cd6e19d263b3 100644
--- a/arch/powerpc/kernel/sys_ppc32.c
+++ b/arch/powerpc/kernel/sys_ppc32.c
@@ -61,91 +61,6 @@ asmlinkage long ppc32_select(u32 n, compat_ulong_t __user *inp,
61 return compat_sys_select((int)n, inp, outp, exp, compat_ptr(tvp_x)); 61 return compat_sys_select((int)n, inp, outp, exp, compat_ptr(tvp_x));
62} 62}
63 63
64#ifdef CONFIG_SYSVIPC
65long compat_sys_ipc(u32 call, u32 first, u32 second, u32 third, compat_uptr_t ptr,
66 u32 fifth)
67{
68 int version;
69
70 version = call >> 16; /* hack for backward compatibility */
71 call &= 0xffff;
72
73 switch (call) {
74
75 case SEMTIMEDOP:
76 if (fifth)
77 /* sign extend semid */
78 return compat_sys_semtimedop((int)first,
79 compat_ptr(ptr), second,
80 compat_ptr(fifth));
81 /* else fall through for normal semop() */
82 case SEMOP:
83 /* struct sembuf is the same on 32 and 64bit :)) */
84 /* sign extend semid */
85 return sys_semtimedop((int)first, compat_ptr(ptr), second,
86 NULL);
87 case SEMGET:
88 /* sign extend key, nsems */
89 return sys_semget((int)first, (int)second, third);
90 case SEMCTL:
91 /* sign extend semid, semnum */
92 return compat_sys_semctl((int)first, (int)second, third,
93 compat_ptr(ptr));
94
95 case MSGSND:
96 /* sign extend msqid */
97 return compat_sys_msgsnd((int)first, (int)second, third,
98 compat_ptr(ptr));
99 case MSGRCV:
100 /* sign extend msqid, msgtyp */
101 return compat_sys_msgrcv((int)first, second, (int)fifth,
102 third, version, compat_ptr(ptr));
103 case MSGGET:
104 /* sign extend key */
105 return sys_msgget((int)first, second);
106 case MSGCTL:
107 /* sign extend msqid */
108 return compat_sys_msgctl((int)first, second, compat_ptr(ptr));
109
110 case SHMAT:
111 /* sign extend shmid */
112 return compat_sys_shmat((int)first, second, third, version,
113 compat_ptr(ptr));
114 case SHMDT:
115 return sys_shmdt(compat_ptr(ptr));
116 case SHMGET:
117 /* sign extend key_t */
118 return sys_shmget((int)first, second, third);
119 case SHMCTL:
120 /* sign extend shmid */
121 return compat_sys_shmctl((int)first, second, compat_ptr(ptr));
122
123 default:
124 return -ENOSYS;
125 }
126
127 return -ENOSYS;
128}
129#endif
130
131/* Note: it is necessary to treat out_fd and in_fd as unsigned ints,
132 * with the corresponding cast to a signed int to insure that the
133 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
134 * and the register representation of a signed int (msr in 64-bit mode) is performed.
135 */
136asmlinkage long compat_sys_sendfile_wrapper(u32 out_fd, u32 in_fd,
137 compat_off_t __user *offset, u32 count)
138{
139 return compat_sys_sendfile((int)out_fd, (int)in_fd, offset, count);
140}
141
142asmlinkage long compat_sys_sendfile64_wrapper(u32 out_fd, u32 in_fd,
143 compat_loff_t __user *offset, u32 count)
144{
145 return sys_sendfile((int)out_fd, (int)in_fd,
146 (off_t __user *)offset, count);
147}
148
149unsigned long compat_sys_mmap2(unsigned long addr, size_t len, 64unsigned long compat_sys_mmap2(unsigned long addr, size_t len,
150 unsigned long prot, unsigned long flags, 65 unsigned long prot, unsigned long flags,
151 unsigned long fd, unsigned long pgoff) 66 unsigned long fd, unsigned long pgoff)
@@ -195,13 +110,6 @@ asmlinkage int compat_sys_ftruncate64(unsigned int fd, u32 reg4, unsigned long h
195 return sys_ftruncate(fd, (high << 32) | low); 110 return sys_ftruncate(fd, (high << 32) | low);
196} 111}
197 112
198long ppc32_lookup_dcookie(u32 cookie_high, u32 cookie_low, char __user *buf,
199 size_t len)
200{
201 return sys_lookup_dcookie((u64)cookie_high << 32 | cookie_low,
202 buf, len);
203}
204
205long 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,
206 size_t len, int advice) 114 size_t len, int advice)
207{ 115{
@@ -209,23 +117,6 @@ long ppc32_fadvise64(int fd, u32 unused, u32 offset_high, u32 offset_low,
209 advice); 117 advice);
210} 118}
211 119
212asmlinkage long compat_sys_add_key(const char __user *_type,
213 const char __user *_description,
214 const void __user *_payload,
215 u32 plen,
216 u32 ringid)
217{
218 return sys_add_key(_type, _description, _payload, plen, ringid);
219}
220
221asmlinkage long compat_sys_request_key(const char __user *_type,
222 const char __user *_description,
223 const char __user *_callout_info,
224 u32 destringid)
225{
226 return sys_request_key(_type, _description, _callout_info, destringid);
227}
228
229asmlinkage long compat_sys_sync_file_range2(int fd, unsigned int flags, 120asmlinkage long compat_sys_sync_file_range2(int fd, unsigned int flags,
230 unsigned offset_hi, unsigned offset_lo, 121 unsigned offset_hi, unsigned offset_lo,
231 unsigned nbytes_hi, unsigned nbytes_lo) 122 unsigned nbytes_hi, unsigned nbytes_lo)
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index ce640aff61a1..2c9789da0e24 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -132,7 +132,6 @@ config S390
132 select HAVE_PERF_EVENTS 132 select HAVE_PERF_EVENTS
133 select HAVE_REGS_AND_STACK_ACCESS_API 133 select HAVE_REGS_AND_STACK_ACCESS_API
134 select HAVE_SYSCALL_TRACEPOINTS 134 select HAVE_SYSCALL_TRACEPOINTS
135 select HAVE_SYSCALL_WRAPPERS
136 select HAVE_UID16 if 32BIT 135 select HAVE_UID16 if 32BIT
137 select HAVE_VIRT_CPU_ACCOUNTING 136 select HAVE_VIRT_CPU_ACCOUNTING
138 select VIRT_TO_BUS 137 select VIRT_TO_BUS
diff --git a/arch/s390/include/asm/unistd.h b/arch/s390/include/asm/unistd.h
index a6667a952969..651886353551 100644
--- a/arch/s390/include/asm/unistd.h
+++ b/arch/s390/include/asm/unistd.h
@@ -54,12 +54,4 @@
54#define __ARCH_WANT_SYS_VFORK 54#define __ARCH_WANT_SYS_VFORK
55#define __ARCH_WANT_SYS_CLONE 55#define __ARCH_WANT_SYS_CLONE
56 56
57/*
58 * "Conditional" syscalls
59 *
60 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
61 * but it doesn't work on all toolchains, so we just do it by hand
62 */
63#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
64
65#endif /* _ASM_S390_UNISTD_H_ */ 57#endif /* _ASM_S390_UNISTD_H_ */
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index 19f26de27fae..8b6e4f5288a2 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -288,51 +288,13 @@ asmlinkage long sys32_getegid16(void)
288 return high2lowgid(from_kgid_munged(current_user_ns(), current_egid())); 288 return high2lowgid(from_kgid_munged(current_user_ns(), current_egid()));
289} 289}
290 290
291/*
292 * sys32_ipc() is the de-multiplexer for the SysV IPC calls in 32bit emulation.
293 *
294 * This is really horribly ugly.
295 */
296#ifdef CONFIG_SYSVIPC 291#ifdef CONFIG_SYSVIPC
297asmlinkage long sys32_ipc(u32 call, int first, int second, int third, u32 ptr) 292COMPAT_SYSCALL_DEFINE5(s390_ipc, uint, call, int, first, unsigned long, second,
293 unsigned long, third, compat_uptr_t, ptr)
298{ 294{
299 if (call >> 16) /* hack for backward compatibility */ 295 if (call >> 16) /* hack for backward compatibility */
300 return -EINVAL; 296 return -EINVAL;
301 switch (call) { 297 return compat_sys_ipc(call, first, second, third, ptr, third);
302 case SEMTIMEDOP:
303 return compat_sys_semtimedop(first, compat_ptr(ptr),
304 second, compat_ptr(third));
305 case SEMOP:
306 /* struct sembuf is the same on 32 and 64bit :)) */
307 return sys_semtimedop(first, compat_ptr(ptr),
308 second, NULL);
309 case SEMGET:
310 return sys_semget(first, second, third);
311 case SEMCTL:
312 return compat_sys_semctl(first, second, third,
313 compat_ptr(ptr));
314 case MSGSND:
315 return compat_sys_msgsnd(first, second, third,
316 compat_ptr(ptr));
317 case MSGRCV:
318 return compat_sys_msgrcv(first, second, 0, third,
319 0, compat_ptr(ptr));
320 case MSGGET:
321 return sys_msgget((key_t) first, second);
322 case MSGCTL:
323 return compat_sys_msgctl(first, second, compat_ptr(ptr));
324 case SHMAT:
325 return compat_sys_shmat(first, second, third,
326 0, compat_ptr(ptr));
327 case SHMDT:
328 return sys_shmdt(compat_ptr(ptr));
329 case SHMGET:
330 return sys_shmget(first, (unsigned)second, third);
331 case SHMCTL:
332 return compat_sys_shmctl(first, second, compat_ptr(ptr));
333 }
334
335 return -ENOSYS;
336} 298}
337#endif 299#endif
338 300
@@ -373,48 +335,6 @@ asmlinkage compat_ssize_t sys32_readahead(int fd, u32 offhi, u32 offlo, s32 coun
373 return sys_readahead(fd, ((loff_t)AA(offhi) << 32) | AA(offlo), count); 335 return sys_readahead(fd, ((loff_t)AA(offhi) << 32) | AA(offlo), count);
374} 336}
375 337
376asmlinkage long sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, size_t count)
377{
378 mm_segment_t old_fs = get_fs();
379 int ret;
380 off_t of;
381
382 if (offset && get_user(of, offset))
383 return -EFAULT;
384
385 set_fs(KERNEL_DS);
386 ret = sys_sendfile(out_fd, in_fd,
387 offset ? (off_t __force __user *) &of : NULL, count);
388 set_fs(old_fs);
389
390 if (offset && put_user(of, offset))
391 return -EFAULT;
392
393 return ret;
394}
395
396asmlinkage long sys32_sendfile64(int out_fd, int in_fd,
397 compat_loff_t __user *offset, s32 count)
398{
399 mm_segment_t old_fs = get_fs();
400 int ret;
401 loff_t lof;
402
403 if (offset && get_user(lof, offset))
404 return -EFAULT;
405
406 set_fs(KERNEL_DS);
407 ret = sys_sendfile64(out_fd, in_fd,
408 offset ? (loff_t __force __user *) &lof : NULL,
409 count);
410 set_fs(old_fs);
411
412 if (offset && put_user(lof, offset))
413 return -EFAULT;
414
415 return ret;
416}
417
418struct stat64_emu31 { 338struct stat64_emu31 {
419 unsigned long long st_dev; 339 unsigned long long st_dev;
420 unsigned int __pad1; 340 unsigned int __pad1;
diff --git a/arch/s390/kernel/compat_linux.h b/arch/s390/kernel/compat_linux.h
index 00d92a5a6f6c..976518c0592a 100644
--- a/arch/s390/kernel/compat_linux.h
+++ b/arch/s390/kernel/compat_linux.h
@@ -94,7 +94,6 @@ long sys32_getuid16(void);
94long sys32_geteuid16(void); 94long sys32_geteuid16(void);
95long sys32_getgid16(void); 95long sys32_getgid16(void);
96long sys32_getegid16(void); 96long sys32_getegid16(void);
97long sys32_ipc(u32 call, int first, int second, int third, u32 ptr);
98long sys32_truncate64(const char __user * path, unsigned long high, 97long sys32_truncate64(const char __user * path, unsigned long high,
99 unsigned long low); 98 unsigned long low);
100long sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned long low); 99long sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned long low);
@@ -106,10 +105,6 @@ long sys32_pread64(unsigned int fd, char __user *ubuf, size_t count,
106long sys32_pwrite64(unsigned int fd, const char __user *ubuf, 105long sys32_pwrite64(unsigned int fd, const char __user *ubuf,
107 size_t count, u32 poshi, u32 poslo); 106 size_t count, u32 poshi, u32 poslo);
108compat_ssize_t sys32_readahead(int fd, u32 offhi, u32 offlo, s32 count); 107compat_ssize_t sys32_readahead(int fd, u32 offhi, u32 offlo, s32 count);
109long sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset,
110 size_t count);
111long sys32_sendfile64(int out_fd, int in_fd, compat_loff_t __user *offset,
112 s32 count);
113long sys32_stat64(const char __user * filename, struct stat64_emu31 __user * statbuf); 108long sys32_stat64(const char __user * filename, struct stat64_emu31 __user * statbuf);
114long sys32_lstat64(const char __user * filename, 109long sys32_lstat64(const char __user * filename,
115 struct stat64_emu31 __user * statbuf); 110 struct stat64_emu31 __user * statbuf);
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index 3c98c4dc5aca..17644c8e10e1 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -258,11 +258,6 @@ ENTRY(sys32_mmap2_wrapper)
258 llgtr %r2,%r2 # struct mmap_arg_struct_emu31 * 258 llgtr %r2,%r2 # struct mmap_arg_struct_emu31 *
259 jg sys32_mmap2 # branch to system call 259 jg sys32_mmap2 # branch to system call
260 260
261ENTRY(compat_sys_getrusage_wrapper)
262 lgfr %r2,%r2 # int
263 llgtr %r3,%r3 # struct rusage_emu31 *
264 jg compat_sys_getrusage # branch to system call
265
266ENTRY(compat_sys_gettimeofday_wrapper) 261ENTRY(compat_sys_gettimeofday_wrapper)
267 llgtr %r2,%r2 # struct timeval_emu31 * 262 llgtr %r2,%r2 # struct timeval_emu31 *
268 llgtr %r3,%r3 # struct timezone * 263 llgtr %r3,%r3 # struct timezone *
@@ -393,14 +388,6 @@ ENTRY(compat_sys_sysinfo_wrapper)
393 llgtr %r2,%r2 # struct sysinfo_emu31 * 388 llgtr %r2,%r2 # struct sysinfo_emu31 *
394 jg compat_sys_sysinfo # branch to system call 389 jg compat_sys_sysinfo # branch to system call
395 390
396ENTRY(sys32_ipc_wrapper)
397 llgfr %r2,%r2 # uint
398 lgfr %r3,%r3 # int
399 lgfr %r4,%r4 # int
400 lgfr %r5,%r5 # int
401 llgfr %r6,%r6 # u32
402 jg sys32_ipc # branch to system call
403
404ENTRY(sys32_fsync_wrapper) 391ENTRY(sys32_fsync_wrapper)
405 llgfr %r2,%r2 # unsigned int 392 llgfr %r2,%r2 # unsigned int
406 jg sys_fsync # branch to system call 393 jg sys_fsync # branch to system call
@@ -666,13 +653,6 @@ ENTRY(sys32_capset_wrapper)
666 llgtr %r3,%r3 # const cap_user_data_t 653 llgtr %r3,%r3 # const cap_user_data_t
667 jg sys_capset # branch to system call 654 jg sys_capset # branch to system call
668 655
669ENTRY(sys32_sendfile_wrapper)
670 lgfr %r2,%r2 # int
671 lgfr %r3,%r3 # int
672 llgtr %r4,%r4 # __kernel_off_emu31_t *
673 llgfr %r5,%r5 # size_t
674 jg sys32_sendfile # branch to system call
675
676#sys32_vfork_wrapper # done in vfork_glue 656#sys32_vfork_wrapper # done in vfork_glue
677 657
678ENTRY(sys32_truncate64_wrapper) 658ENTRY(sys32_truncate64_wrapper)
@@ -938,13 +918,6 @@ ENTRY(sys_epoll_wait_wrapper)
938 lgfr %r5,%r5 # int 918 lgfr %r5,%r5 # int
939 jg sys_epoll_wait # branch to system call 919 jg sys_epoll_wait # branch to system call
940 920
941ENTRY(sys32_lookup_dcookie_wrapper)
942 sllg %r2,%r2,32 # get high word of 64bit dcookie
943 or %r2,%r3 # get low word of 64bit dcookie
944 llgtr %r3,%r4 # char *
945 llgfr %r4,%r5 # size_t
946 jg sys_lookup_dcookie
947
948ENTRY(sys32_fadvise64_wrapper) 921ENTRY(sys32_fadvise64_wrapper)
949 lgfr %r2,%r2 # int 922 lgfr %r2,%r2 # int
950 sllg %r3,%r3,32 # get high word of 64bit loff_t 923 sllg %r3,%r3,32 # get high word of 64bit loff_t
@@ -1264,29 +1237,12 @@ ENTRY(sys_tee_wrapper)
1264 llgfr %r5,%r5 # unsigned int 1237 llgfr %r5,%r5 # unsigned int
1265 jg sys_tee 1238 jg sys_tee
1266 1239
1267ENTRY(compat_sys_vmsplice_wrapper)
1268 lgfr %r2,%r2 # int
1269 llgtr %r3,%r3 # compat_iovec *
1270 llgfr %r4,%r4 # unsigned int
1271 llgfr %r5,%r5 # unsigned int
1272 jg compat_sys_vmsplice
1273
1274ENTRY(sys_getcpu_wrapper) 1240ENTRY(sys_getcpu_wrapper)
1275 llgtr %r2,%r2 # unsigned * 1241 llgtr %r2,%r2 # unsigned *
1276 llgtr %r3,%r3 # unsigned * 1242 llgtr %r3,%r3 # unsigned *
1277 llgtr %r4,%r4 # struct getcpu_cache * 1243 llgtr %r4,%r4 # struct getcpu_cache *
1278 jg sys_getcpu 1244 jg sys_getcpu
1279 1245
1280ENTRY(compat_sys_epoll_pwait_wrapper)
1281 lgfr %r2,%r2 # int
1282 llgtr %r3,%r3 # struct compat_epoll_event *
1283 lgfr %r4,%r4 # int
1284 lgfr %r5,%r5 # int
1285 llgtr %r6,%r6 # compat_sigset_t *
1286 llgf %r0,164(%r15) # compat_size_t
1287 stg %r0,160(%r15)
1288 jg compat_sys_epoll_pwait
1289
1290ENTRY(compat_sys_utimes_wrapper) 1246ENTRY(compat_sys_utimes_wrapper)
1291 llgtr %r2,%r2 # char * 1247 llgtr %r2,%r2 # char *
1292 llgtr %r3,%r3 # struct compat_timeval * 1248 llgtr %r3,%r3 # struct compat_timeval *
@@ -1299,12 +1255,6 @@ ENTRY(compat_sys_utimensat_wrapper)
1299 lgfr %r5,%r5 # int 1255 lgfr %r5,%r5 # int
1300 jg compat_sys_utimensat 1256 jg compat_sys_utimensat
1301 1257
1302ENTRY(compat_sys_signalfd_wrapper)
1303 lgfr %r2,%r2 # int
1304 llgtr %r3,%r3 # compat_sigset_t *
1305 llgfr %r4,%r4 # compat_size_t
1306 jg compat_sys_signalfd
1307
1308ENTRY(sys_eventfd_wrapper) 1258ENTRY(sys_eventfd_wrapper)
1309 llgfr %r2,%r2 # unsigned int 1259 llgfr %r2,%r2 # unsigned int
1310 jg sys_eventfd 1260 jg sys_eventfd
@@ -1323,13 +1273,6 @@ ENTRY(sys_timerfd_create_wrapper)
1323 lgfr %r3,%r3 # int 1273 lgfr %r3,%r3 # int
1324 jg sys_timerfd_create 1274 jg sys_timerfd_create
1325 1275
1326ENTRY(compat_sys_signalfd4_wrapper)
1327 lgfr %r2,%r2 # int
1328 llgtr %r3,%r3 # compat_sigset_t *
1329 llgfr %r4,%r4 # compat_size_t
1330 lgfr %r5,%r5 # int
1331 jg compat_sys_signalfd4
1332
1333ENTRY(sys_eventfd2_wrapper) 1276ENTRY(sys_eventfd2_wrapper)
1334 llgfr %r2,%r2 # unsigned int 1277 llgfr %r2,%r2 # unsigned int
1335 lgfr %r3,%r3 # int 1278 lgfr %r3,%r3 # int
@@ -1361,13 +1304,6 @@ ENTRY(sys32_readahead_wrapper)
1361 lgfr %r5,%r5 # s32 1304 lgfr %r5,%r5 # s32
1362 jg sys32_readahead # branch to system call 1305 jg sys32_readahead # branch to system call
1363 1306
1364ENTRY(sys32_sendfile64_wrapper)
1365 lgfr %r2,%r2 # int
1366 lgfr %r3,%r3 # int
1367 llgtr %r4,%r4 # compat_loff_t *
1368 lgfr %r5,%r5 # s32
1369 jg sys32_sendfile64 # branch to system call
1370
1371ENTRY(sys_tkill_wrapper) 1307ENTRY(sys_tkill_wrapper)
1372 lgfr %r2,%r2 # pid_t 1308 lgfr %r2,%r2 # pid_t
1373 lgfr %r3,%r3 # int 1309 lgfr %r3,%r3 # int
diff --git a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c
index d0964d22adb5..23eb222c1658 100644
--- a/arch/s390/kernel/sys_s390.c
+++ b/arch/s390/kernel/sys_s390.c
@@ -132,19 +132,9 @@ SYSCALL_DEFINE1(s390_fadvise64_64, struct fadvise64_64_args __user *, args)
132 * to 132 * to
133 * %r2: fd, %r3: mode, %r4/%r5: offset, 96(%r15)-103(%r15): len 133 * %r2: fd, %r3: mode, %r4/%r5: offset, 96(%r15)-103(%r15): len
134 */ 134 */
135SYSCALL_DEFINE(s390_fallocate)(int fd, int mode, loff_t offset, 135SYSCALL_DEFINE5(s390_fallocate, int, fd, int, mode, loff_t, offset,
136 u32 len_high, u32 len_low) 136 u32, len_high, u32, len_low)
137{ 137{
138 return sys_fallocate(fd, mode, offset, ((u64)len_high << 32) | len_low); 138 return sys_fallocate(fd, mode, offset, ((u64)len_high << 32) | len_low);
139} 139}
140#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
141asmlinkage long SyS_s390_fallocate(long fd, long mode, loff_t offset,
142 long len_high, long len_low)
143{
144 return SYSC_s390_fallocate((int) fd, (int) mode, offset,
145 (u32) len_high, (u32) len_low);
146}
147SYSCALL_ALIAS(sys_s390_fallocate, SyS_s390_fallocate);
148#endif
149
150#endif 140#endif
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S
index 630b935d1284..d2baabed7148 100644
--- a/arch/s390/kernel/syscalls.S
+++ b/arch/s390/kernel/syscalls.S
@@ -85,7 +85,7 @@ SYSCALL(sys_sigpending,sys_sigpending,compat_sys_sigpending_wrapper)
85SYSCALL(sys_sethostname,sys_sethostname,sys32_sethostname_wrapper) 85SYSCALL(sys_sethostname,sys_sethostname,sys32_sethostname_wrapper)
86SYSCALL(sys_setrlimit,sys_setrlimit,compat_sys_setrlimit_wrapper) /* 75 */ 86SYSCALL(sys_setrlimit,sys_setrlimit,compat_sys_setrlimit_wrapper) /* 75 */
87SYSCALL(sys_old_getrlimit,sys_getrlimit,compat_sys_old_getrlimit_wrapper) 87SYSCALL(sys_old_getrlimit,sys_getrlimit,compat_sys_old_getrlimit_wrapper)
88SYSCALL(sys_getrusage,sys_getrusage,compat_sys_getrusage_wrapper) 88SYSCALL(sys_getrusage,sys_getrusage,compat_sys_getrusage)
89SYSCALL(sys_gettimeofday,sys_gettimeofday,compat_sys_gettimeofday_wrapper) 89SYSCALL(sys_gettimeofday,sys_gettimeofday,compat_sys_gettimeofday_wrapper)
90SYSCALL(sys_settimeofday,sys_settimeofday,compat_sys_settimeofday_wrapper) 90SYSCALL(sys_settimeofday,sys_settimeofday,compat_sys_settimeofday_wrapper)
91SYSCALL(sys_getgroups16,sys_ni_syscall,sys32_getgroups16_wrapper) /* 80 old getgroups16 syscall */ 91SYSCALL(sys_getgroups16,sys_ni_syscall,sys32_getgroups16_wrapper) /* 80 old getgroups16 syscall */
@@ -118,14 +118,14 @@ SYSCALL(sys_newstat,sys_newstat,compat_sys_newstat_wrapper)
118SYSCALL(sys_newlstat,sys_newlstat,compat_sys_newlstat_wrapper) 118SYSCALL(sys_newlstat,sys_newlstat,compat_sys_newlstat_wrapper)
119SYSCALL(sys_newfstat,sys_newfstat,compat_sys_newfstat_wrapper) 119SYSCALL(sys_newfstat,sys_newfstat,compat_sys_newfstat_wrapper)
120NI_SYSCALL /* old uname syscall */ 120NI_SYSCALL /* old uname syscall */
121SYSCALL(sys_lookup_dcookie,sys_lookup_dcookie,sys32_lookup_dcookie_wrapper) /* 110 */ 121SYSCALL(sys_lookup_dcookie,sys_lookup_dcookie,compat_sys_lookup_dcookie) /* 110 */
122SYSCALL(sys_vhangup,sys_vhangup,sys_vhangup) 122SYSCALL(sys_vhangup,sys_vhangup,sys_vhangup)
123NI_SYSCALL /* old "idle" system call */ 123NI_SYSCALL /* old "idle" system call */
124NI_SYSCALL /* vm86old for i386 */ 124NI_SYSCALL /* vm86old for i386 */
125SYSCALL(sys_wait4,sys_wait4,compat_sys_wait4) 125SYSCALL(sys_wait4,sys_wait4,compat_sys_wait4)
126SYSCALL(sys_swapoff,sys_swapoff,sys32_swapoff_wrapper) /* 115 */ 126SYSCALL(sys_swapoff,sys_swapoff,sys32_swapoff_wrapper) /* 115 */
127SYSCALL(sys_sysinfo,sys_sysinfo,compat_sys_sysinfo_wrapper) 127SYSCALL(sys_sysinfo,sys_sysinfo,compat_sys_sysinfo_wrapper)
128SYSCALL(sys_s390_ipc,sys_s390_ipc,sys32_ipc_wrapper) 128SYSCALL(sys_s390_ipc,sys_s390_ipc,compat_sys_s390_ipc)
129SYSCALL(sys_fsync,sys_fsync,sys32_fsync_wrapper) 129SYSCALL(sys_fsync,sys_fsync,sys32_fsync_wrapper)
130SYSCALL(sys_sigreturn,sys_sigreturn,sys32_sigreturn) 130SYSCALL(sys_sigreturn,sys_sigreturn,sys32_sigreturn)
131SYSCALL(sys_clone,sys_clone,sys_clone_wrapper) /* 120 */ 131SYSCALL(sys_clone,sys_clone,sys_clone_wrapper) /* 120 */
@@ -195,7 +195,7 @@ SYSCALL(sys_getcwd,sys_getcwd,sys32_getcwd_wrapper)
195SYSCALL(sys_capget,sys_capget,sys32_capget_wrapper) 195SYSCALL(sys_capget,sys_capget,sys32_capget_wrapper)
196SYSCALL(sys_capset,sys_capset,sys32_capset_wrapper) /* 185 */ 196SYSCALL(sys_capset,sys_capset,sys32_capset_wrapper) /* 185 */
197SYSCALL(sys_sigaltstack,sys_sigaltstack,compat_sys_sigaltstack) 197SYSCALL(sys_sigaltstack,sys_sigaltstack,compat_sys_sigaltstack)
198SYSCALL(sys_sendfile,sys_sendfile64,sys32_sendfile_wrapper) 198SYSCALL(sys_sendfile,sys_sendfile64,compat_sys_sendfile)
199NI_SYSCALL /* streams1 */ 199NI_SYSCALL /* streams1 */
200NI_SYSCALL /* streams2 */ 200NI_SYSCALL /* streams2 */
201SYSCALL(sys_vfork,sys_vfork,sys_vfork) /* 190 */ 201SYSCALL(sys_vfork,sys_vfork,sys_vfork) /* 190 */
@@ -231,7 +231,7 @@ SYSCALL(sys_madvise,sys_madvise,sys32_madvise_wrapper)
231SYSCALL(sys_getdents64,sys_getdents64,sys32_getdents64_wrapper) /* 220 */ 231SYSCALL(sys_getdents64,sys_getdents64,sys32_getdents64_wrapper) /* 220 */
232SYSCALL(sys_fcntl64,sys_ni_syscall,compat_sys_fcntl64_wrapper) 232SYSCALL(sys_fcntl64,sys_ni_syscall,compat_sys_fcntl64_wrapper)
233SYSCALL(sys_readahead,sys_readahead,sys32_readahead_wrapper) 233SYSCALL(sys_readahead,sys_readahead,sys32_readahead_wrapper)
234SYSCALL(sys_sendfile64,sys_ni_syscall,sys32_sendfile64_wrapper) 234SYSCALL(sys_sendfile64,sys_ni_syscall,compat_sys_sendfile64)
235SYSCALL(sys_setxattr,sys_setxattr,sys32_setxattr_wrapper) 235SYSCALL(sys_setxattr,sys_setxattr,sys32_setxattr_wrapper)
236SYSCALL(sys_lsetxattr,sys_lsetxattr,sys32_lsetxattr_wrapper) /* 225 */ 236SYSCALL(sys_lsetxattr,sys_lsetxattr,sys32_lsetxattr_wrapper) /* 225 */
237SYSCALL(sys_fsetxattr,sys_fsetxattr,sys32_fsetxattr_wrapper) 237SYSCALL(sys_fsetxattr,sys_fsetxattr,sys32_fsetxattr_wrapper)
@@ -317,20 +317,20 @@ SYSCALL(sys_get_robust_list,sys_get_robust_list,compat_sys_get_robust_list)
317SYSCALL(sys_splice,sys_splice,sys_splice_wrapper) 317SYSCALL(sys_splice,sys_splice,sys_splice_wrapper)
318SYSCALL(sys_sync_file_range,sys_sync_file_range,sys_sync_file_range_wrapper) 318SYSCALL(sys_sync_file_range,sys_sync_file_range,sys_sync_file_range_wrapper)
319SYSCALL(sys_tee,sys_tee,sys_tee_wrapper) 319SYSCALL(sys_tee,sys_tee,sys_tee_wrapper)
320SYSCALL(sys_vmsplice,sys_vmsplice,compat_sys_vmsplice_wrapper) 320SYSCALL(sys_vmsplice,sys_vmsplice,compat_sys_vmsplice)
321NI_SYSCALL /* 310 sys_move_pages */ 321NI_SYSCALL /* 310 sys_move_pages */
322SYSCALL(sys_getcpu,sys_getcpu,sys_getcpu_wrapper) 322SYSCALL(sys_getcpu,sys_getcpu,sys_getcpu_wrapper)
323SYSCALL(sys_epoll_pwait,sys_epoll_pwait,compat_sys_epoll_pwait_wrapper) 323SYSCALL(sys_epoll_pwait,sys_epoll_pwait,compat_sys_epoll_pwait)
324SYSCALL(sys_utimes,sys_utimes,compat_sys_utimes_wrapper) 324SYSCALL(sys_utimes,sys_utimes,compat_sys_utimes_wrapper)
325SYSCALL(sys_s390_fallocate,sys_fallocate,sys_fallocate_wrapper) 325SYSCALL(sys_s390_fallocate,sys_fallocate,sys_fallocate_wrapper)
326SYSCALL(sys_utimensat,sys_utimensat,compat_sys_utimensat_wrapper) /* 315 */ 326SYSCALL(sys_utimensat,sys_utimensat,compat_sys_utimensat_wrapper) /* 315 */
327SYSCALL(sys_signalfd,sys_signalfd,compat_sys_signalfd_wrapper) 327SYSCALL(sys_signalfd,sys_signalfd,compat_sys_signalfd)
328NI_SYSCALL /* 317 old sys_timer_fd */ 328NI_SYSCALL /* 317 old sys_timer_fd */
329SYSCALL(sys_eventfd,sys_eventfd,sys_eventfd_wrapper) 329SYSCALL(sys_eventfd,sys_eventfd,sys_eventfd_wrapper)
330SYSCALL(sys_timerfd_create,sys_timerfd_create,sys_timerfd_create_wrapper) 330SYSCALL(sys_timerfd_create,sys_timerfd_create,sys_timerfd_create_wrapper)
331SYSCALL(sys_timerfd_settime,sys_timerfd_settime,compat_sys_timerfd_settime) /* 320 */ 331SYSCALL(sys_timerfd_settime,sys_timerfd_settime,compat_sys_timerfd_settime) /* 320 */
332SYSCALL(sys_timerfd_gettime,sys_timerfd_gettime,compat_sys_timerfd_gettime) 332SYSCALL(sys_timerfd_gettime,sys_timerfd_gettime,compat_sys_timerfd_gettime)
333SYSCALL(sys_signalfd4,sys_signalfd4,compat_sys_signalfd4_wrapper) 333SYSCALL(sys_signalfd4,sys_signalfd4,compat_sys_signalfd4)
334SYSCALL(sys_eventfd2,sys_eventfd2,sys_eventfd2_wrapper) 334SYSCALL(sys_eventfd2,sys_eventfd2,sys_eventfd2_wrapper)
335SYSCALL(sys_inotify_init1,sys_inotify_init1,sys_inotify_init1_wrapper) 335SYSCALL(sys_inotify_init1,sys_inotify_init1,sys_inotify_init1_wrapper)
336SYSCALL(sys_pipe2,sys_pipe2,sys_pipe2_wrapper) /* 325 */ 336SYSCALL(sys_pipe2,sys_pipe2,sys_pipe2_wrapper) /* 325 */
diff --git a/arch/sh/include/asm/unistd.h b/arch/sh/include/asm/unistd.h
index 5e90fa2b7eed..e77816c4b9bc 100644
--- a/arch/sh/include/asm/unistd.h
+++ b/arch/sh/include/asm/unistd.h
@@ -30,12 +30,4 @@
30# define __ARCH_WANT_SYS_VFORK 30# define __ARCH_WANT_SYS_VFORK
31# define __ARCH_WANT_SYS_CLONE 31# define __ARCH_WANT_SYS_CLONE
32 32
33/*
34 * "Conditional" syscalls
35 *
36 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
37 * but it doesn't work on all toolchains, so we just do it by hand
38 */
39# define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
40
41#include <uapi/asm/unistd.h> 33#include <uapi/asm/unistd.h>
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index e5641157464f..f5041d741dea 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -62,7 +62,6 @@ config SPARC64
62 select HAVE_RCU_TABLE_FREE if SMP 62 select HAVE_RCU_TABLE_FREE if SMP
63 select HAVE_MEMBLOCK 63 select HAVE_MEMBLOCK
64 select HAVE_MEMBLOCK_NODE_MAP 64 select HAVE_MEMBLOCK_NODE_MAP
65 select HAVE_SYSCALL_WRAPPERS
66 select HAVE_ARCH_TRANSPARENT_HUGEPAGE 65 select HAVE_ARCH_TRANSPARENT_HUGEPAGE
67 select HAVE_DYNAMIC_FTRACE 66 select HAVE_DYNAMIC_FTRACE
68 select HAVE_FTRACE_MCOUNT_RECORD 67 select HAVE_FTRACE_MCOUNT_RECORD
diff --git a/arch/sparc/include/asm/unistd.h b/arch/sparc/include/asm/unistd.h
index 5356810bd7e7..dfa53fdd5cbc 100644
--- a/arch/sparc/include/asm/unistd.h
+++ b/arch/sparc/include/asm/unistd.h
@@ -45,12 +45,4 @@
45#define __ARCH_WANT_COMPAT_SYS_SENDFILE 45#define __ARCH_WANT_COMPAT_SYS_SENDFILE
46#endif 46#endif
47 47
48/*
49 * "Conditional" syscalls
50 *
51 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
52 * but it doesn't work on all toolchains, so we just do it by hand
53 */
54#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
55
56#endif /* _SPARC_UNISTD_H */ 48#endif /* _SPARC_UNISTD_H */
diff --git a/arch/sparc/kernel/sys32.S b/arch/sparc/kernel/sys32.S
index 240a3cecc11e..2e680b5245c9 100644
--- a/arch/sparc/kernel/sys32.S
+++ b/arch/sparc/kernel/sys32.S
@@ -36,7 +36,6 @@ STUB: sra REG1, 0, REG1; \
36 jmpl %g1 + %lo(SYSCALL), %g0; \ 36 jmpl %g1 + %lo(SYSCALL), %g0; \
37 sra REG3, 0, REG3 37 sra REG3, 0, REG3
38 38
39SIGN1(sys32_getrusage, compat_sys_getrusage, %o0)
40SIGN1(sys32_readahead, compat_sys_readahead, %o0) 39SIGN1(sys32_readahead, compat_sys_readahead, %o0)
41SIGN2(sys32_fadvise64, compat_sys_fadvise64, %o0, %o4) 40SIGN2(sys32_fadvise64, compat_sys_fadvise64, %o0, %o4)
42SIGN2(sys32_fadvise64_64, compat_sys_fadvise64_64, %o0, %o5) 41SIGN2(sys32_fadvise64_64, compat_sys_fadvise64_64, %o0, %o5)
@@ -46,12 +45,9 @@ SIGN1(sys32_io_submit, compat_sys_io_submit, %o1)
46SIGN1(sys32_mq_open, compat_sys_mq_open, %o1) 45SIGN1(sys32_mq_open, compat_sys_mq_open, %o1)
47SIGN1(sys32_select, compat_sys_select, %o0) 46SIGN1(sys32_select, compat_sys_select, %o0)
48SIGN3(sys32_futex, compat_sys_futex, %o1, %o2, %o5) 47SIGN3(sys32_futex, compat_sys_futex, %o1, %o2, %o5)
49SIGN2(sys32_sendfile, compat_sys_sendfile, %o0, %o1)
50SIGN1(sys32_recvfrom, compat_sys_recvfrom, %o0) 48SIGN1(sys32_recvfrom, compat_sys_recvfrom, %o0)
51SIGN1(sys32_recvmsg, compat_sys_recvmsg, %o0) 49SIGN1(sys32_recvmsg, compat_sys_recvmsg, %o0)
52SIGN1(sys32_sendmsg, compat_sys_sendmsg, %o0) 50SIGN1(sys32_sendmsg, compat_sys_sendmsg, %o0)
53SIGN2(sys32_sync_file_range, compat_sync_file_range, %o0, %o5)
54SIGN1(sys32_vmsplice, compat_sys_vmsplice, %o0)
55 51
56 .globl sys32_mmap2 52 .globl sys32_mmap2
57sys32_mmap2: 53sys32_mmap2:
diff --git a/arch/sparc/kernel/sys_sparc32.c b/arch/sparc/kernel/sys_sparc32.c
index f38f2280fade..3d0ddbc005fe 100644
--- a/arch/sparc/kernel/sys_sparc32.c
+++ b/arch/sparc/kernel/sys_sparc32.c
@@ -49,71 +49,6 @@
49#include <asm/mmu_context.h> 49#include <asm/mmu_context.h>
50#include <asm/compat_signal.h> 50#include <asm/compat_signal.h>
51 51
52#ifdef CONFIG_SYSVIPC
53asmlinkage long compat_sys_ipc(u32 call, u32 first, u32 second, u32 third, compat_uptr_t ptr, u32 fifth)
54{
55 int version;
56
57 version = call >> 16; /* hack for backward compatibility */
58 call &= 0xffff;
59
60 switch (call) {
61 case SEMTIMEDOP:
62 if (fifth)
63 /* sign extend semid */
64 return compat_sys_semtimedop((int)first,
65 compat_ptr(ptr), second,
66 compat_ptr(fifth));
67 /* else fall through for normal semop() */
68 case SEMOP:
69 /* struct sembuf is the same on 32 and 64bit :)) */
70 /* sign extend semid */
71 return sys_semtimedop((int)first, compat_ptr(ptr), second,
72 NULL);
73 case SEMGET:
74 /* sign extend key, nsems */
75 return sys_semget((int)first, (int)second, third);
76 case SEMCTL:
77 /* sign extend semid, semnum */
78 return compat_sys_semctl((int)first, (int)second, third,
79 compat_ptr(ptr));
80
81 case MSGSND:
82 /* sign extend msqid */
83 return compat_sys_msgsnd((int)first, (int)second, third,
84 compat_ptr(ptr));
85 case MSGRCV:
86 /* sign extend msqid, msgtyp */
87 return compat_sys_msgrcv((int)first, second, (int)fifth,
88 third, version, compat_ptr(ptr));
89 case MSGGET:
90 /* sign extend key */
91 return sys_msgget((int)first, second);
92 case MSGCTL:
93 /* sign extend msqid */
94 return compat_sys_msgctl((int)first, second, compat_ptr(ptr));
95
96 case SHMAT:
97 /* sign extend shmid */
98 return compat_sys_shmat((int)first, second, third, version,
99 compat_ptr(ptr));
100 case SHMDT:
101 return sys_shmdt(compat_ptr(ptr));
102 case SHMGET:
103 /* sign extend key_t */
104 return sys_shmget((int)first, second, third);
105 case SHMCTL:
106 /* sign extend shmid */
107 return compat_sys_shmctl((int)first, second, compat_ptr(ptr));
108
109 default:
110 return -ENOSYS;
111 }
112
113 return -ENOSYS;
114}
115#endif
116
117asmlinkage long sys32_truncate64(const char __user * path, unsigned long high, unsigned long low) 52asmlinkage long sys32_truncate64(const char __user * path, unsigned long high, unsigned long low)
118{ 53{
119 if ((int)high < 0) 54 if ((int)high < 0)
@@ -303,15 +238,7 @@ long compat_sys_fadvise64_64(int fd,
303 advice); 238 advice);
304} 239}
305 240
306long sys32_lookup_dcookie(unsigned long cookie_high, 241long 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)
307 unsigned long cookie_low,
308 char __user *buf, size_t len)
309{
310 return sys_lookup_dcookie((cookie_high << 32) | cookie_low,
311 buf, len);
312}
313
314long compat_sync_file_range(int fd, unsigned long off_high, unsigned long off_low, unsigned long nb_high, unsigned long nb_low, int flags)
315{ 242{
316 return sys_sync_file_range(fd, 243 return sys_sync_file_range(fd,
317 (off_high << 32) | off_low, 244 (off_high << 32) | off_low,
diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c
index 708bc29d36a8..2daaaa6eda23 100644
--- a/arch/sparc/kernel/sys_sparc_64.c
+++ b/arch/sparc/kernel/sys_sparc_64.c
@@ -353,7 +353,7 @@ SYSCALL_DEFINE6(sparc_ipc, unsigned int, call, int, first, unsigned long, second
353 case SEMCTL: { 353 case SEMCTL: {
354 err = sys_semctl(first, second, 354 err = sys_semctl(first, second,
355 (int)third | IPC_64, 355 (int)third | IPC_64,
356 (union semun) ptr); 356 (unsigned long) ptr);
357 goto out; 357 goto out;
358 } 358 }
359 default: 359 default:
@@ -470,10 +470,6 @@ SYSCALL_DEFINE2(64_munmap, unsigned long, addr, size_t, len)
470 470
471 return vm_munmap(addr, len); 471 return vm_munmap(addr, len);
472} 472}
473
474extern unsigned long do_mremap(unsigned long addr,
475 unsigned long old_len, unsigned long new_len,
476 unsigned long flags, unsigned long new_addr);
477 473
478SYSCALL_DEFINE5(64_mremap, unsigned long, addr, unsigned long, old_len, 474SYSCALL_DEFINE5(64_mremap, unsigned long, addr, unsigned long, old_len,
479 unsigned long, new_len, unsigned long, flags, 475 unsigned long, new_len, unsigned long, flags,
diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S
index 088134834dab..8fd932080215 100644
--- a/arch/sparc/kernel/systbls_64.S
+++ b/arch/sparc/kernel/systbls_64.S
@@ -23,9 +23,9 @@ sys_call_table32:
23/*10*/ .word sys_unlink, sunos_execv, sys_chdir, sys_chown16, sys_mknod 23/*10*/ .word sys_unlink, sunos_execv, sys_chdir, sys_chown16, sys_mknod
24/*15*/ .word sys_chmod, sys_lchown16, sys_brk, sys_nis_syscall, compat_sys_lseek 24/*15*/ .word sys_chmod, sys_lchown16, sys_brk, sys_nis_syscall, compat_sys_lseek
25/*20*/ .word sys_getpid, sys_capget, sys_capset, sys_setuid16, sys_getuid16 25/*20*/ .word sys_getpid, sys_capget, sys_capset, sys_setuid16, sys_getuid16
26/*25*/ .word sys32_vmsplice, compat_sys_ptrace, sys_alarm, compat_sys_sigaltstack, sys_pause 26/*25*/ .word compat_sys_vmsplice, compat_sys_ptrace, sys_alarm, compat_sys_sigaltstack, sys_pause
27/*30*/ .word compat_sys_utime, sys_lchown, sys_fchown, sys_access, sys_nice 27/*30*/ .word compat_sys_utime, sys_lchown, sys_fchown, sys_access, sys_nice
28 .word sys_chown, sys_sync, sys_kill, compat_sys_newstat, sys32_sendfile 28 .word sys_chown, sys_sync, sys_kill, compat_sys_newstat, compat_sys_sendfile
29/*40*/ .word compat_sys_newlstat, sys_dup, sys_sparc_pipe, compat_sys_times, sys_getuid 29/*40*/ .word compat_sys_newlstat, sys_dup, sys_sparc_pipe, compat_sys_times, sys_getuid
30 .word sys_umount, sys_setgid16, sys_getgid16, sys_signal, sys_geteuid16 30 .word sys_umount, sys_setgid16, sys_getgid16, sys_signal, sys_geteuid16
31/*50*/ .word sys_getegid16, sys_acct, sys_nis_syscall, sys_getgid, compat_sys_ioctl 31/*50*/ .word sys_getegid16, sys_acct, sys_nis_syscall, sys_getgid, compat_sys_ioctl
@@ -41,7 +41,7 @@ sys_call_table32:
41/*100*/ .word sys_getpriority, sys32_rt_sigreturn, compat_sys_rt_sigaction, compat_sys_rt_sigprocmask, compat_sys_rt_sigpending 41/*100*/ .word sys_getpriority, sys32_rt_sigreturn, compat_sys_rt_sigaction, compat_sys_rt_sigprocmask, compat_sys_rt_sigpending
42 .word compat_sys_rt_sigtimedwait, compat_sys_rt_sigqueueinfo, compat_sys_rt_sigsuspend, sys_setresuid, sys_getresuid 42 .word compat_sys_rt_sigtimedwait, compat_sys_rt_sigqueueinfo, compat_sys_rt_sigsuspend, sys_setresuid, sys_getresuid
43/*110*/ .word sys_setresgid, sys_getresgid, sys_setregid, sys_nis_syscall, sys_nis_syscall 43/*110*/ .word sys_setresgid, sys_getresgid, sys_setregid, sys_nis_syscall, sys_nis_syscall
44 .word sys_getgroups, compat_sys_gettimeofday, sys32_getrusage, sys_nis_syscall, sys_getcwd 44 .word sys_getgroups, compat_sys_gettimeofday, compat_sys_getrusage, sys_nis_syscall, sys_getcwd
45/*120*/ .word compat_sys_readv, compat_sys_writev, compat_sys_settimeofday, sys_fchown16, sys_fchmod 45/*120*/ .word compat_sys_readv, compat_sys_writev, compat_sys_settimeofday, sys_fchown16, sys_fchmod
46 .word sys_nis_syscall, sys_setreuid16, sys_setregid16, sys_rename, compat_sys_truncate 46 .word sys_nis_syscall, sys_setreuid16, sys_setregid16, sys_rename, compat_sys_truncate
47/*130*/ .word compat_sys_ftruncate, sys_flock, compat_sys_lstat64, sys_nis_syscall, sys_nis_syscall 47/*130*/ .word compat_sys_ftruncate, sys_flock, compat_sys_lstat64, sys_nis_syscall, sys_nis_syscall
@@ -59,7 +59,7 @@ sys_call_table32:
59/*190*/ .word sys_init_module, sys_sparc64_personality, sys_remap_file_pages, sys_epoll_create, sys_epoll_ctl 59/*190*/ .word sys_init_module, sys_sparc64_personality, sys_remap_file_pages, sys_epoll_create, sys_epoll_ctl
60 .word sys_epoll_wait, sys_ioprio_set, sys_getppid, compat_sys_sparc_sigaction, sys_sgetmask 60 .word sys_epoll_wait, sys_ioprio_set, sys_getppid, compat_sys_sparc_sigaction, sys_sgetmask
61/*200*/ .word sys_ssetmask, sys_sigsuspend, compat_sys_newlstat, sys_uselib, compat_sys_old_readdir 61/*200*/ .word sys_ssetmask, sys_sigsuspend, compat_sys_newlstat, sys_uselib, compat_sys_old_readdir
62 .word sys32_readahead, sys32_socketcall, sys_syslog, sys32_lookup_dcookie, sys32_fadvise64 62 .word sys32_readahead, sys32_socketcall, sys_syslog, compat_sys_lookup_dcookie, sys32_fadvise64
63/*210*/ .word sys32_fadvise64_64, sys_tgkill, sys_waitpid, sys_swapoff, compat_sys_sysinfo 63/*210*/ .word sys32_fadvise64_64, sys_tgkill, sys_waitpid, sys_swapoff, compat_sys_sysinfo
64 .word compat_sys_ipc, sys32_sigreturn, sys_clone, sys_ioprio_get, compat_sys_adjtimex 64 .word compat_sys_ipc, sys32_sigreturn, sys_clone, sys_ioprio_get, compat_sys_adjtimex
65/*220*/ .word compat_sys_sigprocmask, sys_ni_syscall, sys_delete_module, sys_ni_syscall, sys_getpgid 65/*220*/ .word compat_sys_sigprocmask, sys_ni_syscall, sys_delete_module, sys_ni_syscall, sys_getpgid
diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig
index 0f712f4e1b33..0e5343902363 100644
--- a/arch/tile/Kconfig
+++ b/arch/tile/Kconfig
@@ -16,7 +16,6 @@ config TILE
16 select GENERIC_PENDING_IRQ if SMP 16 select GENERIC_PENDING_IRQ if SMP
17 select GENERIC_IRQ_SHOW 17 select GENERIC_IRQ_SHOW
18 select HAVE_DEBUG_BUGVERBOSE 18 select HAVE_DEBUG_BUGVERBOSE
19 select HAVE_SYSCALL_WRAPPERS if TILEGX
20 select VIRT_TO_BUS 19 select VIRT_TO_BUS
21 select SYS_HYPERVISOR 20 select SYS_HYPERVISOR
22 select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS 21 select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS
diff --git a/arch/tile/kernel/compat.c b/arch/tile/kernel/compat.c
index 6ea4cdb3c6a0..ed378416b86a 100644
--- a/arch/tile/kernel/compat.c
+++ b/arch/tile/kernel/compat.c
@@ -56,12 +56,6 @@ COMPAT_SYSCALL_DEFINE6(pwrite64, unsigned int, fd, char __user *, ubuf,
56 return sys_pwrite64(fd, ubuf, count, ((loff_t)high << 32) | low); 56 return sys_pwrite64(fd, ubuf, count, ((loff_t)high << 32) | low);
57} 57}
58 58
59COMPAT_SYSCALL_DEFINE4(lookup_dcookie, u32, low, u32, high,
60 char __user *, buf, size_t, len)
61{
62 return sys_lookup_dcookie(((loff_t)high << 32) | low, buf, len);
63}
64
65COMPAT_SYSCALL_DEFINE6(sync_file_range2, int, fd, unsigned int, flags, 59COMPAT_SYSCALL_DEFINE6(sync_file_range2, int, fd, unsigned int, flags,
66 u32, offset_lo, u32, offset_hi, 60 u32, offset_lo, u32, offset_hi,
67 u32, nbytes_lo, u32, nbytes_hi) 61 u32, nbytes_lo, u32, nbytes_hi)
diff --git a/arch/x86/ia32/Makefile b/arch/x86/ia32/Makefile
index 455646e0e532..e785b422b766 100644
--- a/arch/x86/ia32/Makefile
+++ b/arch/x86/ia32/Makefile
@@ -5,9 +5,6 @@
5obj-$(CONFIG_IA32_EMULATION) := ia32entry.o sys_ia32.o ia32_signal.o 5obj-$(CONFIG_IA32_EMULATION) := ia32entry.o sys_ia32.o ia32_signal.o
6obj-$(CONFIG_IA32_EMULATION) += nosyscall.o syscall_ia32.o 6obj-$(CONFIG_IA32_EMULATION) += nosyscall.o syscall_ia32.o
7 7
8sysv-$(CONFIG_SYSVIPC) := ipc32.o
9obj-$(CONFIG_IA32_EMULATION) += $(sysv-y)
10
11obj-$(CONFIG_IA32_AOUT) += ia32_aout.o 8obj-$(CONFIG_IA32_AOUT) += ia32_aout.o
12 9
13audit-class-$(CONFIG_AUDIT) := audit.o 10audit-class-$(CONFIG_AUDIT) := audit.o
diff --git a/arch/x86/ia32/ipc32.c b/arch/x86/ia32/ipc32.c
deleted file mode 100644
index 29cdcd02ead3..000000000000
--- a/arch/x86/ia32/ipc32.c
+++ /dev/null
@@ -1,54 +0,0 @@
1#include <linux/kernel.h>
2#include <linux/spinlock.h>
3#include <linux/list.h>
4#include <linux/syscalls.h>
5#include <linux/time.h>
6#include <linux/sem.h>
7#include <linux/msg.h>
8#include <linux/shm.h>
9#include <linux/ipc.h>
10#include <linux/compat.h>
11#include <asm/sys_ia32.h>
12
13asmlinkage long sys32_ipc(u32 call, int first, int second, int third,
14 compat_uptr_t ptr, u32 fifth)
15{
16 int version;
17
18 version = call >> 16; /* hack for backward compatibility */
19 call &= 0xffff;
20
21 switch (call) {
22 case SEMOP:
23 /* struct sembuf is the same on 32 and 64bit :)) */
24 return sys_semtimedop(first, compat_ptr(ptr), second, NULL);
25 case SEMTIMEDOP:
26 return compat_sys_semtimedop(first, compat_ptr(ptr), second,
27 compat_ptr(fifth));
28 case SEMGET:
29 return sys_semget(first, second, third);
30 case SEMCTL:
31 return compat_sys_semctl(first, second, third, compat_ptr(ptr));
32
33 case MSGSND:
34 return compat_sys_msgsnd(first, second, third, compat_ptr(ptr));
35 case MSGRCV:
36 return compat_sys_msgrcv(first, second, fifth, third,
37 version, compat_ptr(ptr));
38 case MSGGET:
39 return sys_msgget((key_t) first, second);
40 case MSGCTL:
41 return compat_sys_msgctl(first, second, compat_ptr(ptr));
42
43 case SHMAT:
44 return compat_sys_shmat(first, second, third, version,
45 compat_ptr(ptr));
46 case SHMDT:
47 return sys_shmdt(compat_ptr(ptr));
48 case SHMGET:
49 return sys_shmget(first, (unsigned)second, third);
50 case SHMCTL:
51 return compat_sys_shmctl(first, second, compat_ptr(ptr));
52 }
53 return -ENOSYS;
54}
diff --git a/arch/x86/ia32/sys_ia32.c b/arch/x86/ia32/sys_ia32.c
index ad7a20cbc699..4e4907c67d92 100644
--- a/arch/x86/ia32/sys_ia32.c
+++ b/arch/x86/ia32/sys_ia32.c
@@ -166,12 +166,6 @@ asmlinkage long sys32_mmap(struct mmap_arg_struct32 __user *arg)
166 a.offset>>PAGE_SHIFT); 166 a.offset>>PAGE_SHIFT);
167} 167}
168 168
169asmlinkage long sys32_mprotect(unsigned long start, size_t len,
170 unsigned long prot)
171{
172 return sys_mprotect(start, len, prot);
173}
174
175asmlinkage long sys32_waitpid(compat_pid_t pid, unsigned int __user *stat_addr, 169asmlinkage long sys32_waitpid(compat_pid_t pid, unsigned int __user *stat_addr,
176 int options) 170 int options)
177{ 171{
@@ -194,35 +188,10 @@ asmlinkage long sys32_pwrite(unsigned int fd, const char __user *ubuf,
194} 188}
195 189
196 190
197asmlinkage long sys32_sendfile(int out_fd, int in_fd,
198 compat_off_t __user *offset, s32 count)
199{
200 mm_segment_t old_fs = get_fs();
201 int ret;
202 off_t of;
203
204 if (offset && get_user(of, offset))
205 return -EFAULT;
206
207 set_fs(KERNEL_DS);
208 ret = sys_sendfile(out_fd, in_fd, offset ? (off_t __user *)&of : NULL,
209 count);
210 set_fs(old_fs);
211
212 if (offset && put_user(of, offset))
213 return -EFAULT;
214 return ret;
215}
216
217/* 191/*
218 * Some system calls that need sign extended arguments. This could be 192 * Some system calls that need sign extended arguments. This could be
219 * done by a generic wrapper. 193 * done by a generic wrapper.
220 */ 194 */
221long sys32_kill(int pid, int sig)
222{
223 return sys_kill(pid, sig);
224}
225
226long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high, 195long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high,
227 __u32 len_low, __u32 len_high, int advice) 196 __u32 len_low, __u32 len_high, int advice)
228{ 197{
@@ -246,12 +215,6 @@ long sys32_vm86_warning(void)
246 return -ENOSYS; 215 return -ENOSYS;
247} 216}
248 217
249long sys32_lookup_dcookie(u32 addr_low, u32 addr_high,
250 char __user *buf, size_t len)
251{
252 return sys_lookup_dcookie(((u64)addr_high << 32) | addr_low, buf, len);
253}
254
255asmlinkage ssize_t sys32_readahead(int fd, unsigned off_lo, unsigned off_hi, 218asmlinkage ssize_t sys32_readahead(int fd, unsigned off_lo, unsigned off_hi,
256 size_t count) 219 size_t count)
257{ 220{
diff --git a/arch/x86/include/asm/sys_ia32.h b/arch/x86/include/asm/sys_ia32.h
index 8459efc39686..0ef202e232d6 100644
--- a/arch/x86/include/asm/sys_ia32.h
+++ b/arch/x86/include/asm/sys_ia32.h
@@ -30,23 +30,14 @@ asmlinkage long sys32_fstatat(unsigned int, const char __user *,
30 struct stat64 __user *, int); 30 struct stat64 __user *, int);
31struct mmap_arg_struct32; 31struct mmap_arg_struct32;
32asmlinkage long sys32_mmap(struct mmap_arg_struct32 __user *); 32asmlinkage long sys32_mmap(struct mmap_arg_struct32 __user *);
33asmlinkage long sys32_mprotect(unsigned long, size_t, unsigned long);
34
35asmlinkage long sys32_alarm(unsigned int);
36 33
37asmlinkage long sys32_waitpid(compat_pid_t, unsigned int __user *, int); 34asmlinkage long sys32_waitpid(compat_pid_t, unsigned int __user *, int);
38asmlinkage long sys32_sysfs(int, u32, u32);
39 35
40asmlinkage long sys32_pread(unsigned int, char __user *, u32, u32, u32); 36asmlinkage long sys32_pread(unsigned int, char __user *, u32, u32, u32);
41asmlinkage long sys32_pwrite(unsigned int, const char __user *, u32, u32, u32); 37asmlinkage long sys32_pwrite(unsigned int, const char __user *, u32, u32, u32);
42 38
43asmlinkage long sys32_personality(unsigned long);
44asmlinkage long sys32_sendfile(int, int, compat_off_t __user *, s32);
45
46long sys32_kill(int, int);
47long sys32_fadvise64_64(int, __u32, __u32, __u32, __u32, int); 39long sys32_fadvise64_64(int, __u32, __u32, __u32, __u32, int);
48long sys32_vm86_warning(void); 40long sys32_vm86_warning(void);
49long sys32_lookup_dcookie(u32, u32, char __user *, size_t);
50 41
51asmlinkage ssize_t sys32_readahead(int, unsigned, unsigned, size_t); 42asmlinkage ssize_t sys32_readahead(int, unsigned, unsigned, size_t);
52asmlinkage long sys32_sync_file_range(int, unsigned, unsigned, 43asmlinkage long sys32_sync_file_range(int, unsigned, unsigned,
@@ -59,9 +50,6 @@ asmlinkage long sys32_fallocate(int, int, unsigned,
59asmlinkage long sys32_sigreturn(void); 50asmlinkage long sys32_sigreturn(void);
60asmlinkage long sys32_rt_sigreturn(void); 51asmlinkage long sys32_rt_sigreturn(void);
61 52
62/* ia32/ipc32.c */
63asmlinkage long sys32_ipc(u32, int, int, int, compat_uptr_t, u32);
64
65asmlinkage long sys32_fanotify_mark(int, unsigned int, u32, u32, int, 53asmlinkage long sys32_fanotify_mark(int, unsigned int, u32, u32, int,
66 const char __user *); 54 const char __user *);
67 55
diff --git a/arch/x86/include/asm/syscalls.h b/arch/x86/include/asm/syscalls.h
index 6cf0a9cc60cd..5f87b35fd2ef 100644
--- a/arch/x86/include/asm/syscalls.h
+++ b/arch/x86/include/asm/syscalls.h
@@ -27,8 +27,8 @@ asmlinkage int sys_modify_ldt(int, void __user *, unsigned long);
27long sys_rt_sigreturn(void); 27long sys_rt_sigreturn(void);
28 28
29/* kernel/tls.c */ 29/* kernel/tls.c */
30asmlinkage int sys_set_thread_area(struct user_desc __user *); 30asmlinkage long sys_set_thread_area(struct user_desc __user *);
31asmlinkage int sys_get_thread_area(struct user_desc __user *); 31asmlinkage long sys_get_thread_area(struct user_desc __user *);
32 32
33/* X86_32 only */ 33/* X86_32 only */
34#ifdef CONFIG_X86_32 34#ifdef CONFIG_X86_32
diff --git a/arch/x86/include/asm/unistd.h b/arch/x86/include/asm/unistd.h
index 3d5df1c4447f..c2a48139c340 100644
--- a/arch/x86/include/asm/unistd.h
+++ b/arch/x86/include/asm/unistd.h
@@ -50,12 +50,4 @@
50# define __ARCH_WANT_SYS_VFORK 50# define __ARCH_WANT_SYS_VFORK
51# define __ARCH_WANT_SYS_CLONE 51# define __ARCH_WANT_SYS_CLONE
52 52
53/*
54 * "Conditional" syscalls
55 *
56 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
57 * but it doesn't work on all toolchains, so we just do it by hand
58 */
59# define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
60
61#endif /* _ASM_X86_UNISTD_H */ 53#endif /* _ASM_X86_UNISTD_H */
diff --git a/arch/x86/kernel/tls.c b/arch/x86/kernel/tls.c
index 9d9d2f9e77a5..f7fec09e3e3a 100644
--- a/arch/x86/kernel/tls.c
+++ b/arch/x86/kernel/tls.c
@@ -3,13 +3,13 @@
3#include <linux/sched.h> 3#include <linux/sched.h>
4#include <linux/user.h> 4#include <linux/user.h>
5#include <linux/regset.h> 5#include <linux/regset.h>
6#include <linux/syscalls.h>
6 7
7#include <asm/uaccess.h> 8#include <asm/uaccess.h>
8#include <asm/desc.h> 9#include <asm/desc.h>
9#include <asm/ldt.h> 10#include <asm/ldt.h>
10#include <asm/processor.h> 11#include <asm/processor.h>
11#include <asm/proto.h> 12#include <asm/proto.h>
12#include <asm/syscalls.h>
13 13
14#include "tls.h" 14#include "tls.h"
15 15
@@ -89,11 +89,9 @@ int do_set_thread_area(struct task_struct *p, int idx,
89 return 0; 89 return 0;
90} 90}
91 91
92asmlinkage int sys_set_thread_area(struct user_desc __user *u_info) 92SYSCALL_DEFINE1(set_thread_area, struct user_desc __user *, u_info)
93{ 93{
94 int ret = do_set_thread_area(current, -1, u_info, 1); 94 return do_set_thread_area(current, -1, u_info, 1);
95 asmlinkage_protect(1, ret, u_info);
96 return ret;
97} 95}
98 96
99 97
@@ -139,11 +137,9 @@ int do_get_thread_area(struct task_struct *p, int idx,
139 return 0; 137 return 0;
140} 138}
141 139
142asmlinkage int sys_get_thread_area(struct user_desc __user *u_info) 140SYSCALL_DEFINE1(get_thread_area, struct user_desc __user *, u_info)
143{ 141{
144 int ret = do_get_thread_area(current, -1, u_info); 142 return do_get_thread_area(current, -1, u_info);
145 asmlinkage_protect(1, ret, u_info);
146 return ret;
147} 143}
148 144
149int regset_tls_active(struct task_struct *target, 145int regset_tls_active(struct task_struct *target,
diff --git a/arch/x86/syscalls/syscall_32.tbl b/arch/x86/syscalls/syscall_32.tbl
index e6d55f0064df..d0d59bfbccce 100644
--- a/arch/x86/syscalls/syscall_32.tbl
+++ b/arch/x86/syscalls/syscall_32.tbl
@@ -43,7 +43,7 @@
4334 i386 nice sys_nice 4334 i386 nice sys_nice
4435 i386 ftime 4435 i386 ftime
4536 i386 sync sys_sync 4536 i386 sync sys_sync
4637 i386 kill sys_kill sys32_kill 4637 i386 kill sys_kill
4738 i386 rename sys_rename 4738 i386 rename sys_rename
4839 i386 mkdir sys_mkdir 4839 i386 mkdir sys_mkdir
4940 i386 rmdir sys_rmdir 4940 i386 rmdir sys_rmdir
@@ -123,7 +123,7 @@
123114 i386 wait4 sys_wait4 compat_sys_wait4 123114 i386 wait4 sys_wait4 compat_sys_wait4
124115 i386 swapoff sys_swapoff 124115 i386 swapoff sys_swapoff
125116 i386 sysinfo sys_sysinfo compat_sys_sysinfo 125116 i386 sysinfo sys_sysinfo compat_sys_sysinfo
126117 i386 ipc sys_ipc sys32_ipc 126117 i386 ipc sys_ipc compat_sys_ipc
127118 i386 fsync sys_fsync 127118 i386 fsync sys_fsync
128119 i386 sigreturn sys_sigreturn stub32_sigreturn 128119 i386 sigreturn sys_sigreturn stub32_sigreturn
129120 i386 clone sys_clone stub32_clone 129120 i386 clone sys_clone stub32_clone
@@ -131,7 +131,7 @@
131122 i386 uname sys_newuname 131122 i386 uname sys_newuname
132123 i386 modify_ldt sys_modify_ldt 132123 i386 modify_ldt sys_modify_ldt
133124 i386 adjtimex sys_adjtimex compat_sys_adjtimex 133124 i386 adjtimex sys_adjtimex compat_sys_adjtimex
134125 i386 mprotect sys_mprotect sys32_mprotect 134125 i386 mprotect sys_mprotect
135126 i386 sigprocmask sys_sigprocmask compat_sys_sigprocmask 135126 i386 sigprocmask sys_sigprocmask compat_sys_sigprocmask
136127 i386 create_module 136127 i386 create_module
137128 i386 init_module sys_init_module 137128 i386 init_module sys_init_module
@@ -193,7 +193,7 @@
193184 i386 capget sys_capget 193184 i386 capget sys_capget
194185 i386 capset sys_capset 194185 i386 capset sys_capset
195186 i386 sigaltstack sys_sigaltstack compat_sys_sigaltstack 195186 i386 sigaltstack sys_sigaltstack compat_sys_sigaltstack
196187 i386 sendfile sys_sendfile sys32_sendfile 196187 i386 sendfile sys_sendfile compat_sys_sendfile
197188 i386 getpmsg 197188 i386 getpmsg
198189 i386 putpmsg 198189 i386 putpmsg
199190 i386 vfork sys_vfork stub32_vfork 199190 i386 vfork sys_vfork stub32_vfork
@@ -259,7 +259,7 @@
259250 i386 fadvise64 sys_fadvise64 sys32_fadvise64 259250 i386 fadvise64 sys_fadvise64 sys32_fadvise64
260# 251 is available for reuse (was briefly sys_set_zone_reclaim) 260# 251 is available for reuse (was briefly sys_set_zone_reclaim)
261252 i386 exit_group sys_exit_group 261252 i386 exit_group sys_exit_group
262253 i386 lookup_dcookie sys_lookup_dcookie sys32_lookup_dcookie 262253 i386 lookup_dcookie sys_lookup_dcookie compat_sys_lookup_dcookie
263254 i386 epoll_create sys_epoll_create 263254 i386 epoll_create sys_epoll_create
264255 i386 epoll_ctl sys_epoll_ctl 264255 i386 epoll_ctl sys_epoll_ctl
265256 i386 epoll_wait sys_epoll_wait 265256 i386 epoll_wait sys_epoll_wait
diff --git a/arch/x86/um/tls_32.c b/arch/x86/um/tls_32.c
index 5f5feff3d24c..80ffa5b9982d 100644
--- a/arch/x86/um/tls_32.c
+++ b/arch/x86/um/tls_32.c
@@ -5,6 +5,7 @@
5 5
6#include <linux/percpu.h> 6#include <linux/percpu.h>
7#include <linux/sched.h> 7#include <linux/sched.h>
8#include <linux/syscalls.h>
8#include <asm/uaccess.h> 9#include <asm/uaccess.h>
9#include <os.h> 10#include <os.h>
10#include <skas.h> 11#include <skas.h>
@@ -274,7 +275,7 @@ clear:
274 goto out; 275 goto out;
275} 276}
276 277
277int sys_set_thread_area(struct user_desc __user *user_desc) 278SYSCALL_DEFINE1(set_thread_area, struct user_desc __user *, user_desc)
278{ 279{
279 struct user_desc info; 280 struct user_desc info;
280 int idx, ret; 281 int idx, ret;
@@ -322,7 +323,7 @@ int ptrace_set_thread_area(struct task_struct *child, int idx,
322 return set_tls_entry(child, &info, idx, 0); 323 return set_tls_entry(child, &info, idx, 0);
323} 324}
324 325
325int sys_get_thread_area(struct user_desc __user *user_desc) 326SYSCALL_DEFINE1(get_thread_area, struct user_desc __user *, user_desc)
326{ 327{
327 struct user_desc info; 328 struct user_desc info;
328 int idx, ret; 329 int idx, ret;
diff --git a/arch/xtensa/include/asm/unistd.h b/arch/xtensa/include/asm/unistd.h
index c38834de9ac7..cb4c2ce8d447 100644
--- a/arch/xtensa/include/asm/unistd.h
+++ b/arch/xtensa/include/asm/unistd.h
@@ -4,14 +4,6 @@
4#define __ARCH_WANT_SYS_CLONE 4#define __ARCH_WANT_SYS_CLONE
5#include <uapi/asm/unistd.h> 5#include <uapi/asm/unistd.h>
6 6
7/*
8 * "Conditional" syscalls
9 *
10 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
11 * but it doesn't work on all toolchains, so we just do it by hand
12 */
13#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall");
14
15#define __ARCH_WANT_STAT64 7#define __ARCH_WANT_STAT64
16#define __ARCH_WANT_SYS_UTIME 8#define __ARCH_WANT_SYS_UTIME
17#define __ARCH_WANT_SYS_LLSEEK 9#define __ARCH_WANT_SYS_LLSEEK
diff --git a/fs/aio.c b/fs/aio.c
index 1dc8786f4588..6db8745c2edd 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1790,7 +1790,5 @@ SYSCALL_DEFINE5(io_getevents, aio_context_t, ctx_id,
1790 ret = read_events(ioctx, min_nr, nr, events, timeout); 1790 ret = read_events(ioctx, min_nr, nr, events, timeout);
1791 put_ioctx(ioctx); 1791 put_ioctx(ioctx);
1792 } 1792 }
1793
1794 asmlinkage_protect(5, ret, ctx_id, min_nr, nr, events, timeout);
1795 return ret; 1793 return ret;
1796} 1794}
diff --git a/fs/compat.c b/fs/compat.c
index d487985dd0ea..5f83ffa42115 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -44,7 +44,6 @@
44#include <linux/signal.h> 44#include <linux/signal.h>
45#include <linux/poll.h> 45#include <linux/poll.h>
46#include <linux/mm.h> 46#include <linux/mm.h>
47#include <linux/eventpoll.h>
48#include <linux/fs_struct.h> 47#include <linux/fs_struct.h>
49#include <linux/slab.h> 48#include <linux/slab.h>
50#include <linux/pagemap.h> 49#include <linux/pagemap.h>
@@ -1253,26 +1252,6 @@ compat_sys_pwritev(unsigned long fd, const struct compat_iovec __user *vec,
1253 return compat_sys_pwritev64(fd, vec, vlen, pos); 1252 return compat_sys_pwritev64(fd, vec, vlen, pos);
1254} 1253}
1255 1254
1256asmlinkage long
1257compat_sys_vmsplice(int fd, const struct compat_iovec __user *iov32,
1258 unsigned int nr_segs, unsigned int flags)
1259{
1260 unsigned i;
1261 struct iovec __user *iov;
1262 if (nr_segs > UIO_MAXIOV)
1263 return -EINVAL;
1264 iov = compat_alloc_user_space(nr_segs * sizeof(struct iovec));
1265 for (i = 0; i < nr_segs; i++) {
1266 struct compat_iovec v;
1267 if (get_user(v.iov_base, &iov32[i].iov_base) ||
1268 get_user(v.iov_len, &iov32[i].iov_len) ||
1269 put_user(compat_ptr(v.iov_base), &iov[i].iov_base) ||
1270 put_user(v.iov_len, &iov[i].iov_len))
1271 return -EFAULT;
1272 }
1273 return sys_vmsplice(fd, iov, nr_segs, flags);
1274}
1275
1276/* 1255/*
1277 * Exactly like fs/open.c:sys_open(), except that it doesn't set the 1256 * Exactly like fs/open.c:sys_open(), except that it doesn't set the
1278 * O_LARGEFILE flag. 1257 * O_LARGEFILE flag.
@@ -1658,84 +1637,6 @@ asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds,
1658 return ret; 1637 return ret;
1659} 1638}
1660 1639
1661#ifdef CONFIG_EPOLL
1662
1663asmlinkage long compat_sys_epoll_pwait(int epfd,
1664 struct compat_epoll_event __user *events,
1665 int maxevents, int timeout,
1666 const compat_sigset_t __user *sigmask,
1667 compat_size_t sigsetsize)
1668{
1669 long err;
1670 compat_sigset_t csigmask;
1671 sigset_t ksigmask, sigsaved;
1672
1673 /*
1674 * If the caller wants a certain signal mask to be set during the wait,
1675 * we apply it here.
1676 */
1677 if (sigmask) {
1678 if (sigsetsize != sizeof(compat_sigset_t))
1679 return -EINVAL;
1680 if (copy_from_user(&csigmask, sigmask, sizeof(csigmask)))
1681 return -EFAULT;
1682 sigset_from_compat(&ksigmask, &csigmask);
1683 sigdelsetmask(&ksigmask, sigmask(SIGKILL) | sigmask(SIGSTOP));
1684 sigprocmask(SIG_SETMASK, &ksigmask, &sigsaved);
1685 }
1686
1687 err = sys_epoll_wait(epfd, events, maxevents, timeout);
1688
1689 /*
1690 * If we changed the signal mask, we need to restore the original one.
1691 * In case we've got a signal while waiting, we do not restore the
1692 * signal mask yet, and we allow do_signal() to deliver the signal on
1693 * the way back to userspace, before the signal mask is restored.
1694 */
1695 if (sigmask) {
1696 if (err == -EINTR) {
1697 memcpy(&current->saved_sigmask, &sigsaved,
1698 sizeof(sigsaved));
1699 set_restore_sigmask();
1700 } else
1701 sigprocmask(SIG_SETMASK, &sigsaved, NULL);
1702 }
1703
1704 return err;
1705}
1706
1707#endif /* CONFIG_EPOLL */
1708
1709#ifdef CONFIG_SIGNALFD
1710
1711asmlinkage long compat_sys_signalfd4(int ufd,
1712 const compat_sigset_t __user *sigmask,
1713 compat_size_t sigsetsize, int flags)
1714{
1715 compat_sigset_t ss32;
1716 sigset_t tmp;
1717 sigset_t __user *ksigmask;
1718
1719 if (sigsetsize != sizeof(compat_sigset_t))
1720 return -EINVAL;
1721 if (copy_from_user(&ss32, sigmask, sizeof(ss32)))
1722 return -EFAULT;
1723 sigset_from_compat(&tmp, &ss32);
1724 ksigmask = compat_alloc_user_space(sizeof(sigset_t));
1725 if (copy_to_user(ksigmask, &tmp, sizeof(sigset_t)))
1726 return -EFAULT;
1727
1728 return sys_signalfd4(ufd, ksigmask, sizeof(sigset_t), flags);
1729}
1730
1731asmlinkage long compat_sys_signalfd(int ufd,
1732 const compat_sigset_t __user *sigmask,
1733 compat_size_t sigsetsize)
1734{
1735 return compat_sys_signalfd4(ufd, sigmask, sigsetsize, 0);
1736}
1737#endif /* CONFIG_SIGNALFD */
1738
1739#ifdef CONFIG_FHANDLE 1640#ifdef CONFIG_FHANDLE
1740/* 1641/*
1741 * Exactly like fs/open.c:sys_open_by_handle_at(), except that it 1642 * Exactly like fs/open.c:sys_open_by_handle_at(), except that it
@@ -1747,25 +1648,3 @@ COMPAT_SYSCALL_DEFINE3(open_by_handle_at, int, mountdirfd,
1747 return do_handle_open(mountdirfd, handle, flags); 1648 return do_handle_open(mountdirfd, handle, flags);
1748} 1649}
1749#endif 1650#endif
1750
1751#ifdef __ARCH_WANT_COMPAT_SYS_SENDFILE
1752asmlinkage long compat_sys_sendfile(int out_fd, int in_fd,
1753 compat_off_t __user *offset, compat_size_t count)
1754{
1755 loff_t pos;
1756 off_t off;
1757 ssize_t ret;
1758
1759 if (offset) {
1760 if (unlikely(get_user(off, offset)))
1761 return -EFAULT;
1762 pos = off;
1763 ret = do_sendfile(out_fd, in_fd, &pos, count, MAX_NON_LFS);
1764 if (unlikely(put_user(pos, offset)))
1765 return -EFAULT;
1766 return ret;
1767 }
1768
1769 return do_sendfile(out_fd, in_fd, NULL, count, 0);
1770}
1771#endif /* __ARCH_WANT_COMPAT_SYS_SENDFILE */
diff --git a/fs/dcookies.c b/fs/dcookies.c
index 17c779967828..ab5954b50267 100644
--- a/fs/dcookies.c
+++ b/fs/dcookies.c
@@ -25,6 +25,7 @@
25#include <linux/dcookies.h> 25#include <linux/dcookies.h>
26#include <linux/mutex.h> 26#include <linux/mutex.h>
27#include <linux/path.h> 27#include <linux/path.h>
28#include <linux/compat.h>
28#include <asm/uaccess.h> 29#include <asm/uaccess.h>
29 30
30/* The dcookies are allocated from a kmem_cache and 31/* The dcookies are allocated from a kmem_cache and
@@ -145,7 +146,7 @@ out:
145/* 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
146 * to retrieve the path. 147 * to retrieve the path.
147 */ 148 */
148SYSCALL_DEFINE(lookup_dcookie)(u64 cookie64, char __user * buf, size_t len) 149SYSCALL_DEFINE3(lookup_dcookie, u64, cookie64, char __user *, buf, size_t, len)
149{ 150{
150 unsigned long cookie = (unsigned long)cookie64; 151 unsigned long cookie = (unsigned long)cookie64;
151 int err = -EINVAL; 152 int err = -EINVAL;
@@ -201,12 +202,16 @@ out:
201 mutex_unlock(&dcookie_mutex); 202 mutex_unlock(&dcookie_mutex);
202 return err; 203 return err;
203} 204}
204#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS 205
205asmlinkage long SyS_lookup_dcookie(u64 cookie64, long buf, long len) 206#ifdef CONFIG_COMPAT
207COMPAT_SYSCALL_DEFINE4(lookup_dcookie, u32, w0, u32, w1, char __user *, buf, size_t, len)
206{ 208{
207 return SYSC_lookup_dcookie(cookie64, (char __user *) buf, (size_t) len); 209#ifdef __BIG_ENDIAN
210 return sys_lookup_dcookie(((u64)w0 << 32) | w1, buf, len);
211#else
212 return sys_lookup_dcookie(((u64)w1 << 32) | w0, buf, len);
213#endif
208} 214}
209SYSCALL_ALIAS(sys_lookup_dcookie, SyS_lookup_dcookie);
210#endif 215#endif
211 216
212static int dcookie_init(void) 217static int dcookie_init(void)
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 277cc38aeda5..deecc7294a67 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -40,6 +40,7 @@
40#include <linux/atomic.h> 40#include <linux/atomic.h>
41#include <linux/proc_fs.h> 41#include <linux/proc_fs.h>
42#include <linux/seq_file.h> 42#include <linux/seq_file.h>
43#include <linux/compat.h>
43 44
44/* 45/*
45 * LOCKING: 46 * LOCKING:
@@ -1998,6 +1999,52 @@ SYSCALL_DEFINE6(epoll_pwait, int, epfd, struct epoll_event __user *, events,
1998 return error; 1999 return error;
1999} 2000}
2000 2001
2002#ifdef CONFIG_COMPAT
2003COMPAT_SYSCALL_DEFINE6(epoll_pwait, int, epfd,
2004 struct epoll_event __user *, events,
2005 int, maxevents, int, timeout,
2006 const compat_sigset_t __user *, sigmask,
2007 compat_size_t, sigsetsize)
2008{
2009 long err;
2010 compat_sigset_t csigmask;
2011 sigset_t ksigmask, sigsaved;
2012
2013 /*
2014 * If the caller wants a certain signal mask to be set during the wait,
2015 * we apply it here.
2016 */
2017 if (sigmask) {
2018 if (sigsetsize != sizeof(compat_sigset_t))
2019 return -EINVAL;
2020 if (copy_from_user(&csigmask, sigmask, sizeof(csigmask)))
2021 return -EFAULT;
2022 sigset_from_compat(&ksigmask, &csigmask);
2023 sigdelsetmask(&ksigmask, sigmask(SIGKILL) | sigmask(SIGSTOP));
2024 sigprocmask(SIG_SETMASK, &ksigmask, &sigsaved);
2025 }
2026
2027 err = sys_epoll_wait(epfd, events, maxevents, timeout);
2028
2029 /*
2030 * If we changed the signal mask, we need to restore the original one.
2031 * In case we've got a signal while waiting, we do not restore the
2032 * signal mask yet, and we allow do_signal() to deliver the signal on
2033 * the way back to userspace, before the signal mask is restored.
2034 */
2035 if (sigmask) {
2036 if (err == -EINTR) {
2037 memcpy(&current->saved_sigmask, &sigsaved,
2038 sizeof(sigsaved));
2039 set_restore_sigmask();
2040 } else
2041 sigprocmask(SIG_SETMASK, &sigsaved, NULL);
2042 }
2043
2044 return err;
2045}
2046#endif
2047
2001static int __init eventpoll_init(void) 2048static int __init eventpoll_init(void)
2002{ 2049{
2003 struct sysinfo si; 2050 struct sysinfo si;
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index 5d8444268a16..d0be29fa94cf 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -755,9 +755,9 @@ out_destroy_group:
755 return fd; 755 return fd;
756} 756}
757 757
758SYSCALL_DEFINE(fanotify_mark)(int fanotify_fd, unsigned int flags, 758SYSCALL_DEFINE5(fanotify_mark, int, fanotify_fd, unsigned int, flags,
759 __u64 mask, int dfd, 759 __u64, mask, int, dfd,
760 const char __user * pathname) 760 const char __user *, pathname)
761{ 761{
762 struct inode *inode = NULL; 762 struct inode *inode = NULL;
763 struct vfsmount *mnt = NULL; 763 struct vfsmount *mnt = NULL;
@@ -857,17 +857,6 @@ fput_and_out:
857 return ret; 857 return ret;
858} 858}
859 859
860#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
861asmlinkage long SyS_fanotify_mark(long fanotify_fd, long flags, __u64 mask,
862 long dfd, long pathname)
863{
864 return SYSC_fanotify_mark((int) fanotify_fd, (unsigned int) flags,
865 mask, (int) dfd,
866 (const char __user *) pathname);
867}
868SYSCALL_ALIAS(sys_fanotify_mark, SyS_fanotify_mark);
869#endif
870
871/* 860/*
872 * fanotify_user_setup - Our initialization function. Note that we cannot return 861 * fanotify_user_setup - Our initialization function. Note that we cannot return
873 * error because we have compiled-in VFS hooks. So an (unlikely) failure here 862 * error because we have compiled-in VFS hooks. So an (unlikely) failure here
diff --git a/fs/open.c b/fs/open.c
index 68354466879f..8c741002f947 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -197,10 +197,7 @@ out:
197 197
198SYSCALL_DEFINE2(ftruncate, unsigned int, fd, unsigned long, length) 198SYSCALL_DEFINE2(ftruncate, unsigned int, fd, unsigned long, length)
199{ 199{
200 long ret = do_sys_ftruncate(fd, length, 1); 200 return do_sys_ftruncate(fd, length, 1);
201 /* avoid REGPARM breakage on x86: */
202 asmlinkage_protect(2, ret, fd, length);
203 return ret;
204} 201}
205 202
206#ifdef CONFIG_COMPAT 203#ifdef CONFIG_COMPAT
@@ -212,32 +209,15 @@ COMPAT_SYSCALL_DEFINE2(ftruncate, unsigned int, fd, compat_ulong_t, length)
212 209
213/* LFS versions of truncate are only needed on 32 bit machines */ 210/* LFS versions of truncate are only needed on 32 bit machines */
214#if BITS_PER_LONG == 32 211#if BITS_PER_LONG == 32
215SYSCALL_DEFINE(truncate64)(const char __user * path, loff_t length) 212SYSCALL_DEFINE2(truncate64, const char __user *, path, loff_t, length)
216{ 213{
217 return do_sys_truncate(path, length); 214 return do_sys_truncate(path, length);
218} 215}
219#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
220asmlinkage long SyS_truncate64(long path, loff_t length)
221{
222 return SYSC_truncate64((const char __user *) path, length);
223}
224SYSCALL_ALIAS(sys_truncate64, SyS_truncate64);
225#endif
226 216
227SYSCALL_DEFINE(ftruncate64)(unsigned int fd, loff_t length) 217SYSCALL_DEFINE2(ftruncate64, unsigned int, fd, loff_t, length)
228{ 218{
229 long ret = do_sys_ftruncate(fd, length, 0); 219 return do_sys_ftruncate(fd, length, 0);
230 /* avoid REGPARM breakage on x86: */
231 asmlinkage_protect(2, ret, fd, length);
232 return ret;
233}
234#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
235asmlinkage long SyS_ftruncate64(long fd, loff_t length)
236{
237 return SYSC_ftruncate64((unsigned int) fd, length);
238} 220}
239SYSCALL_ALIAS(sys_ftruncate64, SyS_ftruncate64);
240#endif
241#endif /* BITS_PER_LONG == 32 */ 221#endif /* BITS_PER_LONG == 32 */
242 222
243 223
@@ -299,7 +279,7 @@ int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
299 return ret; 279 return ret;
300} 280}
301 281
302SYSCALL_DEFINE(fallocate)(int fd, int mode, loff_t offset, loff_t len) 282SYSCALL_DEFINE4(fallocate, int, fd, int, mode, loff_t, offset, loff_t, len)
303{ 283{
304 struct fd f = fdget(fd); 284 struct fd f = fdget(fd);
305 int error = -EBADF; 285 int error = -EBADF;
@@ -311,14 +291,6 @@ SYSCALL_DEFINE(fallocate)(int fd, int mode, loff_t offset, loff_t len)
311 return error; 291 return error;
312} 292}
313 293
314#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
315asmlinkage long SyS_fallocate(long fd, long mode, loff_t offset, loff_t len)
316{
317 return SYSC_fallocate((int)fd, (int)mode, offset, len);
318}
319SYSCALL_ALIAS(sys_fallocate, SyS_fallocate);
320#endif
321
322/* 294/*
323 * access() needs to use the real uid/gid, not the effective uid/gid. 295 * access() needs to use the real uid/gid, not the effective uid/gid.
324 * We do this by temporarily clearing all FS-related capabilities and 296 * We do this by temporarily clearing all FS-related capabilities and
@@ -983,29 +955,19 @@ long do_sys_open(int dfd, const char __user *filename, int flags, umode_t mode)
983 955
984SYSCALL_DEFINE3(open, const char __user *, filename, int, flags, umode_t, mode) 956SYSCALL_DEFINE3(open, const char __user *, filename, int, flags, umode_t, mode)
985{ 957{
986 long ret;
987
988 if (force_o_largefile()) 958 if (force_o_largefile())
989 flags |= O_LARGEFILE; 959 flags |= O_LARGEFILE;
990 960
991 ret = do_sys_open(AT_FDCWD, filename, flags, mode); 961 return do_sys_open(AT_FDCWD, filename, flags, mode);
992 /* avoid REGPARM breakage on x86: */
993 asmlinkage_protect(3, ret, filename, flags, mode);
994 return ret;
995} 962}
996 963
997SYSCALL_DEFINE4(openat, int, dfd, const char __user *, filename, int, flags, 964SYSCALL_DEFINE4(openat, int, dfd, const char __user *, filename, int, flags,
998 umode_t, mode) 965 umode_t, mode)
999{ 966{
1000 long ret;
1001
1002 if (force_o_largefile()) 967 if (force_o_largefile())
1003 flags |= O_LARGEFILE; 968 flags |= O_LARGEFILE;
1004 969
1005 ret = do_sys_open(dfd, filename, flags, mode); 970 return do_sys_open(dfd, filename, flags, mode);
1006 /* avoid REGPARM breakage on x86: */
1007 asmlinkage_protect(4, ret, dfd, filename, flags, mode);
1008 return ret;
1009} 971}
1010 972
1011#ifndef __alpha__ 973#ifndef __alpha__
diff --git a/fs/read_write.c b/fs/read_write.c
index 7a648911246b..8274a794253b 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -515,8 +515,8 @@ SYSCALL_DEFINE3(write, unsigned int, fd, const char __user *, buf,
515 return ret; 515 return ret;
516} 516}
517 517
518SYSCALL_DEFINE(pread64)(unsigned int fd, char __user *buf, 518SYSCALL_DEFINE4(pread64, unsigned int, fd, char __user *, buf,
519 size_t count, loff_t pos) 519 size_t, count, loff_t, pos)
520{ 520{
521 struct fd f; 521 struct fd f;
522 ssize_t ret = -EBADF; 522 ssize_t ret = -EBADF;
@@ -534,17 +534,9 @@ SYSCALL_DEFINE(pread64)(unsigned int fd, char __user *buf,
534 534
535 return ret; 535 return ret;
536} 536}
537#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
538asmlinkage long SyS_pread64(long fd, long buf, long count, loff_t pos)
539{
540 return SYSC_pread64((unsigned int) fd, (char __user *) buf,
541 (size_t) count, pos);
542}
543SYSCALL_ALIAS(sys_pread64, SyS_pread64);
544#endif
545 537
546SYSCALL_DEFINE(pwrite64)(unsigned int fd, const char __user *buf, 538SYSCALL_DEFINE4(pwrite64, unsigned int, fd, const char __user *, buf,
547 size_t count, loff_t pos) 539 size_t, count, loff_t, pos)
548{ 540{
549 struct fd f; 541 struct fd f;
550 ssize_t ret = -EBADF; 542 ssize_t ret = -EBADF;
@@ -562,14 +554,6 @@ SYSCALL_DEFINE(pwrite64)(unsigned int fd, const char __user *buf,
562 554
563 return ret; 555 return ret;
564} 556}
565#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
566asmlinkage long SyS_pwrite64(long fd, long buf, long count, loff_t pos)
567{
568 return SYSC_pwrite64((unsigned int) fd, (const char __user *) buf,
569 (size_t) count, pos);
570}
571SYSCALL_ALIAS(sys_pwrite64, SyS_pwrite64);
572#endif
573 557
574/* 558/*
575 * Reduce an iovec's length in-place. Return the resulting number of segments 559 * Reduce an iovec's length in-place. Return the resulting number of segments
@@ -897,8 +881,8 @@ SYSCALL_DEFINE5(pwritev, unsigned long, fd, const struct iovec __user *, vec,
897 return ret; 881 return ret;
898} 882}
899 883
900ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos, size_t count, 884static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos,
901 loff_t max) 885 size_t count, loff_t max)
902{ 886{
903 struct fd in, out; 887 struct fd in, out;
904 struct inode *in_inode, *out_inode; 888 struct inode *in_inode, *out_inode;
@@ -1022,3 +1006,43 @@ SYSCALL_DEFINE4(sendfile64, int, out_fd, int, in_fd, loff_t __user *, offset, si
1022 1006
1023 return do_sendfile(out_fd, in_fd, NULL, count, 0); 1007 return do_sendfile(out_fd, in_fd, NULL, count, 0);
1024} 1008}
1009
1010#ifdef CONFIG_COMPAT
1011COMPAT_SYSCALL_DEFINE4(sendfile, int, out_fd, int, in_fd,
1012 compat_off_t __user *, offset, compat_size_t, count)
1013{
1014 loff_t pos;
1015 off_t off;
1016 ssize_t ret;
1017
1018 if (offset) {
1019 if (unlikely(get_user(off, offset)))
1020 return -EFAULT;
1021 pos = off;
1022 ret = do_sendfile(out_fd, in_fd, &pos, count, MAX_NON_LFS);
1023 if (unlikely(put_user(pos, offset)))
1024 return -EFAULT;
1025 return ret;
1026 }
1027
1028 return do_sendfile(out_fd, in_fd, NULL, count, 0);
1029}
1030
1031COMPAT_SYSCALL_DEFINE4(sendfile64, int, out_fd, int, in_fd,
1032 compat_loff_t __user *, offset, compat_size_t, count)
1033{
1034 loff_t pos;
1035 ssize_t ret;
1036
1037 if (offset) {
1038 if (unlikely(copy_from_user(&pos, offset, sizeof(loff_t))))
1039 return -EFAULT;
1040 ret = do_sendfile(out_fd, in_fd, &pos, count, 0);
1041 if (unlikely(put_user(pos, offset)))
1042 return -EFAULT;
1043 return ret;
1044 }
1045
1046 return do_sendfile(out_fd, in_fd, NULL, count, 0);
1047}
1048#endif
diff --git a/fs/read_write.h b/fs/read_write.h
index d3e00ef67420..d07b954c6e0c 100644
--- a/fs/read_write.h
+++ b/fs/read_write.h
@@ -12,5 +12,3 @@ ssize_t do_sync_readv_writev(struct file *filp, const struct iovec *iov,
12 unsigned long nr_segs, size_t len, loff_t *ppos, iov_fn_t fn); 12 unsigned long nr_segs, size_t len, loff_t *ppos, iov_fn_t fn);
13ssize_t do_loop_readv_writev(struct file *filp, struct iovec *iov, 13ssize_t do_loop_readv_writev(struct file *filp, struct iovec *iov,
14 unsigned long nr_segs, loff_t *ppos, io_fn_t fn); 14 unsigned long nr_segs, loff_t *ppos, io_fn_t fn);
15ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos, size_t count,
16 loff_t max);
diff --git a/fs/signalfd.c b/fs/signalfd.c
index b53486961735..424b7b65321f 100644
--- a/fs/signalfd.c
+++ b/fs/signalfd.c
@@ -30,6 +30,7 @@
30#include <linux/signalfd.h> 30#include <linux/signalfd.h>
31#include <linux/syscalls.h> 31#include <linux/syscalls.h>
32#include <linux/proc_fs.h> 32#include <linux/proc_fs.h>
33#include <linux/compat.h>
33 34
34void signalfd_cleanup(struct sighand_struct *sighand) 35void signalfd_cleanup(struct sighand_struct *sighand)
35{ 36{
@@ -311,3 +312,33 @@ SYSCALL_DEFINE3(signalfd, int, ufd, sigset_t __user *, user_mask,
311{ 312{
312 return sys_signalfd4(ufd, user_mask, sizemask, 0); 313 return sys_signalfd4(ufd, user_mask, sizemask, 0);
313} 314}
315
316#ifdef CONFIG_COMPAT
317COMPAT_SYSCALL_DEFINE4(signalfd4, int, ufd,
318 const compat_sigset_t __user *,sigmask,
319 compat_size_t, sigsetsize,
320 int, flags)
321{
322 compat_sigset_t ss32;
323 sigset_t tmp;
324 sigset_t __user *ksigmask;
325
326 if (sigsetsize != sizeof(compat_sigset_t))
327 return -EINVAL;
328 if (copy_from_user(&ss32, sigmask, sizeof(ss32)))
329 return -EFAULT;
330 sigset_from_compat(&tmp, &ss32);
331 ksigmask = compat_alloc_user_space(sizeof(sigset_t));
332 if (copy_to_user(ksigmask, &tmp, sizeof(sigset_t)))
333 return -EFAULT;
334
335 return sys_signalfd4(ufd, ksigmask, sizeof(sigset_t), flags);
336}
337
338COMPAT_SYSCALL_DEFINE3(signalfd, int, ufd,
339 const compat_sigset_t __user *,sigmask,
340 compat_size_t, sigsetsize)
341{
342 return compat_sys_signalfd4(ufd, sigmask, sigsetsize, 0);
343}
344#endif
diff --git a/fs/splice.c b/fs/splice.c
index 29e394e49ddd..6b485b8753bd 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -31,6 +31,7 @@
31#include <linux/security.h> 31#include <linux/security.h>
32#include <linux/gfp.h> 32#include <linux/gfp.h>
33#include <linux/socket.h> 33#include <linux/socket.h>
34#include <linux/compat.h>
34#include "internal.h" 35#include "internal.h"
35 36
36/* 37/*
@@ -1690,6 +1691,27 @@ SYSCALL_DEFINE4(vmsplice, int, fd, const struct iovec __user *, iov,
1690 return error; 1691 return error;
1691} 1692}
1692 1693
1694#ifdef CONFIG_COMPAT
1695COMPAT_SYSCALL_DEFINE4(vmsplice, int, fd, const struct compat_iovec __user *, iov32,
1696 unsigned int, nr_segs, unsigned int, flags)
1697{
1698 unsigned i;
1699 struct iovec __user *iov;
1700 if (nr_segs > UIO_MAXIOV)
1701 return -EINVAL;
1702 iov = compat_alloc_user_space(nr_segs * sizeof(struct iovec));
1703 for (i = 0; i < nr_segs; i++) {
1704 struct compat_iovec v;
1705 if (get_user(v.iov_base, &iov32[i].iov_base) ||
1706 get_user(v.iov_len, &iov32[i].iov_len) ||
1707 put_user(compat_ptr(v.iov_base), &iov[i].iov_base) ||
1708 put_user(v.iov_len, &iov[i].iov_len))
1709 return -EFAULT;
1710 }
1711 return sys_vmsplice(fd, iov, nr_segs, flags);
1712}
1713#endif
1714
1693SYSCALL_DEFINE6(splice, int, fd_in, loff_t __user *, off_in, 1715SYSCALL_DEFINE6(splice, int, fd_in, loff_t __user *, off_in,
1694 int, fd_out, loff_t __user *, off_out, 1716 int, fd_out, loff_t __user *, off_out,
1695 size_t, len, unsigned int, flags) 1717 size_t, len, unsigned int, flags)
diff --git a/fs/sync.c b/fs/sync.c
index 2c5d6639a66a..905f3f6b3d85 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -283,8 +283,8 @@ EXPORT_SYMBOL(generic_write_sync);
283 * already-instantiated disk blocks, there are no guarantees here that the data 283 * already-instantiated disk blocks, there are no guarantees here that the data
284 * will be available after a crash. 284 * will be available after a crash.
285 */ 285 */
286SYSCALL_DEFINE(sync_file_range)(int fd, loff_t offset, loff_t nbytes, 286SYSCALL_DEFINE4(sync_file_range, int, fd, loff_t, offset, loff_t, nbytes,
287 unsigned int flags) 287 unsigned int, flags)
288{ 288{
289 int ret; 289 int ret;
290 struct fd f; 290 struct fd f;
@@ -365,29 +365,11 @@ out_put:
365out: 365out:
366 return ret; 366 return ret;
367} 367}
368#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
369asmlinkage long SyS_sync_file_range(long fd, loff_t offset, loff_t nbytes,
370 long flags)
371{
372 return SYSC_sync_file_range((int) fd, offset, nbytes,
373 (unsigned int) flags);
374}
375SYSCALL_ALIAS(sys_sync_file_range, SyS_sync_file_range);
376#endif
377 368
378/* It would be nice if people remember that not all the world's an i386 369/* It would be nice if people remember that not all the world's an i386
379 when they introduce new system calls */ 370 when they introduce new system calls */
380SYSCALL_DEFINE(sync_file_range2)(int fd, unsigned int flags, 371SYSCALL_DEFINE4(sync_file_range2, int, fd, unsigned int, flags,
381 loff_t offset, loff_t nbytes) 372 loff_t, offset, loff_t, nbytes)
382{ 373{
383 return sys_sync_file_range(fd, offset, nbytes, flags); 374 return sys_sync_file_range(fd, offset, nbytes, flags);
384} 375}
385#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
386asmlinkage long SyS_sync_file_range2(long fd, long flags,
387 loff_t offset, loff_t nbytes)
388{
389 return SYSC_sync_file_range2((int) fd, (unsigned int) flags,
390 offset, nbytes);
391}
392SYSCALL_ALIAS(sys_sync_file_range2, SyS_sync_file_range2);
393#endif
diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h
index 4077b5d9ff81..0501fa3f783d 100644
--- a/include/asm-generic/unistd.h
+++ b/include/asm-generic/unistd.h
@@ -9,20 +9,3 @@
9#define __ARCH_WANT_STAT64 9#define __ARCH_WANT_STAT64
10#define __ARCH_WANT_SYS_LLSEEK 10#define __ARCH_WANT_SYS_LLSEEK
11#endif 11#endif
12
13/*
14 * "Conditional" syscalls
15 *
16 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
17 * but it doesn't work on all toolchains, so we just do it by hand
18 */
19#ifndef cond_syscall
20#ifdef CONFIG_SYMBOL_PREFIX
21#define __SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX
22#else
23#define __SYMBOL_PREFIX
24#endif
25#define cond_syscall(x) asm(".weak\t" __SYMBOL_PREFIX #x "\n\t" \
26 ".set\t" __SYMBOL_PREFIX #x "," \
27 __SYMBOL_PREFIX "sys_ni_syscall")
28#endif
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 377cd8c3395e..d53c35352ea9 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -27,12 +27,6 @@
27#define __SC_DELOUSE(t,v) ((t)(unsigned long)(v)) 27#define __SC_DELOUSE(t,v) ((t)(unsigned long)(v))
28#endif 28#endif
29 29
30#define __SC_CCAST1(t1, a1) __SC_DELOUSE(t1,a1)
31#define __SC_CCAST2(t2, a2, ...) __SC_DELOUSE(t2,a2), __SC_CCAST1(__VA_ARGS__)
32#define __SC_CCAST3(t3, a3, ...) __SC_DELOUSE(t3,a3), __SC_CCAST2(__VA_ARGS__)
33#define __SC_CCAST4(t4, a4, ...) __SC_DELOUSE(t4,a4), __SC_CCAST3(__VA_ARGS__)
34#define __SC_CCAST5(t5, a5, ...) __SC_DELOUSE(t5,a5), __SC_CCAST4(__VA_ARGS__)
35#define __SC_CCAST6(t6, a6, ...) __SC_DELOUSE(t6,a6), __SC_CCAST5(__VA_ARGS__)
36#define COMPAT_SYSCALL_DEFINE1(name, ...) \ 30#define COMPAT_SYSCALL_DEFINE1(name, ...) \
37 COMPAT_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__) 31 COMPAT_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
38#define COMPAT_SYSCALL_DEFINE2(name, ...) \ 32#define COMPAT_SYSCALL_DEFINE2(name, ...) \
@@ -46,24 +40,15 @@
46#define COMPAT_SYSCALL_DEFINE6(name, ...) \ 40#define COMPAT_SYSCALL_DEFINE6(name, ...) \
47 COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__) 41 COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
48 42
49#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
50
51#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \ 43#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \
52 asmlinkage long compat_sys##name(__SC_DECL##x(__VA_ARGS__)); \ 44 asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
53 static inline long C_SYSC##name(__SC_DECL##x(__VA_ARGS__)); \ 45 static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
54 asmlinkage long compat_SyS##name(__SC_LONG##x(__VA_ARGS__)) \ 46 asmlinkage long compat_SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__))\
55 { \ 47 { \
56 return (long) C_SYSC##name(__SC_CCAST##x(__VA_ARGS__)); \ 48 return C_SYSC##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__)); \
57 } \ 49 } \
58 SYSCALL_ALIAS(compat_sys##name, compat_SyS##name); \ 50 SYSCALL_ALIAS(compat_sys##name, compat_SyS##name); \
59 static inline long C_SYSC##name(__SC_DECL##x(__VA_ARGS__)) 51 static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__))
60
61#else /* CONFIG_HAVE_SYSCALL_WRAPPERS */
62
63#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \
64 asmlinkage long compat_sys##name(__SC_DECL##x(__VA_ARGS__))
65
66#endif /* CONFIG_HAVE_SYSCALL_WRAPPERS */
67 52
68#ifndef compat_user_stack_pointer 53#ifndef compat_user_stack_pointer
69#define compat_user_stack_pointer() current_user_stack_pointer() 54#define compat_user_stack_pointer() current_user_stack_pointer()
@@ -326,21 +311,13 @@ asmlinkage long
326compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr, 311compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr,
327 compat_size_t __user *len_ptr); 312 compat_size_t __user *len_ptr);
328 313
329#ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC 314asmlinkage long compat_sys_ipc(u32, int, int, u32, compat_uptr_t, u32);
330long compat_sys_semctl(int first, int second, int third, void __user *uptr); 315asmlinkage long compat_sys_shmat(int shmid, compat_uptr_t shmaddr, int shmflg);
331long compat_sys_msgsnd(int first, int second, int third, void __user *uptr); 316asmlinkage long compat_sys_semctl(int semid, int semnum, int cmd, int arg);
332long compat_sys_msgrcv(int first, int second, int msgtyp, int third, 317asmlinkage long compat_sys_msgsnd(int msqid, compat_uptr_t msgp,
333 int version, void __user *uptr);
334long compat_sys_shmat(int first, int second, compat_uptr_t third, int version,
335 void __user *uptr);
336#else
337long compat_sys_semctl(int semid, int semnum, int cmd, int arg);
338long compat_sys_msgsnd(int msqid, struct compat_msgbuf __user *msgp,
339 compat_ssize_t msgsz, int msgflg); 318 compat_ssize_t msgsz, int msgflg);
340long compat_sys_msgrcv(int msqid, struct compat_msgbuf __user *msgp, 319asmlinkage long compat_sys_msgrcv(int msqid, compat_uptr_t msgp,
341 compat_ssize_t msgsz, long msgtyp, int msgflg); 320 compat_ssize_t msgsz, long msgtyp, int msgflg);
342long compat_sys_shmat(int shmid, compat_uptr_t shmaddr, int shmflg);
343#endif
344long compat_sys_msgctl(int first, int second, void __user *uptr); 321long compat_sys_msgctl(int first, int second, void __user *uptr);
345long compat_sys_shmctl(int first, int second, void __user *uptr); 322long compat_sys_shmctl(int first, int second, void __user *uptr);
346long compat_sys_semtimedop(int semid, struct sembuf __user *tsems, 323long compat_sys_semtimedop(int semid, struct sembuf __user *tsems,
@@ -444,13 +421,13 @@ extern long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
444asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid, 421asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid,
445 compat_long_t addr, compat_long_t data); 422 compat_long_t addr, compat_long_t data);
446 423
424asmlinkage long compat_sys_lookup_dcookie(u32, u32, char __user *, size_t);
447/* 425/*
448 * epoll (fs/eventpoll.c) compat bits follow ... 426 * epoll (fs/eventpoll.c) compat bits follow ...
449 */ 427 */
450struct epoll_event; 428struct epoll_event; /* fortunately, this one is fixed-layout */
451#define compat_epoll_event epoll_event
452asmlinkage long compat_sys_epoll_pwait(int epfd, 429asmlinkage long compat_sys_epoll_pwait(int epfd,
453 struct compat_epoll_event __user *events, 430 struct epoll_event __user *events,
454 int maxevents, int timeout, 431 int maxevents, int timeout,
455 const compat_sigset_t __user *sigmask, 432 const compat_sigset_t __user *sigmask,
456 compat_size_t sigsetsize); 433 compat_size_t sigsetsize);
@@ -685,6 +662,8 @@ asmlinkage ssize_t compat_sys_process_vm_writev(compat_pid_t pid,
685 662
686asmlinkage long compat_sys_sendfile(int out_fd, int in_fd, 663asmlinkage long compat_sys_sendfile(int out_fd, int in_fd,
687 compat_off_t __user *offset, compat_size_t count); 664 compat_off_t __user *offset, compat_size_t count);
665asmlinkage long compat_sys_sendfile64(int out_fd, int in_fd,
666 compat_loff_t __user *offset, compat_size_t count);
688asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr, 667asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr,
689 compat_stack_t __user *uoss_ptr); 668 compat_stack_t __user *uoss_ptr);
690 669
diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index 807f1e533226..829d66c67fc2 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -2,6 +2,7 @@
2#define _LINUX_LINKAGE_H 2#define _LINUX_LINKAGE_H
3 3
4#include <linux/compiler.h> 4#include <linux/compiler.h>
5#include <linux/stringify.h>
5#include <asm/linkage.h> 6#include <asm/linkage.h>
6 7
7#ifdef __cplusplus 8#ifdef __cplusplus
@@ -14,6 +15,26 @@
14#define asmlinkage CPP_ASMLINKAGE 15#define asmlinkage CPP_ASMLINKAGE
15#endif 16#endif
16 17
18#ifndef SYMBOL_NAME
19#ifdef CONFIG_SYMBOL_PREFIX
20#define SYMBOL_NAME(x) CONFIG_SYMBOL_PREFIX ## x
21#else
22#define SYMBOL_NAME(x) x
23#endif
24#endif
25#define __SYMBOL_NAME(x) __stringify(SYMBOL_NAME(x))
26
27#ifndef cond_syscall
28#define cond_syscall(x) asm(".weak\t" __SYMBOL_NAME(x) \
29 "\n\t.set\t" __SYMBOL_NAME(x) "," __SYMBOL_NAME(sys_ni_syscall));
30#endif
31
32#ifndef SYSCALL_ALIAS
33#define SYSCALL_ALIAS(alias, name) \
34 asm ("\t.globl " __SYMBOL_NAME(alias) \
35 "\n\t.set\t" __SYMBOL_NAME(alias) "," __SYMBOL_NAME(name))
36#endif
37
17#define __page_aligned_data __section(.data..page_aligned) __aligned(PAGE_SIZE) 38#define __page_aligned_data __section(.data..page_aligned) __aligned(PAGE_SIZE)
18#define __page_aligned_bss __section(.bss..page_aligned) __aligned(PAGE_SIZE) 39#define __page_aligned_bss __section(.bss..page_aligned) __aligned(PAGE_SIZE)
19 40
diff --git a/include/linux/mm.h b/include/linux/mm.h
index c05d7cfbb6b9..1a7f19e7f1a0 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1082,9 +1082,6 @@ extern unsigned long move_page_tables(struct vm_area_struct *vma,
1082 unsigned long old_addr, struct vm_area_struct *new_vma, 1082 unsigned long old_addr, struct vm_area_struct *new_vma,
1083 unsigned long new_addr, unsigned long len, 1083 unsigned long new_addr, unsigned long len,
1084 bool need_rmap_locks); 1084 bool need_rmap_locks);
1085extern unsigned long do_mremap(unsigned long addr,
1086 unsigned long old_len, unsigned long new_len,
1087 unsigned long flags, unsigned long new_addr);
1088extern unsigned long change_protection(struct vm_area_struct *vma, unsigned long start, 1085extern unsigned long change_protection(struct vm_area_struct *vma, unsigned long start,
1089 unsigned long end, pgprot_t newprot, 1086 unsigned long end, pgprot_t newprot,
1090 int dirty_accountable, int prot_numa); 1087 int dirty_accountable, int prot_numa);
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 313a8e0a6553..4147d700a293 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -78,49 +78,34 @@ struct sigaltstack;
78#include <linux/key.h> 78#include <linux/key.h>
79#include <trace/syscall.h> 79#include <trace/syscall.h>
80 80
81#define __SC_DECL1(t1, a1) t1 a1 81/*
82#define __SC_DECL2(t2, a2, ...) t2 a2, __SC_DECL1(__VA_ARGS__) 82 * __MAP - apply a macro to syscall arguments
83#define __SC_DECL3(t3, a3, ...) t3 a3, __SC_DECL2(__VA_ARGS__) 83 * __MAP(n, m, t1, a1, t2, a2, ..., tn, an) will expand to
84#define __SC_DECL4(t4, a4, ...) t4 a4, __SC_DECL3(__VA_ARGS__) 84 * m(t1, a1), m(t2, a2), ..., m(tn, an)
85#define __SC_DECL5(t5, a5, ...) t5 a5, __SC_DECL4(__VA_ARGS__) 85 * The first argument must be equal to the amount of type/name
86#define __SC_DECL6(t6, a6, ...) t6 a6, __SC_DECL5(__VA_ARGS__) 86 * pairs given. Note that this list of pairs (i.e. the arguments
87 87 * of __MAP starting at the third one) is in the same format as
88#define __SC_LONG1(t1, a1) long a1 88 * for SYSCALL_DEFINE<n>/COMPAT_SYSCALL_DEFINE<n>
89#define __SC_LONG2(t2, a2, ...) long a2, __SC_LONG1(__VA_ARGS__) 89 */
90#define __SC_LONG3(t3, a3, ...) long a3, __SC_LONG2(__VA_ARGS__) 90#define __MAP0(m,...)
91#define __SC_LONG4(t4, a4, ...) long a4, __SC_LONG3(__VA_ARGS__) 91#define __MAP1(m,t,a) m(t,a)
92#define __SC_LONG5(t5, a5, ...) long a5, __SC_LONG4(__VA_ARGS__) 92#define __MAP2(m,t,a,...) m(t,a), __MAP1(m,__VA_ARGS__)
93#define __SC_LONG6(t6, a6, ...) long a6, __SC_LONG5(__VA_ARGS__) 93#define __MAP3(m,t,a,...) m(t,a), __MAP2(m,__VA_ARGS__)
94 94#define __MAP4(m,t,a,...) m(t,a), __MAP3(m,__VA_ARGS__)
95#define __SC_CAST1(t1, a1) (t1) a1 95#define __MAP5(m,t,a,...) m(t,a), __MAP4(m,__VA_ARGS__)
96#define __SC_CAST2(t2, a2, ...) (t2) a2, __SC_CAST1(__VA_ARGS__) 96#define __MAP6(m,t,a,...) m(t,a), __MAP5(m,__VA_ARGS__)
97#define __SC_CAST3(t3, a3, ...) (t3) a3, __SC_CAST2(__VA_ARGS__) 97#define __MAP(n,...) __MAP##n(__VA_ARGS__)
98#define __SC_CAST4(t4, a4, ...) (t4) a4, __SC_CAST3(__VA_ARGS__) 98
99#define __SC_CAST5(t5, a5, ...) (t5) a5, __SC_CAST4(__VA_ARGS__) 99#define __SC_DECL(t, a) t a
100#define __SC_CAST6(t6, a6, ...) (t6) a6, __SC_CAST5(__VA_ARGS__) 100#define __TYPE_IS_LL(t) (__same_type((t)0, 0LL) || __same_type((t)0, 0ULL))
101 101#define __SC_LONG(t, a) __typeof(__builtin_choose_expr(__TYPE_IS_LL(t), 0LL, 0L)) a
102#define __SC_TEST(type) BUILD_BUG_ON(sizeof(type) > sizeof(long)) 102#define __SC_CAST(t, a) (t) a
103#define __SC_TEST1(t1, a1) __SC_TEST(t1) 103#define __SC_ARGS(t, a) a
104#define __SC_TEST2(t2, a2, ...) __SC_TEST(t2); __SC_TEST1(__VA_ARGS__) 104#define __SC_TEST(t, a) (void)BUILD_BUG_ON_ZERO(!__TYPE_IS_LL(t) && sizeof(t) > sizeof(long))
105#define __SC_TEST3(t3, a3, ...) __SC_TEST(t3); __SC_TEST2(__VA_ARGS__)
106#define __SC_TEST4(t4, a4, ...) __SC_TEST(t4); __SC_TEST3(__VA_ARGS__)
107#define __SC_TEST5(t5, a5, ...) __SC_TEST(t5); __SC_TEST4(__VA_ARGS__)
108#define __SC_TEST6(t6, a6, ...) __SC_TEST(t6); __SC_TEST5(__VA_ARGS__)
109 105
110#ifdef CONFIG_FTRACE_SYSCALLS 106#ifdef CONFIG_FTRACE_SYSCALLS
111#define __SC_STR_ADECL1(t, a) #a 107#define __SC_STR_ADECL(t, a) #a
112#define __SC_STR_ADECL2(t, a, ...) #a, __SC_STR_ADECL1(__VA_ARGS__) 108#define __SC_STR_TDECL(t, a) #t
113#define __SC_STR_ADECL3(t, a, ...) #a, __SC_STR_ADECL2(__VA_ARGS__)
114#define __SC_STR_ADECL4(t, a, ...) #a, __SC_STR_ADECL3(__VA_ARGS__)
115#define __SC_STR_ADECL5(t, a, ...) #a, __SC_STR_ADECL4(__VA_ARGS__)
116#define __SC_STR_ADECL6(t, a, ...) #a, __SC_STR_ADECL5(__VA_ARGS__)
117
118#define __SC_STR_TDECL1(t, a) #t
119#define __SC_STR_TDECL2(t, a, ...) #t, __SC_STR_TDECL1(__VA_ARGS__)
120#define __SC_STR_TDECL3(t, a, ...) #t, __SC_STR_TDECL2(__VA_ARGS__)
121#define __SC_STR_TDECL4(t, a, ...) #t, __SC_STR_TDECL3(__VA_ARGS__)
122#define __SC_STR_TDECL5(t, a, ...) #t, __SC_STR_TDECL4(__VA_ARGS__)
123#define __SC_STR_TDECL6(t, a, ...) #t, __SC_STR_TDECL5(__VA_ARGS__)
124 109
125extern struct ftrace_event_class event_class_syscall_enter; 110extern struct ftrace_event_class event_class_syscall_enter;
126extern struct ftrace_event_class event_class_syscall_exit; 111extern struct ftrace_event_class event_class_syscall_exit;
@@ -155,7 +140,13 @@ extern struct trace_event_functions exit_syscall_print_funcs;
155 __attribute__((section("_ftrace_events"))) \ 140 __attribute__((section("_ftrace_events"))) \
156 *__event_exit_##sname = &event_exit_##sname; 141 *__event_exit_##sname = &event_exit_##sname;
157 142
158#define SYSCALL_METADATA(sname, nb) \ 143#define SYSCALL_METADATA(sname, nb, ...) \
144 static const char *types_##sname[] = { \
145 __MAP(nb,__SC_STR_TDECL,__VA_ARGS__) \
146 }; \
147 static const char *args_##sname[] = { \
148 __MAP(nb,__SC_STR_ADECL,__VA_ARGS__) \
149 }; \
159 SYSCALL_TRACE_ENTER_EVENT(sname); \ 150 SYSCALL_TRACE_ENTER_EVENT(sname); \
160 SYSCALL_TRACE_EXIT_EVENT(sname); \ 151 SYSCALL_TRACE_EXIT_EVENT(sname); \
161 static struct syscall_metadata __used \ 152 static struct syscall_metadata __used \
@@ -163,8 +154,8 @@ extern struct trace_event_functions exit_syscall_print_funcs;
163 .name = "sys"#sname, \ 154 .name = "sys"#sname, \
164 .syscall_nr = -1, /* Filled in at boot */ \ 155 .syscall_nr = -1, /* Filled in at boot */ \
165 .nb_args = nb, \ 156 .nb_args = nb, \
166 .types = types_##sname, \ 157 .types = nb ? types_##sname : NULL, \
167 .args = args_##sname, \ 158 .args = nb ? args_##sname : NULL, \
168 .enter_event = &event_enter_##sname, \ 159 .enter_event = &event_enter_##sname, \
169 .exit_event = &event_exit_##sname, \ 160 .exit_event = &event_exit_##sname, \
170 .enter_fields = LIST_HEAD_INIT(__syscall_meta_##sname.enter_fields), \ 161 .enter_fields = LIST_HEAD_INIT(__syscall_meta_##sname.enter_fields), \
@@ -172,26 +163,13 @@ extern struct trace_event_functions exit_syscall_print_funcs;
172 static struct syscall_metadata __used \ 163 static struct syscall_metadata __used \
173 __attribute__((section("__syscalls_metadata"))) \ 164 __attribute__((section("__syscalls_metadata"))) \
174 *__p_syscall_meta_##sname = &__syscall_meta_##sname; 165 *__p_syscall_meta_##sname = &__syscall_meta_##sname;
166#else
167#define SYSCALL_METADATA(sname, nb, ...)
168#endif
175 169
176#define SYSCALL_DEFINE0(sname) \ 170#define SYSCALL_DEFINE0(sname) \
177 SYSCALL_TRACE_ENTER_EVENT(_##sname); \ 171 SYSCALL_METADATA(_##sname, 0); \
178 SYSCALL_TRACE_EXIT_EVENT(_##sname); \
179 static struct syscall_metadata __used \
180 __syscall_meta__##sname = { \
181 .name = "sys_"#sname, \
182 .syscall_nr = -1, /* Filled in at boot */ \
183 .nb_args = 0, \
184 .enter_event = &event_enter__##sname, \
185 .exit_event = &event_exit__##sname, \
186 .enter_fields = LIST_HEAD_INIT(__syscall_meta__##sname.enter_fields), \
187 }; \
188 static struct syscall_metadata __used \
189 __attribute__((section("__syscalls_metadata"))) \
190 *__p_syscall_meta_##sname = &__syscall_meta__##sname; \
191 asmlinkage long sys_##sname(void) 172 asmlinkage long sys_##sname(void)
192#else
193#define SYSCALL_DEFINE0(name) asmlinkage long sys_##name(void)
194#endif
195 173
196#define SYSCALL_DEFINE1(name, ...) SYSCALL_DEFINEx(1, _##name, __VA_ARGS__) 174#define SYSCALL_DEFINE1(name, ...) SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
197#define SYSCALL_DEFINE2(name, ...) SYSCALL_DEFINEx(2, _##name, __VA_ARGS__) 175#define SYSCALL_DEFINE2(name, ...) SYSCALL_DEFINEx(2, _##name, __VA_ARGS__)
@@ -200,57 +178,23 @@ extern struct trace_event_functions exit_syscall_print_funcs;
200#define SYSCALL_DEFINE5(name, ...) SYSCALL_DEFINEx(5, _##name, __VA_ARGS__) 178#define SYSCALL_DEFINE5(name, ...) SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
201#define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name, __VA_ARGS__) 179#define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
202 180
203#ifdef CONFIG_PPC64
204#define SYSCALL_ALIAS(alias, name) \
205 asm ("\t.globl " #alias "\n\t.set " #alias ", " #name "\n" \
206 "\t.globl ." #alias "\n\t.set ." #alias ", ." #name)
207#else
208#if defined(CONFIG_ALPHA) || defined(CONFIG_MIPS)
209#define SYSCALL_ALIAS(alias, name) \
210 asm ( #alias " = " #name "\n\t.globl " #alias)
211#else
212#define SYSCALL_ALIAS(alias, name) \
213 asm ("\t.globl " #alias "\n\t.set " #alias ", " #name)
214#endif
215#endif
216
217#ifdef CONFIG_FTRACE_SYSCALLS
218#define SYSCALL_DEFINEx(x, sname, ...) \ 181#define SYSCALL_DEFINEx(x, sname, ...) \
219 static const char *types_##sname[] = { \ 182 SYSCALL_METADATA(sname, x, __VA_ARGS__) \
220 __SC_STR_TDECL##x(__VA_ARGS__) \
221 }; \
222 static const char *args_##sname[] = { \
223 __SC_STR_ADECL##x(__VA_ARGS__) \
224 }; \
225 SYSCALL_METADATA(sname, x); \
226 __SYSCALL_DEFINEx(x, sname, __VA_ARGS__) 183 __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
227#else
228#define SYSCALL_DEFINEx(x, sname, ...) \
229 __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
230#endif
231
232#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
233
234#define SYSCALL_DEFINE(name) static inline long SYSC_##name
235 184
185#define __PROTECT(...) asmlinkage_protect(__VA_ARGS__)
236#define __SYSCALL_DEFINEx(x, name, ...) \ 186#define __SYSCALL_DEFINEx(x, name, ...) \
237 asmlinkage long sys##name(__SC_DECL##x(__VA_ARGS__)); \ 187 asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \
238 static inline long SYSC##name(__SC_DECL##x(__VA_ARGS__)); \ 188 static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \
239 asmlinkage long SyS##name(__SC_LONG##x(__VA_ARGS__)) \ 189 asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
240 { \ 190 { \
241 __SC_TEST##x(__VA_ARGS__); \ 191 long ret = SYSC##name(__MAP(x,__SC_CAST,__VA_ARGS__)); \
242 return (long) SYSC##name(__SC_CAST##x(__VA_ARGS__)); \ 192 __MAP(x,__SC_TEST,__VA_ARGS__); \
193 __PROTECT(x, ret,__MAP(x,__SC_ARGS,__VA_ARGS__)); \
194 return ret; \
243 } \ 195 } \
244 SYSCALL_ALIAS(sys##name, SyS##name); \ 196 SYSCALL_ALIAS(sys##name, SyS##name); \
245 static inline long SYSC##name(__SC_DECL##x(__VA_ARGS__)) 197 static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__))
246
247#else /* CONFIG_HAVE_SYSCALL_WRAPPERS */
248
249#define SYSCALL_DEFINE(name) asmlinkage long sys_##name
250#define __SYSCALL_DEFINEx(x, name, ...) \
251 asmlinkage long sys##name(__SC_DECL##x(__VA_ARGS__))
252
253#endif /* CONFIG_HAVE_SYSCALL_WRAPPERS */
254 198
255asmlinkage long sys_time(time_t __user *tloc); 199asmlinkage long sys_time(time_t __user *tloc);
256asmlinkage long sys_stime(time_t __user *tptr); 200asmlinkage long sys_stime(time_t __user *tptr);
@@ -694,7 +638,7 @@ asmlinkage long sys_msgctl(int msqid, int cmd, struct msqid_ds __user *buf);
694asmlinkage long sys_semget(key_t key, int nsems, int semflg); 638asmlinkage long sys_semget(key_t key, int nsems, int semflg);
695asmlinkage long sys_semop(int semid, struct sembuf __user *sops, 639asmlinkage long sys_semop(int semid, struct sembuf __user *sops,
696 unsigned nsops); 640 unsigned nsops);
697asmlinkage long sys_semctl(int semid, int semnum, int cmd, union semun arg); 641asmlinkage long sys_semctl(int semid, int semnum, int cmd, unsigned long arg);
698asmlinkage long sys_semtimedop(int semid, struct sembuf __user *sops, 642asmlinkage long sys_semtimedop(int semid, struct sembuf __user *sops,
699 unsigned nsops, 643 unsigned nsops,
700 const struct timespec __user *timeout); 644 const struct timespec __user *timeout);
diff --git a/ipc/compat.c b/ipc/compat.c
index 2547f29dcd1b..892f6585dd60 100644
--- a/ipc/compat.c
+++ b/ipc/compat.c
@@ -240,7 +240,7 @@ static inline int put_compat_semid_ds(struct semid64_ds *s,
240 240
241static long do_compat_semctl(int first, int second, int third, u32 pad) 241static long do_compat_semctl(int first, int second, int third, u32 pad)
242{ 242{
243 union semun fourth; 243 unsigned long fourth;
244 int err, err2; 244 int err, err2;
245 struct semid64_ds s64; 245 struct semid64_ds s64;
246 struct semid64_ds __user *up64; 246 struct semid64_ds __user *up64;
@@ -249,9 +249,13 @@ static long do_compat_semctl(int first, int second, int third, u32 pad)
249 memset(&s64, 0, sizeof(s64)); 249 memset(&s64, 0, sizeof(s64));
250 250
251 if ((third & (~IPC_64)) == SETVAL) 251 if ((third & (~IPC_64)) == SETVAL)
252 fourth.val = (int) pad; 252#ifdef __BIG_ENDIAN
253 fourth = (unsigned long)pad << 32;
254#else
255 fourth = pad;
256#endif
253 else 257 else
254 fourth.__pad = compat_ptr(pad); 258 fourth = (unsigned long)compat_ptr(pad);
255 switch (third & (~IPC_64)) { 259 switch (third & (~IPC_64)) {
256 case IPC_INFO: 260 case IPC_INFO:
257 case IPC_RMID: 261 case IPC_RMID:
@@ -269,7 +273,7 @@ static long do_compat_semctl(int first, int second, int third, u32 pad)
269 case IPC_STAT: 273 case IPC_STAT:
270 case SEM_STAT: 274 case SEM_STAT:
271 up64 = compat_alloc_user_space(sizeof(s64)); 275 up64 = compat_alloc_user_space(sizeof(s64));
272 fourth.__pad = up64; 276 fourth = (unsigned long)up64;
273 err = sys_semctl(first, second, third, fourth); 277 err = sys_semctl(first, second, third, fourth);
274 if (err < 0) 278 if (err < 0)
275 break; 279 break;
@@ -295,7 +299,7 @@ static long do_compat_semctl(int first, int second, int third, u32 pad)
295 if (err) 299 if (err)
296 break; 300 break;
297 301
298 fourth.__pad = up64; 302 fourth = (unsigned long)up64;
299 err = sys_semctl(first, second, third, fourth); 303 err = sys_semctl(first, second, third, fourth);
300 break; 304 break;
301 305
@@ -306,7 +310,7 @@ static long do_compat_semctl(int first, int second, int third, u32 pad)
306 return err; 310 return err;
307} 311}
308 312
309long compat_do_msg_fill(void __user *dest, struct msg_msg *msg, size_t bufsz) 313static long compat_do_msg_fill(void __user *dest, struct msg_msg *msg, size_t bufsz)
310{ 314{
311 struct compat_msgbuf __user *msgp = dest; 315 struct compat_msgbuf __user *msgp = dest;
312 size_t msgsz; 316 size_t msgsz;
@@ -320,77 +324,117 @@ long compat_do_msg_fill(void __user *dest, struct msg_msg *msg, size_t bufsz)
320 return msgsz; 324 return msgsz;
321} 325}
322 326
327#ifndef COMPAT_SHMLBA
328#define COMPAT_SHMLBA SHMLBA
329#endif
330
323#ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC 331#ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC
324long compat_sys_semctl(int first, int second, int third, void __user *uptr) 332COMPAT_SYSCALL_DEFINE6(ipc, u32, call, int, first, int, second,
333 u32, third, compat_uptr_t, ptr, u32, fifth)
325{ 334{
335 int version;
326 u32 pad; 336 u32 pad;
327 337
328 if (!uptr) 338 version = call >> 16; /* hack for backward compatibility */
329 return -EINVAL; 339 call &= 0xffff;
330 if (get_user(pad, (u32 __user *) uptr)) 340
331 return -EFAULT; 341 switch (call) {
332 return do_compat_semctl(first, second, third, pad); 342 case SEMOP:
333} 343 /* struct sembuf is the same on 32 and 64bit :)) */
344 return sys_semtimedop(first, compat_ptr(ptr), second, NULL);
345 case SEMTIMEDOP:
346 return compat_sys_semtimedop(first, compat_ptr(ptr), second,
347 compat_ptr(fifth));
348 case SEMGET:
349 return sys_semget(first, second, third);
350 case SEMCTL:
351 if (!ptr)
352 return -EINVAL;
353 if (get_user(pad, (u32 __user *) compat_ptr(ptr)))
354 return -EFAULT;
355 return do_compat_semctl(first, second, third, pad);
334 356
335long compat_sys_msgsnd(int first, int second, int third, void __user *uptr) 357 case MSGSND: {
336{ 358 struct compat_msgbuf __user *up = compat_ptr(ptr);
337 struct compat_msgbuf __user *up = uptr; 359 compat_long_t type;
338 long type;
339 360
340 if (first < 0) 361 if (first < 0 || second < 0)
341 return -EINVAL; 362 return -EINVAL;
342 if (second < 0)
343 return -EINVAL;
344 363
345 if (get_user(type, &up->mtype)) 364 if (get_user(type, &up->mtype))
346 return -EFAULT; 365 return -EFAULT;
347 366
348 return do_msgsnd(first, type, up->mtext, second, third); 367 return do_msgsnd(first, type, up->mtext, second, third);
349} 368 }
369 case MSGRCV: {
370 void __user *uptr = compat_ptr(ptr);
350 371
351long compat_sys_msgrcv(int first, int second, int msgtyp, int third, 372 if (first < 0 || second < 0)
352 int version, void __user *uptr)
353{
354 if (first < 0)
355 return -EINVAL;
356 if (second < 0)
357 return -EINVAL;
358
359 if (!version) {
360 struct compat_ipc_kludge ipck;
361 if (!uptr)
362 return -EINVAL; 373 return -EINVAL;
363 if (copy_from_user (&ipck, uptr, sizeof(ipck))) 374
364 return -EFAULT; 375 if (!version) {
365 uptr = compat_ptr(ipck.msgp); 376 struct compat_ipc_kludge ipck;
366 msgtyp = ipck.msgtyp; 377 if (!uptr)
378 return -EINVAL;
379 if (copy_from_user (&ipck, uptr, sizeof(ipck)))
380 return -EFAULT;
381 uptr = compat_ptr(ipck.msgp);
382 fifth = ipck.msgtyp;
383 }
384 return do_msgrcv(first, uptr, second, fifth, third,
385 compat_do_msg_fill);
367 } 386 }
368 return do_msgrcv(first, uptr, second, msgtyp, third, 387 case MSGGET:
369 compat_do_msg_fill); 388 return sys_msgget(first, second);
389 case MSGCTL:
390 return compat_sys_msgctl(first, second, compat_ptr(ptr));
391
392 case SHMAT: {
393 int err;
394 unsigned long raddr;
395
396 if (version == 1)
397 return -EINVAL;
398 err = do_shmat(first, compat_ptr(ptr), second, &raddr,
399 COMPAT_SHMLBA);
400 if (err < 0)
401 return err;
402 return put_user(raddr, (compat_ulong_t *)compat_ptr(third));
403 }
404 case SHMDT:
405 return sys_shmdt(compat_ptr(ptr));
406 case SHMGET:
407 return sys_shmget(first, (unsigned)second, third);
408 case SHMCTL:
409 return compat_sys_shmctl(first, second, compat_ptr(ptr));
410 }
411
412 return -ENOSYS;
370} 413}
371#else 414#endif
372long compat_sys_semctl(int semid, int semnum, int cmd, int arg) 415
416COMPAT_SYSCALL_DEFINE4(semctl, int, semid, int, semnum, int, cmd, int, arg)
373{ 417{
374 return do_compat_semctl(semid, semnum, cmd, arg); 418 return do_compat_semctl(semid, semnum, cmd, arg);
375} 419}
376 420
377long compat_sys_msgsnd(int msqid, struct compat_msgbuf __user *msgp, 421COMPAT_SYSCALL_DEFINE4(msgsnd, int, msqid, compat_uptr_t, msgp,
378 compat_ssize_t msgsz, int msgflg) 422 compat_ssize_t, msgsz, int, msgflg)
379{ 423{
424 struct compat_msgbuf __user *up = compat_ptr(msgp);
380 compat_long_t mtype; 425 compat_long_t mtype;
381 426
382 if (get_user(mtype, &msgp->mtype)) 427 if (get_user(mtype, &up->mtype))
383 return -EFAULT; 428 return -EFAULT;
384 return do_msgsnd(msqid, mtype, msgp->mtext, (ssize_t)msgsz, msgflg); 429 return do_msgsnd(msqid, mtype, up->mtext, (ssize_t)msgsz, msgflg);
385} 430}
386 431
387long compat_sys_msgrcv(int msqid, struct compat_msgbuf __user *msgp, 432COMPAT_SYSCALL_DEFINE5(msgrcv, int, msqid, compat_uptr_t, msgp,
388 compat_ssize_t msgsz, long msgtyp, int msgflg) 433 compat_ssize_t, msgsz, long, msgtyp, int, msgflg)
389{ 434{
390 return do_msgrcv(msqid, msgp, (ssize_t)msgsz, msgtyp, msgflg, 435 return do_msgrcv(msqid, compat_ptr(msgp), (ssize_t)msgsz, msgtyp,
391 compat_do_msg_fill); 436 msgflg, compat_do_msg_fill);
392} 437}
393#endif
394 438
395static inline int get_compat_msqid64(struct msqid64_ds *m64, 439static inline int get_compat_msqid64(struct msqid64_ds *m64,
396 struct compat_msqid64_ds __user *up64) 440 struct compat_msqid64_ds __user *up64)
@@ -508,28 +552,7 @@ long compat_sys_msgctl(int first, int second, void __user *uptr)
508 return err; 552 return err;
509} 553}
510 554
511#ifndef COMPAT_SHMLBA 555COMPAT_SYSCALL_DEFINE3(shmat, int, shmid, compat_uptr_t, shmaddr, int, shmflg)
512#define COMPAT_SHMLBA SHMLBA
513#endif
514
515#ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC
516long compat_sys_shmat(int first, int second, compat_uptr_t third, int version,
517 void __user *uptr)
518{
519 int err;
520 unsigned long raddr;
521 compat_ulong_t __user *uaddr;
522
523 if (version == 1)
524 return -EINVAL;
525 err = do_shmat(first, uptr, second, &raddr, COMPAT_SHMLBA);
526 if (err < 0)
527 return err;
528 uaddr = compat_ptr(third);
529 return put_user(raddr, uaddr);
530}
531#else
532long compat_sys_shmat(int shmid, compat_uptr_t shmaddr, int shmflg)
533{ 556{
534 unsigned long ret; 557 unsigned long ret;
535 long err; 558 long err;
@@ -540,7 +563,6 @@ long compat_sys_shmat(int shmid, compat_uptr_t shmaddr, int shmflg)
540 force_successful_syscall_return(); 563 force_successful_syscall_return();
541 return (long)ret; 564 return (long)ret;
542} 565}
543#endif
544 566
545static inline int get_compat_shmid64_ds(struct shmid64_ds *s64, 567static inline int get_compat_shmid64_ds(struct shmid64_ds *s64,
546 struct compat_shmid64_ds __user *up64) 568 struct compat_shmid64_ds __user *up64)
diff --git a/ipc/sem.c b/ipc/sem.c
index 58d31f1c1eb5..5b167d00efa6 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -799,7 +799,7 @@ static unsigned long copy_semid_to_user(void __user *buf, struct semid64_ds *in,
799} 799}
800 800
801static int semctl_nolock(struct ipc_namespace *ns, int semid, 801static int semctl_nolock(struct ipc_namespace *ns, int semid,
802 int cmd, int version, union semun arg) 802 int cmd, int version, void __user *p)
803{ 803{
804 int err; 804 int err;
805 struct sem_array *sma; 805 struct sem_array *sma;
@@ -834,7 +834,7 @@ static int semctl_nolock(struct ipc_namespace *ns, int semid,
834 } 834 }
835 max_id = ipc_get_maxid(&sem_ids(ns)); 835 max_id = ipc_get_maxid(&sem_ids(ns));
836 up_read(&sem_ids(ns).rw_mutex); 836 up_read(&sem_ids(ns).rw_mutex);
837 if (copy_to_user (arg.__buf, &seminfo, sizeof(struct seminfo))) 837 if (copy_to_user(p, &seminfo, sizeof(struct seminfo)))
838 return -EFAULT; 838 return -EFAULT;
839 return (max_id < 0) ? 0: max_id; 839 return (max_id < 0) ? 0: max_id;
840 } 840 }
@@ -871,7 +871,7 @@ static int semctl_nolock(struct ipc_namespace *ns, int semid,
871 tbuf.sem_ctime = sma->sem_ctime; 871 tbuf.sem_ctime = sma->sem_ctime;
872 tbuf.sem_nsems = sma->sem_nsems; 872 tbuf.sem_nsems = sma->sem_nsems;
873 sem_unlock(sma); 873 sem_unlock(sma);
874 if (copy_semid_to_user (arg.buf, &tbuf, version)) 874 if (copy_semid_to_user(p, &tbuf, version))
875 return -EFAULT; 875 return -EFAULT;
876 return id; 876 return id;
877 } 877 }
@@ -883,8 +883,67 @@ out_unlock:
883 return err; 883 return err;
884} 884}
885 885
886static int semctl_setval(struct ipc_namespace *ns, int semid, int semnum,
887 unsigned long arg)
888{
889 struct sem_undo *un;
890 struct sem_array *sma;
891 struct sem* curr;
892 int err;
893 int nsems;
894 struct list_head tasks;
895 int val;
896#if defined(CONFIG_64BIT) && defined(__BIG_ENDIAN)
897 /* big-endian 64bit */
898 val = arg >> 32;
899#else
900 /* 32bit or little-endian 64bit */
901 val = arg;
902#endif
903
904 sma = sem_lock_check(ns, semid);
905 if (IS_ERR(sma))
906 return PTR_ERR(sma);
907
908 INIT_LIST_HEAD(&tasks);
909 nsems = sma->sem_nsems;
910
911 err = -EACCES;
912 if (ipcperms(ns, &sma->sem_perm, S_IWUGO))
913 goto out_unlock;
914
915 err = security_sem_semctl(sma, SETVAL);
916 if (err)
917 goto out_unlock;
918
919 err = -EINVAL;
920 if(semnum < 0 || semnum >= nsems)
921 goto out_unlock;
922
923 curr = &sma->sem_base[semnum];
924
925 err = -ERANGE;
926 if (val > SEMVMX || val < 0)
927 goto out_unlock;
928
929 assert_spin_locked(&sma->sem_perm.lock);
930 list_for_each_entry(un, &sma->list_id, list_id)
931 un->semadj[semnum] = 0;
932
933 curr->semval = val;
934 curr->sempid = task_tgid_vnr(current);
935 sma->sem_ctime = get_seconds();
936 /* maybe some queued-up processes were waiting for this */
937 do_smart_update(sma, NULL, 0, 0, &tasks);
938 err = 0;
939out_unlock:
940 sem_unlock(sma);
941 wake_up_sem_queue_do(&tasks);
942 return err;
943}
944
886static int semctl_main(struct ipc_namespace *ns, int semid, int semnum, 945static int semctl_main(struct ipc_namespace *ns, int semid, int semnum,
887 int cmd, int version, union semun arg) 946 int cmd, void __user *p)
888{ 947{
889 struct sem_array *sma; 948 struct sem_array *sma;
890 struct sem* curr; 949 struct sem* curr;
@@ -903,7 +962,7 @@ static int semctl_main(struct ipc_namespace *ns, int semid, int semnum,
903 962
904 err = -EACCES; 963 err = -EACCES;
905 if (ipcperms(ns, &sma->sem_perm, 964 if (ipcperms(ns, &sma->sem_perm,
906 (cmd == SETVAL || cmd == SETALL) ? S_IWUGO : S_IRUGO)) 965 cmd == SETALL ? S_IWUGO : S_IRUGO))
907 goto out_unlock; 966 goto out_unlock;
908 967
909 err = security_sem_semctl(sma, cmd); 968 err = security_sem_semctl(sma, cmd);
@@ -914,7 +973,7 @@ static int semctl_main(struct ipc_namespace *ns, int semid, int semnum,
914 switch (cmd) { 973 switch (cmd) {
915 case GETALL: 974 case GETALL:
916 { 975 {
917 ushort __user *array = arg.array; 976 ushort __user *array = p;
918 int i; 977 int i;
919 978
920 if(nsems > SEMMSL_FAST) { 979 if(nsems > SEMMSL_FAST) {
@@ -957,7 +1016,7 @@ static int semctl_main(struct ipc_namespace *ns, int semid, int semnum,
957 } 1016 }
958 } 1017 }
959 1018
960 if (copy_from_user (sem_io, arg.array, nsems*sizeof(ushort))) { 1019 if (copy_from_user (sem_io, p, nsems*sizeof(ushort))) {
961 sem_putref(sma); 1020 sem_putref(sma);
962 err = -EFAULT; 1021 err = -EFAULT;
963 goto out_free; 1022 goto out_free;
@@ -991,7 +1050,7 @@ static int semctl_main(struct ipc_namespace *ns, int semid, int semnum,
991 err = 0; 1050 err = 0;
992 goto out_unlock; 1051 goto out_unlock;
993 } 1052 }
994 /* GETVAL, GETPID, GETNCTN, GETZCNT, SETVAL: fall-through */ 1053 /* GETVAL, GETPID, GETNCTN, GETZCNT: fall-through */
995 } 1054 }
996 err = -EINVAL; 1055 err = -EINVAL;
997 if(semnum < 0 || semnum >= nsems) 1056 if(semnum < 0 || semnum >= nsems)
@@ -1012,27 +1071,6 @@ static int semctl_main(struct ipc_namespace *ns, int semid, int semnum,
1012 case GETZCNT: 1071 case GETZCNT:
1013 err = count_semzcnt(sma,semnum); 1072 err = count_semzcnt(sma,semnum);
1014 goto out_unlock; 1073 goto out_unlock;
1015 case SETVAL:
1016 {
1017 int val = arg.val;
1018 struct sem_undo *un;
1019
1020 err = -ERANGE;
1021 if (val > SEMVMX || val < 0)
1022 goto out_unlock;
1023
1024 assert_spin_locked(&sma->sem_perm.lock);
1025 list_for_each_entry(un, &sma->list_id, list_id)
1026 un->semadj[semnum] = 0;
1027
1028 curr->semval = val;
1029 curr->sempid = task_tgid_vnr(current);
1030 sma->sem_ctime = get_seconds();
1031 /* maybe some queued-up processes were waiting for this */
1032 do_smart_update(sma, NULL, 0, 0, &tasks);
1033 err = 0;
1034 goto out_unlock;
1035 }
1036 } 1074 }
1037out_unlock: 1075out_unlock:
1038 sem_unlock(sma); 1076 sem_unlock(sma);
@@ -1076,7 +1114,7 @@ copy_semid_from_user(struct semid64_ds *out, void __user *buf, int version)
1076 * NOTE: no locks must be held, the rw_mutex is taken inside this function. 1114 * NOTE: no locks must be held, the rw_mutex is taken inside this function.
1077 */ 1115 */
1078static int semctl_down(struct ipc_namespace *ns, int semid, 1116static int semctl_down(struct ipc_namespace *ns, int semid,
1079 int cmd, int version, union semun arg) 1117 int cmd, int version, void __user *p)
1080{ 1118{
1081 struct sem_array *sma; 1119 struct sem_array *sma;
1082 int err; 1120 int err;
@@ -1084,7 +1122,7 @@ static int semctl_down(struct ipc_namespace *ns, int semid,
1084 struct kern_ipc_perm *ipcp; 1122 struct kern_ipc_perm *ipcp;
1085 1123
1086 if(cmd == IPC_SET) { 1124 if(cmd == IPC_SET) {
1087 if (copy_semid_from_user(&semid64, arg.buf, version)) 1125 if (copy_semid_from_user(&semid64, p, version))
1088 return -EFAULT; 1126 return -EFAULT;
1089 } 1127 }
1090 1128
@@ -1120,11 +1158,11 @@ out_up:
1120 return err; 1158 return err;
1121} 1159}
1122 1160
1123SYSCALL_DEFINE(semctl)(int semid, int semnum, int cmd, union semun arg) 1161SYSCALL_DEFINE4(semctl, int, semid, int, semnum, int, cmd, unsigned long, arg)
1124{ 1162{
1125 int err = -EINVAL;
1126 int version; 1163 int version;
1127 struct ipc_namespace *ns; 1164 struct ipc_namespace *ns;
1165 void __user *p = (void __user *)arg;
1128 1166
1129 if (semid < 0) 1167 if (semid < 0)
1130 return -EINVAL; 1168 return -EINVAL;
@@ -1137,32 +1175,23 @@ SYSCALL_DEFINE(semctl)(int semid, int semnum, int cmd, union semun arg)
1137 case SEM_INFO: 1175 case SEM_INFO:
1138 case IPC_STAT: 1176 case IPC_STAT:
1139 case SEM_STAT: 1177 case SEM_STAT:
1140 err = semctl_nolock(ns, semid, cmd, version, arg); 1178 return semctl_nolock(ns, semid, cmd, version, p);
1141 return err;
1142 case GETALL: 1179 case GETALL:
1143 case GETVAL: 1180 case GETVAL:
1144 case GETPID: 1181 case GETPID:
1145 case GETNCNT: 1182 case GETNCNT:
1146 case GETZCNT: 1183 case GETZCNT:
1147 case SETVAL:
1148 case SETALL: 1184 case SETALL:
1149 err = semctl_main(ns,semid,semnum,cmd,version,arg); 1185 return semctl_main(ns, semid, semnum, cmd, p);
1150 return err; 1186 case SETVAL:
1187 return semctl_setval(ns, semid, semnum, arg);
1151 case IPC_RMID: 1188 case IPC_RMID:
1152 case IPC_SET: 1189 case IPC_SET:
1153 err = semctl_down(ns, semid, cmd, version, arg); 1190 return semctl_down(ns, semid, cmd, version, p);
1154 return err;
1155 default: 1191 default:
1156 return -EINVAL; 1192 return -EINVAL;
1157 } 1193 }
1158} 1194}
1159#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
1160asmlinkage long SyS_semctl(int semid, int semnum, int cmd, union semun arg)
1161{
1162 return SYSC_semctl((int) semid, (int) semnum, (int) cmd, arg);
1163}
1164SYSCALL_ALIAS(sys_semctl, SyS_semctl);
1165#endif
1166 1195
1167/* If the task doesn't already have a undo_list, then allocate one 1196/* If the task doesn't already have a undo_list, then allocate one
1168 * here. We guarantee there is only one thread using this undo list, 1197 * here. We guarantee there is only one thread using this undo list,
diff --git a/ipc/syscall.c b/ipc/syscall.c
index 0d1e32ce048e..52429489cde0 100644
--- a/ipc/syscall.c
+++ b/ipc/syscall.c
@@ -33,12 +33,12 @@ SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, unsigned long, second,
33 case SEMGET: 33 case SEMGET:
34 return sys_semget(first, second, third); 34 return sys_semget(first, second, third);
35 case SEMCTL: { 35 case SEMCTL: {
36 union semun fourth; 36 unsigned long arg;
37 if (!ptr) 37 if (!ptr)
38 return -EINVAL; 38 return -EINVAL;
39 if (get_user(fourth.__pad, (void __user * __user *) ptr)) 39 if (get_user(arg, (unsigned long __user *) ptr))
40 return -EFAULT; 40 return -EFAULT;
41 return sys_semctl(first, second, third, fourth); 41 return sys_semctl(first, second, third, arg);
42 } 42 }
43 43
44 case MSGSND: 44 case MSGSND:
diff --git a/kernel/compat.c b/kernel/compat.c
index 1e8f1455117a..0a09e481b70b 100644
--- a/kernel/compat.c
+++ b/kernel/compat.c
@@ -516,25 +516,6 @@ int put_compat_rusage(const struct rusage *r, struct compat_rusage __user *ru)
516 return 0; 516 return 0;
517} 517}
518 518
519asmlinkage long compat_sys_getrusage(int who, struct compat_rusage __user *ru)
520{
521 struct rusage r;
522 int ret;
523 mm_segment_t old_fs = get_fs();
524
525 set_fs(KERNEL_DS);
526 ret = sys_getrusage(who, (struct rusage __user *) &r);
527 set_fs(old_fs);
528
529 if (ret)
530 return ret;
531
532 if (put_compat_rusage(&r, ru))
533 return -EFAULT;
534
535 return 0;
536}
537
538COMPAT_SYSCALL_DEFINE4(wait4, 519COMPAT_SYSCALL_DEFINE4(wait4,
539 compat_pid_t, pid, 520 compat_pid_t, pid,
540 compat_uint_t __user *, stat_addr, 521 compat_uint_t __user *, stat_addr,
diff --git a/kernel/exit.c b/kernel/exit.c
index 60bc027c61c3..6e3151ec900f 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -1629,9 +1629,6 @@ SYSCALL_DEFINE5(waitid, int, which, pid_t, upid, struct siginfo __user *,
1629 } 1629 }
1630 1630
1631 put_pid(pid); 1631 put_pid(pid);
1632
1633 /* avoid REGPARM breakage on x86: */
1634 asmlinkage_protect(5, ret, which, upid, infop, options, ru);
1635 return ret; 1632 return ret;
1636} 1633}
1637 1634
@@ -1669,8 +1666,6 @@ SYSCALL_DEFINE4(wait4, pid_t, upid, int __user *, stat_addr,
1669 ret = do_wait(&wo); 1666 ret = do_wait(&wo);
1670 put_pid(pid); 1667 put_pid(pid);
1671 1668
1672 /* avoid REGPARM breakage on x86: */
1673 asmlinkage_protect(4, ret, upid, stat_addr, options, ru);
1674 return ret; 1669 return ret;
1675} 1670}
1676 1671
diff --git a/kernel/fork.c b/kernel/fork.c
index 339f60dfd62b..7d40687b1434 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1677,10 +1677,7 @@ SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp,
1677 int, tls_val) 1677 int, tls_val)
1678#endif 1678#endif
1679{ 1679{
1680 long ret = do_fork(clone_flags, newsp, 0, parent_tidptr, child_tidptr); 1680 return do_fork(clone_flags, newsp, 0, parent_tidptr, child_tidptr);
1681 asmlinkage_protect(5, ret, clone_flags, newsp,
1682 parent_tidptr, child_tidptr, tls_val);
1683 return ret;
1684} 1681}
1685#endif 1682#endif
1686 1683
diff --git a/kernel/sys.c b/kernel/sys.c
index afd0f7e125c9..b95d3c72ba21 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -1851,6 +1851,20 @@ SYSCALL_DEFINE2(getrusage, int, who, struct rusage __user *, ru)
1851 return getrusage(current, who, ru); 1851 return getrusage(current, who, ru);
1852} 1852}
1853 1853
1854#ifdef CONFIG_COMPAT
1855COMPAT_SYSCALL_DEFINE2(getrusage, int, who, struct compat_rusage __user *, ru)
1856{
1857 struct rusage r;
1858
1859 if (who != RUSAGE_SELF && who != RUSAGE_CHILDREN &&
1860 who != RUSAGE_THREAD)
1861 return -EINVAL;
1862
1863 k_getrusage(current, who, &r);
1864 return put_compat_rusage(&r, ru);
1865}
1866#endif
1867
1854SYSCALL_DEFINE1(umask, int, mask) 1868SYSCALL_DEFINE1(umask, int, mask)
1855{ 1869{
1856 mask = xchg(&current->fs->umask, mask & S_IRWXUGO); 1870 mask = xchg(&current->fs->umask, mask & S_IRWXUGO);
diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c
index 395084d4ce16..bfd6787b355a 100644
--- a/kernel/sys_ni.c
+++ b/kernel/sys_ni.c
@@ -20,6 +20,7 @@ cond_syscall(sys_quotactl);
20cond_syscall(sys32_quotactl); 20cond_syscall(sys32_quotactl);
21cond_syscall(sys_acct); 21cond_syscall(sys_acct);
22cond_syscall(sys_lookup_dcookie); 22cond_syscall(sys_lookup_dcookie);
23cond_syscall(compat_sys_lookup_dcookie);
23cond_syscall(sys_swapon); 24cond_syscall(sys_swapon);
24cond_syscall(sys_swapoff); 25cond_syscall(sys_swapoff);
25cond_syscall(sys_kexec_load); 26cond_syscall(sys_kexec_load);
@@ -155,7 +156,7 @@ cond_syscall(compat_sys_process_vm_writev);
155cond_syscall(sys_pciconfig_read); 156cond_syscall(sys_pciconfig_read);
156cond_syscall(sys_pciconfig_write); 157cond_syscall(sys_pciconfig_write);
157cond_syscall(sys_pciconfig_iobase); 158cond_syscall(sys_pciconfig_iobase);
158cond_syscall(sys32_ipc); 159cond_syscall(compat_sys_s390_ipc);
159cond_syscall(ppc_rtas); 160cond_syscall(ppc_rtas);
160cond_syscall(sys_spu_run); 161cond_syscall(sys_spu_run);
161cond_syscall(sys_spu_create); 162cond_syscall(sys_spu_create);
diff --git a/kernel/uid16.c b/kernel/uid16.c
index d7948eb10225..f6c83d7ef000 100644
--- a/kernel/uid16.c
+++ b/kernel/uid16.c
@@ -18,67 +18,43 @@
18 18
19SYSCALL_DEFINE3(chown16, const char __user *, filename, old_uid_t, user, old_gid_t, group) 19SYSCALL_DEFINE3(chown16, const char __user *, filename, old_uid_t, user, old_gid_t, group)
20{ 20{
21 long ret = sys_chown(filename, low2highuid(user), low2highgid(group)); 21 return sys_chown(filename, low2highuid(user), low2highgid(group));
22 /* avoid REGPARM breakage on x86: */
23 asmlinkage_protect(3, ret, filename, user, group);
24 return ret;
25} 22}
26 23
27SYSCALL_DEFINE3(lchown16, const char __user *, filename, old_uid_t, user, old_gid_t, group) 24SYSCALL_DEFINE3(lchown16, const char __user *, filename, old_uid_t, user, old_gid_t, group)
28{ 25{
29 long ret = sys_lchown(filename, low2highuid(user), low2highgid(group)); 26 return sys_lchown(filename, low2highuid(user), low2highgid(group));
30 /* avoid REGPARM breakage on x86: */
31 asmlinkage_protect(3, ret, filename, user, group);
32 return ret;
33} 27}
34 28
35SYSCALL_DEFINE3(fchown16, unsigned int, fd, old_uid_t, user, old_gid_t, group) 29SYSCALL_DEFINE3(fchown16, unsigned int, fd, old_uid_t, user, old_gid_t, group)
36{ 30{
37 long ret = sys_fchown(fd, low2highuid(user), low2highgid(group)); 31 return sys_fchown(fd, low2highuid(user), low2highgid(group));
38 /* avoid REGPARM breakage on x86: */
39 asmlinkage_protect(3, ret, fd, user, group);
40 return ret;
41} 32}
42 33
43SYSCALL_DEFINE2(setregid16, old_gid_t, rgid, old_gid_t, egid) 34SYSCALL_DEFINE2(setregid16, old_gid_t, rgid, old_gid_t, egid)
44{ 35{
45 long ret = sys_setregid(low2highgid(rgid), low2highgid(egid)); 36 return sys_setregid(low2highgid(rgid), low2highgid(egid));
46 /* avoid REGPARM breakage on x86: */
47 asmlinkage_protect(2, ret, rgid, egid);
48 return ret;
49} 37}
50 38
51SYSCALL_DEFINE1(setgid16, old_gid_t, gid) 39SYSCALL_DEFINE1(setgid16, old_gid_t, gid)
52{ 40{
53 long ret = sys_setgid(low2highgid(gid)); 41 return sys_setgid(low2highgid(gid));
54 /* avoid REGPARM breakage on x86: */
55 asmlinkage_protect(1, ret, gid);
56 return ret;
57} 42}
58 43
59SYSCALL_DEFINE2(setreuid16, old_uid_t, ruid, old_uid_t, euid) 44SYSCALL_DEFINE2(setreuid16, old_uid_t, ruid, old_uid_t, euid)
60{ 45{
61 long ret = sys_setreuid(low2highuid(ruid), low2highuid(euid)); 46 return sys_setreuid(low2highuid(ruid), low2highuid(euid));
62 /* avoid REGPARM breakage on x86: */
63 asmlinkage_protect(2, ret, ruid, euid);
64 return ret;
65} 47}
66 48
67SYSCALL_DEFINE1(setuid16, old_uid_t, uid) 49SYSCALL_DEFINE1(setuid16, old_uid_t, uid)
68{ 50{
69 long ret = sys_setuid(low2highuid(uid)); 51 return sys_setuid(low2highuid(uid));
70 /* avoid REGPARM breakage on x86: */
71 asmlinkage_protect(1, ret, uid);
72 return ret;
73} 52}
74 53
75SYSCALL_DEFINE3(setresuid16, old_uid_t, ruid, old_uid_t, euid, old_uid_t, suid) 54SYSCALL_DEFINE3(setresuid16, old_uid_t, ruid, old_uid_t, euid, old_uid_t, suid)
76{ 55{
77 long ret = sys_setresuid(low2highuid(ruid), low2highuid(euid), 56 return sys_setresuid(low2highuid(ruid), low2highuid(euid),
78 low2highuid(suid)); 57 low2highuid(suid));
79 /* avoid REGPARM breakage on x86: */
80 asmlinkage_protect(3, ret, ruid, euid, suid);
81 return ret;
82} 58}
83 59
84SYSCALL_DEFINE3(getresuid16, old_uid_t __user *, ruidp, old_uid_t __user *, euidp, old_uid_t __user *, suidp) 60SYSCALL_DEFINE3(getresuid16, old_uid_t __user *, ruidp, old_uid_t __user *, euidp, old_uid_t __user *, suidp)
@@ -100,11 +76,8 @@ SYSCALL_DEFINE3(getresuid16, old_uid_t __user *, ruidp, old_uid_t __user *, euid
100 76
101SYSCALL_DEFINE3(setresgid16, old_gid_t, rgid, old_gid_t, egid, old_gid_t, sgid) 77SYSCALL_DEFINE3(setresgid16, old_gid_t, rgid, old_gid_t, egid, old_gid_t, sgid)
102{ 78{
103 long ret = sys_setresgid(low2highgid(rgid), low2highgid(egid), 79 return sys_setresgid(low2highgid(rgid), low2highgid(egid),
104 low2highgid(sgid)); 80 low2highgid(sgid));
105 /* avoid REGPARM breakage on x86: */
106 asmlinkage_protect(3, ret, rgid, egid, sgid);
107 return ret;
108} 81}
109 82
110 83
@@ -127,18 +100,12 @@ SYSCALL_DEFINE3(getresgid16, old_gid_t __user *, rgidp, old_gid_t __user *, egid
127 100
128SYSCALL_DEFINE1(setfsuid16, old_uid_t, uid) 101SYSCALL_DEFINE1(setfsuid16, old_uid_t, uid)
129{ 102{
130 long ret = sys_setfsuid(low2highuid(uid)); 103 return sys_setfsuid(low2highuid(uid));
131 /* avoid REGPARM breakage on x86: */
132 asmlinkage_protect(1, ret, uid);
133 return ret;
134} 104}
135 105
136SYSCALL_DEFINE1(setfsgid16, old_gid_t, gid) 106SYSCALL_DEFINE1(setfsgid16, old_gid_t, gid)
137{ 107{
138 long ret = sys_setfsgid(low2highgid(gid)); 108 return sys_setfsgid(low2highgid(gid));
139 /* avoid REGPARM breakage on x86: */
140 asmlinkage_protect(1, ret, gid);
141 return ret;
142} 109}
143 110
144static int groups16_to_user(old_gid_t __user *grouplist, 111static int groups16_to_user(old_gid_t __user *grouplist,
diff --git a/mm/fadvise.c b/mm/fadvise.c
index 7e092689a12a..3bcfd81db45e 100644
--- a/mm/fadvise.c
+++ b/mm/fadvise.c
@@ -25,7 +25,7 @@
25 * POSIX_FADV_WILLNEED could set PG_Referenced, and POSIX_FADV_NOREUSE could 25 * POSIX_FADV_WILLNEED could set PG_Referenced, and POSIX_FADV_NOREUSE could
26 * deactivate the pages and clear PG_Referenced. 26 * deactivate the pages and clear PG_Referenced.
27 */ 27 */
28SYSCALL_DEFINE(fadvise64_64)(int fd, loff_t offset, loff_t len, int advice) 28SYSCALL_DEFINE4(fadvise64_64, int, fd, loff_t, offset, loff_t, len, int, advice)
29{ 29{
30 struct fd f = fdget(fd); 30 struct fd f = fdget(fd);
31 struct address_space *mapping; 31 struct address_space *mapping;
@@ -145,26 +145,12 @@ out:
145 fdput(f); 145 fdput(f);
146 return ret; 146 return ret;
147} 147}
148#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
149asmlinkage long SyS_fadvise64_64(long fd, loff_t offset, loff_t len, long advice)
150{
151 return SYSC_fadvise64_64((int) fd, offset, len, (int) advice);
152}
153SYSCALL_ALIAS(sys_fadvise64_64, SyS_fadvise64_64);
154#endif
155 148
156#ifdef __ARCH_WANT_SYS_FADVISE64 149#ifdef __ARCH_WANT_SYS_FADVISE64
157 150
158SYSCALL_DEFINE(fadvise64)(int fd, loff_t offset, size_t len, int advice) 151SYSCALL_DEFINE4(fadvise64, int, fd, loff_t, offset, size_t, len, int, advice)
159{ 152{
160 return sys_fadvise64_64(fd, offset, len, advice); 153 return sys_fadvise64_64(fd, offset, len, advice);
161} 154}
162#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
163asmlinkage long SyS_fadvise64(long fd, loff_t offset, long len, long advice)
164{
165 return SYSC_fadvise64((int) fd, offset, (size_t)len, (int)advice);
166}
167SYSCALL_ALIAS(sys_fadvise64, SyS_fadvise64);
168#endif
169 155
170#endif 156#endif
diff --git a/mm/nommu.c b/mm/nommu.c
index fbe3e2f317eb..298884dcd6e7 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -1771,7 +1771,7 @@ unsigned long vm_brk(unsigned long addr, unsigned long len)
1771 * 1771 *
1772 * MREMAP_FIXED is not supported under NOMMU conditions 1772 * MREMAP_FIXED is not supported under NOMMU conditions
1773 */ 1773 */
1774unsigned long do_mremap(unsigned long addr, 1774static unsigned long do_mremap(unsigned long addr,
1775 unsigned long old_len, unsigned long new_len, 1775 unsigned long old_len, unsigned long new_len,
1776 unsigned long flags, unsigned long new_addr) 1776 unsigned long flags, unsigned long new_addr)
1777{ 1777{
@@ -1806,7 +1806,6 @@ unsigned long do_mremap(unsigned long addr,
1806 vma->vm_end = vma->vm_start + new_len; 1806 vma->vm_end = vma->vm_start + new_len;
1807 return vma->vm_start; 1807 return vma->vm_start;
1808} 1808}
1809EXPORT_SYMBOL(do_mremap);
1810 1809
1811SYSCALL_DEFINE5(mremap, unsigned long, addr, unsigned long, old_len, 1810SYSCALL_DEFINE5(mremap, unsigned long, addr, unsigned long, old_len,
1812 unsigned long, new_len, unsigned long, flags, 1811 unsigned long, new_len, unsigned long, flags,
diff --git a/mm/readahead.c b/mm/readahead.c
index 7963f2391236..daed28dd5830 100644
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@ -576,7 +576,7 @@ do_readahead(struct address_space *mapping, struct file *filp,
576 return 0; 576 return 0;
577} 577}
578 578
579SYSCALL_DEFINE(readahead)(int fd, loff_t offset, size_t count) 579SYSCALL_DEFINE3(readahead, int, fd, loff_t, offset, size_t, count)
580{ 580{
581 ssize_t ret; 581 ssize_t ret;
582 struct fd f; 582 struct fd f;
@@ -595,10 +595,3 @@ SYSCALL_DEFINE(readahead)(int fd, loff_t offset, size_t count)
595 } 595 }
596 return ret; 596 return ret;
597} 597}
598#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
599asmlinkage long SyS_readahead(long fd, loff_t offset, long count)
600{
601 return SYSC_readahead((int) fd, offset, (size_t) count);
602}
603SYSCALL_ALIAS(sys_readahead, SyS_readahead);
604#endif