2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 14:25:49 +00:00

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: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Acked-by: Andrew Vagin <avagin@odin.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Laurent Dufour
2015-07-01 17:32:39 +02:00
committed by Pavel Emelyanov
parent 6f119a22a6
commit 5a34ae1891
3 changed files with 4 additions and 3 deletions

View File

@@ -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;

View File

@@ -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);

View File

@@ -16,8 +16,8 @@
const char *test_doc = "Check for alternate signal stack";
const char *test_author = "Cyrill Gorcunov <gorcunov@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,