Backtrace on P1014.

ANDY KENNEDY ANDY.KENNEDY at adtran.com
Fri Apr 26 14:51:34 UTC 2013


> From: Filippo ARCIDIACONO [mailto:filippo.arcidiacono at st.com]
> 
> On 4/26/2013 5:30 AM, ANDY KENNEDY wrote:
> > I'm attempting to link static an app that contains backtrace.  I
> > set LDFLAGS to "-lubacktrace -ldl" and I get a viable file which
> > does run.  The app crashes.  During the call to backtrace, I get
> > an error:
> >
> > libgcc_s.so.1 must be installed for backtrace to work
> >
> > I have attempted to launch the app with LD_LIBRARY_PATH, however,
> > it appears that this has an unobtainable path:
> >
> >
> > ~/working/uClibc-0.9.33.2$ grep -R __LDSO_LIBRARY_PATH__ .
> > ./ldso/libdl/libdl.c:#if !defined SHARED && defined __LDSO_LIBRARY_PATH__
> >
> > Does anyone know why the __LDSO_LIBRARY_PATH__ is here?
> Indeed there was a typo error in commit
> e4aa966cf25e83cd0c72f34f7855a995ff93944d
> </uClibc/commit/ldso/libdl/libdl.c?id=e4aa966cf25e83cd0c72f34f7855a995ff93944d>.
> It should be __LDSO_LD_LIBRARY_PATH__, it has been introduced to disable
> the use of
> LD_LIBRARY_PATH on hardened systems.
> We take care to fix it soon.
> 
> >
> > Thanks,
> > Andy
> 
> Regards,
> Filippo

To answer Carmelo's question:
123456789012345678901234567890123456789012345678901234567890123456789012
This code can never be reached through a standard build of uClibc.
Using CrossTool-NG, I have no way to affect the #defines of the build,
thus I would be unable to -D__LDSO_LD_LIBRARY_PATH__ and, even with
Filippo's suggested changes, this code can still not be reached.

/work/uClibc-0.9.33.2# grep -R --color __LDSO_LD_LIBRARY_PATH__ .
./ldso/ldso/ldso.c:#ifdef __LDSO_LD_LIBRARY_PATH__
./ldso/ldso/ldso.c:#ifdef __LDSO_LD_LIBRARY_PATH__
./ldso/ldso/ldso.c:#ifdef __LDSO_LD_LIBRARY_PATH__
./ldso/ldso/ldso.c:#ifdef __LDSO_LD_LIBRARY_PATH__
./ldso/ldso/dl-elf.c:#ifdef __LDSO_LD_LIBRARY_PATH__
./ldso/libdl/libdl.c:#ifdef __LDSO_LD_LIBRARY_PATH__

It is _used_ all over the place, but there is never a time when it is
_SET_.  There is no way to get to any of the code that this #define
protects.  Should we put in a config option for this somewhere, or set
this variable if for building these libraries as the static libraries?
This code will not exist in the libdl.a library.

As far as a test case goes, no I don't have one to share at the moment,
and I'm pressed for time getting this done, but I'll get one for you
later.

At the moment, however, what can we do to make it so this is not
unreachable code?

Andy


More information about the uClibc mailing list