Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 272106
b: refs/heads/master
c: fcf6340
h: refs/heads/master
v: v3
  • Loading branch information
Christopher Yeoh authored and Linus Torvalds committed Nov 1, 2011
1 parent 77677b1 commit 81d9174
Show file tree
Hide file tree
Showing 18 changed files with 551 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 32ea845d5bafc37b7406bea1aee3005407cb0900
refs/heads/master: fcf634098c00dd9cd247447368495f0b79be12d1
2 changes: 2 additions & 0 deletions trunk/arch/powerpc/include/asm/systbl.h
Original file line number Diff line number Diff line change
Expand Up @@ -354,3 +354,5 @@ COMPAT_SYS_SPU(clock_adjtime)
SYSCALL_SPU(syncfs)
COMPAT_SYS_SPU(sendmmsg)
SYSCALL_SPU(setns)
COMPAT_SYS(process_vm_readv)
COMPAT_SYS(process_vm_writev)
4 changes: 3 additions & 1 deletion trunk/arch/powerpc/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -373,10 +373,12 @@
#define __NR_syncfs 348
#define __NR_sendmmsg 349
#define __NR_setns 350
#define __NR_process_vm_readv 351
#define __NR_process_vm_writev 352

#ifdef __KERNEL__

#define __NR_syscalls 351
#define __NR_syscalls 353

#define __NR__exit __NR_exit
#define NR_syscalls __NR_syscalls
Expand Down
2 changes: 2 additions & 0 deletions trunk/arch/x86/ia32/ia32entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -850,4 +850,6 @@ ia32_sys_call_table:
.quad sys_syncfs
.quad compat_sys_sendmmsg /* 345 */
.quad sys_setns
.quad compat_sys_process_vm_readv
.quad compat_sys_process_vm_writev
ia32_syscall_end:
4 changes: 3 additions & 1 deletion trunk/arch/x86/include/asm/unistd_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -352,10 +352,12 @@
#define __NR_syncfs 344
#define __NR_sendmmsg 345
#define __NR_setns 346
#define __NR_process_vm_readv 347
#define __NR_process_vm_writev 348

#ifdef __KERNEL__

#define NR_syscalls 347
#define NR_syscalls 349

#define __ARCH_WANT_IPC_PARSE_VERSION
#define __ARCH_WANT_OLD_READDIR
Expand Down
4 changes: 4 additions & 0 deletions trunk/arch/x86/include/asm/unistd_64.h
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,10 @@ __SYSCALL(__NR_sendmmsg, sys_sendmmsg)
__SYSCALL(__NR_setns, sys_setns)
#define __NR_getcpu 309
__SYSCALL(__NR_getcpu, sys_getcpu)
#define __NR_process_vm_readv 310
__SYSCALL(__NR_process_vm_readv, sys_process_vm_readv)
#define __NR_process_vm_writev 311
__SYSCALL(__NR_process_vm_writev, sys_process_vm_writev)

#ifndef __NO_STUBS
#define __ARCH_WANT_OLD_READDIR
Expand Down
2 changes: 2 additions & 0 deletions trunk/arch/x86/kernel/syscall_table_32.S
Original file line number Diff line number Diff line change
Expand Up @@ -346,3 +346,5 @@ ENTRY(sys_call_table)
.long sys_syncfs
.long sys_sendmmsg /* 345 */
.long sys_setns
.long sys_process_vm_readv
.long sys_process_vm_writev
4 changes: 2 additions & 2 deletions trunk/fs/aio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1387,13 +1387,13 @@ static ssize_t aio_setup_vectored_rw(int type, struct kiocb *kiocb, bool compat)
ret = compat_rw_copy_check_uvector(type,
(struct compat_iovec __user *)kiocb->ki_buf,
kiocb->ki_nbytes, 1, &kiocb->ki_inline_vec,
&kiocb->ki_iovec);
&kiocb->ki_iovec, 1);
else
#endif
ret = rw_copy_check_uvector(type,
(struct iovec __user *)kiocb->ki_buf,
kiocb->ki_nbytes, 1, &kiocb->ki_inline_vec,
&kiocb->ki_iovec);
&kiocb->ki_iovec, 1);
if (ret < 0)
goto out;

Expand Down
7 changes: 4 additions & 3 deletions trunk/fs/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ compat_sys_io_getevents(aio_context_t ctx_id,
ssize_t compat_rw_copy_check_uvector(int type,
const struct compat_iovec __user *uvector, unsigned long nr_segs,
unsigned long fast_segs, struct iovec *fast_pointer,
struct iovec **ret_pointer)
struct iovec **ret_pointer, int check_access)
{
compat_ssize_t tot_len;
struct iovec *iov = *ret_pointer = fast_pointer;
Expand Down Expand Up @@ -593,7 +593,8 @@ ssize_t compat_rw_copy_check_uvector(int type,
}
if (len < 0) /* size_t not fitting in compat_ssize_t .. */
goto out;
if (!access_ok(vrfy_dir(type), compat_ptr(buf), len)) {
if (check_access &&
!access_ok(vrfy_dir(type), compat_ptr(buf), len)) {
ret = -EFAULT;
goto out;
}
Expand Down Expand Up @@ -1107,7 +1108,7 @@ static ssize_t compat_do_readv_writev(int type, struct file *file,
goto out;

tot_len = compat_rw_copy_check_uvector(type, uvector, nr_segs,
UIO_FASTIOV, iovstack, &iov);
UIO_FASTIOV, iovstack, &iov, 1);
if (tot_len == 0) {
ret = 0;
goto out;
Expand Down
8 changes: 5 additions & 3 deletions trunk/fs/read_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,8 @@ ssize_t do_loop_readv_writev(struct file *filp, struct iovec *iov,
ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
unsigned long nr_segs, unsigned long fast_segs,
struct iovec *fast_pointer,
struct iovec **ret_pointer)
struct iovec **ret_pointer,
int check_access)
{
unsigned long seg;
ssize_t ret;
Expand Down Expand Up @@ -689,7 +690,8 @@ ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
ret = -EINVAL;
goto out;
}
if (unlikely(!access_ok(vrfy_dir(type), buf, len))) {
if (check_access
&& unlikely(!access_ok(vrfy_dir(type), buf, len))) {
ret = -EFAULT;
goto out;
}
Expand Down Expand Up @@ -721,7 +723,7 @@ static ssize_t do_readv_writev(int type, struct file *file,
}

ret = rw_copy_check_uvector(type, uvector, nr_segs,
ARRAY_SIZE(iovstack), iovstack, &iov);
ARRAY_SIZE(iovstack), iovstack, &iov, 1);
if (ret <= 0)
goto out;

Expand Down
3 changes: 2 additions & 1 deletion trunk/include/linux/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,8 @@ extern ssize_t compat_rw_copy_check_uvector(int type,
const struct compat_iovec __user *uvector,
unsigned long nr_segs,
unsigned long fast_segs, struct iovec *fast_pointer,
struct iovec **ret_pointer);
struct iovec **ret_pointer,
int check_access);

extern void __user *compat_alloc_user_space(unsigned long len);

Expand Down
7 changes: 4 additions & 3 deletions trunk/include/linux/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1633,9 +1633,10 @@ struct inode_operations {
struct seq_file;

ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
unsigned long nr_segs, unsigned long fast_segs,
struct iovec *fast_pointer,
struct iovec **ret_pointer);
unsigned long nr_segs, unsigned long fast_segs,
struct iovec *fast_pointer,
struct iovec **ret_pointer,
int check_access);

extern ssize_t vfs_read(struct file *, char __user *, size_t, loff_t *);
extern ssize_t vfs_write(struct file *, const char __user *, size_t, loff_t *);
Expand Down
13 changes: 13 additions & 0 deletions trunk/include/linux/syscalls.h
Original file line number Diff line number Diff line change
Expand Up @@ -844,4 +844,17 @@ asmlinkage long sys_open_by_handle_at(int mountdirfd,
struct file_handle __user *handle,
int flags);
asmlinkage long sys_setns(int fd, int nstype);
asmlinkage long sys_process_vm_readv(pid_t pid,
const struct iovec __user *lvec,
unsigned long liovcnt,
const struct iovec __user *rvec,
unsigned long riovcnt,
unsigned long flags);
asmlinkage long sys_process_vm_writev(pid_t pid,
const struct iovec __user *lvec,
unsigned long liovcnt,
const struct iovec __user *rvec,
unsigned long riovcnt,
unsigned long flags);

#endif
4 changes: 4 additions & 0 deletions trunk/kernel/sys_ni.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ cond_syscall(sys_io_submit);
cond_syscall(sys_io_cancel);
cond_syscall(sys_io_getevents);
cond_syscall(sys_syslog);
cond_syscall(sys_process_vm_readv);
cond_syscall(sys_process_vm_writev);
cond_syscall(compat_sys_process_vm_readv);
cond_syscall(compat_sys_process_vm_writev);

/* arch-specific weak syscall entries */
cond_syscall(sys_pciconfig_read);
Expand Down
3 changes: 2 additions & 1 deletion trunk/mm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
mmu-y := nommu.o
mmu-$(CONFIG_MMU) := fremap.o highmem.o madvise.o memory.o mincore.o \
mlock.o mmap.o mprotect.o mremap.o msync.o rmap.o \
vmalloc.o pagewalk.o pgtable-generic.o
vmalloc.o pagewalk.o pgtable-generic.o \
process_vm_access.o

obj-y := filemap.o mempool.o oom_kill.o fadvise.o \
maccess.o page_alloc.o page-writeback.o \
Expand Down
Loading

0 comments on commit 81d9174

Please sign in to comment.