tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: dlopen() and libpthread



On Tue, Oct 23, 2012 at 07:17:10AM +0200, Emmanuel Dreyfus wrote:
> Emmanuel Dreyfus <manu%netbsd.org@localhost> wrote:
> 
> > Rmoving the requirement for libpthread to be linked at startup time will
> > not be easy. linking with -lpthreead any program that can use dlopen seems
> > overkill. Let the administrator set LD_PRELOAD=/usr/lib/lipbthread.so.1
> > seems an acceptable workaround.
> > 
> > We could have a generic way of setting envirnoement variables for setuid
> > binaries. What about something like /etc/suenv.d/$progname? 
> 
> Another idea: is it possible to patch an already linked binary to add
> -lpthread? 

No.
Well, not unless there are adequate gaps between the existing elf
header sections.

You might be able to make every program use libthread.so by replacing
the libc.so (that the dynamic linker finds) with a stub library that
has .NEEDED entries for the real libc.so and libpthread.so.

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index