From owner-svn-src-stable-12@freebsd.org Sun Sep 29 03:36:52 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DF016F04F3; Sun, 29 Sep 2019 03:36:52 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46grn05YKyz43BT; Sun, 29 Sep 2019 03:36:52 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A35B6C03A; Sun, 29 Sep 2019 03:36:52 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8T3aq8Y007274; Sun, 29 Sep 2019 03:36:52 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8T3apkI007271; Sun, 29 Sep 2019 03:36:51 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201909290336.x8T3apkI007271@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 29 Sep 2019 03:36:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352865 - in stable: 11 11/contrib/ntp/ntpd 11/etc 11/usr.sbin/ntp 12 12/contrib/ntp/ntpd 12/usr.sbin/ntp 12/usr.sbin/ntp/ntpd X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11 11/contrib/ntp/ntpd 11/etc 11/usr.sbin/ntp 12 12/contrib/ntp/ntpd 12/usr.sbin/ntp 12/usr.sbin/ntp/ntpd X-SVN-Commit-Revision: 352865 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Sep 2019 03:36:52 -0000 Author: cy Date: Sun Sep 29 03:36:50 2019 New Revision: 352865 URL: https://svnweb.freebsd.org/changeset/base/352865 Log: MFC r352304, r352540 r352304: No longer mlock() ntpd pages by default in memory thus allowing its pages to page as necessary. To restore historic BSD behaviour add the following to ntp.conf: rlimit memlock 32 Discussed on: freebsd-current@ between Sept 6-9, 2019 Reported by: Users using ASLR with stack gap != 0 Reviewed by: ian, kib, rgrimes (all previous versions) Differential Revision: https://reviews.freebsd.org/D21581 r352540: Follow up on r352304 which disabled default mlockall() at startup. Unfortunately though the original tarball supports this in ./configure (for Linux), to fully support disabling of mlockall() by default requires a little extra help otherwise the following is logged in syslog: Cannot set RLIMIT_MEMLOCK: Operation not permitted Modified: stable/12/UPDATING stable/12/contrib/ntp/ntpd/ntpd.c stable/12/usr.sbin/ntp/config.h stable/12/usr.sbin/ntp/ntpd/ntp.conf Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/UPDATING stable/11/contrib/ntp/ntpd/ntpd.c stable/11/etc/ntp.conf stable/11/usr.sbin/ntp/config.h Directory Properties: stable/11/ (props changed) Modified: stable/12/UPDATING ============================================================================== --- stable/12/UPDATING Sun Sep 29 03:26:29 2019 (r352864) +++ stable/12/UPDATING Sun Sep 29 03:36:50 2019 (r352865) @@ -16,6 +16,12 @@ from older versions of FreeBSD, try WITHOUT_CLANG and the tip of head, and then rebuild without this option. The bootstrap process from older version of current across the gcc/clang cutover is a bit fragile. +20190913: + ntpd no longer by default locks its pages in memory, allowing them + to be paged out by the kernel. Use rlimit memlock to restore + historic BSD behaviour. For example, add "rlimit memlock 32" + to ntp.conf to lock up to 32 MB of ntpd address space in memory. + 20190914: The vfs.fusefs.sync_unmount and vfs.fusefs.init_backgrounded sysctls and the "-o sync_unmount" and "-o init_backgrounded" mount options have Modified: stable/12/contrib/ntp/ntpd/ntpd.c ============================================================================== --- stable/12/contrib/ntp/ntpd/ntpd.c Sun Sep 29 03:26:29 2019 (r352864) +++ stable/12/contrib/ntp/ntpd/ntpd.c Sun Sep 29 03:36:50 2019 (r352865) @@ -999,7 +999,7 @@ ntpdmain( # if defined(HAVE_MLOCKALL) # ifdef HAVE_SETRLIMIT ntp_rlimit(RLIMIT_STACK, DFLT_RLIMIT_STACK * 4096, 4096, "4k"); -# ifdef RLIMIT_MEMLOCK +# if defined(RLIMIT_MEMLOCK) && defined(DFLT_RLIMIT_MEMLOCK) && DFLT_RLIMIT_MEMLOCK != -1 /* * The default RLIMIT_MEMLOCK is very low on Linux systems. * Unless we increase this limit malloc calls are likely to Modified: stable/12/usr.sbin/ntp/config.h ============================================================================== --- stable/12/usr.sbin/ntp/config.h Sun Sep 29 03:26:29 2019 (r352864) +++ stable/12/usr.sbin/ntp/config.h Sun Sep 29 03:36:50 2019 (r352865) @@ -287,7 +287,7 @@ #define DEFAULT_HZ 100 /* Default number of megabytes for RLIMIT_MEMLOCK */ -#define DFLT_RLIMIT_MEMLOCK 32 +#define DFLT_RLIMIT_MEMLOCK -1 /* Default number of 4k pages for RLIMIT_STACK */ #define DFLT_RLIMIT_STACK 50 Modified: stable/12/usr.sbin/ntp/ntpd/ntp.conf ============================================================================== --- stable/12/usr.sbin/ntp/ntpd/ntp.conf Sun Sep 29 03:26:29 2019 (r352864) +++ stable/12/usr.sbin/ntp/ntpd/ntp.conf Sun Sep 29 03:36:50 2019 (r352865) @@ -102,3 +102,11 @@ restrict ::1 # Use either leapfile in /etc/ntp or periodically updated leapfile in /var/db. #leapfile "/etc/ntp/leap-seconds" leapfile "/var/db/ntpd.leap-seconds.list" + +# Specify the number of megabytes of memory that should be allocated and +# locked. -1 (default) means "do not lock the process into memory". +# 0 means "lock whatever memory the process wants into memory". Any other +# number means to lock up to that number of megabytes into memory. +# 0 may result in a segfault when ASLR with stack gap randomization +# is enabled. +#rlimit memlock 32