Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Deflector shields just came on, Captain.


devel / comp.unix.programmer / Re: (Ubuntu) Error loading a shared library (This used to work, now it doesn't)

SubjectAuthor
* (Ubuntu) Error loading a shared library (This used to work, now it doesn't)Kenny McCormack
+* Re: (Ubuntu) Error loading a shared library (This used to work, now it doesn't)Lawrence D'Oliveiro
|+- Re: (Ubuntu) Error loading a shared library (This used to work, now it doesn't)Kaz Kylheku
|`* Re: (Ubuntu) Error loading a shared library (This used to work, now it doesn't)Kenny McCormack
| +* Re: (Ubuntu) Error loading a shared library (This used to work, now it doesn't)Kaz Kylheku
| |`- Re: (Ubuntu) Error loading a shared library (This used to work, now it doesn't)Kenny McCormack
| `- Re: (Ubuntu) Error loading a shared library (This used to work, now it doesn't)Lawrence D'Oliveiro
`- Re: (Ubuntu) Error loading a shared library (This used to work, now it doesn't)Lawrence D'Oliveiro

1
(Ubuntu) Error loading a shared library (This used to work, now it doesn't)

<up0cn1$h405$1@news.xmission.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10957&group=comp.unix.programmer#10957

  copy link   Newsgroups: comp.unix.programmer
Path: i2pn2.org!rocksolid2!news.neodome.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gaze...@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.unix.programmer
Subject: (Ubuntu) Error loading a shared library (This used to work, now it doesn't)
Date: Fri, 26 Jan 2024 13:39:45 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <up0cn1$h405$1@news.xmission.com>
Injection-Date: Fri, 26 Jan 2024 13:39:45 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="561157"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
 by: Kenny McCormack - Fri, 26 Jan 2024 13:39 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.

--
"Every time Mitt opens his mouth, a swing state gets its wings."

(Should be on a bumper sticker)

Re: (Ubuntu) Error loading a shared library (This used to work, now it doesn't)

<up190l$313qt$9@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10958&group=comp.unix.programmer#10958

  copy link   Newsgroups: comp.unix.programmer
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo...@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.unix.programmer
Subject: Re: (Ubuntu) Error loading a shared library (This used to work, now
it doesn't)
Date: Fri, 26 Jan 2024 21:42:45 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <up190l$313qt$9@dont-email.me>
References: <up0cn1$h405$1@news.xmission.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 26 Jan 2024 21:42:45 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="e3e30b5c11bd53f646c3b65395233311";
logging-data="3182429"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19snihwhXH2afKFJD7sWFFP"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:25c5PLWA/eH1z9bLjMewFCU19iQ=
 by: Lawrence D'Oliv - Fri, 26 Jan 2024 21:42 UTC

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>).

Re: (Ubuntu) Error loading a shared library (This used to work, now it doesn't)

<20240126141036.468@kylheku.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10959&group=comp.unix.programmer#10959

  copy link   Newsgroups: comp.unix.programmer
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 433-929-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.unix.programmer
Subject: Re: (Ubuntu) Error loading a shared library (This used to work, now
it doesn't)
Date: Sat, 27 Jan 2024 00:11:17 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <20240126141036.468@kylheku.com>
References: <up0cn1$h405$1@news.xmission.com> <up190l$313qt$9@dont-email.me>
Injection-Date: Sat, 27 Jan 2024 00:11:17 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="85b954c92e20c07bbf64fab99e256847";
logging-data="3239124"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+41QkL/5vhOCpqqMPyZ3A3vB3JINQRweI="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:T0+Dh7j7w7lVKu+m8aWlBvsZbVY=
 by: Kaz Kylheku - Sat, 27 Jan 2024 00:11 UTC

On 2024-01-26, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
> 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>).

Yes, this kind of thing works right. Glibc is executable; you can
run your /lib/ld.so.6 or whatever it is called to get an informational
message about the library.

I suspect this will work even on that system where your trick isn't
working.

It is likely that Kenny has to prepare this object in some special
way. It has to be primarily be a shared library that also happens
to support execution.

It's probably not enough to compile the code relocatable, but otherwise
build a normal executable (even though that happened to work before).

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Re: (Ubuntu) Error loading a shared library (This used to work, now it doesn't)

<up2qar$ihrs$1@news.xmission.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10960&group=comp.unix.programmer#10960

  copy link   Newsgroups: comp.unix.programmer
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gaze...@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.unix.programmer
Subject: Re: (Ubuntu) Error loading a shared library (This used to work, now
it doesn't)
Date: Sat, 27 Jan 2024 11:44:27 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <up2qar$ihrs$1@news.xmission.com>
References: <up0cn1$h405$1@news.xmission.com> <up190l$313qt$9@dont-email.me>
Injection-Date: Sat, 27 Jan 2024 11:44:27 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="608124"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
 by: Kenny McCormack - Sat, 27 Jan 2024 11:44 UTC

In article <up190l$313qt$9@dont-email.me>,
Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
>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.

P.S. Good read on stackoverflow. Good to see at least some people
refusing to drink the Kool Aid.

Anyway, it does sound like it boils down to needing to compile the program
twice - once as shared lib and once as executable. Not as convenient as
before, but so it goes. It makes you wish that there was some way to
"bundle" the two outputs together into a single file - sort of like how
other, more complex filesystems (e.g., the old MacOS) worked.

But so it goes...

files - one compiled
--
Just remember:

Pence is all the evil, with none of the crazy.

Re: (Ubuntu) Error loading a shared library (This used to work, now it doesn't)

<20240127090419.728@kylheku.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10961&group=comp.unix.programmer#10961

  copy link   Newsgroups: comp.unix.programmer
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 433-929-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.unix.programmer
Subject: Re: (Ubuntu) Error loading a shared library (This used to work, now
it doesn't)
Date: Sat, 27 Jan 2024 17:06:05 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <20240127090419.728@kylheku.com>
References: <up0cn1$h405$1@news.xmission.com> <up190l$313qt$9@dont-email.me>
<up2qar$ihrs$1@news.xmission.com>
Injection-Date: Sat, 27 Jan 2024 17:06:05 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="85b954c92e20c07bbf64fab99e256847";
logging-data="3643595"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+OeNy75A1wJ2uC2WQBq+pbM8qQWZA/94M="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:HwTVKwfQxeTR8UglHFHz2Ep4kus=
 by: Kaz Kylheku - Sat, 27 Jan 2024 17:06 UTC

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.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Re: (Ubuntu) Error loading a shared library (This used to work, now it doesn't)

<up3hsr$iutv$1@news.xmission.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10962&group=comp.unix.programmer#10962

  copy link   Newsgroups: comp.unix.programmer
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gaze...@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.unix.programmer
Subject: Re: (Ubuntu) Error loading a shared library (This used to work, now
it doesn't)
Date: Sat, 27 Jan 2024 18:26:35 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <up3hsr$iutv$1@news.xmission.com>
References: <up0cn1$h405$1@news.xmission.com> <up190l$313qt$9@dont-email.me> <up2qar$ihrs$1@news.xmission.com> <20240127090419.728@kylheku.com>
Injection-Date: Sat, 27 Jan 2024 18:26:35 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="621503"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
 by: Kenny McCormack - Sat, 27 Jan 2024 18:26 UTC

In article <20240127090419.728@kylheku.com>,
Kaz Kylheku <433-929-6894@kylheku.com> wrote:
>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.

Yup. Well said.

--
There's nothing more American than demanding to carry an AR-15 to
"protect yourself" but refusing to wear a mask to protect everyone else.

Re: (Ubuntu) Error loading a shared library (This used to work, now it doesn't)

<up3smi$3hbk7$12@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10963&group=comp.unix.programmer#10963

  copy link   Newsgroups: comp.unix.programmer
Path: i2pn2.org!i2pn.org!news.swapon.de!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo...@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.unix.programmer
Subject: Re: (Ubuntu) Error loading a shared library (This used to work, now
it doesn't)
Date: Sat, 27 Jan 2024 21:30:58 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 5
Message-ID: <up3smi$3hbk7$12@dont-email.me>
References: <up0cn1$h405$1@news.xmission.com> <up190l$313qt$9@dont-email.me>
<up2qar$ihrs$1@news.xmission.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 27 Jan 2024 21:30:58 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="a9befbf67dfd56f15a347bec2826e976";
logging-data="3714695"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Pb4HPMsk2oSmB38MdCm0a"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:sE9LcZNHJOeDvqV9859c2IpglIo=
 by: Lawrence D'Oliv - Sat, 27 Jan 2024 21:30 UTC

On Sat, 27 Jan 2024 11:44:27 -0000 (UTC), Kenny McCormack wrote:

> Good to see at least some people refusing to drink the Kool Aid.

Looking forward to your alternative, Kool-Aid-free glibc fork.

Re: (Ubuntu) Error loading a shared library (This used to work, now it doesn't)

<up791n$ao7u$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10964&group=comp.unix.programmer#10964

  copy link   Newsgroups: comp.unix.programmer
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo...@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.unix.programmer
Subject: Re: (Ubuntu) Error loading a shared library (This used to work, now
it doesn't)
Date: Mon, 29 Jan 2024 04:20:07 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 11
Message-ID: <up791n$ao7u$1@dont-email.me>
References: <up0cn1$h405$1@news.xmission.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 29 Jan 2024 04:20:07 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="ab6b8bf6b4ebf5dcda22bbd1afce0bd5";
logging-data="352510"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+b+rGh4HN7f9XcLL4KTBTo"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:rDkhkGimfabbNzKdUXJlVtAR68c=
 by: Lawrence D'Oliv - Mon, 29 Jan 2024 04:20 UTC

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.
> ... When run, it sets LD_PRELOAD to itself, then runs another program
> (such that LD_PRELOAD kicks in - sort of "call back").

Seems to me you’re doing it in an unnecessarily complicated way. Surely
the entire executable is not needed to be in the callback; so why not
separate out the part that does not need to be in the shared library, into
the executable proper, and have it import the shared library, just like
the code you are calling?

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor