[SCM] Samba Shared Repository - branch master
steven.danneman at isilon.com
Wed Feb 25 17:01:12 MST 2009
> > @@ -966,6 +899,13 @@ bool reinit_after_fork(struct messaging_context
> > * numbers as each other */
> > set_need_random_reseed();
> > +#ifdef WITH_MADVISE_PROTECTED
> > + /* Protect parent process from being killed by kernel when system
> > + * memory is low. Child processes can still be killed */
> > + if(!parent_longlived)
> > + madvise(NULL,0,MADV_PROTECT);
> > +#endif
> > +
> I think that will still protect the child, I think we need to reset the
> flag in the child, or does fork() auto resets it?
Good point. I've looked at the FreeBSD kernel implementation of MADV_PROTECT, and it is implemented as a per-process flag which will be inherited on fork. Furthermore, there's no way to unset it even if we call madvise(NULL, 0, MADV_NORMAL).
So it appears our choices in behavior are protect all processes, or protect none. I'm inclined to agree with Volker that protecting all children, some of which might be leaking is the wrong way to go. I may just revert this one.
More information about the samba-technical