Automated submission of kernel panic reports

Jilles Tjoelker jilles at stack.nl
Sun Nov 3 21:30:09 UTC 2013


On Tue, Oct 29, 2013 at 03:32:19AM -0700, Colin Percival wrote:
> The code is in
>   http://svnweb.freebsd.org/base/user/cperciva/panicmail/
> and it uses my FreeBSD-base-system-only public-key encryption code:
>   http://svnweb.freebsd.org/base/user/cperciva/pkesh/

Some remarks about panicmail:

> local tmpfile=`mktemp` || exit 1

This kind of thing does not do what you expect. The 'local' utility
returns 0 because it successfully created the local variable, ignoring
the status from the command substitution. Use
  local tmpfile
  tmpfile=`mktemp` || exit 1
in both occurrences.

> # And we want a backtrace (we should be able to pipe the commands
> # directly into kgdb, but that doesn't work with our /bin/sh):

It looks like the problem is, in fact, that gdb will not read from a
pipe. When the pipe is at EOF, poll() returns POLLHUP status and gdb
aborts with "Hangup detected on fd 0" even though there is unread data
in the kernel buffer.

Earlier kernels incorrectly did not return POLLHUP, hiding the gdb bug.
Some other shells (but not ash-derived ones such as all versions of
FreeBSD sh) provide here-document input as a temporary file, avoiding
the gdb bug.

> return 0;

It would be better style to omit the redundant semicolon here (occurs
several times).

Some remarks about pkesh:

> D=`mktemp -d "${TMP:-/tmp}/pkesh.XXXXXX"`

I think the usual environment variable for the directory for temporary
files is TMPDIR, not TMP.

The rest of the script uses $D mostly unquoted, unlike the change that
was made to panicmail.

-- 
Jilles Tjoelker


More information about the freebsd-hackers mailing list