ash r21030 broken?

Cristian Ionescu-Idbohrn cristian.ionescu-idbohrn at axis.com
Wed Feb 20 16:58:49 UTC 2008


On Wed, 20 Feb 2008, Denys Vlasenko wrote:

> On Wednesday 20 February 2008 17:37, Denys Vlasenko wrote:
> > On Wednesday 20 February 2008 11:46, Cristian Ionescu-Idbohrn wrote:
> > >
> > > I'm still seeing uninitialized data which leeds to segfaults :(
> > >
> > > I run a quite complicated chain of scripts at startup, on my embedded
> > > system.
> > >
> > > See attached.
> > >
> > > sh: (A) LINE 5914
> > > sh: (B) LINE 5921: name='RCLIB=/sh/dhcp_command_line.sh', name_len=6
> > > sh: (C) LINE 5923
> > > sh (pid 31) segfaults for page address 00000000 at pc 355a0828
> > > Segmentation fault
> > >
> > > Going back to shell/ash.c svn r21020 gives me a clean startup.
> > > So, I think I'll stick to r21020 for now.
> >
> > Can you try attached patch (on top of previous one)?

I'd like to, but...

> > It covers a few more cases where we had uninitialized
> > ->next pointers:
> >
> > -                               sp = stalloc(sizeof(*sp));
> > +                               sp = stzalloc(sizeof(*sp));
> >                                 sp->text = start;
>
> And if it still fails, make both alloc() functions zero out
> allocated block:
>
> static void *
> ckmalloc(size_t nbytes)
> {
> -       return ckrealloc(NULL, nbytes);
> +       return memset(ckrealloc(NULL, nbytes), 0, nbytes);
> }
>
> static void *
> stalloc(size_t nbytes)
> {
> ...
>         g_stacknleft -= aligned;
> +       memset(p, 0, nbytes);
>         return p;
> }
>
> If this helps, then it's only a matter of finding a ckmalloc/stalloc
> which really needs to be ckzalloc/stzalloc.

Sorry Denys :(
I've no access to my embedded system now and the comming 2+ weeks.
Holidays ;-)

Maybe a 16Mb RAM qemu could help nail down these problems, in absence of a
low memory embeded system, as it seems one of the factors that provokes
the errors may be low memory, but I'm just guessing.

When I'm back, I'll check that up, if noone else beats be to it.


Cheers,

-- 
Cristian



More information about the busybox mailing list