Skip to content

Commit 48304f7

Browse files
Christoph Hellwigtorvalds
authored andcommitted
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: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Link: http://lkml.kernel.org/r/20200515143646.3857579-26-hch@lst.de Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent a1e81f9 commit 48304f7

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎fs/exec.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,6 +1053,8 @@ int kernel_read_file_from_fd(int fd, void **buf, loff_t *size, loff_t max_size,
10531053
}
10541054
EXPORT_SYMBOL_GPL(kernel_read_file_from_fd);
10551055

1056+
#if defined(CONFIG_HAVE_AOUT) || defined(CONFIG_BINFMT_FLAT) || \
1057+
defined(CONFIG_BINFMT_ELF_FDPIC)
10561058
ssize_t read_code(struct file *file, unsigned long addr, loff_t pos, size_t len)
10571059
{
10581060
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)
10611063
return res;
10621064
}
10631065
EXPORT_SYMBOL(read_code);
1066+
#endif
10641067

10651068
/*
10661069
* Maps the mm_struct mm into the current task struct.

0 commit comments

Comments
 (0)