From owner-freebsd-hackers@FreeBSD.ORG Fri Oct 9 14:50:08 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8DA451065676 for ; Fri, 9 Oct 2009 14:50:08 +0000 (UTC) (envelope-from mel.flynn+fbsd.hackers@mailing.thruhere.net) Received: from mailhub.rachie.is-a-geek.net (rachie.is-a-geek.net [66.230.99.27]) by mx1.freebsd.org (Postfix) with ESMTP id 544B38FC20 for ; Fri, 9 Oct 2009 14:50:07 +0000 (UTC) Received: from smoochies.rachie.is-a-geek.net (mailhub.lan.rachie.is-a-geek.net [192.168.2.11]) by mailhub.rachie.is-a-geek.net (Postfix) with ESMTP id C58167E853; Fri, 9 Oct 2009 06:50:18 -0800 (AKDT) From: Mel Flynn To: freebsd-hackers@freebsd.org Date: Fri, 9 Oct 2009 16:50:04 +0200 User-Agent: KMail/1.12.1 (FreeBSD/8.0-RC1; KDE/4.3.1; i386; ; ) References: <200910090015.24175.mel.flynn+fbsd.hackers@mailing.thruhere.net> <86skds7vqi.fsf@ds4.des.no> In-Reply-To: <86skds7vqi.fsf@ds4.des.no> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Message-Id: <200910091650.04231.mel.flynn+fbsd.hackers@mailing.thruhere.net> Cc: Dag-Erling =?iso-8859-1?q?Sm=F8rgrav?= Subject: Re: Running a program through gdb without "interfering" X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Oct 2009 14:50:08 -0000 On Friday 09 October 2009 11:38:29 Dag-Erling Sm=F8rgrav wrote: > Mel Flynn 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