Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Nov 2001 09:43:30 -0800 (PST)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Dima Dorfman <dima@trit.org>
Cc:        audit@freebsd.org
Subject:   RE: DDB 'kill' command
Message-ID:  <XFMail.011126094330.jhb@FreeBSD.org>
In-Reply-To: <20011126163445.24CC43EC8@bazooka.trit.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On 26-Nov-01 Dima Dorfman wrote:
> The attached patch implements a 'kill' command in DDB.  Previously, it
> was possible to do `call psignal(xxx,yyy)` and have it DTRT.  (This
> was very useful when you accidently got your system so deep in the
> hole that spawning kill(1) takes forever and even then possibly
> doesn't succeed.)  However, psignal() doesn't respect locking by
> itself, so trying that now leads to all kinds of badness.  This patch
> basically wraps the psignal() call in a 'kill' command that respects
> all necessary locks.
> 
> Actually, it isn't very clear exactly which locks it should respect.
> The debugger is a special case in this way.  This patch uses the
> PROC_TRYLOCK macro; if it fails, the command bails out.  Thus, it
> can't use pfind()--the latter automatically does a PROC_LOCK--so it
> has to walk the allproc list manually.  It does *not* attempt to get a
> shared lock on the allproc list.  There is similar code in db_trace.c,
> and it doesn't call sx_slock(), either; I asked jhb about this a while
> ago, and all he said was that it is intentional.
> 
> Please review.

Looks fine.  The lack of locks and using a trylock is indeed intentional since
you can't block in the debugger.

-- 

John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-audit" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.011126094330.jhb>