On Tue, Feb 23, 2010 at 02:35:11PM +0100, Jan Stary wrote:
> On Feb 23 13:36:56, Anthony Howe wrote:
> > I have a daemon process I've written and trying to debug, however,
> > whenever it crashes, I get no core file.
> >
> > 1. The daemon does a setrlimit of RLIMIT_CORE to RLIM_INFINITY (same as
> > if I had done "ulimit -H -c unlimited" in the shell before starting the
> > process).
> >
> > 2. The daemon sets its working directory to /var/tmp, which is writeable
> > by every one, yet no core file appears. Likewise /var/crash has no core
> > file.
> >
> > 3. The program does not use file system setuid bits, BUT does use the
> > setuid() et al. system calls to drop privileges from root to some other
> > user (which can write into /var/tmp).
> >
> > 4. A find / -name '*.core' finds nothing anywhere.
> >
> > 5. I've even tried sysctl kern.nosuidcoredump=0 and
> > kern.nosuidcoredump=2 thinking that the setuid family of system
> > functions might be resetting a flag when I drop privileges.
> >
> > 6. Even forcing a SIGABRT, which should produce a core, does not create
> > one.
> >
> >
> > What am I missing in order to get a daemon process on OpenBSD to dump
> > core when it crashes?
>
> Depends on how exactly it "crashes", man sigaction(2).
> Are you possibly catching the signals yourself?
> The following coredumps as a charm:
>
> #include <stdlib.h>
>
> int
> main()
> {
> abort();
> /* NOTREACHED */
> return 0;
> }
ktrace might help here too.
-Otto