diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-04-13 20:31:37 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-04-29 15:40:23 -0400 |
commit | 3dc20cb282ec03cc4c997130d680c800011ed479 (patch) | |
tree | d8374e58a433a144c571e193cb0b024374ee0b6a /fs/exec.c | |
parent | 3af0761307d04f6b9a4626fb80011a22c143d75e (diff) |
new helper: read_code()
switch binfmts that use ->read() to that (and to kernel_read()
in several cases in binfmt_flat - sure, it's nommu, but still,
doing ->read() into kmalloc'ed buffer...)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/exec.c')
-rw-r--r-- | fs/exec.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -802,6 +802,15 @@ int kernel_read(struct file *file, loff_t offset, | |||
802 | 802 | ||
803 | EXPORT_SYMBOL(kernel_read); | 803 | EXPORT_SYMBOL(kernel_read); |
804 | 804 | ||
805 | ssize_t read_code(struct file *file, unsigned long addr, loff_t pos, size_t len) | ||
806 | { | ||
807 | ssize_t res = file->f_op->read(file, (void __user *)addr, len, &pos); | ||
808 | if (res > 0) | ||
809 | flush_icache_range(addr, addr + len); | ||
810 | return res; | ||
811 | } | ||
812 | EXPORT_SYMBOL(read_code); | ||
813 | |||
805 | static int exec_mmap(struct mm_struct *mm) | 814 | static int exec_mmap(struct mm_struct *mm) |
806 | { | 815 | { |
807 | struct task_struct *tsk; | 816 | struct task_struct *tsk; |