This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: libiberty/pex-unix vfork abuse?
"Dave Korn" <dave.korn@artimi.com> writes:
> > On the other hand, the setting of environ is very dubious and is
> > likely to break on real systems. The code should be changed to call
> > execve instead. Unfortunately there is no standard execvpe function.
> > Fortunately gcc never uses the variant which sets environ. Offhand
> > I'm not sure what does.
>
> Perhaps we could work around this case by setting environ in the parent
> before the vfork call and restoring it afterward, but we'd need kind of
> serialisation there, and I don't know how to do a critical section using
> pthreads/posix.
The setting of environ came in here:
http://gcc.gnu.org/ml/gcc-patches/2006-05/msg00377.html
Mark, setting the global environ variable won't work correctly on Unix
when using vfork. Your e-mail refers to the prelinker. The prelinker
sources that I have don't use the pex routines. Do your prelinker
sources require setting the environment when using the PEX_SEARCH flag
while setting the environment? If not, I think the simple approach is
to disallow that flag for pex_run_in_environment, to not set environ,
and to use execve instead.
Ian