This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: runtime loader replaces argv[0]
- From: Patrick Donnelly <batrick at batbytes dot com>
- To: "Carlos O'Donell" <carlos at redhat dot com>
- Cc: libc-help at sourceware dot org
- Date: Sat, 16 May 2015 12:10:33 -0400
- Subject: Re: runtime loader replaces argv[0]
- Authentication-results: sourceware.org; auth=none
- References: <CACh33FpWkwyAPfUcHSEwpNiw6nEyqvTE1upyB4L5mHsSgmW=kA at mail dot gmail dot com> <5556C0D8 dot 6020006 at redhat dot com>
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