HomeFreeBSD

rtld: Fix segfault in direct exec mode

Description

rtld: Fix segfault in direct exec mode

When rtld is directly executed with arguments, it has to move the
program arguments, environment and elf aux data up a few slots to
remove its own arguments before the process being executed sees
them. When copying the environment, rtld was incorrectly testing
whether the location about to be written to currently contained
NULL, when was supposed to check whether it had just copied the
NULL terminator of the environment string. This had the result
that the ELF aux data was mostly treated as environment variables,
and rtld would quickly crash when it tried to access required
ELF aux data that it didn't think was present.

Differential Revision: https://reviews.freebsd.org/D23008
Reviewed by: kib
MFC after: 1 month

Details

Provenance
rstoneAuthored on
Reviewer
kib
Differential Revision
D23008: rtld: Fix segfault in direct exec mode
Parents
rS356443: Define a unified pmap structure for i386.
Branches
Unknown
Tags
Unknown