aboutsummaryrefslogtreecommitdiffstats
path: root/fs/exec.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-04-13 20:31:37 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2013-04-29 15:40:23 -0400
commit3dc20cb282ec03cc4c997130d680c800011ed479 (patch)
treed8374e58a433a144c571e193cb0b024374ee0b6a /fs/exec.c
parent3af0761307d04f6b9a4626fb80011a22c143d75e (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.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/exec.c b/fs/exec.c
index a96a4885bbbf..77dc9096440f 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -802,6 +802,15 @@ int kernel_read(struct file *file, loff_t offset,
802 802
803EXPORT_SYMBOL(kernel_read); 803EXPORT_SYMBOL(kernel_read);
804 804
805ssize_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}
812EXPORT_SYMBOL(read_code);
813
805static int exec_mmap(struct mm_struct *mm) 814static int exec_mmap(struct mm_struct *mm)
806{ 815{
807 struct task_struct *tsk; 816 struct task_struct *tsk;