[BusyBox] SIGSEGV problem

bgat at open-widgets.com bgat at open-widgets.com
Thu Jan 4 20:37:02 UTC 2001


Guys:


I'm trying to run BusyBox 0.48 on a *very* spartan embedded Linux
setup on an MBX860.  I'm trying to use BusyBox as a simple shell.  I'm
not running tinylogin or anything else.

For some time, I've been having problems getting busybox's sh to run
more than one command.  I finally decided to start looking into this,
and what I found is that I'm getting a SIGSEGV at cmdedit.c:445.  The
offending line looks like this:

	memset(command, 0, BUFSIZ);

I grabbed a trace from gdb (attached), and I'm not seeing anything
unusual--- an xcalloc call returns a pointer for the command buffer,
and that pointer value is used without problems in the first
invocation of cmdedit_read_input.  When it comes around to that
function again, after running whatever command I've given it ("ls",
usually), the same memset() causes the segfault.

I'm still digging into the sources, because I'm no BusyBox internals
guru.  Is there something obvious going on here that I'm missing?

I had the same problem with 0.47.


Thanks!


b.g.
-- 
Bill Gatliff
bgat at open-widgets.com
-------------- next part --------------
GNU gdb 5.0
Copyright 2000 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=powerpc-linux"...
(gdb) target remote 192.168.2.3:9999
Remote debugging using 192.168.2.3:9999
0x100000c0 in _start ()
(gdb) b sh.c:1382
Breakpoint 1 at 0x10032e4c: file sh.c, line 1382.
(gdb) b cmdedit.c:445
Breakpoint 2 at 0x10001fd4: file cmdedit.c, line 445.
(gdb) b c
(gdb) b c
Continuing.

Breakpoint 1, busy_loop (input=0x100de050) at sh.c:1382
1382					if (getCommand(input, command))
(gdb) next

Breakpoint 2, cmdedit_read_input (prompt=0x100f32c8 "[@192 /]# ", 
    command=0x100f12c0 "") at cmdedit.c:445
445		memset(command, 0, BUFSIZ);
(gdb) print command
$1 = 0x100f12c0 ""
(gdb) c
Continuing.

Program received signal SIGSTOP, Stopped (signal).
0x1006dc8c in wait4 ()
(gdb) c
Continuing.

Breakpoint 1, busy_loop (input=0x100de050) at sh.c:1382
1382					if (getCommand(input, command))
(gdb) print command
$2 = 0x100f12c0 "ls"
(gdb) next

Breakpoint 2, cmdedit_read_input (prompt=0x100f32c8 "[@192 /]# ", 
    command=0x100f12c0 "ls") at cmdedit.c:445
445		memset(command, 0, BUFSIZ);
(gdb) 

Program received signal SIGSEGV, Segmentation fault.
0x10067188 in memset ()
(gdb) quit
The program is running.  Exit anyway? (y or n) 


More information about the busybox mailing list