Skip to content

Commit 76b021d

Browse files
author
Al Viro
committed
convert vmsplice to COMPAT_SYSCALL_DEFINE
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 8d2d5c4 commit 76b021d

6 files changed

Lines changed: 24 additions & 30 deletions

File tree

‎arch/s390/kernel/compat_wrapper.S‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,13 +1252,6 @@ ENTRY(sys_tee_wrapper)
12521252
llgfr %r5,%r5 # unsigned int
12531253
jg sys_tee
12541254

1255-
ENTRY(compat_sys_vmsplice_wrapper)
1256-
lgfr %r2,%r2 # int
1257-
llgtr %r3,%r3 # compat_iovec *
1258-
llgfr %r4,%r4 # unsigned int
1259-
llgfr %r5,%r5 # unsigned int
1260-
jg compat_sys_vmsplice
1261-
12621255
ENTRY(sys_getcpu_wrapper)
12631256
llgtr %r2,%r2 # unsigned *
12641257
llgtr %r3,%r3 # unsigned *

‎arch/s390/kernel/syscalls.S‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ SYSCALL(sys_get_robust_list,sys_get_robust_list,compat_sys_get_robust_list)
317317
SYSCALL(sys_splice,sys_splice,sys_splice_wrapper)
318318
SYSCALL(sys_sync_file_range,sys_sync_file_range,sys_sync_file_range_wrapper)
319319
SYSCALL(sys_tee,sys_tee,sys_tee_wrapper)
320-
SYSCALL(sys_vmsplice,sys_vmsplice,compat_sys_vmsplice_wrapper)
320+
SYSCALL(sys_vmsplice,sys_vmsplice,compat_sys_vmsplice)
321321
NI_SYSCALL /* 310 sys_move_pages */
322322
SYSCALL(sys_getcpu,sys_getcpu,sys_getcpu_wrapper)
323323
SYSCALL(sys_epoll_pwait,sys_epoll_pwait,compat_sys_epoll_pwait)

‎arch/sparc/kernel/sys32.S‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ SIGN1(sys32_recvfrom, compat_sys_recvfrom, %o0)
4949
SIGN1(sys32_recvmsg, compat_sys_recvmsg, %o0)
5050
SIGN1(sys32_sendmsg, compat_sys_sendmsg, %o0)
5151
SIGN2(sys32_sync_file_range, compat_sync_file_range, %o0, %o5)
52-
SIGN1(sys32_vmsplice, compat_sys_vmsplice, %o0)
5352

5453
.globl sys32_mmap2
5554
sys32_mmap2:

‎arch/sparc/kernel/systbls_64.S‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ sys_call_table32:
2323
/*10*/ .word sys_unlink, sunos_execv, sys_chdir, sys_chown16, sys_mknod
2424
/*15*/ .word sys_chmod, sys_lchown16, sys_brk, sys_nis_syscall, compat_sys_lseek
2525
/*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
2727
/*30*/ .word compat_sys_utime, sys_lchown, sys_fchown, sys_access, sys_nice
2828
.word sys_chown, sys_sync, sys_kill, compat_sys_newstat, compat_sys_sendfile
2929
/*40*/ .word compat_sys_newlstat, sys_dup, sys_sparc_pipe, compat_sys_times, sys_getuid

‎fs/compat.c‎

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,26 +1253,6 @@ compat_sys_pwritev(unsigned long fd, const struct compat_iovec __user *vec,
12531253
return compat_sys_pwritev64(fd, vec, vlen, pos);
12541254
}
12551255

1256-
asmlinkage long
1257-
compat_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-
12761256
/*
12771257
* Exactly like fs/open.c:sys_open(), except that it doesn't set the
12781258
* O_LARGEFILE flag.

‎fs/splice.c‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <linux/security.h>
3232
#include <linux/gfp.h>
3333
#include <linux/socket.h>
34+
#include <linux/compat.h>
3435

3536
/*
3637
* Attempt to steal a page from a pipe buffer. This should perhaps go into
@@ -1688,6 +1689,27 @@ SYSCALL_DEFINE4(vmsplice, int, fd, const struct iovec __user *, iov,
16881689
return error;
16891690
}
16901691

1692+
#ifdef CONFIG_COMPAT
1693+
COMPAT_SYSCALL_DEFINE4(vmsplice, int, fd, const struct compat_iovec __user *, iov32,
1694+
unsigned int, nr_segs, unsigned int, flags)
1695+
{
1696+
unsigned i;
1697+
struct iovec __user *iov;
1698+
if (nr_segs > UIO_MAXIOV)
1699+
return -EINVAL;
1700+
iov = compat_alloc_user_space(nr_segs * sizeof(struct iovec));
1701+
for (i = 0; i < nr_segs; i++) {
1702+
struct compat_iovec v;
1703+
if (get_user(v.iov_base, &iov32[i].iov_base) ||
1704+
get_user(v.iov_len, &iov32[i].iov_len) ||
1705+
put_user(compat_ptr(v.iov_base), &iov[i].iov_base) ||
1706+
put_user(v.iov_len, &iov[i].iov_len))
1707+
return -EFAULT;
1708+
}
1709+
return sys_vmsplice(fd, iov, nr_segs, flags);
1710+
}
1711+
#endif
1712+
16911713
SYSCALL_DEFINE6(splice, int, fd_in, loff_t __user *, off_in,
16921714
int, fd_out, loff_t __user *, off_out,
16931715
size_t, len, unsigned int, flags)

0 commit comments

Comments
 (0)