exporting argc/argv to applets

Rich Felker dalias at aerifal.cx
Sun Jul 9 05:05:21 UTC 2006


On Sat, Jul 08, 2006 at 01:55:59PM -0400, Rob Landley wrote:
> On Friday 07 July 2006 10:58 pm, Rich Felker wrote:
> > > Go look at http://www.gentoo.org/proj/en/hardened/pic-internals.xml
> > > sections 3
> >
> > I'm quite familiar with what PIC is and how it's used.
> 
> And yet you miss the underlying concepts.

You can continue with the personal insults but I assure you I
understand everything related to PIC. Unfortunately I've had to..

> > > and 4, and contemplate that like standard system libraries, BusyBox is
> > > _also_ likely to have lots and lots of copies of the same executable in
> > > memory at once, and could dirty lots of pages with unnecessarily
> > > scattered relocations.
> >
> > How would there be any relocations? All addresses except calls to the
> > libc are resolved at link time unless you use shared libbb which we
> > seem to agree is stupid.
> 
> How about dynamically linking busybox against the C library?  In which case, 
> all the calls busybox makes to the C library have to be resolved 
> by /lib/ld-linux.so or /lib/ld-uClibc.so by patching the executable as it's 
> loaded.

No, a PLT is used even without PIC in the BB objects, and copy
relocations (evil) are used for external variables imported from the C
library. Using PIC for the BB binary is in no way needed for shared
libs. If it's used, the purpose is almost surely address randomization
or other "security" measures.

> > > PIC can optimize for DRAM usage at the expense of on-disk binary size, on
> > > a system with an MMU and multiple copies of the same process.
> >
> > PIC never optimizes, it just makes a costly process (runtime linking)
> > less costly.
> 
> And yet runtime linking is something people want to do.  It is common practice 
> outside of the ivory towers of academia.

You can use this insult all you want too, but I find it's the ivory
towers that love bloat like dynamic linking. Anyway I was very
deliberate in saying "runtime linking" instead of "shared libraries".
I very much like and want shared libraries. What I don't like is
deferring a very slow (both practically and big-O-wise) computation
that has the same results every time to the moment the program starts
and using dirty pages to store constant data. Performing the linking
only when needed and reusing the results until something changes is
much more efficient and practical and there are in fact ways to make
shared libraries that work this way.

> > > If you reply "just statically link everything", I'm going to put you in
> > > my spam filter.
> >
> > We're talking about BB, not everything.
> 
> *plonk*

.....

Rich




More information about the busybox mailing list