Commit 48304f79 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Linus Torvalds

exec: only build read_code when needed

Only build read_code when binary formats that use it are built into the
kernel.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Link: http://lkml.kernel.org/r/20200515143646.3857579-26-hch@lst.deSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent a1e81f96
...@@ -1053,6 +1053,8 @@ int kernel_read_file_from_fd(int fd, void **buf, loff_t *size, loff_t max_size, ...@@ -1053,6 +1053,8 @@ int kernel_read_file_from_fd(int fd, void **buf, loff_t *size, loff_t max_size,
} }
EXPORT_SYMBOL_GPL(kernel_read_file_from_fd); EXPORT_SYMBOL_GPL(kernel_read_file_from_fd);
#if defined(CONFIG_HAVE_AOUT) || defined(CONFIG_BINFMT_FLAT) || \
defined(CONFIG_BINFMT_ELF_FDPIC)
ssize_t read_code(struct file *file, unsigned long addr, loff_t pos, size_t len) ssize_t read_code(struct file *file, unsigned long addr, loff_t pos, size_t len)
{ {
ssize_t res = vfs_read(file, (void __user *)addr, len, &pos); ssize_t res = vfs_read(file, (void __user *)addr, len, &pos);
...@@ -1061,6 +1063,7 @@ ssize_t read_code(struct file *file, unsigned long addr, loff_t pos, size_t len) ...@@ -1061,6 +1063,7 @@ ssize_t read_code(struct file *file, unsigned long addr, loff_t pos, size_t len)
return res; return res;
} }
EXPORT_SYMBOL(read_code); EXPORT_SYMBOL(read_code);
#endif
/* /*
* Maps the mm_struct mm into the current task struct. * Maps the mm_struct mm into the current task struct.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment