freebsd-dev/lib/libc
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 Add support for usermode (vdso-like) gettimeofday(2) and 2015-12-07 12:20:26 +00:00
amd64 Add include for declaration of _set_tp(). Eliminates -Wmissing-prototypes warnings. 2015-09-20 04:59:01 +00:00
arm Do not compile ARMv6 instructions on ARMv4/v5. Although clang is fine 2015-12-24 22:13:52 +00:00
capability use .Mt to mark up email addresses consistently (part4) 2014-06-23 08:25:03 +00:00
compat-43 Use ANSI C prototypes. Eliminates -Wold-style-definition warnings. 2015-09-20 20:53:24 +00:00
db Use intptr_t note ptrdiff_t when storing flags in the bottom bits of 2016-01-29 01:22:12 +00:00
gdtoa META MODE: Don't create .meta files when symlinking sources into the obj directory. 2015-11-25 19:44:43 +00:00
gen Add implementations of sendmmsg(3) and recvmmsg(3) functions which 2016-01-29 14:12:12 +00:00
gmon Replace the last non-optional use of sbrk() in the tree with mmap(). 2016-01-21 18:17:19 +00:00
i386 Switch libc from using _sig{procmask,action,suspend} symbols, which 2015-08-29 14:25:01 +00:00
iconv libc: Use namespace.h in a few more files. 2015-12-20 23:05:20 +00:00
include Add implementations of sendmmsg(3) and recvmmsg(3) functions which 2016-01-29 14:12:12 +00:00
inet Use ANSI C prototypes. Eliminates -Wold-style-definition warnings. 2015-09-20 20:50:56 +00:00
isc Use ANSI C prototypes. Eliminates -Wold-style-definition warnings. 2015-09-23 16:16:16 +00:00
locale Link localeconv(3) to localeconv_l(3) 2015-11-25 09:12:30 +00:00
md Bring the md5 functions into libc for internal use only. 2014-08-12 12:25:56 +00:00
mips Fix the implementations of PSEUDO_NOERROR and PSEUDO. 2016-01-21 17:29:01 +00:00
nameser Add missing break. 2014-08-20 14:58:25 +00:00
net Replace nslexer.l->nslexer.c custom rule with a -D CFLAG. 2016-01-27 01:33:23 +00:00
nls Use mdoc(7) macros to handle parenthesis 2015-04-26 10:54:52 +00:00
posix1e Remove names from some prototypes 2015-09-20 20:16:34 +00:00
powerpc Add include for declaration of _set_tp(). Eliminates -Wmissing-prototypes warnings. 2015-09-20 04:59:01 +00:00
powerpc64 Add include for declaration of _set_tp(). Eliminates -Wmissing-prototypes warnings. 2015-09-20 04:59:01 +00:00
quad Remove MK_ARM_EABI, the armeb issues have been fixed. The code to support 2014-10-01 08:26:51 +00:00
regex Add -static to CFLAGS to unbreak the tests by using a libc.a with 2015-12-13 06:33:52 +00:00
resolv Allow users override DEBUG on the command line via DEBUG_FLAGS="-DDEBUG" with 2015-12-15 05:37:09 +00:00
riscv Bring in initial libc and libstand support for RISC-V. 2016-01-17 15:21:23 +00:00
rpc Fix a mismerge from NetBSD in r162194 with xdr_rpcb_entry_list_ptr(..) 2016-01-12 00:20:57 +00:00
secure Remove a stale comment and clarify the original where it was taken from 2015-08-14 14:58:04 +00:00
softfloat Replace use of ${.CURDIR} by ${LIBC_SRCTOP} and define ${LIBC_SRCTOP} 2014-03-04 02:19:39 +00:00
sparc64 Fix unused-but-set-variable 2015-11-15 20:44:22 +00:00
stdio Use __alignof__ instead of assuming int64_t to get the right 2015-12-30 03:36:22 +00:00
stdlib Add .NOMETA missed in r291320. 2016-01-20 20:58:42 +00:00
stdtime Use ANSI C prototypes. Eliminates -Wold-style-definition warnings. 2015-09-20 20:51:52 +00:00
string Add a standards compliance note for strtok_r as suggested by cpercival. 2016-01-22 20:36:03 +00:00
sys Add implementations of sendmmsg(3) and recvmmsg(3) functions which 2016-01-29 14:12:12 +00:00
tests This seems like a very trivial bug that should have been squashed a long 2016-01-30 04:16:05 +00:00
uuid Replace use of ${.CURDIR} by ${LIBC_SRCTOP} and define ${LIBC_SRCTOP} 2014-03-04 02:19:39 +00:00
xdr Bring in initial libc and libstand support for RISC-V. 2016-01-17 15:21:23 +00:00
yp If a NIS server has long entries on its database that is bigger than 2015-11-19 13:36:53 +00:00
libc.ldscript Attempt to move the POSIX iconv* symbols out of runtime linker space. 2013-11-17 22:52:17 +00:00
Makefile Remove excess whitespace 2016-01-27 00:24:24 +00:00
Makefile.depend Update META_MODE dependencies. 2015-09-17 05:06:34 +00:00
Versions.def Fix the inheritance of the FBSDprivate_1.0 namespace. 2014-04-03 17:31:38 +00:00