[CRIU] [PATCH 3/4] test/zdtm: Fix test_msg massive stack usage
Laurent Dufour
ldufour at linux.vnet.ibm.com
Wed Jul 1 08:32:39 PDT 2015
In test_msg() a buffer is allocated on stack to cook the outputed message.
This buffer's size was defined using the PAGE_SIZE constant defined in
zdtmtst.h file.
On some system like ppc64, the page size is large (64K), leading to massive
stack allocation, which may be too large in case of alternate stack like
the one used in the sigaltstack test.
This fix, defines a 2048 characters buffer for test_msg, and expose a
constant to allocate stack accordingly in the sigaltstack test.
Signed-off-by: Laurent Dufour <ldufour at linux.vnet.ibm.com>
---
test/zdtm/lib/msg.c | 2 +-
test/zdtm/lib/zdtmtst.h | 1 +
test/zdtm/live/static/sigaltstack.c | 4 ++--
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/test/zdtm/lib/msg.c b/test/zdtm/lib/msg.c
index 48ddd43e0906..c88ceacf1eed 100644
--- a/test/zdtm/lib/msg.c
+++ b/test/zdtm/lib/msg.c
@@ -38,7 +38,7 @@ void test_msg(const char *format, ...)
{
va_list arg;
int off = 0;
- char buf[PAGE_SIZE];
+ char buf[TEST_MSG_BUFFER_SIZE];
int __errno = errno;
struct timeval tv;
struct tm *tm;
diff --git a/test/zdtm/lib/zdtmtst.h b/test/zdtm/lib/zdtmtst.h
index 69de1ec3f00b..23802d026b15 100644
--- a/test/zdtm/lib/zdtmtst.h
+++ b/test/zdtm/lib/zdtmtst.h
@@ -25,6 +25,7 @@ extern void test_init_ns(int argc, char **argv, unsigned long clone_flags, int (
#define CLONE_NEWIPC 0x08000000
#endif
+#define TEST_MSG_BUFFER_SIZE 2048
/*wrapper for fork: init log offset*/
#define test_fork() test_fork_id(-1)
extern int test_fork_id(int id);
diff --git a/test/zdtm/live/static/sigaltstack.c b/test/zdtm/live/static/sigaltstack.c
index 37a23c9dc710..087b88c62234 100644
--- a/test/zdtm/live/static/sigaltstack.c
+++ b/test/zdtm/live/static/sigaltstack.c
@@ -16,8 +16,8 @@
const char *test_doc = "Check for alternate signal stack";
const char *test_author = "Cyrill Gorcunov <gorcunov at openvz.org>";
-static char stack_thread[SIGSTKSZ];
-static char stack_main[SIGSTKSZ];
+static char stack_thread[SIGSTKSZ + TEST_MSG_BUFFER_SIZE];
+static char stack_main[SIGSTKSZ + TEST_MSG_BUFFER_SIZE];
enum {
SAS_MAIN_OLD,
--
1.9.1
More information about the CRIU
mailing list