Kenny McCormack
2024-01-26 13:39:45 UTC
I have a program that is both an executable and a shared library. I
compile it with -fpic and -pie on x86/64. When run, it sets LD_PRELOAD to
itself, then runs another program (such that LD_PRELOAD kicks in - sort of
a "call back"). When originally developed, this all worked fine. And it
still works on the development system.
However, on the target system (which is running a later version of Ubuntu),
it used to work, but now does not.
When I run it on the target system, I get the following error message:
ERROR: ld.so: object '/path/to/my/Program' from LD_PRELOAD
cannot be preloaded (cannot dynamically load position-independent
executable): ignored.
The program then runs - but of course, doesn't work as intended.
My sense is that this is some sort of "security" thing, as Ubuntu is known
for removing functionality in the name of "security". Can anyone confirm
or deny this and/or explain why this was done?
Anyway, one workaround would be to compile the program as two separate
programs - one the executable and the other the library, but I am curious
if any other workarounds are available.
compile it with -fpic and -pie on x86/64. When run, it sets LD_PRELOAD to
itself, then runs another program (such that LD_PRELOAD kicks in - sort of
a "call back"). When originally developed, this all worked fine. And it
still works on the development system.
However, on the target system (which is running a later version of Ubuntu),
it used to work, but now does not.
When I run it on the target system, I get the following error message:
ERROR: ld.so: object '/path/to/my/Program' from LD_PRELOAD
cannot be preloaded (cannot dynamically load position-independent
executable): ignored.
The program then runs - but of course, doesn't work as intended.
My sense is that this is some sort of "security" thing, as Ubuntu is known
for removing functionality in the name of "security". Can anyone confirm
or deny this and/or explain why this was done?
Anyway, one workaround would be to compile the program as two separate
programs - one the executable and the other the library, but I am curious
if any other workarounds are available.
--
"Every time Mitt opens his mouth, a swing state gets its wings."
(Should be on a bumper sticker)
"Every time Mitt opens his mouth, a swing state gets its wings."
(Should be on a bumper sticker)