提交 69369a70 编写于 作者: J Josh Triplett 提交者: Linus Torvalds

fs, kernel: permit disabling the uselib syscall

uselib hasn't been used since libc5; glibc does not use it.  Support
turning it off.

When disabled, also omit the load_elf_library implementation from
binfmt_elf.c, which only uselib invokes.

bloat-o-meter:
add/remove: 0/4 grow/shrink: 0/1 up/down: 0/-785 (-785)
function                                     old     new   delta
padzero                                       39      36      -3
uselib_flags                                  20       -     -20
sys_uselib                                   168       -    -168
SyS_uselib                                   168       -    -168
load_elf_library                             426       -    -426

The new CONFIG_USELIB defaults to `y'.
Signed-off-by: NJosh Triplett <josh@joshtriplett.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 8f6c5ffc
...@@ -46,10 +46,15 @@ ...@@ -46,10 +46,15 @@
#endif #endif
static int load_elf_binary(struct linux_binprm *bprm); static int load_elf_binary(struct linux_binprm *bprm);
static int load_elf_library(struct file *);
static unsigned long elf_map(struct file *, unsigned long, struct elf_phdr *, static unsigned long elf_map(struct file *, unsigned long, struct elf_phdr *,
int, int, unsigned long); int, int, unsigned long);
#ifdef CONFIG_USELIB
static int load_elf_library(struct file *);
#else
#define load_elf_library NULL
#endif
/* /*
* If we don't support core dumping, then supply a NULL so we * If we don't support core dumping, then supply a NULL so we
* don't even try. * don't even try.
...@@ -1005,6 +1010,7 @@ static int load_elf_binary(struct linux_binprm *bprm) ...@@ -1005,6 +1010,7 @@ static int load_elf_binary(struct linux_binprm *bprm)
goto out; goto out;
} }
#ifdef CONFIG_USELIB
/* This is really simpleminded and specialized - we are loading an /* This is really simpleminded and specialized - we are loading an
a.out library that is given an ELF header. */ a.out library that is given an ELF header. */
static int load_elf_library(struct file *file) static int load_elf_library(struct file *file)
...@@ -1083,6 +1089,7 @@ static int load_elf_library(struct file *file) ...@@ -1083,6 +1089,7 @@ static int load_elf_library(struct file *file)
out: out:
return error; return error;
} }
#endif /* #ifdef CONFIG_USELIB */
#ifdef CONFIG_ELF_CORE #ifdef CONFIG_ELF_CORE
/* /*
......
...@@ -97,6 +97,7 @@ static inline void put_binfmt(struct linux_binfmt * fmt) ...@@ -97,6 +97,7 @@ static inline void put_binfmt(struct linux_binfmt * fmt)
module_put(fmt->module); module_put(fmt->module);
} }
#ifdef CONFIG_USELIB
/* /*
* Note that a shared library must be both readable and executable due to * Note that a shared library must be both readable and executable due to
* security reasons. * security reasons.
...@@ -156,6 +157,7 @@ SYSCALL_DEFINE1(uselib, const char __user *, library) ...@@ -156,6 +157,7 @@ SYSCALL_DEFINE1(uselib, const char __user *, library)
out: out:
return error; return error;
} }
#endif /* #ifdef CONFIG_USELIB */
#ifdef CONFIG_MMU #ifdef CONFIG_MMU
/* /*
......
...@@ -273,6 +273,16 @@ config FHANDLE ...@@ -273,6 +273,16 @@ config FHANDLE
get renamed. Enables open_by_handle_at(2) and name_to_handle_at(2) get renamed. Enables open_by_handle_at(2) and name_to_handle_at(2)
syscalls. syscalls.
config USELIB
bool "uselib syscall"
default y
help
This option enables the uselib syscall, a system call used in the
dynamic linker from libc5 and earlier. glibc does not use this
system call. If you intend to run programs built on libc5 or
earlier, you may need to enable this syscall. Current systems
running glibc can safely disable this.
config AUDIT config AUDIT
bool "Auditing support" bool "Auditing support"
depends on NET depends on NET
......
...@@ -152,6 +152,7 @@ cond_syscall(sys_process_vm_readv); ...@@ -152,6 +152,7 @@ cond_syscall(sys_process_vm_readv);
cond_syscall(sys_process_vm_writev); cond_syscall(sys_process_vm_writev);
cond_syscall(compat_sys_process_vm_readv); cond_syscall(compat_sys_process_vm_readv);
cond_syscall(compat_sys_process_vm_writev); cond_syscall(compat_sys_process_vm_writev);
cond_syscall(sys_uselib);
/* arch-specific weak syscall entries */ /* arch-specific weak syscall entries */
cond_syscall(sys_pciconfig_read); cond_syscall(sys_pciconfig_read);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册