aboutsummaryrefslogtreecommitdiff
path: root/modutils/modutils.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2016-10-19 17:01:55 +0100
committerRon Yorston <rmy@pobox.com>2016-10-19 17:01:55 +0100
commit075814c60a316cfd088c88f26f75ab21b5850b98 (patch)
treef6e33ac693630827deb309faa5fa4931588db57d /modutils/modutils.c
parent977d65c1bbc57f5cdd0c8bfd67c8b5bb1cd390dd (diff)
parentf37e1155aabde6bd95d267a8aec347cedccb8bc3 (diff)
downloadbusybox-w32-075814c60a316cfd088c88f26f75ab21b5850b98.tar.gz
busybox-w32-075814c60a316cfd088c88f26f75ab21b5850b98.tar.bz2
busybox-w32-075814c60a316cfd088c88f26f75ab21b5850b98.zip
Merge branch busybox (up to "ash: comment out free(p) just before...")
Diffstat (limited to 'modutils/modutils.c')
-rw-r--r--modutils/modutils.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/modutils/modutils.c b/modutils/modutils.c
index 0a056731d..d36caaf68 100644
--- a/modutils/modutils.c
+++ b/modutils/modutils.c
@@ -13,6 +13,9 @@ extern int delete_module(const char *module, unsigned int flags);
13#else 13#else
14# include <sys/syscall.h> 14# include <sys/syscall.h>
15# define init_module(mod, len, opts) syscall(__NR_init_module, mod, len, opts) 15# define init_module(mod, len, opts) syscall(__NR_init_module, mod, len, opts)
16# if defined(__NR_finit_module)
17# define finit_module(fd, uargs, flags) syscall(__NR_finit_module, fd, uargs, flags)
18# endif
16# define delete_module(mod, flags) syscall(__NR_delete_module, mod, flags) 19# define delete_module(mod, flags) syscall(__NR_delete_module, mod, flags)
17#endif 20#endif
18 21
@@ -212,6 +215,24 @@ int FAST_FUNC bb_init_module(const char *filename, const char *options)
212 return bb_init_module_24(filename, options); 215 return bb_init_module_24(filename, options);
213#endif 216#endif
214 217
218 /*
219 * First we try finit_module if available. Some kernels are configured
220 * to only allow loading of modules off of secure storage (like a read-
221 * only rootfs) which needs the finit_module call. If it fails, we fall
222 * back to normal module loading to support compressed modules.
223 */
224# ifdef __NR_finit_module
225 {
226 int fd = open(filename, O_RDONLY | O_CLOEXEC);
227 if (fd >= 0) {
228 rc = finit_module(fd, options, 0) != 0;
229 close(fd);
230 if (rc == 0)
231 return rc;
232 }
233 }
234# endif
235
215 image_size = INT_MAX - 4095; 236 image_size = INT_MAX - 4095;
216 mmaped = 0; 237 mmaped = 0;
217 image = try_to_mmap_module(filename, &image_size); 238 image = try_to_mmap_module(filename, &image_size);