[BusyBox 0001272]: ash crashes on mpc8349 powerpc platform - free invalid pointer

bugs at busybox.net bugs at busybox.net
Wed Mar 14 04:45:06 UTC 2007


A NOTE has been added to this issue. 
====================================================================== 
http://busybox.net/bugs/view.php?id=1272 
====================================================================== 
Reported By:                Franklin
Assigned To:                BusyBox
====================================================================== 
Project:                    BusyBox
Issue ID:                   1272
Category:                   Standards Compliance
Reproducibility:            always
Severity:                   crash
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             03-12-2007 18:30 PDT
Last Modified:              03-13-2007 21:45 PDT
====================================================================== 
Summary:                    ash crashes on mpc8349 powerpc platform - free
invalid pointer
Description: 
I used to post a message on mailing list, and now I think it should be a
bug.

Recently I'm playing embedded system running on mpc8349 (powerpc).
I built the toolchain myself, including glibc-2.4, binutils-2.17 and
gcc-4.1.1
Then I downloaded the busybox 1.4.1 and built it.  However, when running 
starting script, it shown the following messages and the system was
unusable:

*** glibc detected *** -sh: free(): invalid pointer: 0x1007f1a8 ***
======= Backtrace: =========
/usr/powerpc/lib/libc.so.6[0xfe016ec]
/usr/powerpc/lib/libc.so.6(__libc_free+0xc0)[0xfe03120]
-sh[0x10045138]
-sh[0x100527b4]
-sh[0x10050490]
-sh[0x10050650]
-sh[0x100517ac]
-sh[0x10051d2c]
-sh[0x100042bc]
-sh[0x1000449c]
/usr/powerpc/lib/libc.so.6[0xfda9750]
/usr/powerpc/lib/libc.so.6[0xfda9974]

I tried to hack into shells/ash.c, added some debug messages and found
that, 
in the popstackmark() in ash.c (about line 8315+), 

        while (stackp != mark->stackp) {
                sp = stackp;
                stackp = sp->prev;
                ckfree(sp);
        }

in some cases the mark->stackp became NULL, so the stackp would never be
equal 
to mark->stackp, then finally it will try to free the stackbase, which is
a 
static non-pointer struct variable, and glibc complains about it.

I don't know what cases cause the mark->stackp become NULL. I think that
the 
mark itself might be invalid too.  Right now I just added a 

if (!mark->stackp) return;

before the while loop, and the shell goes well.  It is a ugly solution,
but I have no idea about how to dig more.
====================================================================== 

---------------------------------------------------------------------- 
 Franklin - 03-13-07 21:45  
---------------------------------------------------------------------- 
I traced into ash.c and found that, when running evalcommand(), in the
function evalbltin(), the mark->stackp will be cleared to NULL after
calling

if ((i = setjmp(jmploc.loc)))

But I have no idea about what's setjmp() doing. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
03-12-07 18:30  Franklin       New Issue                                    
03-12-07 18:30  Franklin       Status                   new => assigned     
03-12-07 18:30  Franklin       Assigned To               => BusyBox         
03-12-07 18:30  Franklin       File Added: busybox.log                      
03-12-07 18:31  Franklin       Issue Monitored: Franklin                    
03-13-07 21:45  Franklin       Note Added: 0002235                          
======================================================================




More information about the busybox-cvs mailing list