summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@dtucker.net>2022-07-03 18:14:09 +1000
committerDarren Tucker <dtucker@dtucker.net>2022-07-03 18:14:09 +1000
commitbfce0e66b6017a9bfab450b9dc7d4b16f90de817 (patch)
treedaf03837fa52a65338b1208dd59a15f7bf3de842 /configure.ac
parent6208d611520f9ea94d5369f9da404b709930029d (diff)
downloadopenssh-git-bfce0e66b6017a9bfab450b9dc7d4b16f90de817.tar.gz
Skip all rlimit tests when sandboxing disabled.
The rlimit tests can hang when being run with some compiler sanitizers so skip all of them if sandbox=no.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac20
1 files changed, 9 insertions, 11 deletions
diff --git a/configure.ac b/configure.ac
index d371d408..a0ff6f0b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3570,14 +3570,12 @@ AC_ARG_WITH([sandbox],
]
)
+if test "x$sandbox_arg" != "xno"; then
# POSIX specifies that poll() "shall fail with EINVAL if the nfds argument
# is greater than OPEN_MAX". On some platforms that includes implementions
# of select in userspace on top of poll() so check both work with rlimit
# NOFILES so check that both work before enabling the rlimit sandbox.
-AC_MSG_CHECKING([if select and/or poll works with descriptor rlimit])
-if test "x$sandbox_arg" = "xno"; then
- AC_MSG_RESULT([sandboxing disabled, skipping])
-else
+ AC_MSG_CHECKING([if select and/or poll works with descriptor rlimit])
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([[
#include <sys/types.h>
@@ -3632,10 +3630,9 @@ else
[AC_MSG_WARN([cross compiling: assuming no])
select_works_with_rlimit=no]
)
-fi
-AC_MSG_CHECKING([if setrlimit(RLIMIT_NOFILE,{0,0}) works])
-AC_RUN_IFELSE(
+ AC_MSG_CHECKING([if setrlimit(RLIMIT_NOFILE,{0,0}) works])
+ AC_RUN_IFELSE(
[AC_LANG_PROGRAM([[
#include <sys/types.h>
#ifdef HAVE_SYS_TIME_H
@@ -3658,10 +3655,10 @@ AC_RUN_IFELSE(
rlimit_nofile_zero_works=no],
[AC_MSG_WARN([cross compiling: assuming yes])
rlimit_nofile_zero_works=yes]
-)
+ )
-AC_MSG_CHECKING([if setrlimit RLIMIT_FSIZE works])
-AC_RUN_IFELSE(
+ AC_MSG_CHECKING([if setrlimit RLIMIT_FSIZE works])
+ AC_RUN_IFELSE(
[AC_LANG_PROGRAM([[
#include <sys/types.h>
#include <sys/resource.h>
@@ -3677,7 +3674,8 @@ AC_RUN_IFELSE(
AC_DEFINE(SANDBOX_SKIP_RLIMIT_FSIZE, 1,
[setrlimit RLIMIT_FSIZE works])],
[AC_MSG_WARN([cross compiling: assuming yes])]
-)
+ )
+fi
if test "x$sandbox_arg" = "xpledge" || \
( test -z "$sandbox_arg" && test "x$ac_cv_func_pledge" = "xyes" ) ; then