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.
Showing the changes to include (2 of 8 files). Show all
Unified · Split
| @@ -577,8 +577,7 @@ extern ssize_t compat_rw_copy_check_uvector(int type, · 576 unmodified lines | ||
| 577 | 577 | const struct compat_iovec __user *uvector, |
| 578 | 578 | unsigned long nr_segs, |
| 579 | 579 | unsigned long fast_segs, struct iovec *fast_pointer, |
| 580 | − struct iovec **ret_pointer, | |
| 581 | − int check_access); | |
| 580 | + struct iovec **ret_pointer); | |
| 582 | 581 | |
| 583 | 582 | extern void __user *compat_alloc_user_space(unsigned long len); |
| 584 | 583 | |
| @@ -173,6 +173,15 @@ struct inodes_stat_t { · 172 unmodified lines | ||
| 173 | 173 | #define WRITE_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FUA) |
| 174 | 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 | 185 | #define SEL_IN 1 |
| 177 | 186 | #define SEL_OUT 2 |
| 178 | 187 | #define SEL_EX 4 |
| @@ -1690,8 +1699,7 @@ struct seq_file; · 1511 unmodified lines | ||
| 1690 | 1699 | ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector, |
| 1691 | 1700 | unsigned long nr_segs, unsigned long fast_segs, |
| 1692 | 1701 | struct iovec *fast_pointer, |
| 1693 | − struct iovec **ret_pointer, | |
| 1694 | − int check_access); | |
| 1702 | + struct iovec **ret_pointer); | |
| 1695 | 1703 | |
| 1696 | 1704 | extern ssize_t vfs_read(struct file *, char __user *, size_t, loff_t *); |
| 1697 | 1705 | extern ssize_t vfs_write(struct file *, const char __user *, size_t, loff_t *); |