ash r21030 broken?

Cristian Ionescu-Idbohrn cristian.ionescu-idbohrn at axis.com
Mon Mar 10 09:31:32 PDT 2008


Hi Denys,

On Wed, 20 Feb 2008, Cristian Ionescu-Idbohrn wrote:

> 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 ;-)
>
> When I'm back, I'll check that up, if noone else beats be to it.

Alright.  Back from holidays.  Picked it up from where I left.
I first applied the patch.  Still segfaults :(

Applied the 2 suggested 'memset' changes mentioned above.  Kernel
boots, linuxrc starts running but ends quite fast showing:

  Kernel panic - not syncing: Attempted to kill init!

Going back to r21020 puts me back on track.
Didn't test the latest ash.c r21125 yet.


Cheers,

-- 
Cristian


More information about the busybox mailing list