History

aio/vfs: cleanup of rw_copy_check_uvector() and compat_rw_copy_check_uvector()

A cleanup of rw_copy_check_uvector and compat_rw_copy_check_uvector after changes made to support CMA in an earlier patch. Rather than having an additional check_access parameter to these functions, the first paramater type is overloaded to allow the caller to specify CHECK_IOVEC_ONLY which means check that the contents of the iovec are valid, but do not check the memory that they point to. This is used by process_vm_readv/writev where we need to validate that a iovec passed to the syscall is valid but do not want to check the memory that it points to at this point because it refers to an address space in another process.

Christopher Yeoh committed 14 years ago

Commit ac34ebb1 parent ee62c6b8 files · +29 −23Browse files

Showing the changes to include (2 of 8 files). Show all

Unified · Split

2 files
  1. include/linux/compat.h +1 −2
  2. include/linux/fs.h +10 −2
include/linux/compat.h+1−2
@@ -577,8 +577,7 @@ extern ssize_t compat_rw_copy_check_uvector(int type, · 576 unmodified lines
577 const struct compat_iovec __user *uvector,577 const struct compat_iovec __user *uvector,
578 unsigned long nr_segs,578 unsigned long nr_segs,
579 unsigned long fast_segs, struct iovec *fast_pointer,579 unsigned long fast_segs, struct iovec *fast_pointer,
580 struct iovec **ret_pointer,580 struct iovec **ret_pointer);
581 int check_access);
582 581
583extern void __user *compat_alloc_user_space(unsigned long len);582extern void __user *compat_alloc_user_space(unsigned long len);
584 583
include/linux/fs.h+10−2
@@ -173,6 +173,15 @@ struct inodes_stat_t { · 172 unmodified lines
173#define WRITE_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FUA)173#define WRITE_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FUA)
174#define WRITE_FLUSH_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FLUSH | REQ_FUA)174#define WRITE_FLUSH_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FLUSH | REQ_FUA)
175 175
176
177/*
178 * Flag for rw_copy_check_uvector and compat_rw_copy_check_uvector
179 * that indicates that they should check the contents of the iovec are
180 * valid, but not check the memory that the iovec elements
181 * points too.
182 */
183#define CHECK_IOVEC_ONLY -1
184
176#define SEL_IN 1185#define SEL_IN 1
177#define SEL_OUT 2186#define SEL_OUT 2
178#define SEL_EX 4187#define SEL_EX 4
@@ -1690,8 +1699,7 @@ struct seq_file; · 1511 unmodified lines
1690ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,1699ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
1691 unsigned long nr_segs, unsigned long fast_segs,1700 unsigned long nr_segs, unsigned long fast_segs,
1692 struct iovec *fast_pointer,1701 struct iovec *fast_pointer,
1693 struct iovec **ret_pointer,1702 struct iovec **ret_pointer);
1694 int check_access);
1695 1703
1696extern ssize_t vfs_read(struct file *, char __user *, size_t, loff_t *);1704extern ssize_t vfs_read(struct file *, char __user *, size_t, loff_t *);
1697extern ssize_t vfs_write(struct file *, const char __user *, size_t, loff_t *);1705extern ssize_t vfs_write(struct file *, const char __user *, size_t, loff_t *);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t