NetBSD Problem Report #51158

From martin@duskware.de  Sun May 22 18:47:23 2016
Return-Path: <martin@duskware.de>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 350B17A3D4
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 22 May 2016 18:47:23 +0000 (UTC)
From: martin@NetBSD.org
Reply-To: martin@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: ntpd fails to set stack limit
X-Send-Pr-Version: 3.95

>Number:         51158
>Category:       bin
>Synopsis:       ntpd fails to set stack limit
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun May 22 18:50:00 +0000 2016
>Last-Modified:  Tue Aug 28 16:15:01 +0000 2018
>Originator:     Martin Husemann
>Release:        NetBSD 7.99.29
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD space-truckin.duskware.de 7.99.29 NetBSD 7.99.29 (CUBIETRUCK) #260: Sun May 22 15:17:59 CEST 2016 martin@night-owl.duskware.de:/usr/src/sys/arch/evbarm/compile/CUBIETRUCK evbarm
Architecture: earmv7hfeb
Machine: evbarm
>Description:

Maybe fallout from the aslr changes:

May 22 21:45:11 space-truckin ntpd[363]: ntp_rlimit: Cannot set RLIMIT_STACK: Invalid argument


>How-To-Repeat:
Boot a current evbarm system.

>Fix:
n/a

>Audit-Trail:
From: "John D. Baker" <jdbaker@mylinuxisp.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/51158: ntpd fails to set stack limit
Date: Sun, 22 May 2016 15:47:54 -0500 (CDT)

 Also seen on i386-current.

 -- 
 |/"\ John D. Baker, KN5UKS               NetBSD     Darwin/MacOS X
 |\ / jdbaker[snail]mylinuxisp[flyspeck]com    OpenBSD            FreeBSD
 | X  No HTML/proprietary data in email.   BSD just sits there and works!
 |/ \ GPGkeyID:  D703 4A7E 479F 63F8 D3F4  BD99 9572 8F23 E4AD 1645

From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/51158: ntpd fails to set stack limit
Date: Sun, 29 May 2016 22:55:36 +0000

 On Sun, May 22, 2016 at 06:50:00PM +0000, martin@NetBSD.org wrote:
  > Maybe fallout from the aslr changes:
  > 
  > May 22 21:45:11 space-truckin ntpd[363]: ntp_rlimit: Cannot set RLIMIT_STACK: Invalid argument

 This is suggestive:

      The setrlimit() function may fail if:

      [EINVAL]           The limit specified to setrlimit() cannot be lowered,
                         because current usage is already higher than the
                         limit.


 -- 
 David A. Holland
 dholland@netbsd.org

From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/51158: ntpd fails to set stack limity
Date: Mon, 30 May 2016 12:14:34 +0200

 On Sun, May 29, 2016 at 11:00:01PM +0000, David Holland wrote:
 >  This is suggestive:
 >  
 >       The setrlimit() function may fail if:
 >  
 >       [EINVAL]           The limit specified to setrlimit() cannot be lowered,
 >                          because current usage is already higher than the
 >                          limit.

 Yes, but IMHO we should examine closer how this corelates to ASLR enabling
 by default.

 Martin

From: christos@zoulas.com (Christos Zoulas)
To: gnats-bugs@NetBSD.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, 
	martin@NetBSD.org
Cc: 
Subject: Re: bin/51158: ntpd fails to set stack limity
Date: Mon, 30 May 2016 10:22:58 -0400

 On May 30, 10:15am, martin@duskware.de (Martin Husemann) wrote:
 -- Subject: Re: bin/51158: ntpd fails to set stack limity

 |  Yes, but IMHO we should examine closer how this corelates to ASLR enabling
 |  by default.

 It tries to set the stack limit too low. The logic should be corrected to
 retry since hard-coding 64K is not good enough.

 christos

From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/51158: ntpd fails to set stack limity
Date: Tue, 31 May 2016 04:22:38 +0000

 On Mon, May 30, 2016 at 10:15:01AM +0000, Martin Husemann wrote:
  >  On Sun, May 29, 2016 at 11:00:01PM +0000, David Holland wrote:
  >  >  This is suggestive:
  >  >  
  >  >       The setrlimit() function may fail if:
  >  >  
  >  >       [EINVAL]           The limit specified to setrlimit() cannot be lowered,
  >  >                          because current usage is already higher than the
  >  >                          limit.
  >  
  >  Yes, but IMHO we should examine closer how this corelates to ASLR enabling
  >  by default.

 That was more or less my point -- a good bet would be that something
 is calculating current usage wrong.

 -- 
 David A. Holland
 dholland@netbsd.org

From: coypu@sdf.org
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/51158: ntpd fails to set stack limit
Date: Sun, 3 Jun 2018 11:35:01 +0000

 Adding information from duplicate bug report 5245 from jak:

 ntpd wants to lock itself in RAM (and out of swap), to do this it
 attempts to reduce its maximum stack footprint.  The maximum stack
 footprint it currently uses is 512KiB (DFLT_RLIMIT_STACK = 128), and
 relatively recently as small as 256KiB (7.99.3x).  Since ASLR was
 enabled, we've been seeing "ntp_rlimit: Cannot set RLIMIT_STACK: Invalid
 argument" messages nearly ever time ntpd is started.

From: scole_mail <scole_mail@gmx.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/51158: ntpd fails to set stack limit
Date: Tue, 28 Aug 2018 07:59:23 -0700

 I see this happening on my 8.0 i386 machine every boot.  I don't see it
 when I restart ntpd, unless I'm looking in the wrong place.

 Thanks

From: Joerg Sonnenberger <joerg@bec.de>
To: gnats-bugs@NetBSD.org
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, martin@NetBSD.org
Subject: Re: kern/51158: ntpd fails to set stack limit
Date: Tue, 28 Aug 2018 17:57:55 +0200

 This is ultimately a bug in the way the stack randomisation is done. But
 fixing it is complicated and there are few things where the current code
 creates noticable problems.

 Joerg

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.