aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDawid Gorecki <dgr@semihalf.com>2021-12-20 05:27:12 +0000
committerMarcin Wojtas <mw@FreeBSD.org>2022-01-23 10:09:53 +0000
commit408c698b133f33e52ec2d067447dd32b425cfcc8 (patch)
tree9e3766a2ec6f5e55db6d58c325eb99728786a840
parent5b042fcbdff8a651daecfbf91759fc8baf43ece0 (diff)
downloadsrc-408c698b133f33e52ec2d067447dd32b425cfcc8.tar.gz
src-408c698b133f33e52ec2d067447dd32b425cfcc8.zip
t_setrlimit: Adjust resource limit to 20M
With ASLR enabled by default, RLIMIT_STACK test fails due to the fact that default stack gap can be as big as 15M. Because of that the resource limit of 4M results in test program receiving SIGSEGV immediately after exiting the setrlimit syscall. Since the idea of this test is to check if rlim_cur does not extend past rlim_max, adjusting the resource limit to 20M should not invalidate the test results. Obtained from: Semihalf Sponsored by: Alstom Group Differential revision: https://reviews.freebsd.org/D33116 (cherry picked from commit 4f741801d86089a1c5d631ba1e0f1421cdcf7a7e)
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c b/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c
index 6b90deab8f3f..15154cb8274f 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c
@@ -551,7 +551,11 @@ ATF_TC_BODY(setrlimit_stack, tc)
struct rlimit res;
/* Ensure soft limit is not bigger than hard limit */
+#ifdef __FreeBSD__
+ res.rlim_cur = res.rlim_max = 20971520;
+#else
res.rlim_cur = res.rlim_max = 4192256;
+#endif
ATF_REQUIRE(setrlimit(RLIMIT_STACK, &res) == 0);
ATF_REQUIRE(getrlimit(RLIMIT_STACK, &res) == 0);
ATF_CHECK(res.rlim_cur <= res.rlim_max);