Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Jan 1999 21:12:07 -0800 (PST)
From:      Archie Cobbs <archie@whistle.com>
To:        freebsd-current@FreeBSD.ORG, freebsd-hackers@FreeBSD.ORG
Subject:   Automated debug sanity checkers
Message-ID:  <199901160512.VAA07999@bubba.whistle.com>

next in thread | raw e-mail | index | archive | help
I was thinking about the DIAGNOSTICS replacement macros and
had a random thought...

Suppose you're sitting in front of a ddb (or better yet gdb) prompt
because your kernel has just crashed due to who knows what reason.
What do you do to debug this? You start looking at variables,
memory, etc for anything funny going on.

For example, several times we've spent hours going through a crash
dump to find, for example, that a process was on two queues, or
some mbuf was mangled, etc.

The thought is that it would be really easy to help automate this
process, by doing the following:

 1. Define a new kernel option INCLUDE_SANITY_CHECKS (or whatever)

 2. When this is defined, all the various FreeBSD kernel
    submodules (VM, networking, device drivers, etc) would
    include a function that exhaustively runs sanity checks --
    ie, validations that all the assumptions in the code are true --
    for that particular submodule. This means checking all queues,
    flags, whatever.

 3. The function is required to only READ memory, not modify it.
    It can report any inconsistencies, though, obviously.

 4. The function is linked into a linker set SANITY_SET(...) or whatever

Then by simply calling this function from the debugger you can
much more quickly narrow down on the problem (and hopefully fix
it before you get tired and go to sleep :-)

Moreover, since the function is running post-mortem, it can do
very detailed checks that would otherwise take way too long.
E.g., check every mbuf, every queue entry, check the filesystem,
etc. Basically a "fsck" for the kernel memory.

Is this something that people would be motivated enough to make
as "official" FreeBSD kernel good housekeeping policy?

-Archie

___________________________________________________________________________
Archie Cobbs   *   Whistle Communications, Inc.  *   http://www.whistle.com

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



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