mm: remove compat_process_vm_{readv,writev}
Now that import_iovec handles compat iovecs, the native syscalls can be used for the compat case as well. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Родитель
598b3cec83
Коммит
c3973b401e
|
@ -763,9 +763,9 @@ __SYSCALL(__NR_sendmmsg, compat_sys_sendmmsg)
|
|||
#define __NR_setns 375
|
||||
__SYSCALL(__NR_setns, sys_setns)
|
||||
#define __NR_process_vm_readv 376
|
||||
__SYSCALL(__NR_process_vm_readv, compat_sys_process_vm_readv)
|
||||
__SYSCALL(__NR_process_vm_readv, sys_process_vm_readv)
|
||||
#define __NR_process_vm_writev 377
|
||||
__SYSCALL(__NR_process_vm_writev, compat_sys_process_vm_writev)
|
||||
__SYSCALL(__NR_process_vm_writev, sys_process_vm_writev)
|
||||
#define __NR_kcmp 378
|
||||
__SYSCALL(__NR_kcmp, sys_kcmp)
|
||||
#define __NR_finit_module 379
|
||||
|
|
|
@ -317,8 +317,8 @@
|
|||
306 n32 syncfs sys_syncfs
|
||||
307 n32 sendmmsg compat_sys_sendmmsg
|
||||
308 n32 setns sys_setns
|
||||
309 n32 process_vm_readv compat_sys_process_vm_readv
|
||||
310 n32 process_vm_writev compat_sys_process_vm_writev
|
||||
309 n32 process_vm_readv sys_process_vm_readv
|
||||
310 n32 process_vm_writev sys_process_vm_writev
|
||||
311 n32 kcmp sys_kcmp
|
||||
312 n32 finit_module sys_finit_module
|
||||
313 n32 sched_setattr sys_sched_setattr
|
||||
|
|
|
@ -356,8 +356,8 @@
|
|||
342 o32 syncfs sys_syncfs
|
||||
343 o32 sendmmsg sys_sendmmsg compat_sys_sendmmsg
|
||||
344 o32 setns sys_setns
|
||||
345 o32 process_vm_readv sys_process_vm_readv compat_sys_process_vm_readv
|
||||
346 o32 process_vm_writev sys_process_vm_writev compat_sys_process_vm_writev
|
||||
345 o32 process_vm_readv sys_process_vm_readv
|
||||
346 o32 process_vm_writev sys_process_vm_writev
|
||||
347 o32 kcmp sys_kcmp
|
||||
348 o32 finit_module sys_finit_module
|
||||
349 o32 sched_setattr sys_sched_setattr
|
||||
|
|
|
@ -372,8 +372,8 @@
|
|||
327 common syncfs sys_syncfs
|
||||
328 common setns sys_setns
|
||||
329 common sendmmsg sys_sendmmsg compat_sys_sendmmsg
|
||||
330 common process_vm_readv sys_process_vm_readv compat_sys_process_vm_readv
|
||||
331 common process_vm_writev sys_process_vm_writev compat_sys_process_vm_writev
|
||||
330 common process_vm_readv sys_process_vm_readv
|
||||
331 common process_vm_writev sys_process_vm_writev
|
||||
332 common kcmp sys_kcmp
|
||||
333 common finit_module sys_finit_module
|
||||
334 common sched_setattr sys_sched_setattr
|
||||
|
|
|
@ -449,8 +449,8 @@
|
|||
348 common syncfs sys_syncfs
|
||||
349 common sendmmsg sys_sendmmsg compat_sys_sendmmsg
|
||||
350 common setns sys_setns
|
||||
351 nospu process_vm_readv sys_process_vm_readv compat_sys_process_vm_readv
|
||||
352 nospu process_vm_writev sys_process_vm_writev compat_sys_process_vm_writev
|
||||
351 nospu process_vm_readv sys_process_vm_readv
|
||||
352 nospu process_vm_writev sys_process_vm_writev
|
||||
353 nospu finit_module sys_finit_module
|
||||
354 nospu kcmp sys_kcmp
|
||||
355 common sched_setattr sys_sched_setattr
|
||||
|
|
|
@ -347,8 +347,8 @@
|
|||
337 common clock_adjtime sys_clock_adjtime sys_clock_adjtime32
|
||||
338 common syncfs sys_syncfs sys_syncfs
|
||||
339 common setns sys_setns sys_setns
|
||||
340 common process_vm_readv sys_process_vm_readv compat_sys_process_vm_readv
|
||||
341 common process_vm_writev sys_process_vm_writev compat_sys_process_vm_writev
|
||||
340 common process_vm_readv sys_process_vm_readv sys_process_vm_readv
|
||||
341 common process_vm_writev sys_process_vm_writev sys_process_vm_writev
|
||||
342 common s390_runtime_instr sys_s390_runtime_instr sys_s390_runtime_instr
|
||||
343 common kcmp sys_kcmp sys_kcmp
|
||||
344 common finit_module sys_finit_module sys_finit_module
|
||||
|
|
|
@ -406,8 +406,8 @@
|
|||
335 common syncfs sys_syncfs
|
||||
336 common sendmmsg sys_sendmmsg compat_sys_sendmmsg
|
||||
337 common setns sys_setns
|
||||
338 common process_vm_readv sys_process_vm_readv compat_sys_process_vm_readv
|
||||
339 common process_vm_writev sys_process_vm_writev compat_sys_process_vm_writev
|
||||
338 common process_vm_readv sys_process_vm_readv
|
||||
339 common process_vm_writev sys_process_vm_writev
|
||||
340 32 kern_features sys_ni_syscall sys_kern_features
|
||||
340 64 kern_features sys_kern_features
|
||||
341 common kcmp sys_kcmp
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
#define __x32_sys_getsockopt __x64_sys_getsockopt
|
||||
#define __x32_sys_setsockopt __x64_sys_setsockopt
|
||||
#define __x32_sys_vmsplice __x64_sys_vmsplice
|
||||
#define __x32_sys_process_vm_readv __x64_sys_process_vm_readv
|
||||
#define __x32_sys_process_vm_writev __x64_sys_process_vm_writev
|
||||
|
||||
#define __SYSCALL_64(nr, sym)
|
||||
|
||||
|
|
|
@ -358,8 +358,8 @@
|
|||
344 i386 syncfs sys_syncfs
|
||||
345 i386 sendmmsg sys_sendmmsg compat_sys_sendmmsg
|
||||
346 i386 setns sys_setns
|
||||
347 i386 process_vm_readv sys_process_vm_readv compat_sys_process_vm_readv
|
||||
348 i386 process_vm_writev sys_process_vm_writev compat_sys_process_vm_writev
|
||||
347 i386 process_vm_readv sys_process_vm_readv
|
||||
348 i386 process_vm_writev sys_process_vm_writev
|
||||
349 i386 kcmp sys_kcmp
|
||||
350 i386 finit_module sys_finit_module
|
||||
351 i386 sched_setattr sys_sched_setattr
|
||||
|
|
|
@ -395,8 +395,8 @@
|
|||
536 x32 rt_tgsigqueueinfo compat_sys_rt_tgsigqueueinfo
|
||||
537 x32 recvmmsg compat_sys_recvmmsg_time64
|
||||
538 x32 sendmmsg compat_sys_sendmmsg
|
||||
539 x32 process_vm_readv compat_sys_process_vm_readv
|
||||
540 x32 process_vm_writev compat_sys_process_vm_writev
|
||||
539 x32 process_vm_readv sys_process_vm_readv
|
||||
540 x32 process_vm_writev sys_process_vm_writev
|
||||
541 x32 setsockopt sys_setsockopt
|
||||
542 x32 getsockopt sys_getsockopt
|
||||
543 x32 io_setup compat_sys_io_setup
|
||||
|
|
|
@ -780,14 +780,6 @@ asmlinkage long compat_sys_open_by_handle_at(int mountdirfd,
|
|||
int flags);
|
||||
asmlinkage long compat_sys_sendmmsg(int fd, struct compat_mmsghdr __user *mmsg,
|
||||
unsigned vlen, unsigned int flags);
|
||||
asmlinkage ssize_t compat_sys_process_vm_readv(compat_pid_t pid,
|
||||
const struct compat_iovec __user *lvec,
|
||||
compat_ulong_t liovcnt, const struct compat_iovec __user *rvec,
|
||||
compat_ulong_t riovcnt, compat_ulong_t flags);
|
||||
asmlinkage ssize_t compat_sys_process_vm_writev(compat_pid_t pid,
|
||||
const struct compat_iovec __user *lvec,
|
||||
compat_ulong_t liovcnt, const struct compat_iovec __user *rvec,
|
||||
compat_ulong_t riovcnt, compat_ulong_t flags);
|
||||
asmlinkage long compat_sys_execveat(int dfd, const char __user *filename,
|
||||
const compat_uptr_t __user *argv,
|
||||
const compat_uptr_t __user *envp, int flags);
|
||||
|
|
|
@ -727,11 +727,9 @@ __SYSCALL(__NR_setns, sys_setns)
|
|||
#define __NR_sendmmsg 269
|
||||
__SC_COMP(__NR_sendmmsg, sys_sendmmsg, compat_sys_sendmmsg)
|
||||
#define __NR_process_vm_readv 270
|
||||
__SC_COMP(__NR_process_vm_readv, sys_process_vm_readv, \
|
||||
compat_sys_process_vm_readv)
|
||||
__SYSCALL(__NR_process_vm_readv, sys_process_vm_readv)
|
||||
#define __NR_process_vm_writev 271
|
||||
__SC_COMP(__NR_process_vm_writev, sys_process_vm_writev, \
|
||||
compat_sys_process_vm_writev)
|
||||
__SYSCALL(__NR_process_vm_writev, sys_process_vm_writev)
|
||||
#define __NR_kcmp 272
|
||||
__SYSCALL(__NR_kcmp, sys_kcmp)
|
||||
#define __NR_finit_module 273
|
||||
|
|
|
@ -14,10 +14,6 @@
|
|||
#include <linux/slab.h>
|
||||
#include <linux/syscalls.h>
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
#include <linux/compat.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* process_vm_rw_pages - read/write pages from task specified
|
||||
* @pages: array of pointers to pages we want to copy
|
||||
|
@ -304,68 +300,3 @@ SYSCALL_DEFINE6(process_vm_writev, pid_t, pid,
|
|||
{
|
||||
return process_vm_rw(pid, lvec, liovcnt, rvec, riovcnt, flags, 1);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
|
||||
static ssize_t
|
||||
compat_process_vm_rw(compat_pid_t pid,
|
||||
const struct compat_iovec __user *lvec,
|
||||
unsigned long liovcnt,
|
||||
const struct compat_iovec __user *rvec,
|
||||
unsigned long riovcnt,
|
||||
unsigned long flags, int vm_write)
|
||||
{
|
||||
struct iovec iovstack_l[UIO_FASTIOV];
|
||||
struct iovec iovstack_r[UIO_FASTIOV];
|
||||
struct iovec *iov_l = iovstack_l;
|
||||
struct iovec *iov_r = iovstack_r;
|
||||
struct iov_iter iter;
|
||||
ssize_t rc = -EFAULT;
|
||||
int dir = vm_write ? WRITE : READ;
|
||||
|
||||
if (flags != 0)
|
||||
return -EINVAL;
|
||||
|
||||
rc = import_iovec(dir, (const struct iovec __user *)lvec, liovcnt,
|
||||
UIO_FASTIOV, &iov_l, &iter);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
if (!iov_iter_count(&iter))
|
||||
goto free_iov_l;
|
||||
iov_r = iovec_from_user((const struct iovec __user *)rvec, riovcnt,
|
||||
UIO_FASTIOV, iovstack_r, true);
|
||||
if (IS_ERR(iov_r)) {
|
||||
rc = PTR_ERR(iov_r);
|
||||
goto free_iov_l;
|
||||
}
|
||||
rc = process_vm_rw_core(pid, &iter, iov_r, riovcnt, flags, vm_write);
|
||||
if (iov_r != iovstack_r)
|
||||
kfree(iov_r);
|
||||
free_iov_l:
|
||||
kfree(iov_l);
|
||||
return rc;
|
||||
}
|
||||
|
||||
COMPAT_SYSCALL_DEFINE6(process_vm_readv, compat_pid_t, pid,
|
||||
const struct compat_iovec __user *, lvec,
|
||||
compat_ulong_t, liovcnt,
|
||||
const struct compat_iovec __user *, rvec,
|
||||
compat_ulong_t, riovcnt,
|
||||
compat_ulong_t, flags)
|
||||
{
|
||||
return compat_process_vm_rw(pid, lvec, liovcnt, rvec,
|
||||
riovcnt, flags, 0);
|
||||
}
|
||||
|
||||
COMPAT_SYSCALL_DEFINE6(process_vm_writev, compat_pid_t, pid,
|
||||
const struct compat_iovec __user *, lvec,
|
||||
compat_ulong_t, liovcnt,
|
||||
const struct compat_iovec __user *, rvec,
|
||||
compat_ulong_t, riovcnt,
|
||||
compat_ulong_t, flags)
|
||||
{
|
||||
return compat_process_vm_rw(pid, lvec, liovcnt, rvec,
|
||||
riovcnt, flags, 1);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -727,11 +727,9 @@ __SYSCALL(__NR_setns, sys_setns)
|
|||
#define __NR_sendmmsg 269
|
||||
__SC_COMP(__NR_sendmmsg, sys_sendmmsg, compat_sys_sendmmsg)
|
||||
#define __NR_process_vm_readv 270
|
||||
__SC_COMP(__NR_process_vm_readv, sys_process_vm_readv, \
|
||||
compat_sys_process_vm_readv)
|
||||
__SYSCALL(__NR_process_vm_readv, sys_process_vm_readv)
|
||||
#define __NR_process_vm_writev 271
|
||||
__SC_COMP(__NR_process_vm_writev, sys_process_vm_writev, \
|
||||
compat_sys_process_vm_writev)
|
||||
__SYSCALL(__NR_process_vm_writev, sys_process_vm_writev)
|
||||
#define __NR_kcmp 272
|
||||
__SYSCALL(__NR_kcmp, sys_kcmp)
|
||||
#define __NR_finit_module 273
|
||||
|
|
|
@ -443,8 +443,8 @@
|
|||
348 common syncfs sys_syncfs
|
||||
349 common sendmmsg sys_sendmmsg compat_sys_sendmmsg
|
||||
350 common setns sys_setns
|
||||
351 nospu process_vm_readv sys_process_vm_readv compat_sys_process_vm_readv
|
||||
352 nospu process_vm_writev sys_process_vm_writev compat_sys_process_vm_writev
|
||||
351 nospu process_vm_readv sys_process_vm_readv
|
||||
352 nospu process_vm_writev sys_process_vm_writev
|
||||
353 nospu finit_module sys_finit_module
|
||||
354 nospu kcmp sys_kcmp
|
||||
355 common sched_setattr sys_sched_setattr
|
||||
|
|
|
@ -347,8 +347,8 @@
|
|||
337 common clock_adjtime sys_clock_adjtime compat_sys_clock_adjtime
|
||||
338 common syncfs sys_syncfs sys_syncfs
|
||||
339 common setns sys_setns sys_setns
|
||||
340 common process_vm_readv sys_process_vm_readv compat_sys_process_vm_readv
|
||||
341 common process_vm_writev sys_process_vm_writev compat_sys_process_vm_writev
|
||||
340 common process_vm_readv sys_process_vm_readv sys_process_vm_readv
|
||||
341 common process_vm_writev sys_process_vm_writev sys_process_vm_writev
|
||||
342 common s390_runtime_instr sys_s390_runtime_instr sys_s390_runtime_instr
|
||||
343 common kcmp sys_kcmp compat_sys_kcmp
|
||||
344 common finit_module sys_finit_module compat_sys_finit_module
|
||||
|
|
|
@ -395,8 +395,8 @@
|
|||
536 x32 rt_tgsigqueueinfo compat_sys_rt_tgsigqueueinfo
|
||||
537 x32 recvmmsg compat_sys_recvmmsg_time64
|
||||
538 x32 sendmmsg compat_sys_sendmmsg
|
||||
539 x32 process_vm_readv compat_sys_process_vm_readv
|
||||
540 x32 process_vm_writev compat_sys_process_vm_writev
|
||||
539 x32 process_vm_readv sys_process_vm_readv
|
||||
540 x32 process_vm_writev sys_process_vm_writev
|
||||
541 x32 setsockopt sys_setsockopt
|
||||
542 x32 getsockopt sys_getsockopt
|
||||
543 x32 io_setup compat_sys_io_setup
|
||||
|
|
Загрузка…
Ссылка в новой задаче