aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Triplett <josh@joshtriplett.org>2014-04-03 17:48:27 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-03 19:21:05 -0400
commit69369a7003735d0d8ef22097e27a55a8bad9557a (patch)
treeb7638899a8e81fc18a497791685f1b571d733896
parent8f6c5ffc8987f4f5b5a3e9d557d94bbf3a9bf216 (diff)
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: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--fs/binfmt_elf.c9
-rw-r--r--fs/exec.c2
-rw-r--r--init/Kconfig10
-rw-r--r--kernel/sys_ni.c1
4 files changed, 21 insertions, 1 deletions
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 67be2951b98a..0f59799fa105 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -46,10 +46,15 @@
46#endif 46#endif
47 47
48static int load_elf_binary(struct linux_binprm *bprm); 48static int load_elf_binary(struct linux_binprm *bprm);
49static int load_elf_library(struct file *);
50static unsigned long elf_map(struct file *, unsigned long, struct elf_phdr *, 49static unsigned long elf_map(struct file *, unsigned long, struct elf_phdr *,
51 int, int, unsigned long); 50 int, int, unsigned long);
52 51
52#ifdef CONFIG_USELIB
53static int load_elf_library(struct file *);
54#else
55#define load_elf_library NULL
56#endif
57
53/* 58/*
54 * If we don't support core dumping, then supply a NULL so we 59 * If we don't support core dumping, then supply a NULL so we
55 * don't even try. 60 * don't even try.
@@ -1005,6 +1010,7 @@ out_free_ph:
1005 goto out; 1010 goto out;
1006} 1011}
1007 1012
1013#ifdef CONFIG_USELIB
1008/* This is really simpleminded and specialized - we are loading an 1014/* This is really simpleminded and specialized - we are loading an
1009 a.out library that is given an ELF header. */ 1015 a.out library that is given an ELF header. */
1010static int load_elf_library(struct file *file) 1016static int load_elf_library(struct file *file)
@@ -1083,6 +1089,7 @@ out_free_ph:
1083out: 1089out:
1084 return error; 1090 return error;
1085} 1091}
1092#endif /* #ifdef CONFIG_USELIB */
1086 1093
1087#ifdef CONFIG_ELF_CORE 1094#ifdef CONFIG_ELF_CORE
1088/* 1095/*
diff --git a/fs/exec.c b/fs/exec.c
index 4f59402fdda5..25dfeba6d55f 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -97,6 +97,7 @@ static inline void put_binfmt(struct linux_binfmt * fmt)
97 module_put(fmt->module); 97 module_put(fmt->module);
98} 98}
99 99
100#ifdef CONFIG_USELIB
100/* 101/*
101 * Note that a shared library must be both readable and executable due to 102 * Note that a shared library must be both readable and executable due to
102 * security reasons. 103 * security reasons.
@@ -156,6 +157,7 @@ exit:
156out: 157out:
157 return error; 158 return error;
158} 159}
160#endif /* #ifdef CONFIG_USELIB */
159 161
160#ifdef CONFIG_MMU 162#ifdef CONFIG_MMU
161/* 163/*
diff --git a/init/Kconfig b/init/Kconfig
index e45cc62904b3..8114a06117e3 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -273,6 +273,16 @@ config FHANDLE
273 get renamed. Enables open_by_handle_at(2) and name_to_handle_at(2) 273 get renamed. Enables open_by_handle_at(2) and name_to_handle_at(2)
274 syscalls. 274 syscalls.
275 275
276config USELIB
277 bool "uselib syscall"
278 default y
279 help
280 This option enables the uselib syscall, a system call used in the
281 dynamic linker from libc5 and earlier. glibc does not use this
282 system call. If you intend to run programs built on libc5 or
283 earlier, you may need to enable this syscall. Current systems
284 running glibc can safely disable this.
285
276config AUDIT 286config AUDIT
277 bool "Auditing support" 287 bool "Auditing support"
278 depends on NET 288 depends on NET
diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c
index 74395a95b7e9..bc8d1b74a6b9 100644
--- a/kernel/sys_ni.c
+++ b/kernel/sys_ni.c
@@ -152,6 +152,7 @@ cond_syscall(sys_process_vm_readv);
152cond_syscall(sys_process_vm_writev); 152cond_syscall(sys_process_vm_writev);
153cond_syscall(compat_sys_process_vm_readv); 153cond_syscall(compat_sys_process_vm_readv);
154cond_syscall(compat_sys_process_vm_writev); 154cond_syscall(compat_sys_process_vm_writev);
155cond_syscall(sys_uselib);
155 156
156/* arch-specific weak syscall entries */ 157/* arch-specific weak syscall entries */
157cond_syscall(sys_pciconfig_read); 158cond_syscall(sys_pciconfig_read);