Commit 5a34ae18 authored by Laurent Dufour's avatar Laurent Dufour Committed by Pavel Emelyanov

test/zdtm: Fix test_msg massive stack usage

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: 's avatarLaurent Dufour <ldufour@linux.vnet.ibm.com>
Acked-by: 's avatarAndrew Vagin <avagin@odin.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 6f119a22
...@@ -38,7 +38,7 @@ void test_msg(const char *format, ...) ...@@ -38,7 +38,7 @@ void test_msg(const char *format, ...)
{ {
va_list arg; va_list arg;
int off = 0; int off = 0;
char buf[PAGE_SIZE]; char buf[TEST_MSG_BUFFER_SIZE];
int __errno = errno; int __errno = errno;
struct timeval tv; struct timeval tv;
struct tm *tm; struct tm *tm;
......
...@@ -25,6 +25,7 @@ extern void test_init_ns(int argc, char **argv, unsigned long clone_flags, int ( ...@@ -25,6 +25,7 @@ extern void test_init_ns(int argc, char **argv, unsigned long clone_flags, int (
#define CLONE_NEWIPC 0x08000000 #define CLONE_NEWIPC 0x08000000
#endif #endif
#define TEST_MSG_BUFFER_SIZE 2048
/*wrapper for fork: init log offset*/ /*wrapper for fork: init log offset*/
#define test_fork() test_fork_id(-1) #define test_fork() test_fork_id(-1)
extern int test_fork_id(int id); extern int test_fork_id(int id);
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
const char *test_doc = "Check for alternate signal stack"; const char *test_doc = "Check for alternate signal stack";
const char *test_author = "Cyrill Gorcunov <gorcunov@openvz.org>"; const char *test_author = "Cyrill Gorcunov <gorcunov@openvz.org>";
static char stack_thread[SIGSTKSZ]; static char stack_thread[SIGSTKSZ + TEST_MSG_BUFFER_SIZE];
static char stack_main[SIGSTKSZ]; static char stack_main[SIGSTKSZ + TEST_MSG_BUFFER_SIZE];
enum { enum {
SAS_MAIN_OLD, SAS_MAIN_OLD,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment