runtime loader replaces argv[0]

Patrick Donnelly batrick@batbytes.com
Sat May 16 16:10:00 GMT 2015


Hi Carlos,

On Sat, May 16, 2015 at 12:00 AM, Carlos O'Donell <carlos@redhat.com> wrote:
>> So as for my question, is there a viable workaround for this or does
>> anyone have some other suggestion?
>
> Use patchelf to modify the binary PT_INTERP to use the preserved loader.
>
> or
>
> Maintain the application filesystem layout using a chroot

Hmm, patchelf looks like a great option except I'd like to avoid more
dependencies. chroot is not viable because our software is meant to be
run without privileges.

As I suspected, I will most likely need to modify the executable file
myself to replace the loader. Perhaps this can be done with a
lightweight hack.

> There are many other aspects of the preserved application you are not
> maintaining also, and eventually your preserved application will fail
> if it relies on features tied to the OS or filesystem. See the recent
> discussion on posix_fallocate for an example of this, where the system
> call isn't available on NFS (uses somewhat unsafe fallback in glibc),
> but is for other local filesystems.

We've come across many problems preserving applications but this one
was one of the more difficult ones as the workaround, which maintains
correctness, will probably involve editing the executable. That's
something we hoped to avoid.

Thanks for your help Carlos.

-- 
Patrick Donnelly



More information about the Libc-help mailing list