From 95485883f6451cd21e4f7643c32fad0b66bb134d Mon Sep 17 00:00:00 2001 From: Kamil Rytarowski Date: Mon, 14 Jan 2019 09:52:03 +0100 Subject: executor: do not call setrlimit(2) for RLIMIT_AS for NetBSD Setting the limit caused abnormal failure during early init on NetBSD. --- executor/common_bsd.h | 6 ++++-- pkg/csource/generated.go | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/executor/common_bsd.h b/executor/common_bsd.h index 0dcf6ff5f..652f3c660 100644 --- a/executor/common_bsd.h +++ b/executor/common_bsd.h @@ -280,9 +280,11 @@ static void sandbox_common() // Some minimal sandboxing. struct rlimit rlim; -#ifndef GOOS_openbsd +#ifdef GOOS_freebsd // Documented bug in OpenBSD. - // This causes frequent random aborts on netbsd. Reason unknown. + // This causes frequent random aborts. Reason unknown. + + // This also causes ENOMEM on NetBSD during early init. rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_AS, &rlim); #endif diff --git a/pkg/csource/generated.go b/pkg/csource/generated.go index 90a10799e..fc7953842 100644 --- a/pkg/csource/generated.go +++ b/pkg/csource/generated.go @@ -647,7 +647,7 @@ static void sandbox_common() if (setsid() == -1) fail("setsid failed"); struct rlimit rlim; -#ifndef GOOS_openbsd +#ifdef GOOS_freebsd rlim.rlim_cur = rlim.rlim_max = 128 << 20; setrlimit(RLIMIT_AS, &rlim); #endif -- cgit mrf-deployment