Accept linkers representation for ELF segments with zero on-disk length.
authorkib <kib@FreeBSD.org>
Sun, 12 Mar 2017 13:51:13 +0000 (13:51 +0000)
committerkib <kib@FreeBSD.org>
Sun, 12 Mar 2017 13:51:13 +0000 (13:51 +0000)
commitc77fb555717fa2fa2ddf6035a5ef6ccbf9065056
tree3fea19738eb17dec563404c00446f474ddd983f8
parent3d6312cf4f121610e7c3e24b0f457fed8dd64237
Accept linkers representation for ELF segments with zero on-disk length.

For such segments, GNU bfd linker writes knowingly incorrect value
into the the file offset field of the program header entry, with the
motivation that file should not be mapped for creation of this segment
at all.

Relax checks for the ELF structure validity when on-disk segment
length is zero, and explicitely set mapping length to zero for such
segments to avoid validating rounding arithmetic.

PR: 217610
Reported by: Robert Clausecker <fuz@fuz.su>
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
sys/kern/imgact_elf.c