[Buildroot] Buildroot fails on powerpc with busybox login.c

Bernhard Fischer rep.nop at aon.at
Thu Sep 21 21:26:07 UTC 2006


On Sun, Sep 17, 2006 at 06:59:37PM -0400, Rob Landley wrote:
>On Sunday 17 September 2006 10:43 am, Denis Vlasenko wrote:
>
>> Using bb_common_bufsiz1 is in general a size-saving hack.
>> It is risky because it can create nasty bugs when someone else
>> will decide to use it in another part of the same program.
>> So it should be used with care. I'd say "only if size savings
>> are big enough to warrant it".
>
>You have to track the usage, but that's true of all memory.
>
>> One place where you can use it more-or-less safely is in <applet>_main().
>
>No, you can only use it if you understand all the code an applet calls.  But 
>if you don't understand all the code an applet calls, you're likely to break 
>stuff anyway.

>Using it from libbb is nasty, but within an applet should be quite sane.

yep.

>> You can be sure that caller doesn't use it and you can
>> directly code it so that there are no calls to functions
>> which implicitly clobber bb_common_bufsiz1.
>> It's easy because currently no libbb function uses it IIRC.
>
>It would be bad for libbb functions to use bb_common_bufsiz1 (which should 
>probably have a better name, like bb_buffer or bb_common something), because 
>then code calling them would have to worry about side effects.  But within an 
>applet, if you can't track side effects from modifying global variables, 
>there's already a problem.
>
>> But here it is used in a function, not in a <applet>_main().
>> The function has no way to check whether caller uses bb_common_bufsiz1
>> in an unsafe manner (i.e. across the call to this function).
>> 
>> So it is a bit scary here. And it gives no size savings AT ALL
>> because char buf[BUFSIZ] was an automatic variable on stack.
>
>Declaring 4k on the stack is a bit impolite to nommu systems.

Rob, WTH 4k? it's 8k for me on i386. Nothing to do with pagesize there.

Care to try this patch (i want to apply something like this before we
release the next "big" release, just to make people aware of some HUGE
buffers that are allocated, so there is still time to clean at least
some of them up.)

Index: Rules.mak
===================================================================
--- Rules.mak   (revision 16172)
+++ Rules.mak   (working copy)
@@ -285,6 +285,7 @@
     CHECKED_CFLAGS+=$(call check_cc,$(CC),-Winit-self,)
     CHECKED_CFLAGS+=$(call check_cc,$(CC),-Wshadow,)
     CHECKED_CFLAGS+=$(call check_cc,$(CC),-Wcast-align,)
+    CHECKED_CFLAGS+=$(call check_cc,$(CC),-Wlarger-than-4097,)
 endif
 STRIPCMD:=$(call check_strip,$(STRIP),-s --remove-section=.note --remove-section=.comment,$(STRIP))
 ifeq ($(strip $(CONFIG_STATIC)),y)





More information about the busybox mailing list