aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-03-31 17:32:17 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-03-31 17:32:17 -0400
commit190f918660a69d1c56fd05dc8c6cbb8336a8a0af (patch)
tree2320b4aab7f048d97c35ac6ade5b7dedc71da89d /fs
parent176ab02d4916f09d5d8cb63372d142df4378cdea (diff)
parent1e4ec6217dcf4b26cf959b70298a3b990479c955 (diff)
Merge branch 'compat' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Pull s390 compat wrapper rework from Heiko Carstens: "S390 compat system call wrapper simplification work. The intention of this work is to get rid of all hand written assembly compat system call wrappers on s390, which perform proper sign or zero extension, or pointer conversion of compat system call parameters. Instead all of this should be done with C code eg by using Al's COMPAT_SYSCALL_DEFINEx() macro. Therefore all common code and s390 specific compat system calls have been converted to the COMPAT_SYSCALL_DEFINEx() macro. In order to generate correct code all compat system calls may only have eg compat_ulong_t parameters, but no unsigned long parameters. Those patches which change parameter types from unsigned long to compat_ulong_t parameters are separate in this series, but shouldn't cause any harm. The only compat system calls which intentionally have 64 bit parameters (preadv64 and pwritev64) in support of the x86/32 ABI haven't been changed, but are now only available if an architecture defines __ARCH_WANT_COMPAT_SYS_PREADV64/PWRITEV64. System calls which do not have a compat variant but still need proper zero extension on s390, like eg "long sys_brk(unsigned long brk)" will get a proper wrapper function with the new s390 specific COMPAT_SYSCALL_WRAPx() macro: COMPAT_SYSCALL_WRAP1(brk, unsigned long, brk); which generates the following code (simplified): asmlinkage long sys_brk(unsigned long brk); asmlinkage long compat_sys_brk(long brk) { return sys_brk((u32)brk); } Given that the C file which contains all the COMPAT_SYSCALL_WRAP lines includes both linux/syscall.h and linux/compat.h, it will generate build errors, if the declaration of sys_brk() doesn't match, or if there exists a non-matching compat_sys_brk() declaration. In addition this will intentionally result in a link error if somewhere else a compat_sys_brk() function exists, which probably should have been used instead. Two more BUILD_BUG_ONs make sure the size and type of each compat syscall parameter can be handled correctly with the s390 specific macros. I converted the compat system calls step by step to verify the generated code is correct and matches the previous code. In fact it did not always match, however that was always a bug in the hand written asm code. In result we get less code, less bugs, and much more sanity checking" * 'compat' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: (44 commits) s390/compat: add copyright statement compat: include linux/unistd.h within linux/compat.h s390/compat: get rid of compat wrapper assembly code s390/compat: build error for large compat syscall args mm/compat: convert to COMPAT_SYSCALL_DEFINE with changing parameter types kexec/compat: convert to COMPAT_SYSCALL_DEFINE with changing parameter types net/compat: convert to COMPAT_SYSCALL_DEFINE with changing parameter types ipc/compat: convert to COMPAT_SYSCALL_DEFINE with changing parameter types fs/compat: convert to COMPAT_SYSCALL_DEFINE with changing parameter types ipc/compat: convert to COMPAT_SYSCALL_DEFINE fs/compat: convert to COMPAT_SYSCALL_DEFINE security/compat: convert to COMPAT_SYSCALL_DEFINE mm/compat: convert to COMPAT_SYSCALL_DEFINE net/compat: convert to COMPAT_SYSCALL_DEFINE kernel/compat: convert to COMPAT_SYSCALL_DEFINE fs/compat: optional preadv64/pwrite64 compat system calls ipc/compat_sys_msgrcv: change msgtyp type from long to compat_long_t s390/compat: partial parameter conversion within syscall wrappers s390/compat: automatic zero, sign and pointer conversion of syscalls s390/compat: add sync_file_range and fallocate compat syscalls ...
Diffstat (limited to 'fs')
-rw-r--r--fs/compat.c121
-rw-r--r--fs/compat_ioctl.c5
-rw-r--r--fs/exec.c6
-rw-r--r--fs/read_write.c36
4 files changed, 90 insertions, 78 deletions
diff --git a/fs/compat.c b/fs/compat.c
index 6af20de2c1a3..19252b97f0cc 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -72,8 +72,8 @@ int compat_printk(const char *fmt, ...)
72 * Not all architectures have sys_utime, so implement this in terms 72 * Not all architectures have sys_utime, so implement this in terms
73 * of sys_utimes. 73 * of sys_utimes.
74 */ 74 */
75asmlinkage long compat_sys_utime(const char __user *filename, 75COMPAT_SYSCALL_DEFINE2(utime, const char __user *, filename,
76 struct compat_utimbuf __user *t) 76 struct compat_utimbuf __user *, t)
77{ 77{
78 struct timespec tv[2]; 78 struct timespec tv[2];
79 79
@@ -87,7 +87,7 @@ asmlinkage long compat_sys_utime(const char __user *filename,
87 return do_utimes(AT_FDCWD, filename, t ? tv : NULL, 0); 87 return do_utimes(AT_FDCWD, filename, t ? tv : NULL, 0);
88} 88}
89 89
90asmlinkage long compat_sys_utimensat(unsigned int dfd, const char __user *filename, struct compat_timespec __user *t, int flags) 90COMPAT_SYSCALL_DEFINE4(utimensat, unsigned int, dfd, const char __user *, filename, struct compat_timespec __user *, t, int, flags)
91{ 91{
92 struct timespec tv[2]; 92 struct timespec tv[2];
93 93
@@ -102,7 +102,7 @@ asmlinkage long compat_sys_utimensat(unsigned int dfd, const char __user *filena
102 return do_utimes(dfd, filename, t ? tv : NULL, flags); 102 return do_utimes(dfd, filename, t ? tv : NULL, flags);
103} 103}
104 104
105asmlinkage long compat_sys_futimesat(unsigned int dfd, const char __user *filename, struct compat_timeval __user *t) 105COMPAT_SYSCALL_DEFINE3(futimesat, unsigned int, dfd, const char __user *, filename, struct compat_timeval __user *, t)
106{ 106{
107 struct timespec tv[2]; 107 struct timespec tv[2];
108 108
@@ -121,7 +121,7 @@ asmlinkage long compat_sys_futimesat(unsigned int dfd, const char __user *filena
121 return do_utimes(dfd, filename, t ? tv : NULL, 0); 121 return do_utimes(dfd, filename, t ? tv : NULL, 0);
122} 122}
123 123
124asmlinkage long compat_sys_utimes(const char __user *filename, struct compat_timeval __user *t) 124COMPAT_SYSCALL_DEFINE2(utimes, const char __user *, filename, struct compat_timeval __user *, t)
125{ 125{
126 return compat_sys_futimesat(AT_FDCWD, filename, t); 126 return compat_sys_futimesat(AT_FDCWD, filename, t);
127} 127}
@@ -159,8 +159,8 @@ static int cp_compat_stat(struct kstat *stat, struct compat_stat __user *ubuf)
159 return copy_to_user(ubuf, &tmp, sizeof(tmp)) ? -EFAULT : 0; 159 return copy_to_user(ubuf, &tmp, sizeof(tmp)) ? -EFAULT : 0;
160} 160}
161 161
162asmlinkage long compat_sys_newstat(const char __user * filename, 162COMPAT_SYSCALL_DEFINE2(newstat, const char __user *, filename,
163 struct compat_stat __user *statbuf) 163 struct compat_stat __user *, statbuf)
164{ 164{
165 struct kstat stat; 165 struct kstat stat;
166 int error; 166 int error;
@@ -171,8 +171,8 @@ asmlinkage long compat_sys_newstat(const char __user * filename,
171 return cp_compat_stat(&stat, statbuf); 171 return cp_compat_stat(&stat, statbuf);
172} 172}
173 173
174asmlinkage long compat_sys_newlstat(const char __user * filename, 174COMPAT_SYSCALL_DEFINE2(newlstat, const char __user *, filename,
175 struct compat_stat __user *statbuf) 175 struct compat_stat __user *, statbuf)
176{ 176{
177 struct kstat stat; 177 struct kstat stat;
178 int error; 178 int error;
@@ -184,9 +184,9 @@ asmlinkage long compat_sys_newlstat(const char __user * filename,
184} 184}
185 185
186#ifndef __ARCH_WANT_STAT64 186#ifndef __ARCH_WANT_STAT64
187asmlinkage long compat_sys_newfstatat(unsigned int dfd, 187COMPAT_SYSCALL_DEFINE4(newfstatat, unsigned int, dfd,
188 const char __user *filename, 188 const char __user *, filename,
189 struct compat_stat __user *statbuf, int flag) 189 struct compat_stat __user *, statbuf, int, flag)
190{ 190{
191 struct kstat stat; 191 struct kstat stat;
192 int error; 192 int error;
@@ -198,8 +198,8 @@ asmlinkage long compat_sys_newfstatat(unsigned int dfd,
198} 198}
199#endif 199#endif
200 200
201asmlinkage long compat_sys_newfstat(unsigned int fd, 201COMPAT_SYSCALL_DEFINE2(newfstat, unsigned int, fd,
202 struct compat_stat __user * statbuf) 202 struct compat_stat __user *, statbuf)
203{ 203{
204 struct kstat stat; 204 struct kstat stat;
205 int error = vfs_fstat(fd, &stat); 205 int error = vfs_fstat(fd, &stat);
@@ -247,7 +247,7 @@ static int put_compat_statfs(struct compat_statfs __user *ubuf, struct kstatfs *
247 * The following statfs calls are copies of code from fs/statfs.c and 247 * The following statfs calls are copies of code from fs/statfs.c and
248 * should be checked against those from time to time 248 * should be checked against those from time to time
249 */ 249 */
250asmlinkage long compat_sys_statfs(const char __user *pathname, struct compat_statfs __user *buf) 250COMPAT_SYSCALL_DEFINE2(statfs, const char __user *, pathname, struct compat_statfs __user *, buf)
251{ 251{
252 struct kstatfs tmp; 252 struct kstatfs tmp;
253 int error = user_statfs(pathname, &tmp); 253 int error = user_statfs(pathname, &tmp);
@@ -256,7 +256,7 @@ asmlinkage long compat_sys_statfs(const char __user *pathname, struct compat_sta
256 return error; 256 return error;
257} 257}
258 258
259asmlinkage long compat_sys_fstatfs(unsigned int fd, struct compat_statfs __user *buf) 259COMPAT_SYSCALL_DEFINE2(fstatfs, unsigned int, fd, struct compat_statfs __user *, buf)
260{ 260{
261 struct kstatfs tmp; 261 struct kstatfs tmp;
262 int error = fd_statfs(fd, &tmp); 262 int error = fd_statfs(fd, &tmp);
@@ -298,7 +298,7 @@ static int put_compat_statfs64(struct compat_statfs64 __user *ubuf, struct kstat
298 return 0; 298 return 0;
299} 299}
300 300
301asmlinkage long compat_sys_statfs64(const char __user *pathname, compat_size_t sz, struct compat_statfs64 __user *buf) 301COMPAT_SYSCALL_DEFINE3(statfs64, const char __user *, pathname, compat_size_t, sz, struct compat_statfs64 __user *, buf)
302{ 302{
303 struct kstatfs tmp; 303 struct kstatfs tmp;
304 int error; 304 int error;
@@ -312,7 +312,7 @@ asmlinkage long compat_sys_statfs64(const char __user *pathname, compat_size_t s
312 return error; 312 return error;
313} 313}
314 314
315asmlinkage long compat_sys_fstatfs64(unsigned int fd, compat_size_t sz, struct compat_statfs64 __user *buf) 315COMPAT_SYSCALL_DEFINE3(fstatfs64, unsigned int, fd, compat_size_t, sz, struct compat_statfs64 __user *, buf)
316{ 316{
317 struct kstatfs tmp; 317 struct kstatfs tmp;
318 int error; 318 int error;
@@ -331,7 +331,7 @@ asmlinkage long compat_sys_fstatfs64(unsigned int fd, compat_size_t sz, struct c
331 * Given how simple this syscall is that apporach is more maintainable 331 * Given how simple this syscall is that apporach is more maintainable
332 * than the various conversion hacks. 332 * than the various conversion hacks.
333 */ 333 */
334asmlinkage long compat_sys_ustat(unsigned dev, struct compat_ustat __user *u) 334COMPAT_SYSCALL_DEFINE2(ustat, unsigned, dev, struct compat_ustat __user *, u)
335{ 335{
336 struct compat_ustat tmp; 336 struct compat_ustat tmp;
337 struct kstatfs sbuf; 337 struct kstatfs sbuf;
@@ -399,8 +399,8 @@ static int put_compat_flock64(struct flock *kfl, struct compat_flock64 __user *u
399} 399}
400#endif 400#endif
401 401
402asmlinkage long compat_sys_fcntl64(unsigned int fd, unsigned int cmd, 402COMPAT_SYSCALL_DEFINE3(fcntl64, unsigned int, fd, unsigned int, cmd,
403 unsigned long arg) 403 compat_ulong_t, arg)
404{ 404{
405 mm_segment_t old_fs; 405 mm_segment_t old_fs;
406 struct flock f; 406 struct flock f;
@@ -468,16 +468,15 @@ asmlinkage long compat_sys_fcntl64(unsigned int fd, unsigned int cmd,
468 return ret; 468 return ret;
469} 469}
470 470
471asmlinkage long compat_sys_fcntl(unsigned int fd, unsigned int cmd, 471COMPAT_SYSCALL_DEFINE3(fcntl, unsigned int, fd, unsigned int, cmd,
472 unsigned long arg) 472 compat_ulong_t, arg)
473{ 473{
474 if ((cmd == F_GETLK64) || (cmd == F_SETLK64) || (cmd == F_SETLKW64)) 474 if ((cmd == F_GETLK64) || (cmd == F_SETLK64) || (cmd == F_SETLKW64))
475 return -EINVAL; 475 return -EINVAL;
476 return compat_sys_fcntl64(fd, cmd, arg); 476 return compat_sys_fcntl64(fd, cmd, arg);
477} 477}
478 478
479asmlinkage long 479COMPAT_SYSCALL_DEFINE2(io_setup, unsigned, nr_reqs, u32 __user *, ctx32p)
480compat_sys_io_setup(unsigned nr_reqs, u32 __user *ctx32p)
481{ 480{
482 long ret; 481 long ret;
483 aio_context_t ctx64; 482 aio_context_t ctx64;
@@ -496,32 +495,24 @@ compat_sys_io_setup(unsigned nr_reqs, u32 __user *ctx32p)
496 return ret; 495 return ret;
497} 496}
498 497
499asmlinkage long 498COMPAT_SYSCALL_DEFINE5(io_getevents, compat_aio_context_t, ctx_id,
500compat_sys_io_getevents(aio_context_t ctx_id, 499 compat_long_t, min_nr,
501 unsigned long min_nr, 500 compat_long_t, nr,
502 unsigned long nr, 501 struct io_event __user *, events,
503 struct io_event __user *events, 502 struct compat_timespec __user *, timeout)
504 struct compat_timespec __user *timeout)
505{ 503{
506 long ret;
507 struct timespec t; 504 struct timespec t;
508 struct timespec __user *ut = NULL; 505 struct timespec __user *ut = NULL;
509 506
510 ret = -EFAULT;
511 if (unlikely(!access_ok(VERIFY_WRITE, events,
512 nr * sizeof(struct io_event))))
513 goto out;
514 if (timeout) { 507 if (timeout) {
515 if (get_compat_timespec(&t, timeout)) 508 if (get_compat_timespec(&t, timeout))
516 goto out; 509 return -EFAULT;
517 510
518 ut = compat_alloc_user_space(sizeof(*ut)); 511 ut = compat_alloc_user_space(sizeof(*ut));
519 if (copy_to_user(ut, &t, sizeof(t)) ) 512 if (copy_to_user(ut, &t, sizeof(t)) )
520 goto out; 513 return -EFAULT;
521 } 514 }
522 ret = sys_io_getevents(ctx_id, min_nr, nr, events, ut); 515 return sys_io_getevents(ctx_id, min_nr, nr, events, ut);
523out:
524 return ret;
525} 516}
526 517
527/* A write operation does a read from user space and vice versa */ 518/* A write operation does a read from user space and vice versa */
@@ -617,8 +608,8 @@ copy_iocb(long nr, u32 __user *ptr32, struct iocb __user * __user *ptr64)
617 608
618#define MAX_AIO_SUBMITS (PAGE_SIZE/sizeof(struct iocb *)) 609#define MAX_AIO_SUBMITS (PAGE_SIZE/sizeof(struct iocb *))
619 610
620asmlinkage long 611COMPAT_SYSCALL_DEFINE3(io_submit, compat_aio_context_t, ctx_id,
621compat_sys_io_submit(aio_context_t ctx_id, int nr, u32 __user *iocb) 612 int, nr, u32 __user *, iocb)
622{ 613{
623 struct iocb __user * __user *iocb64; 614 struct iocb __user * __user *iocb64;
624 long ret; 615 long ret;
@@ -770,10 +761,10 @@ static int do_nfs4_super_data_conv(void *raw_data)
770#define NCPFS_NAME "ncpfs" 761#define NCPFS_NAME "ncpfs"
771#define NFS4_NAME "nfs4" 762#define NFS4_NAME "nfs4"
772 763
773asmlinkage long compat_sys_mount(const char __user * dev_name, 764COMPAT_SYSCALL_DEFINE5(mount, const char __user *, dev_name,
774 const char __user * dir_name, 765 const char __user *, dir_name,
775 const char __user * type, unsigned long flags, 766 const char __user *, type, compat_ulong_t, flags,
776 const void __user * data) 767 const void __user *, data)
777{ 768{
778 char *kernel_type; 769 char *kernel_type;
779 unsigned long data_page; 770 unsigned long data_page;
@@ -869,8 +860,8 @@ efault:
869 return -EFAULT; 860 return -EFAULT;
870} 861}
871 862
872asmlinkage long compat_sys_old_readdir(unsigned int fd, 863COMPAT_SYSCALL_DEFINE3(old_readdir, unsigned int, fd,
873 struct compat_old_linux_dirent __user *dirent, unsigned int count) 864 struct compat_old_linux_dirent __user *, dirent, unsigned int, count)
874{ 865{
875 int error; 866 int error;
876 struct fd f = fdget(fd); 867 struct fd f = fdget(fd);
@@ -948,8 +939,8 @@ efault:
948 return -EFAULT; 939 return -EFAULT;
949} 940}
950 941
951asmlinkage long compat_sys_getdents(unsigned int fd, 942COMPAT_SYSCALL_DEFINE3(getdents, unsigned int, fd,
952 struct compat_linux_dirent __user *dirent, unsigned int count) 943 struct compat_linux_dirent __user *, dirent, unsigned int, count)
953{ 944{
954 struct fd f; 945 struct fd f;
955 struct compat_linux_dirent __user * lastdirent; 946 struct compat_linux_dirent __user * lastdirent;
@@ -981,7 +972,7 @@ asmlinkage long compat_sys_getdents(unsigned int fd,
981 return error; 972 return error;
982} 973}
983 974
984#ifndef __ARCH_OMIT_COMPAT_SYS_GETDENTS64 975#ifdef __ARCH_WANT_COMPAT_SYS_GETDENTS64
985 976
986struct compat_getdents_callback64 { 977struct compat_getdents_callback64 {
987 struct dir_context ctx; 978 struct dir_context ctx;
@@ -1033,8 +1024,8 @@ efault:
1033 return -EFAULT; 1024 return -EFAULT;
1034} 1025}
1035 1026
1036asmlinkage long compat_sys_getdents64(unsigned int fd, 1027COMPAT_SYSCALL_DEFINE3(getdents64, unsigned int, fd,
1037 struct linux_dirent64 __user * dirent, unsigned int count) 1028 struct linux_dirent64 __user *, dirent, unsigned int, count)
1038{ 1029{
1039 struct fd f; 1030 struct fd f;
1040 struct linux_dirent64 __user * lastdirent; 1031 struct linux_dirent64 __user * lastdirent;
@@ -1066,7 +1057,7 @@ asmlinkage long compat_sys_getdents64(unsigned int fd,
1066 fdput(f); 1057 fdput(f);
1067 return error; 1058 return error;
1068} 1059}
1069#endif /* ! __ARCH_OMIT_COMPAT_SYS_GETDENTS64 */ 1060#endif /* __ARCH_WANT_COMPAT_SYS_GETDENTS64 */
1070 1061
1071/* 1062/*
1072 * Exactly like fs/open.c:sys_open(), except that it doesn't set the 1063 * Exactly like fs/open.c:sys_open(), except that it doesn't set the
@@ -1287,9 +1278,9 @@ out_nofds:
1287 return ret; 1278 return ret;
1288} 1279}
1289 1280
1290asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp, 1281COMPAT_SYSCALL_DEFINE5(select, int, n, compat_ulong_t __user *, inp,
1291 compat_ulong_t __user *outp, compat_ulong_t __user *exp, 1282 compat_ulong_t __user *, outp, compat_ulong_t __user *, exp,
1292 struct compat_timeval __user *tvp) 1283 struct compat_timeval __user *, tvp)
1293{ 1284{
1294 struct timespec end_time, *to = NULL; 1285 struct timespec end_time, *to = NULL;
1295 struct compat_timeval tv; 1286 struct compat_timeval tv;
@@ -1320,7 +1311,7 @@ struct compat_sel_arg_struct {
1320 compat_uptr_t tvp; 1311 compat_uptr_t tvp;
1321}; 1312};
1322 1313
1323asmlinkage long compat_sys_old_select(struct compat_sel_arg_struct __user *arg) 1314COMPAT_SYSCALL_DEFINE1(old_select, struct compat_sel_arg_struct __user *, arg)
1324{ 1315{
1325 struct compat_sel_arg_struct a; 1316 struct compat_sel_arg_struct a;
1326 1317
@@ -1381,9 +1372,9 @@ static long do_compat_pselect(int n, compat_ulong_t __user *inp,
1381 return ret; 1372 return ret;
1382} 1373}
1383 1374
1384asmlinkage long compat_sys_pselect6(int n, compat_ulong_t __user *inp, 1375COMPAT_SYSCALL_DEFINE6(pselect6, int, n, compat_ulong_t __user *, inp,
1385 compat_ulong_t __user *outp, compat_ulong_t __user *exp, 1376 compat_ulong_t __user *, outp, compat_ulong_t __user *, exp,
1386 struct compat_timespec __user *tsp, void __user *sig) 1377 struct compat_timespec __user *, tsp, void __user *, sig)
1387{ 1378{
1388 compat_size_t sigsetsize = 0; 1379 compat_size_t sigsetsize = 0;
1389 compat_uptr_t up = 0; 1380 compat_uptr_t up = 0;
@@ -1400,9 +1391,9 @@ asmlinkage long compat_sys_pselect6(int n, compat_ulong_t __user *inp,
1400 sigsetsize); 1391 sigsetsize);
1401} 1392}
1402 1393
1403asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds, 1394COMPAT_SYSCALL_DEFINE5(ppoll, struct pollfd __user *, ufds,
1404 unsigned int nfds, struct compat_timespec __user *tsp, 1395 unsigned int, nfds, struct compat_timespec __user *, tsp,
1405 const compat_sigset_t __user *sigmask, compat_size_t sigsetsize) 1396 const compat_sigset_t __user *, sigmask, compat_size_t, sigsetsize)
1406{ 1397{
1407 compat_sigset_t ss32; 1398 compat_sigset_t ss32;
1408 sigset_t ksigmask, sigsaved; 1399 sigset_t ksigmask, sigsaved;
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index 3881610b6438..e82289047272 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -1538,9 +1538,10 @@ static int compat_ioctl_check_table(unsigned int xcmd)
1538 return ioctl_pointer[i] == xcmd; 1538 return ioctl_pointer[i] == xcmd;
1539} 1539}
1540 1540
1541asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd, 1541COMPAT_SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd,
1542 unsigned long arg) 1542 compat_ulong_t, arg32)
1543{ 1543{
1544 unsigned long arg = arg32;
1544 struct fd f = fdget(fd); 1545 struct fd f = fdget(fd);
1545 int error = -EBADF; 1546 int error = -EBADF;
1546 if (!f.file) 1547 if (!f.file)
diff --git a/fs/exec.c b/fs/exec.c
index 3d78fccdd723..4f59402fdda5 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1619,9 +1619,9 @@ SYSCALL_DEFINE3(execve,
1619 return do_execve(getname(filename), argv, envp); 1619 return do_execve(getname(filename), argv, envp);
1620} 1620}
1621#ifdef CONFIG_COMPAT 1621#ifdef CONFIG_COMPAT
1622asmlinkage long compat_sys_execve(const char __user * filename, 1622COMPAT_SYSCALL_DEFINE3(execve, const char __user *, filename,
1623 const compat_uptr_t __user * argv, 1623 const compat_uptr_t __user *, argv,
1624 const compat_uptr_t __user * envp) 1624 const compat_uptr_t __user *, envp)
1625{ 1625{
1626 return compat_do_execve(getname(filename), argv, envp); 1626 return compat_do_execve(getname(filename), argv, envp);
1627} 1627}
diff --git a/fs/read_write.c b/fs/read_write.c
index 28cc9c810744..31c6efa43183 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -994,9 +994,9 @@ COMPAT_SYSCALL_DEFINE3(readv, compat_ulong_t, fd,
994 return ret; 994 return ret;
995} 995}
996 996
997COMPAT_SYSCALL_DEFINE4(preadv64, unsigned long, fd, 997static long __compat_sys_preadv64(unsigned long fd,
998 const struct compat_iovec __user *,vec, 998 const struct compat_iovec __user *vec,
999 unsigned long, vlen, loff_t, pos) 999 unsigned long vlen, loff_t pos)
1000{ 1000{
1001 struct fd f; 1001 struct fd f;
1002 ssize_t ret; 1002 ssize_t ret;
@@ -1013,12 +1013,22 @@ COMPAT_SYSCALL_DEFINE4(preadv64, unsigned long, fd,
1013 return ret; 1013 return ret;
1014} 1014}
1015 1015
1016#ifdef __ARCH_WANT_COMPAT_SYS_PREADV64
1017COMPAT_SYSCALL_DEFINE4(preadv64, unsigned long, fd,
1018 const struct compat_iovec __user *,vec,
1019 unsigned long, vlen, loff_t, pos)
1020{
1021 return __compat_sys_preadv64(fd, vec, vlen, pos);
1022}
1023#endif
1024
1016COMPAT_SYSCALL_DEFINE5(preadv, compat_ulong_t, fd, 1025COMPAT_SYSCALL_DEFINE5(preadv, compat_ulong_t, fd,
1017 const struct compat_iovec __user *,vec, 1026 const struct compat_iovec __user *,vec,
1018 compat_ulong_t, vlen, u32, pos_low, u32, pos_high) 1027 compat_ulong_t, vlen, u32, pos_low, u32, pos_high)
1019{ 1028{
1020 loff_t pos = ((loff_t)pos_high << 32) | pos_low; 1029 loff_t pos = ((loff_t)pos_high << 32) | pos_low;
1021 return compat_sys_preadv64(fd, vec, vlen, pos); 1030
1031 return __compat_sys_preadv64(fd, vec, vlen, pos);
1022} 1032}
1023 1033
1024static size_t compat_writev(struct file *file, 1034static size_t compat_writev(struct file *file,
@@ -1061,9 +1071,9 @@ COMPAT_SYSCALL_DEFINE3(writev, compat_ulong_t, fd,
1061 return ret; 1071 return ret;
1062} 1072}
1063 1073
1064COMPAT_SYSCALL_DEFINE4(pwritev64, unsigned long, fd, 1074static long __compat_sys_pwritev64(unsigned long fd,
1065 const struct compat_iovec __user *,vec, 1075 const struct compat_iovec __user *vec,
1066 unsigned long, vlen, loff_t, pos) 1076 unsigned long vlen, loff_t pos)
1067{ 1077{
1068 struct fd f; 1078 struct fd f;
1069 ssize_t ret; 1079 ssize_t ret;
@@ -1080,12 +1090,22 @@ COMPAT_SYSCALL_DEFINE4(pwritev64, unsigned long, fd,
1080 return ret; 1090 return ret;
1081} 1091}
1082 1092
1093#ifdef __ARCH_WANT_COMPAT_SYS_PWRITEV64
1094COMPAT_SYSCALL_DEFINE4(pwritev64, unsigned long, fd,
1095 const struct compat_iovec __user *,vec,
1096 unsigned long, vlen, loff_t, pos)
1097{
1098 return __compat_sys_pwritev64(fd, vec, vlen, pos);
1099}
1100#endif
1101
1083COMPAT_SYSCALL_DEFINE5(pwritev, compat_ulong_t, fd, 1102COMPAT_SYSCALL_DEFINE5(pwritev, compat_ulong_t, fd,
1084 const struct compat_iovec __user *,vec, 1103 const struct compat_iovec __user *,vec,
1085 compat_ulong_t, vlen, u32, pos_low, u32, pos_high) 1104 compat_ulong_t, vlen, u32, pos_low, u32, pos_high)
1086{ 1105{
1087 loff_t pos = ((loff_t)pos_high << 32) | pos_low; 1106 loff_t pos = ((loff_t)pos_high << 32) | pos_low;
1088 return compat_sys_pwritev64(fd, vec, vlen, pos); 1107
1108 return __compat_sys_pwritev64(fd, vec, vlen, pos);
1089} 1109}
1090#endif 1110#endif
1091 1111