Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Oct 2009 16:50:04 +0200
From:      Mel Flynn <mel.flynn+fbsd.hackers@mailing.thruhere.net>
To:        freebsd-hackers@freebsd.org
Cc:        Dag-Erling =?iso-8859-1?q?Sm=F8rgrav?= <des@des.no>
Subject:   Re: Running a program through gdb without "interfering"
Message-ID:  <200910091650.04231.mel.flynn%2Bfbsd.hackers@mailing.thruhere.net>
In-Reply-To: <86skds7vqi.fsf@ds4.des.no>
References:  <200910090015.24175.mel.flynn%2Bfbsd.hackers@mailing.thruhere.net> <86skds7vqi.fsf@ds4.des.no>

next in thread | previous in thread | raw e-mail | index | archive | help
On Friday 09 October 2009 11:38:29 Dag-Erling Sm=F8rgrav wrote:
> Mel Flynn <mel.flynn+fbsd.hackers@mailing.thruhere.net> writes:
> > is there a way to have a program run through gdb and gdb only record a
> > segfault, but otherwise let the program run?
>=20
> Yes, just run "gdb /path/to/program" and type "run".

Not what I was looking for. The segfaults are random and the only way to=20
somewhat reliably reproduce it is to have portmaster invoke it as it's=20
PM_SU_CMD. And no, running that same command again doesn't trigger the=20
segfault, so it's "something environmental". Hence I'm looking for somethin=
g=20
like:
gdb -batch -x script_with_run_cmd.gdb -exec /usr/local/bin/sudo $argv

where somehow I need $argv to be passed as arguments to sudo. I'm thinking =
i=20
should just wrap it and mktemp(1) a new command script for gdb to use with =
set=20
args $*, but if anyone has a more clever idea, I'd love to hear it.

> > [...] sudo *sometimes* segfaults [...] However, it doesn't dump core
>=20
> sudo(1) is setuid root.  You need to set kern.sugid_coredump to get it
> to dump core.

It still segfaults and doesn't dump:
Oct  9 04:34:18 smell kernel: pid 39476 (sudo), uid 0: exited on signal 11
Oct  9 04:36:32 smell kernel: pid 79657 (sudo), uid 0: exited on signal 11
Oct  9 04:36:43 smell kernel: pid 82390 (sudo), uid 0: exited on signal 11
Oct  9 04:51:46 smell kernel: pid 3601 (sudo), uid 0: exited on signal 11

find / -name '*.core' in the jail does not yield anything.=20

> > [1] In order to get this working I had to put a statically compiled ps =
in
> > the jail, or the uid test would fail. It has the downside that it lists
> > both jail and host processes, [...]
>=20
> Uh, no.  Processes outside the jail are not visible inside it, no matter
> what version of ps(1) or top(1) or any other such program you use.

I'll write this off as pilot error, cause I cannot reproduce it. I saw bash=
 as=20
one of the processes listed in a blank ps run, which isn't installed in the=
=20
jail, but since I don't have the terminal history anymore, it's entirely=20
possible I ran ps on the host.
=2D-=20
Mel



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200910091650.04231.mel.flynn%2Bfbsd.hackers>