From 82360d236276099f4db306bea07bdddaa5b0f590 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 29 Jun 2010 13:08:36 -0700 Subject: [PATCH 1/2] Move local variables to heap We were already modifing this function so it would run in the local development environment, so let's just do the stack fixes here are well. It's all simple enough. --- .topmsg | 4 +++- cmd/ztest/ztest.c | 16 ++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.topmsg b/.topmsg index b607aee225..b32b4eda48 100644 --- a/.topmsg +++ b/.topmsg @@ -1,6 +1,8 @@ From: Brian Behlendorf Subject: [PATCH] linux ztest -Minor changes to ztest for this environment. +Minor changes to ztest for this environment. These including +updating ztest to run in the local development tree, as well +as relocating some local variables in this function to the heap. Signed-off-by: Brian Behlendorf diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c index e481be066d..e12b326359 100644 --- a/cmd/ztest/ztest.c +++ b/cmd/ztest/ztest.c @@ -4820,11 +4820,15 @@ static void ztest_run_zdb(char *pool) { int status; - char bin[MAXPATHLEN + MAXNAMELEN + 20]; - char zdb[MAXPATHLEN + MAXNAMELEN + 20]; - char zbuf[1024]; + char *bin; + char *zdb; + char *zbuf; FILE *fp; + bin = umem_alloc(MAXPATHLEN + MAXNAMELEN + 20, UMEM_NOFAIL); + zdb = umem_alloc(MAXPATHLEN + MAXNAMELEN + 20, UMEM_NOFAIL); + zbuf = umem_alloc(1024, UMEM_NOFAIL); + /* Designed to be run exclusively in the development tree */ VERIFY(realpath(getexecname(), bin) != NULL); strstr(bin, "/ztest/")[0] = '\0'; @@ -4849,13 +4853,17 @@ ztest_run_zdb(char *pool) status = pclose(fp); if (status == 0) - return; + goto out; ztest_dump_core = 0; if (WIFEXITED(status)) fatal(0, "'%s' exit code %d", zdb, WEXITSTATUS(status)); else fatal(0, "'%s' died with signal %d", zdb, WTERMSIG(status)); +out: + umem_free(bin, MAXPATHLEN + MAXNAMELEN + 20); + umem_free(zdb, MAXPATHLEN + MAXNAMELEN + 20); + umem_free(zbuf, 1024); } static void From 81d56b70fdf95cd1fdab67588d3ee0f3ac2f6b8f Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 29 Jun 2010 13:14:44 -0700 Subject: [PATCH 2/2] Refresh autogen.sh products --- cmd/ztest/Makefile.in | 3 ++- configure | 2 +- lib/libzpool/Makefile.in | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/ztest/Makefile.in b/cmd/ztest/Makefile.in index 041abe2e2c..d0b3c4b49a 100644 --- a/cmd/ztest/Makefile.in +++ b/cmd/ztest/Makefile.in @@ -288,7 +288,8 @@ AM_LIBTOOLFLAGS = --silent AM_CFLAGS = -Wall -Wstrict-prototypes -fno-strict-aliasing -Werror \ -D_GNU_SOURCE -D__EXTENSIONS__ -D_REENTRANT \ -D_POSIX_PTHREAD_SEMANTICS -D_FILE_OFFSET_BITS=64 \ - -D_LARGEFILE64_SOURCE -DTEXT_DOMAIN=\"zfs-linux-user\" + -D_LARGEFILE64_SOURCE -DTEXT_DOMAIN=\"zfs-linux-user\" \ + -Wframe-larger-than=1024 ztest_SOURCES = \ ${top_srcdir}/cmd/ztest/ztest.c diff --git a/configure b/configure index bc611f808c..e97f4ae0b6 100755 --- a/configure +++ b/configure @@ -17281,7 +17281,7 @@ _ACEOF KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG " HOSTCFLAGS="${HOSTCFLAGS} -DDEBUG " - USERDEBUG="-DDEBUG" + USERDEBUG="-DDEBUG -fstack-check" else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } diff --git a/lib/libzpool/Makefile.in b/lib/libzpool/Makefile.in index 5f3d055d17..e1838b429d 100644 --- a/lib/libzpool/Makefile.in +++ b/lib/libzpool/Makefile.in @@ -348,7 +348,8 @@ AM_LIBTOOLFLAGS = --silent AM_CFLAGS = -Wall -Wstrict-prototypes -fno-strict-aliasing -Werror \ -D_GNU_SOURCE -D__EXTENSIONS__ -D_REENTRANT \ -D_POSIX_PTHREAD_SEMANTICS -D_FILE_OFFSET_BITS=64 \ - -D_LARGEFILE64_SOURCE -DTEXT_DOMAIN=\"zfs-linux-user\" + -D_LARGEFILE64_SOURCE -DTEXT_DOMAIN=\"zfs-linux-user\" \ + -Wframe-larger-than=1024 SUBDIRS = include lib_LTLIBRARIES = libzpool.la libzpool_la_SOURCES = \