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.
On Fri, 26 Jan 2024 13:39:45 -0000 (UTC), Kenny McCormack wrote:
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.
Seems this kind of thing never worked right, and was explicitly
disabled a while back
<https://patchwork.ozlabs.org/project/glibc/patch/20190312130235.8E82C89CE49C@oldenburg2.str.redhat.com/>
(found from
<https://stackoverflow.com/questions/59074126/loading-executable-or-executing-a-library>).
On Fri, 26 Jan 2024 13:39:45 -0000 (UTC), Kenny McCormack wrote:
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.
Seems this kind of thing never worked right, and was explicitly
disabled a while back ><https://patchwork.ozlabs.org/project/glibc/patch/20190312130235.8E82C89CE49C@oldenburg2.str.redhat.com/>
(found from ><https://stackoverflow.com/questions/59074126/loading-executable-or-executing-a-library>).
OK, so it *is* tied to version of glibc. Thanks.
That explains why it works on the older system, but fails on a newer one.
And not really a Ubuntu thing - more of a "Red Hat" thing.
On 2024-01-27, Kenny McCormack <gazelle@shell.xmission.com> wrote:
OK, so it *is* tied to version of glibc. Thanks.
The "ld.so" dynamic loader is something that comes from glibc, that's why.
That explains why it works on the older system, but fails on a newer one.
And not really a Ubuntu thing - more of a "Red Hat" thing.
If that patch is upstreamed into glibc, it's a thing in every
glibc system.
Good to see at least some people refusing to drink the Kool Aid.
I have a program that is both an executable and a shared library.
... When run, it sets LD_PRELOAD to itself, then runs another program
(such that LD_PRELOAD kicks in - sort of "call back").
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 307 |
Nodes: | 16 (2 / 14) |
Uptime: | 67:48:05 |
Calls: | 6,915 |
Files: | 12,379 |
Messages: | 5,431,814 |