diff --git a/net/ntp/files/patch-ntpd_ntpd.c b/net/ntp/files/patch-ntpd_ntpd.c index 3f8187a072e4..d49e66c00363 100644 --- a/net/ntp/files/patch-ntpd_ntpd.c +++ b/net/ntp/files/patch-ntpd_ntpd.c @@ -1,10 +1,43 @@ --- ntpd/ntpd.c.orig 2019-02-20 09:21:44.000000000 -0800 -+++ ntpd/ntpd.c 2019-09-20 12:11:54.469651000 -0700 -@@ -999,7 +999,7 @@ ++++ ntpd/ntpd.c 2019-10-24 19:21:44.229660000 -0700 +@@ -137,6 +137,8 @@ + # include + # include + #endif /* LIBSECCOMP and KERN_SECCOMP */ ++#include ++#include + + #ifdef HAVE_DNSREGISTRATION + # include +@@ -790,6 +792,13 @@ + int fd; + int zero; + # endif ++ int aslr = 0; ++ int aslr_len = sizeof(aslr); ++#ifdef __LP64__ ++ char *aslr_var = "kern.elf64.aslr.enable"; ++#else ++ char *aslr_var = "kern.elf32.aslr.enable"; ++#endif + + # ifdef NEED_PTHREAD_WARMUP + my_pthread_warmup(); +@@ -998,8 +1007,16 @@ + /* Setup stack size in preparation for locking pages in memory. */ # if defined(HAVE_MLOCKALL) # ifdef HAVE_SETRLIMIT - ntp_rlimit(RLIMIT_STACK, DFLT_RLIMIT_STACK * 4096, 4096, "4k"); +- ntp_rlimit(RLIMIT_STACK, DFLT_RLIMIT_STACK * 4096, 4096, "4k"); -# ifdef RLIMIT_MEMLOCK ++ ++ if ((rc = sysctlbyname(aslr_var, &aslr, &aslr_len, NULL, 0)) != 0) ++ msyslog(LOG_ERR, ++ "sysctlbyname: %s: %s", ++ aslr_var, ++ strerror(rc)); ++ ++ if (aslr == 0) ++ ntp_rlimit(RLIMIT_STACK, DFLT_RLIMIT_STACK * 4096, 4096, "4k"); +# if defined(RLIMIT_MEMLOCK) && defined(DFLT_RLIMIT_MEMLOCK) && DFLT_RLIMIT_MEMLOCK != -1 /* * The default RLIMIT_MEMLOCK is very low on Linux systems.