freebsd-dev/libexec/rtld-elf
Maxim Sobolev 7fd852f860 This seems like a very trivial bug that should have been squashed a long
time ago, but for some reason it was not. Basically, without this change
dlopen(3)'ing an empty .so file would just cause application to dump core
with SIGSEGV.

Make sure the file has enough data for at least the ELF header before
mmap'ing it.

Add a test case to check that dlopen an empty file return an error.

There were a separate discussion as to whether it should be SIGBUS
instead when you try to access region mapped from an empty file,
but it's definitely SIGSEGV now, so if anyone want to check that please
be my guest.
Reviewed by:	mjg, cem
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D5112
2016-01-30 04:16:05 +00:00
..
aarch64 Do not call callbacks for dl_iterate_phdr(3) with the rtld bind and 2016-01-20 07:21:33 +00:00
amd64 Do not call callbacks for dl_iterate_phdr(3) with the rtld bind and 2016-01-20 07:21:33 +00:00
arm Do not call callbacks for dl_iterate_phdr(3) with the rtld bind and 2016-01-20 07:21:33 +00:00
i386 Do not call callbacks for dl_iterate_phdr(3) with the rtld bind and 2016-01-20 07:21:33 +00:00
mips Create a generalized exec hook that different architectures can hook 2016-01-03 04:32:02 +00:00
powerpc Do not call callbacks for dl_iterate_phdr(3) with the rtld bind and 2016-01-20 07:21:33 +00:00
powerpc64 Do not call callbacks for dl_iterate_phdr(3) with the rtld bind and 2016-01-20 07:21:33 +00:00
riscv Follow r293066 adding a generalized exec hook for RISC-V as well. 2016-01-23 11:46:52 +00:00
sparc64 Do not call callbacks for dl_iterate_phdr(3) with the rtld bind and 2016-01-20 07:21:33 +00:00
tests Fix LDADD/DPADD that should be LIBADD. 2015-12-04 03:17:47 +00:00
debug.c Do not call callbacks for dl_iterate_phdr(3) with the rtld bind and 2016-01-20 07:21:33 +00:00
debug.h Remove historical GNUC test 2015-05-06 15:29:11 +00:00
libmap.c Rather than using the #define for path names, indirect through a char * 2015-10-31 04:39:55 +00:00
libmap.h Make the directory mapping functionality, which was previously only 2013-09-21 21:03:52 +00:00
Makefile Follow-on to r291666: use -ffreestanding instead of -fno-builtin. 2015-12-03 21:25:59 +00:00
Makefile.depend new depends 2015-06-16 23:37:19 +00:00
malloc.c Move all the paths into a new path.h to centralize them. 2015-10-31 04:39:28 +00:00
map_object.c This seems like a very trivial bug that should have been squashed a long 2016-01-30 04:16:05 +00:00
paths.h Restore ABI variants now that ldconfig groks -soft. In addition, as a 2016-01-18 21:40:20 +00:00
rtld_lock.c Change compiler setting to make default visibility of the symbols for 2015-03-29 18:53:21 +00:00
rtld_lock.h Change compiler setting to make default visibility of the symbols for 2015-03-29 18:53:21 +00:00
rtld_printf.c Add the LD_LIBRARY_PATH_FDS environmental variable. 2014-06-20 17:08:32 +00:00
rtld_printf.h Add the LD_LIBRARY_PATH_FDS environmental variable. 2014-06-20 17:08:32 +00:00
rtld_tls.h Change compiler setting to make default visibility of the symbols for 2015-03-29 18:53:21 +00:00
rtld.1 mdoc: remove superfluous paragraph macros. 2014-06-23 18:40:21 +00:00
rtld.c Do not unlock rtld_phdr_lock over callback invocations. 2016-01-27 20:20:37 +00:00
rtld.h Do not call callbacks for dl_iterate_phdr(3) with the rtld bind and 2016-01-20 07:21:33 +00:00
Symbol.map Add rtld private interface for dso to detect dynamic loading 2015-01-03 18:09:53 +00:00
xmalloc.c Increase alignment to size of pointer if the alignment is too small. 2014-02-22 11:06:48 +00:00