Subject: Re: Segmentation fault
To: None <tech-userlevel@netbsd.org>
From: Lucio De Re <lucio@proxima.alt.za>
List: tech-userlevel
Date: 09/28/2000 08:17:33
On Wed, Sep 27, 2000 at 07:29:00PM +0200, Ignatios Souvatzis wrote:
>
> I didn't follow closely... if you have source to the program, could you link
> it with electric_fence, please (both ways)? This catches out-of-malloc-accesses
> very effectively.
>
The results of "ktrace /usr/local/bin/backend" are quite enlightening:
---- cut ----
$ cd tmp
$ ktrace /usr/local/bin/backend
Memory fault
$ kdump
232 ktrace RET ktrace 0
232 ktrace CALL execve(0xbfbfdcb7,0xbfbfdc6c,0xbfbfdc74)
232 ktrace NAMI "/usr/local/bin/backend"
$ /usr/local/bin/backend
Memory fault
$ ls -l /usr/local/bin/backend
-r-sr-x--- 1 root operator 19544 Sep 25 09:02
/usr/local/bin/backend
$ su
Password:
csh: Permission denied
csh: Trying to start from "/root"
grin# ktrace /usr/local/bin/backend
ktrace: exec of '/usr/local/bin/backend' failed: Permission denied
---- cut ----
The permission denied to "root" stems from the /usr mount flags, where
maproot is the default nobody:nogroup. That in itself is a bit of a
problem, but I won't comment on it until I have thought it through.
Now let me see what happens once I have executed the program through
gdb:
---- cut ----
$ gdb /usr/local/bin/backend
GNU gdb 4.17
Copyright 1998 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 "i386--netbsd"...
(gdb) run
Starting program: /usr/local/bin/backend
usage: backend [-h] [-d <dir>]... [-i <id>] [-R] [-v] <destination>
Program exited with code 02.
(gdb) q
$ ktrace /usr/local/bin/backend
usage: backend [-h] [-d <dir>]... [-i <id>] [-R] [-v] <destination>
---- cut ----
Looks more workable, but the ktrace is still trivial :-(
---- cut ----
$ ls -l ktrace.out
-rw-rw-r-- 1 lucio staff 186 Sep 28 08:13 ktrace.out
$ kdump
245 ktrace RET ktrace 0
245 ktrace CALL execve(0xbfbfdcb7,0xbfbfdc6c,0xbfbfdc74)
245 ktrace NAMI "/usr/local/bin/backend"
---- cut ----
From this point, backend behaves fine.
++L