crazy GLIBC hack... surely not a good idea...

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

crazy GLIBC hack... surely not a good idea...

#1 Post by sc0ttman »

I would like to run some stuff that was compiled in Lupu/Lucid or whatever uses libc 2.11

I'm using a wary based Puppy, which is on libc 2.10, so the command:

Code: Select all

strings /lib/libc.so.6 | grep GLIBC
produces this:

Code: Select all

GLIBC_2.0
GLIBC_2.1
GLIBC_2.1.1
GLIBC_2.1.2
GLIBC_2.1.3
GLIBC_2.2
GLIBC_2.2.1
GLIBC_2.2.2
GLIBC_2.2.3
GLIBC_2.2.4
GLIBC_2.2.6
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.5
GLIBC_2.6
GLIBC_2.7
GLIBC_2.8
GLIBC_2.9
GLIBC_2.10
GLIBC_PRIVATE
What would happen if I followed Technos example of hacking Flash9 to pretend to be Flash 10, and added GLIBC_2.11 into the binary...? Or maybe replaced an older string (such as GLIBC_2.10) with GLIBC_2.11?? Is it possible? I know it's crazy, but am curious - there's a few tiny cli bins I wanna try out...
Last edited by sc0ttman on Thu 01 Dec 2011, 11:52, edited 1 time in total.
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

big_bass
Posts: 1740
Joined: Mon 13 Aug 2007, 12:21

#2 Post by big_bass »

Hey sc0ttman
I would like to run some stuff that was compiled in Lupu/Lucid or whatever uses libc 2.11

I'm using a wary based Puppy, which is on libc 2.10, so the command:
this is the reason when we use linux (any thing pertaining to linux) I am not talking about only puppy this is a general statement for all distros

we must have the source code
so that it simply can be recompiled
against your version of installed programs

hacking compiled binaries is a bad practice
the only reason someone would do that is if the
binary wasn't open source to start with

whatever the app you need ask for the source code
or a link to the source code then if it wont compile on your box
help the dev with your feedback
so he/she can get it working on more machines

now after saying all that and you want to experiment only
http://www.murga-linux.com/puppy/viewto ... 3&start=23



Joe

User avatar
Dave_G
Posts: 453
Joined: Thu 21 Jul 2011, 13:53

#3 Post by Dave_G »

Hey sc0ttman,

Go for it, nothing wrong with firing up the ol' hex editor.
One of two things are going to happen:

1) The app expects a function or variable type in the "new" lib which is not in the old one which you just renamed and will crash, oh well at least
you will know.

2) It will work.
Sometimes the dev just cleans up the code and ups the version number
but the lib is functionally the same as the older one.

Oh and by the way, in case you haven't done this kind of thing before,
when hex editing an executable keep the new strings the same length
as the old ones or you will trash the whole thing.

Dave.

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#4 Post by technosaurus »

I used to have an object file that I could preload with ldpreload that had stubs of these pseudo functions. I usually just make it a void function or if it needs to be an int function, just return 0. It was handy to have around for just these sorts of things without having to track down and compile a bunch of packages.
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#5 Post by sc0ttman »

Thanks for the replies guys, bigbass - I know its a dumb thing to do, but thats just me...

I've been 'off my face' on various medications the past 3 days, literally not knowing if yesterday morning was today or not, where I was 5 hours ago, and so on... But then the GLIBC hacking idea came to me, so I thought I would ask! :)

Dave G, I was thinking today as well... I cannot replace anything with GLIBC_2.11, except GLIBC_2.10, which is the real one, so that would probably break everything...

And Techno, I wish that info wasn't SO far above my head (I'm on lots of pills for a bad neck in the 1st place lol)..

But anyway, thanks for the replies, I thought I would ask - and was basically waiting for amigo to come and tell me to stop being an idiot. ;)
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

big_bass
Posts: 1740
Joined: Mon 13 Aug 2007, 12:21

#6 Post by big_bass »

Thanks for the replies guys, bigbass - I know its a dumb thing to do, but thats just me...

I've been 'off my face' on various medications the past 3 days, literally not knowing if yesterday morning was today or not, where I was 5 hours ago, and so on... But then the GLIBC hacking idea came to me, so I thought I would ask! Smile
its fine to experiment have fun ,enjoy and post your results

note that even my dog barks at me when I do something "strange"
although my dog would never growl at me or bite me :D

and friends dont let friends drive drunk :D

I hope you are feeling better
life is already to short to be sick for any cause

Joe

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#7 Post by amigo »

Did I hear my name?? The best way to do what you want is to install the needed library in an out-of-the-way location. Then, use a script wrapper to set LD_LIBRARY_PATH to point to the library before exec-ing the binary which needs that library. This avoids borking your system by arbitrarily replacing glibc. You need to understand that nearly everything on your system uses glibc, so replacing it without recompiling everything against the new version is very risky. Many programs will continue to work normally, but there will nearly always be some which do not -often in subtle ways which may not be immediately obvious. You can always use the new version for other programs as well -just use a wrapper for each program you want to use that version.

Sorry to hear about your neck -if you are taking NSAID's like ibuprofen, etc, try to find a way to not take them for long as they will ruin your kidneys. I've just found out the hard way by having a kidney fail (leading to super-high blood pressure). One of the better ways to deal with the neck pains is by taking tricyclic anti-depressants -particularly nortryptilin. I have 6 bad disks in my neck, chest and lumbar regions and a seventh already removed, so I have a *little* experience with the subject...

User avatar
Dave_G
Posts: 453
Joined: Thu 21 Jul 2011, 13:53

#8 Post by Dave_G »

amigo wrote:
The best way to do what you want is to install the needed library in an
out-of-the-way location. Then, use a script wrapper to set
LD_LIBRARY_PATH to point to the library
Sounds very interesting and extremely useful.
Wanna post more details ? I'm very interested.

Thanks,
Dave.

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#9 Post by technosaurus »

if the working library was in /usr/share/myapp

Code: Select all

LD_LIBRARY_PATH=/usr/share/myapp:$LD_LIBRARY_PATH && /usr/share/myapp/myapp
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
Dave_G
Posts: 453
Joined: Thu 21 Jul 2011, 13:53

#10 Post by Dave_G »

Thanks technosaurus

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#11 Post by sc0ttman »

technosaurus wrote:if the working library was in /usr/share/myapp

Code: Select all

LD_LIBRARY_PATH=/usr/share/myapp:$LD_LIBRARY_PATH && /usr/share/myapp/myapp
How could we make sure a program uses 2.11 if needed, without writing wrappers for it in advance? Could we 'catch' the glibc errors and then re-run with the new LD_LIBRARY_PATH?? Or is that impossible?
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

User avatar
Makoto
Posts: 1665
Joined: Fri 04 Sep 2009, 01:30
Location: Out wandering... maybe.

#12 Post by Makoto »

Okay, now you've got my attention as well. :) I've been way too paranoid to attempt mucking with the versions of glib/c in my setup... which sc0ttman knows. :oops:

sc0ttman: Hope you're feeling better, for whatever reason you were taking the medications.
[ Puppy 4.3.1 JP, Frugal install ] * [ XenialPup 7.5, Frugal install ] * [XenialPup 64 7.5, Frugal install] * [ 4GB RAM | 512MB swap ]
In memory of our beloved American Eskimo puppy (1995-2010) and black Lab puppy (1997-2011).

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#13 Post by sc0ttman »

Makoto wrote:Okay, now you've got my attention as well. :) I've been way too paranoid to attempt mucking with the versions of glib/c in my setup... which sc0ttman knows. :oops:
To clever, some might say!
sc0ttman: Hope you're feeling better, for whatever reason you were taking the medications.
Sorry to hear about your neck
Forgot to say "Thank you"... I'm better now, just need to find a (good) gym after Xmas - mine closed down!! :(
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

User avatar
Makoto
Posts: 1665
Joined: Fri 04 Sep 2009, 01:30
Location: Out wandering... maybe.

#14 Post by Makoto »

Yes, but I meant the more technical doctor's explanation, though (not that I'm asking you to mention what it was). :oops: You did say it was serious enough that you had to take various medications.
sc0ttman wrote:Forgot to say "Thank you"... I'm better now, just need to find a (good) gym after Xmas - mine closed down!! :(
I wouldn't know what to look for in a good gym, anyway. :oops: Most of the ones I've seen didn't seem all that great, to begin with...
[ Puppy 4.3.1 JP, Frugal install ] * [ XenialPup 7.5, Frugal install ] * [XenialPup 64 7.5, Frugal install] * [ 4GB RAM | 512MB swap ]
In memory of our beloved American Eskimo puppy (1995-2010) and black Lab puppy (1997-2011).

Post Reply