Re: ntpd segfaults on start

From: Cy Schubert <Cy.Schubert_at_cschubert.com>
Date: Sat, 07 Sep 2019 08:45:21 -0700
In message <20190907153226.GI2559_at_kib.kiev.ua>, Konstantin Belousov writes:
> On Sat, Sep 07, 2019 at 06:09:16AM -0700, Cy Schubert wrote:
> > In message <20190907075619.GG2559_at_kib.kiev.ua>, Konstantin Belousov writes:
> > > On Sat, Sep 07, 2019 at 12:53:19AM -0700, Harlan Stenn wrote:
> > > > Cy,
> > > > 
> > > > On 9/6/2019 4:56 PM, Cy Schubert wrote:
> > > > > ...
> > > > > 
> > > > > For those who enable ASLR, a better workaround is, to add this to you
> r 
> > > > > ntp.conf:
> > > > > 
> > > > > rlimit memlock 64
> > > > > 
> > > > > Until a more precise default is determined.
> > > > 
> > > > Should I change the default value for FreeBSD-12 to be 64 for now?
> > > > 
> > > > I can get this change in place for the upcoming ntp-4.2.8p14 release,
> > > > and we can change it later if needed.
> > >
> > > ASLR is disabled by default, so if anybody tweak a system config, she
> > > should know better to tweak ntpd as well.  I am fine with changing the
> > > defaults for ntpd, but I think that more useful would be to update
> > > the documentation (but where to put it ?).
> > 
> > I agree. We should update the documentation for now. 64 MB was my first 
> > successful test but I suspect we can get it lower, like 47 MB. For now we 
> > can update the documentation to say that if a person enables ASLR they must
>  
> > add this to ntp.conf. I'll find the best number instead of the current 
> > sledgehammer.
> > 
> > Where to put it? I've added it to the ASLR wiki (https://wiki.freebsd.org/A
> S
> > LR) for now. An ASLR page should go into the handbook documenting how to 
> > use up ASLR and gotchas like this and mitigations.
> May be in security(7).

Maybe.

>
> There are actually two workarounds, with enabled ASLR.  One is the rlimit,
> another one is to disable stack base randomization by gap.

The latter works but I'm not enamoured with it. I suppose we can list the 
workarounds and let the user pick the one they want to use.

I've been able to set the memlock rlimit as low as 20 MB. The issue is 
letting it default to 0 which allows ntp to mlockall() anything it wants. 
ntpd on my sandbox is currently using 18 MB.


-- 
Cheers,
Cy Schubert <Cy.Schubert_at_cschubert.com>
FreeBSD UNIX:  <cy_at_FreeBSD.org>   Web:  http://www.FreeBSD.org

	The need of the many outweighs the greed of the few.
Received on Sat Sep 07 2019 - 13:45:27 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:21 UTC