diff options
author | Jo-Philipp Wich <jo@mein.io> | 2017-07-16 23:43:19 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2017-07-21 08:09:45 +0200 |
commit | ef1cafa736679eb035d405bcdf903fd1fb329865 (patch) | |
tree | 800864adbf3c53c4c35220fabf6e40d8af63f247 /scripts/checkpatch.pl | |
parent | f2fdd68664cdf09075e6f18b20946e41a22284b2 (diff) | |
download | upstream-ef1cafa736679eb035d405bcdf903fd1fb329865.tar.gz upstream-ef1cafa736679eb035d405bcdf903fd1fb329865.tar.bz2 upstream-ef1cafa736679eb035d405bcdf903fd1fb329865.zip |
build: fix invocation of bundled ld.so in SDK and Imagebuilder
Commit 72d751cba9 "build: rework library bundling" introduced a new helper
binary "runas" whose sole purpose was mangling the argv vector passed to
the actual called ELF image so that the renamed executable could obtain the
proper name from argv[0].
This approach, however totally defeated the purpose of calling bundled ELF
executables through the shipped ld.so loader since the execv() invocation
performed by "runas" would cause the kernel the interprete the final program
image through the system ELF loader again.
To solve the problem, use an alternative approach of shipping a shared object
"runas.so" which uses an ELF ".init_array" function pointer to obtain the
argv[] vector of the to-be-executed main() function and mangle it in-place.
The actual argv[0] value to use is communicated out-of-band using an
environment variable "RUNAS_ARG0" by the shell wrapper script. The wrapper
script also takes care of setting LD_PRELOAD to instruct the shipped ELF
loader to preload the actual ELF program image with the "runas.so" helper
library.
Fixes FS#909.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'scripts/checkpatch.pl')
0 files changed, 0 insertions, 0 deletions