Re: [PATCH 0/3] elf: load the main program from AT_EXECFD
Florian Weimer <[email protected]>
| Newsgroups | gmane.comp.lib.glibc.alpha |
|---|---|
| Message-ID | <[email protected]> |
* Christian Brauner: >> What does /proc/self/exe look like for such processes? Does GDB work? >> There are two cases to consider: launching with GDB, and attaching GDB >> to a running process with the -p option. > > Right, I checked that. > > /proc/self/exe is ld.so. The kernel exec'd ld.so, so it names ld.so > whether the program arrived via AT_EXECFD, via --program-fd, or via a > plain "ld.so PROG" command line. Yeah, and that causes problems with binaries that try to be relocatable. We don't have a very convenient way to get the correct path in those scenarios, so a lot of code uses /proc/self/exe instead. I'm wondering if we can use the checkpoint-restore facilities (the restore parts) to fix this: load ld.so another time, transfer control to it, and instruct it to unmap the first copy and then invoke the necessary prctls to make the process look exactly like a directly invoked process. Thanks, Florian