busybox 1.9.1 syslogd segfaults on startup

Clem Taylor clem.taylor at gmail.com
Tue Feb 26 00:32:10 UTC 2008


On Mon, Feb 25, 2008 at 6:30 PM, Denys Vlasenko
<vda.linux at googlemail.com> wrote:
>  Hmm. I have an idea.
>  Go to libbb.h and delete "const" here:
>  extern struct globals *const ptr_to_globals;

And the decl in messages.c

>  Then rebuild busybox. Does it segfault now?

Okay, now it doesn't segfault.

ptr_to_globals is a constant pointer, so it shouldn't be changed. But
then in syslogd_main() it is used on the left hand side via
PTR_TO_GLOBALS. Does that mean there are actually two different
versions of ptrs_to_globals, the original const value (which may be
bogus or 0) and then the overwritten version? Depending on the mood of
the optimizer, you could get either version. If ptr_to_globals really
wants to be a const pointer, then it sounds like it needs to be done
with some linker command file voodoo to get overlapping sections and
not with malloc().

> And how much bigger busybox
>  now? (output of "size busybox_old busybox").

Yup, 2K.

   text    data     bss     dec     hex filename
 528666    6082    4804  539552   83ba0 busybox_unstripped.no-const
 526594    6086    4804  537484   8338c busybox_unstripped.const

                                       --Clem



More information about the busybox mailing list