[Samba] Strange crashes and disconnection from PDC?
Andrew Bartlett
abartlet at samba.org
Sun Jul 28 06:06:01 GMT 2002
Nir Soffer wrote:
>
> Cc:'d to samba-technical
>
> ( Background - I'm trying to see how I can get smbd to dump core,
> with a user supplied option to allow tell it where to dump it, I'm
> poring over the related code)
>
> > A 'corefile directory' option might be nice - but we will have to be
> > careful. Look into smb_panic() and exit_server() for somewhere to
> > start.
>
> Err. Okay. Can anyone explain me what's up here? From server.c
>
> #if DUMP_CORE
> /*******************************************************************
> Prepare to dump a core file - carefully !
> ********************************************************************/
>
> static BOOL dump_core(void)
> {
> char *p;
> pstring dname;
> pstrcpy(dname,lp_logfile());
You certainly could not use this in a signal handler, becouse it just
touches too much of (the already possibly corrupt) smbd.
> if ((p=strrchr(dname,'/'))) *p=0;
> pstrcat(dname,"/corefiles");
> mkdir(dname,0700);
> sys_chown(dname,getuid(),getgid());
> chmod(dname,0700);
> if (chdir(dname)) return(False);
> umask(~(0700));
>
> dump_core is already there, DUMP_CORE is set to 1 (it looks like this
> is the default one shipped, btw), yet nothing bloody happens.
>
> The above snippet appears to create a corefiles directory above the log
> dir, (which is, I assume, what you want to change using the core
> directory
> option), but it doesn't create it anywhere I can see after killing a
> process with
> sig11. What am I missing here?
>
> Also - from what I see, the execution flow of a panic is something like:
>
> exit_servers is set is a fault handler, however in fault_setup (fault.c)
> a
> SIGSEGV handler is set to sig_fault which calls fault_report which
> calls smb_panic which calls abort().
>
> When the heck is exit_servers called, then? And what function does
> dump_core perform if there's no one to call it?
I think it's there for gprof runs. You extract the profile data by
dumping core and exaimining the resulting binary...
> I'm probably missing something fundamental here, enlightment will
> be appreciated.
Yes, its a weird area...
Andrew Bartlett
--
Andrew Bartlett abartlet at pcug.org.au
Manager, Authentication Subsystems, Samba Team abartlet at samba.org
Student Network Administrator, Hawker College abartlet at hawkerc.net
http://samba.org http://build.samba.org http://hawkerc.net
More information about the samba-technical
mailing list