m4-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

increase limit when testing stack overflow


From: Eric Blake
Subject: increase limit when testing stack overflow
Date: Sun, 03 Aug 2008 17:54:29 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.16) Gecko/20080708 Thunderbird/2.0.0.16 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On OpenBSD, I saw this from the checks directory:

$ ./stackovf.test ../src/m4
Stack soft limit set to 50K
./stackovf.test[94]: cat: Cannot allocate memory
Failure - ../src/m4 aborted unexpectedly
Output from ../src/m4:
./stackovf.test[97]: cat: Cannot allocate memory
./stackovf.test: rm: Cannot allocate memory

On that platform, SIGSTKSZ is 40k, and although 50k is larger than the
minimum, it was too close to the limit and resulted in bogus test
behavior.  Since stackovf.test already checks for a shell that supports
ulimit -sS 300, I'm increasing the subsequent ulimit to use the same size
as the prior check; I verified that on the OpenBSD platform, this was
sufficient for the test to pass as expected rather than trigger early
exits in sh, cat, or rm.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkiWRTUACgkQ84KuGfSFAYDUpACeP5XACOi6ea//NsMgeQurVmzY
ncYAnjZdsD/76dTFci49miChnXwxIS6g
=rzrR
-----END PGP SIGNATURE-----
>From e0835c041b5ae5b1f0c5da9c7850e57166695f78 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Sun, 3 Aug 2008 14:34:31 -0600
Subject: [PATCH] Increase ulimit stack value to be larger than SIGSTKSZ.

* checks/stackovf.test (tmpfile): Use 300K rather than 50K, since
at least OpenBSD's sh died early from an undersized stack limit.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog            |    6 ++++++
 checks/stackovf.test |    4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6bea889..44de879 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-08-03  Eric Blake  <address@hidden>
+
+       Increase ulimit stack value to be larger than SIGSTKSZ.
+       * checks/stackovf.test (tmpfile): Use 300K rather than 50K, since
+       at least OpenBSD's sh died early from an undersized stack limit.
+
 2008-07-17  Eric Blake  <address@hidden>
 
        Fix missing copyright notices.
diff --git a/checks/stackovf.test b/checks/stackovf.test
index 4b938e7..0ab0ccb 100755
--- a/checks/stackovf.test
+++ b/checks/stackovf.test
@@ -62,9 +62,9 @@ trap '(exit $?); exit $?' 1 2 3 15
 tmpfile="$tmpdir"/m4.out
 
 # Limit the stack size if the shell we are running permits it
-if (exec 2>/dev/null; ulimit -Ss 50)
+if (exec 2>/dev/null; ulimit -Ss 300)
 then
-  ulimit -Ss 50
+  ulimit -Ss 300
   echo "Stack soft limit set to `ulimit -s`K";
 else
   echo "Can't reset stack limit - this may take a while..."
-- 
1.5.6.4


reply via email to

[Prev in Thread] Current Thread [Next in Thread]