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.
This commit is contained in:
Darren Tucker 2022-07-03 18:14:09 +10:00
parent 6208d61152
commit bfce0e66b6
1 changed files with 9 additions and 11 deletions

View File

@ -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_RUN_IFELSE(
[AC_LANG_PROGRAM([[
#include <sys/types.h>
@ -3632,7 +3630,6 @@ 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(
@ -3678,6 +3675,7 @@ AC_RUN_IFELSE(
[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