Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 07 Sep 2019 08:45:21 -0700
From:      Cy Schubert <Cy.Schubert@cschubert.com>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        Cy Schubert <Cy.Schubert@cschubert.com>, Harlan Stenn <stenn@nwtime.org>,  Vladimir Zakharov <zakharov.vv@gmail.com>, freebsd-current@freebsd.org
Subject:   Re: ntpd segfaults on start
Message-ID:  <201909071545.x87FjLS6004448@slippy.cwsent.com>
In-Reply-To: <20190907153226.GI2559@kib.kiev.ua>
References:  <20190905061251.rrip6635ebbfimsv@vzakharov>  <20190905063354.qxecqjkafikdtdyq@vzakharov> <201909051307.x85D7MGs034053@slippy.cwsent.com> <20190905142817.GB2559@kib.kiev.ua> <201909060355.x863tRhP089169@slippy.cwsent.com> <201909060639.x866dJ7f090176@slippy.cwsent.com> <201909062356.x86NuKdk003780@slippy.cwsent.com> <156d1e7c-0dbb-8707-90b3-13ae97c87449@nwtime.org> <20190907075619.GG2559@kib.kiev.ua> <201909071309.x87D9GxZ089964@slippy.cwsent.com> <20190907153226.GI2559@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
In message <20190907153226.GI2559@kib.kiev.ua>, Konstantin Belousov writes:
> On Sat, Sep 07, 2019 at 06:09:16AM -0700, Cy Schubert wrote:
> > In message <20190907075619.GG2559@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@cschubert.com>
FreeBSD UNIX:  <cy@FreeBSD.org>   Web:  http://www.FreeBSD.org

	The need of the many outweighs the greed of the few.





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909071545.x87FjLS6004448>