Commit 4ddb45db authored by Dominik Brodowski's avatar Dominik Brodowski Committed by Ingo Molnar

x86/syscalls: Use COMPAT_SYSCALL_DEFINEx() macros for x86-only compat syscalls

While at it, convert declarations of type "unsigned" to "unsigned int".
Signed-off-by: default avatarDominik Brodowski <linux@dominikbrodowski.net>
Acked-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Acked-by: default avatarAndy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: luto@amacapital.net
Cc: viro@zeniv.linux.org.uk
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 7c2178c1
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
4 i386 write sys_write 4 i386 write sys_write
5 i386 open sys_open compat_sys_open 5 i386 open sys_open compat_sys_open
6 i386 close sys_close 6 i386 close sys_close
7 i386 waitpid sys_waitpid sys32_waitpid 7 i386 waitpid sys_waitpid compat_sys_x86_waitpid
8 i386 creat sys_creat 8 i386 creat sys_creat
9 i386 link sys_link 9 i386 link sys_link
10 i386 unlink sys_unlink 10 i386 unlink sys_unlink
...@@ -96,7 +96,7 @@ ...@@ -96,7 +96,7 @@
87 i386 swapon sys_swapon 87 i386 swapon sys_swapon
88 i386 reboot sys_reboot 88 i386 reboot sys_reboot
89 i386 readdir sys_old_readdir compat_sys_old_readdir 89 i386 readdir sys_old_readdir compat_sys_old_readdir
90 i386 mmap sys_old_mmap sys32_mmap 90 i386 mmap sys_old_mmap compat_sys_x86_mmap
91 i386 munmap sys_munmap 91 i386 munmap sys_munmap
92 i386 truncate sys_truncate compat_sys_truncate 92 i386 truncate sys_truncate compat_sys_truncate
93 i386 ftruncate sys_ftruncate compat_sys_ftruncate 93 i386 ftruncate sys_ftruncate compat_sys_ftruncate
...@@ -186,8 +186,8 @@ ...@@ -186,8 +186,8 @@
177 i386 rt_sigtimedwait sys_rt_sigtimedwait compat_sys_rt_sigtimedwait 177 i386 rt_sigtimedwait sys_rt_sigtimedwait compat_sys_rt_sigtimedwait
178 i386 rt_sigqueueinfo sys_rt_sigqueueinfo compat_sys_rt_sigqueueinfo 178 i386 rt_sigqueueinfo sys_rt_sigqueueinfo compat_sys_rt_sigqueueinfo
179 i386 rt_sigsuspend sys_rt_sigsuspend 179 i386 rt_sigsuspend sys_rt_sigsuspend
180 i386 pread64 sys_pread64 sys32_pread 180 i386 pread64 sys_pread64 compat_sys_x86_pread
181 i386 pwrite64 sys_pwrite64 sys32_pwrite 181 i386 pwrite64 sys_pwrite64 compat_sys_x86_pwrite
182 i386 chown sys_chown16 182 i386 chown sys_chown16
183 i386 getcwd sys_getcwd 183 i386 getcwd sys_getcwd
184 i386 capget sys_capget 184 i386 capget sys_capget
...@@ -199,11 +199,11 @@ ...@@ -199,11 +199,11 @@
190 i386 vfork sys_vfork 190 i386 vfork sys_vfork
191 i386 ugetrlimit sys_getrlimit compat_sys_getrlimit 191 i386 ugetrlimit sys_getrlimit compat_sys_getrlimit
192 i386 mmap2 sys_mmap_pgoff 192 i386 mmap2 sys_mmap_pgoff
193 i386 truncate64 sys_truncate64 sys32_truncate64 193 i386 truncate64 sys_truncate64 compat_sys_x86_truncate64
194 i386 ftruncate64 sys_ftruncate64 sys32_ftruncate64 194 i386 ftruncate64 sys_ftruncate64 compat_sys_x86_ftruncate64
195 i386 stat64 sys_stat64 sys32_stat64 195 i386 stat64 sys_stat64 compat_sys_x86_stat64
196 i386 lstat64 sys_lstat64 sys32_lstat64 196 i386 lstat64 sys_lstat64 compat_sys_x86_lstat64
197 i386 fstat64 sys_fstat64 sys32_fstat64 197 i386 fstat64 sys_fstat64 compat_sys_x86_fstat64
198 i386 lchown32 sys_lchown 198 i386 lchown32 sys_lchown
199 i386 getuid32 sys_getuid 199 i386 getuid32 sys_getuid
200 i386 getgid32 sys_getgid 200 i386 getgid32 sys_getgid
...@@ -231,7 +231,7 @@ ...@@ -231,7 +231,7 @@
# 222 is unused # 222 is unused
# 223 is unused # 223 is unused
224 i386 gettid sys_gettid 224 i386 gettid sys_gettid
225 i386 readahead sys_readahead sys32_readahead 225 i386 readahead sys_readahead compat_sys_x86_readahead
226 i386 setxattr sys_setxattr 226 i386 setxattr sys_setxattr
227 i386 lsetxattr sys_lsetxattr 227 i386 lsetxattr sys_lsetxattr
228 i386 fsetxattr sys_fsetxattr 228 i386 fsetxattr sys_fsetxattr
...@@ -256,7 +256,7 @@ ...@@ -256,7 +256,7 @@
247 i386 io_getevents sys_io_getevents compat_sys_io_getevents 247 i386 io_getevents sys_io_getevents compat_sys_io_getevents
248 i386 io_submit sys_io_submit compat_sys_io_submit 248 i386 io_submit sys_io_submit compat_sys_io_submit
249 i386 io_cancel sys_io_cancel 249 i386 io_cancel sys_io_cancel
250 i386 fadvise64 sys_fadvise64 sys32_fadvise64 250 i386 fadvise64 sys_fadvise64 compat_sys_x86_fadvise64
# 251 is available for reuse (was briefly sys_set_zone_reclaim) # 251 is available for reuse (was briefly sys_set_zone_reclaim)
252 i386 exit_group sys_exit_group 252 i386 exit_group sys_exit_group
253 i386 lookup_dcookie sys_lookup_dcookie compat_sys_lookup_dcookie 253 i386 lookup_dcookie sys_lookup_dcookie compat_sys_lookup_dcookie
...@@ -278,7 +278,7 @@ ...@@ -278,7 +278,7 @@
269 i386 fstatfs64 sys_fstatfs64 compat_sys_fstatfs64 269 i386 fstatfs64 sys_fstatfs64 compat_sys_fstatfs64
270 i386 tgkill sys_tgkill 270 i386 tgkill sys_tgkill
271 i386 utimes sys_utimes compat_sys_utimes 271 i386 utimes sys_utimes compat_sys_utimes
272 i386 fadvise64_64 sys_fadvise64_64 sys32_fadvise64_64 272 i386 fadvise64_64 sys_fadvise64_64 compat_sys_x86_fadvise64_64
273 i386 vserver 273 i386 vserver
274 i386 mbind sys_mbind 274 i386 mbind sys_mbind
275 i386 get_mempolicy sys_get_mempolicy compat_sys_get_mempolicy 275 i386 get_mempolicy sys_get_mempolicy compat_sys_get_mempolicy
...@@ -306,7 +306,7 @@ ...@@ -306,7 +306,7 @@
297 i386 mknodat sys_mknodat 297 i386 mknodat sys_mknodat
298 i386 fchownat sys_fchownat 298 i386 fchownat sys_fchownat
299 i386 futimesat sys_futimesat compat_sys_futimesat 299 i386 futimesat sys_futimesat compat_sys_futimesat
300 i386 fstatat64 sys_fstatat64 sys32_fstatat 300 i386 fstatat64 sys_fstatat64 compat_sys_x86_fstatat
301 i386 unlinkat sys_unlinkat 301 i386 unlinkat sys_unlinkat
302 i386 renameat sys_renameat 302 i386 renameat sys_renameat
303 i386 linkat sys_linkat 303 i386 linkat sys_linkat
...@@ -320,7 +320,7 @@ ...@@ -320,7 +320,7 @@
311 i386 set_robust_list sys_set_robust_list compat_sys_set_robust_list 311 i386 set_robust_list sys_set_robust_list compat_sys_set_robust_list
312 i386 get_robust_list sys_get_robust_list compat_sys_get_robust_list 312 i386 get_robust_list sys_get_robust_list compat_sys_get_robust_list
313 i386 splice sys_splice 313 i386 splice sys_splice
314 i386 sync_file_range sys_sync_file_range sys32_sync_file_range 314 i386 sync_file_range sys_sync_file_range compat_sys_x86_sync_file_range
315 i386 tee sys_tee 315 i386 tee sys_tee
316 i386 vmsplice sys_vmsplice compat_sys_vmsplice 316 i386 vmsplice sys_vmsplice compat_sys_vmsplice
317 i386 move_pages sys_move_pages compat_sys_move_pages 317 i386 move_pages sys_move_pages compat_sys_move_pages
...@@ -330,7 +330,7 @@ ...@@ -330,7 +330,7 @@
321 i386 signalfd sys_signalfd compat_sys_signalfd 321 i386 signalfd sys_signalfd compat_sys_signalfd
322 i386 timerfd_create sys_timerfd_create 322 i386 timerfd_create sys_timerfd_create
323 i386 eventfd sys_eventfd 323 i386 eventfd sys_eventfd
324 i386 fallocate sys_fallocate sys32_fallocate 324 i386 fallocate sys_fallocate compat_sys_x86_fallocate
325 i386 timerfd_settime sys_timerfd_settime compat_sys_timerfd_settime 325 i386 timerfd_settime sys_timerfd_settime compat_sys_timerfd_settime
326 i386 timerfd_gettime sys_timerfd_gettime compat_sys_timerfd_gettime 326 i386 timerfd_gettime sys_timerfd_gettime compat_sys_timerfd_gettime
327 i386 signalfd4 sys_signalfd4 compat_sys_signalfd4 327 i386 signalfd4 sys_signalfd4 compat_sys_signalfd4
......
...@@ -51,15 +51,14 @@ ...@@ -51,15 +51,14 @@
#define AA(__x) ((unsigned long)(__x)) #define AA(__x) ((unsigned long)(__x))
asmlinkage long sys32_truncate64(const char __user *filename, COMPAT_SYSCALL_DEFINE3(x86_truncate64, const char __user *, filename,
unsigned long offset_low, unsigned long, offset_low, unsigned long, offset_high)
unsigned long offset_high)
{ {
return sys_truncate(filename, ((loff_t) offset_high << 32) | offset_low); return sys_truncate(filename, ((loff_t) offset_high << 32) | offset_low);
} }
asmlinkage long sys32_ftruncate64(unsigned int fd, unsigned long offset_low, COMPAT_SYSCALL_DEFINE3(x86_ftruncate64, unsigned int, fd,
unsigned long offset_high) unsigned long, offset_low, unsigned long, offset_high)
{ {
return sys_ftruncate(fd, ((loff_t) offset_high << 32) | offset_low); return sys_ftruncate(fd, ((loff_t) offset_high << 32) | offset_low);
} }
...@@ -96,8 +95,8 @@ static int cp_stat64(struct stat64 __user *ubuf, struct kstat *stat) ...@@ -96,8 +95,8 @@ static int cp_stat64(struct stat64 __user *ubuf, struct kstat *stat)
return 0; return 0;
} }
asmlinkage long sys32_stat64(const char __user *filename, COMPAT_SYSCALL_DEFINE2(x86_stat64, const char __user *, filename,
struct stat64 __user *statbuf) struct stat64 __user *, statbuf)
{ {
struct kstat stat; struct kstat stat;
int ret = vfs_stat(filename, &stat); int ret = vfs_stat(filename, &stat);
...@@ -107,8 +106,8 @@ asmlinkage long sys32_stat64(const char __user *filename, ...@@ -107,8 +106,8 @@ asmlinkage long sys32_stat64(const char __user *filename,
return ret; return ret;
} }
asmlinkage long sys32_lstat64(const char __user *filename, COMPAT_SYSCALL_DEFINE2(x86_lstat64, const char __user *, filename,
struct stat64 __user *statbuf) struct stat64 __user *, statbuf)
{ {
struct kstat stat; struct kstat stat;
int ret = vfs_lstat(filename, &stat); int ret = vfs_lstat(filename, &stat);
...@@ -117,7 +116,8 @@ asmlinkage long sys32_lstat64(const char __user *filename, ...@@ -117,7 +116,8 @@ asmlinkage long sys32_lstat64(const char __user *filename,
return ret; return ret;
} }
asmlinkage long sys32_fstat64(unsigned int fd, struct stat64 __user *statbuf) COMPAT_SYSCALL_DEFINE2(x86_fstat64, unsigned int, fd,
struct stat64 __user *, statbuf)
{ {
struct kstat stat; struct kstat stat;
int ret = vfs_fstat(fd, &stat); int ret = vfs_fstat(fd, &stat);
...@@ -126,8 +126,9 @@ asmlinkage long sys32_fstat64(unsigned int fd, struct stat64 __user *statbuf) ...@@ -126,8 +126,9 @@ asmlinkage long sys32_fstat64(unsigned int fd, struct stat64 __user *statbuf)
return ret; return ret;
} }
asmlinkage long sys32_fstatat(unsigned int dfd, const char __user *filename, COMPAT_SYSCALL_DEFINE4(x86_fstatat, unsigned int, dfd,
struct stat64 __user *statbuf, int flag) const char __user *, filename,
struct stat64 __user *, statbuf, int, flag)
{ {
struct kstat stat; struct kstat stat;
int error; int error;
...@@ -153,7 +154,7 @@ struct mmap_arg_struct32 { ...@@ -153,7 +154,7 @@ struct mmap_arg_struct32 {
unsigned int offset; unsigned int offset;
}; };
asmlinkage long sys32_mmap(struct mmap_arg_struct32 __user *arg) COMPAT_SYSCALL_DEFINE1(x86_mmap, struct mmap_arg_struct32 __user *, arg)
{ {
struct mmap_arg_struct32 a; struct mmap_arg_struct32 a;
...@@ -167,22 +168,22 @@ asmlinkage long sys32_mmap(struct mmap_arg_struct32 __user *arg) ...@@ -167,22 +168,22 @@ asmlinkage long sys32_mmap(struct mmap_arg_struct32 __user *arg)
a.offset>>PAGE_SHIFT); a.offset>>PAGE_SHIFT);
} }
asmlinkage long sys32_waitpid(compat_pid_t pid, unsigned int __user *stat_addr, COMPAT_SYSCALL_DEFINE3(x86_waitpid, compat_pid_t, pid, unsigned int __user *,
int options) stat_addr, int, options)
{ {
return compat_sys_wait4(pid, stat_addr, options, NULL); return compat_sys_wait4(pid, stat_addr, options, NULL);
} }
/* warning: next two assume little endian */ /* warning: next two assume little endian */
asmlinkage long sys32_pread(unsigned int fd, char __user *ubuf, u32 count, COMPAT_SYSCALL_DEFINE5(x86_pread, unsigned int, fd, char __user *, ubuf,
u32 poslo, u32 poshi) u32, count, u32, poslo, u32, poshi)
{ {
return sys_pread64(fd, ubuf, count, return sys_pread64(fd, ubuf, count,
((loff_t)AA(poshi) << 32) | AA(poslo)); ((loff_t)AA(poshi) << 32) | AA(poslo));
} }
asmlinkage long sys32_pwrite(unsigned int fd, const char __user *ubuf, COMPAT_SYSCALL_DEFINE5(x86_pwrite, unsigned int, fd, const char __user *, ubuf,
u32 count, u32 poslo, u32 poshi) u32, count, u32, poslo, u32, poshi)
{ {
return sys_pwrite64(fd, ubuf, count, return sys_pwrite64(fd, ubuf, count,
((loff_t)AA(poshi) << 32) | AA(poslo)); ((loff_t)AA(poshi) << 32) | AA(poslo));
...@@ -193,8 +194,9 @@ asmlinkage long sys32_pwrite(unsigned int fd, const char __user *ubuf, ...@@ -193,8 +194,9 @@ asmlinkage long sys32_pwrite(unsigned int fd, const char __user *ubuf,
* Some system calls that need sign extended arguments. This could be * Some system calls that need sign extended arguments. This could be
* done by a generic wrapper. * done by a generic wrapper.
*/ */
long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high, COMPAT_SYSCALL_DEFINE6(x86_fadvise64_64, int, fd, __u32, offset_low,
__u32 len_low, __u32 len_high, int advice) __u32, offset_high, __u32, len_low, __u32, len_high,
int, advice)
{ {
return sys_fadvise64_64(fd, return sys_fadvise64_64(fd,
(((u64)offset_high)<<32) | offset_low, (((u64)offset_high)<<32) | offset_low,
...@@ -202,30 +204,31 @@ long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high, ...@@ -202,30 +204,31 @@ long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high,
advice); advice);
} }
asmlinkage ssize_t sys32_readahead(int fd, unsigned off_lo, unsigned off_hi, COMPAT_SYSCALL_DEFINE4(x86_readahead, int, fd, unsigned int, off_lo,
size_t count) unsigned int, off_hi, size_t, count)
{ {
return sys_readahead(fd, ((u64)off_hi << 32) | off_lo, count); return sys_readahead(fd, ((u64)off_hi << 32) | off_lo, count);
} }
asmlinkage long sys32_sync_file_range(int fd, unsigned off_low, unsigned off_hi, COMPAT_SYSCALL_DEFINE6(x86_sync_file_range, int, fd, unsigned int, off_low,
unsigned n_low, unsigned n_hi, int flags) unsigned int, off_hi, unsigned int, n_low,
unsigned int, n_hi, int, flags)
{ {
return sys_sync_file_range(fd, return sys_sync_file_range(fd,
((u64)off_hi << 32) | off_low, ((u64)off_hi << 32) | off_low,
((u64)n_hi << 32) | n_low, flags); ((u64)n_hi << 32) | n_low, flags);
} }
asmlinkage long sys32_fadvise64(int fd, unsigned offset_lo, unsigned offset_hi, COMPAT_SYSCALL_DEFINE5(x86_fadvise64, int, fd, unsigned int, offset_lo,
size_t len, int advice) unsigned int, offset_hi, size_t, len, int, advice)
{ {
return sys_fadvise64_64(fd, ((u64)offset_hi << 32) | offset_lo, return sys_fadvise64_64(fd, ((u64)offset_hi << 32) | offset_lo,
len, advice); len, advice);
} }
asmlinkage long sys32_fallocate(int fd, int mode, unsigned offset_lo, COMPAT_SYSCALL_DEFINE6(x86_fallocate, int, fd, int, mode,
unsigned offset_hi, unsigned len_lo, unsigned int, offset_lo, unsigned int, offset_hi,
unsigned len_hi) unsigned int, len_lo, unsigned int, len_hi)
{ {
return sys_fallocate(fd, mode, ((u64)offset_hi << 32) | offset_lo, return sys_fallocate(fd, mode, ((u64)offset_hi << 32) | offset_lo,
((u64)len_hi << 32) | len_lo); ((u64)len_hi << 32) | len_lo);
......
...@@ -20,30 +20,41 @@ ...@@ -20,30 +20,41 @@
#include <asm/ia32.h> #include <asm/ia32.h>
/* ia32/sys_ia32.c */ /* ia32/sys_ia32.c */
asmlinkage long sys32_truncate64(const char __user *, unsigned long, unsigned long); asmlinkage long compat_sys_x86_truncate64(const char __user *, unsigned long,
asmlinkage long sys32_ftruncate64(unsigned int, unsigned long, unsigned long); unsigned long);
asmlinkage long compat_sys_x86_ftruncate64(unsigned int, unsigned long,
unsigned long);
asmlinkage long sys32_stat64(const char __user *, struct stat64 __user *); asmlinkage long compat_sys_x86_stat64(const char __user *,
asmlinkage long sys32_lstat64(const char __user *, struct stat64 __user *); struct stat64 __user *);
asmlinkage long sys32_fstat64(unsigned int, struct stat64 __user *); asmlinkage long compat_sys_x86_lstat64(const char __user *,
asmlinkage long sys32_fstatat(unsigned int, const char __user *, struct stat64 __user *);
asmlinkage long compat_sys_x86_fstat64(unsigned int, struct stat64 __user *);
asmlinkage long compat_sys_x86_fstatat(unsigned int, const char __user *,
struct stat64 __user *, int); struct stat64 __user *, int);
struct mmap_arg_struct32; struct mmap_arg_struct32;
asmlinkage long sys32_mmap(struct mmap_arg_struct32 __user *); asmlinkage long compat_sys_x86_mmap(struct mmap_arg_struct32 __user *);
asmlinkage long sys32_waitpid(compat_pid_t, unsigned int __user *, int); asmlinkage long compat_sys_x86_waitpid(compat_pid_t, unsigned int __user *,
int);
asmlinkage long sys32_pread(unsigned int, char __user *, u32, u32, u32); asmlinkage long compat_sys_x86_pread(unsigned int, char __user *, u32, u32,
asmlinkage long sys32_pwrite(unsigned int, const char __user *, u32, u32, u32); u32);
asmlinkage long compat_sys_x86_pwrite(unsigned int, const char __user *, u32,
u32, u32);
long sys32_fadvise64_64(int, __u32, __u32, __u32, __u32, int); asmlinkage long compat_sys_x86_fadvise64_64(int, __u32, __u32, __u32, __u32,
int);
asmlinkage ssize_t sys32_readahead(int, unsigned, unsigned, size_t); asmlinkage ssize_t compat_sys_x86_readahead(int, unsigned int, unsigned int,
asmlinkage long sys32_sync_file_range(int, unsigned, unsigned, size_t);
unsigned, unsigned, int); asmlinkage long compat_sys_x86_sync_file_range(int, unsigned int, unsigned int,
asmlinkage long sys32_fadvise64(int, unsigned, unsigned, size_t, int); unsigned int, unsigned int,
asmlinkage long sys32_fallocate(int, int, unsigned, int);
unsigned, unsigned, unsigned); asmlinkage long compat_sys_x86_fadvise64(int, unsigned int, unsigned int,
size_t, int);
asmlinkage long compat_sys_x86_fallocate(int, int, unsigned int, unsigned int,
unsigned int, unsigned int);
/* ia32/ia32_signal.c */ /* ia32/ia32_signal.c */
asmlinkage long sys32_sigreturn(void); asmlinkage long sys32_sigreturn(void);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment