HomeFreeBSD

Fix ldd for PIE binaries after rtld stopped accepting binaries for dlopen.

Description

Fix ldd for PIE binaries after rtld stopped accepting binaries for dlopen.

ldd proclaims ET_DYN objects as shared libraries and tries to
dlopen(RTLD_TRACE) them to get dependencies. Since PIE binaries are
ET_DYN | DF_1_PIE, refusal to dlopen such binaries breaks ldd.

Fix it by reading and parsing dynamic segment looking for DF_FLAG_1
and taking DF_1_PIE into account when deciding between binary and
library.

Reported by: Dewayne Geraghty <dewayne@heuristicsystems.com.au>
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D25257

Details

Provenance
kibAuthored on
Reviewer
markj
Differential Revision
D25257: Fix ldd for PIE binaries after rtld stopped accepting binaries for dlopen.
Parents
rS362151: procctl(2): document PROC_KPTI
Branches
Unknown
Tags
Unknown