Automatic backtrace [Was: Re: NetAPP/Samba 3.0/plugs]

David Lee t.d.lee at
Wed Mar 13 02:40:06 GMT 2002

On 13 Mar 2002, Scott Gifford wrote:

> [...]
> All of this is handled by the OS, and core is dumped in the current
> working directory.  I don't know how Samba decides what directories to
> chdir() into, but if it wanders around a bit, something like
> chdir("/some/known/directory"); abort(); in a signal handler will make
> sure that the corefile ends up in a sane place.
> > Dumping core just has 'bad idea' written all over it.
> It seem to me that investing a lot of time into designing something
> that gives the equivalent functionality of core files has 'reinventing
> the wheel' written all over it...

Scott, I certainly sympathise with your "not reinventing the wheel" ideal. 
And I'm tempted to agree that having a core file might be preferable to
having a simple backtrace.  (Note that you draw me further into an
implicit "either/or", which I will later address.) 

But I seem to recall that various OSes, for security reasons, may
deliberately not drop core files for suid-like programs under some
circumstances.  (Someone help me here please!)  For instance, on our
Solaris systems, although I've seen such "internal/panic" messages from
"smbd" over the years, I don't ever recall finding a core file from it
(although I have for other suid programs such as sendmail: I think this is
something to do with smbd's flipping between ruid and euid). 

I'm assuming that samba's "panic action" (which I've never used myself) 
is basically a sound mechanism for invoking simple commands. 

Hence on balance (and including Andrew's other corefile-related issues),
my suggestion for trying to get "panic action" to invoke a debugger
backtrace directly and automatically.

> > Plus the people who know how to use gdb on a core file would already
> > have a magic 'panic action' already setup.
> Perhaps, but I know how to use gdb on a core file, and I have no idea
> what a reasonable thing to put in 'panic action' would be...It's tempting
> to say that's because of my ignorance of Samba, but it's equally
> tempting to say that it's because Samba behaves in a nonstandard
> way...

Scott: I synpathise with what you are saying.  I, too, am comfortable with
getting a backtrace out of a typical corefile, but I have not known
anything much about Samba's "panic action" (until this discussion!). 

But we're in danger of seeing this as an either/or, when it is more a

On balance, then, I tend to favour the ease, relative reliability and
"automatically works" characterstic of a default "panic action" that tries
to invoke a debugger backtrace mechanism.

If we also (i.e. both/and, rather than either/or) had a core file that
would be icing on the cake.  But, as Andrew B. points out, the core file
mechanism in the case of smbd can be problematical, both within Samba, and
across OSes. 

Hoep that helps our ruminations.


:  David Lee                                I.T. Service          :
:  Systems Programmer                       Computer Centre       :
:                                           University of Durham  :
:            South Road            :
:                                           Durham                :
:  Phone: +44 191 374 2882                  U.K.                  :

More information about the samba-technical mailing list