SV: SIGBUS Panic in smbd

Ken Weaverling weave at hopi.dtcc.edu
Wed Jun 30 10:41:20 GMT 1999


> > I still cannot see why this thing is crashing Ken's
> > system, unless the underlying passwd functions are
> > keeping a private malloced area that they are doing
> > a free() on on second and subsequent calls....
> 
> That could be, and since we don't know and it could be different
> between different systems, we shouldn't free the pointers or reassign
> them to either static or allocated memory (they are owned by the
> library, not us). I do still propose strcpy as the dirty hack and a
> struct of our own as the fix.

The man page for getpwnam on DG/UX says:

BUGS
       In   all  of  the  above  functions  except  getpwent_r, getpwuid_r,
       getpwnam_r, and fgetpwent_r, the information is contained in a static
       area, so it must be copied if it is to be saved.

However, the stack trace of my core files consistently show getpwnam being
called, and triggering a malloc or realloc, so "static" is obviously not
to be taken literally in this case...

I think perhaps some of this might be due to NIS functions being called in
the background on our box. My programmer (a far better code hacker than
I), Luke Brown (luke at hopi.dtcc.edu), tells me that he had some serious 
problems with getpwnam_r not being thread safe in a program he wrote using
threads on DG/UX due to the NIS crap. He ended up rewriting it to be
thread safe. So he can rewrite me a getpwnam() call that REALLY uses a
static ptr if need be and hopefully our libc won't freak if a free to
an unknown pointer happens.

This is a hack, but it can at least save us if/until y'all fix the code!

> > Ken - do you have purify on that box ?

No, 'fraid not. I don't even have strace... :-(

> This would be an almost good approach, but quite unmanagable I think
> (for the same reason I think that getpwnam and getpwanam deals in
> static memory, it is virtually impossible to know when to free/reset
> the pointers unless you make a function for that which must be called
> when we're done with the struct).

Thanks for the help. I have 13,000 users on my quad-processor DG/UX boxes
(although not all at once, usually just a few hundred at once). It was
only panic'ing with me for some reason, and only my account and not others
on my same client. But yesterday I saw a panic occur to another user, so
it's a rare trigger, but not isolated.


-- 
Ken Weaverling  (weave @ dtcc.edu)  WHOIS: KJW
 Manager of Computer Support and Applications
   Delaware Technical & Community College




More information about the samba-technical mailing list