]> granicus.if.org Git - zfs/commitdiff
Remove NPTL_GUARD_WITHIN_STACK
authorBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 29 Jan 2013 18:35:02 +0000 (10:35 -0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 29 Jan 2013 18:58:20 +0000 (10:58 -0800)
Commit 4b2f65b253952c5103311cc8bb4b8cdc6836fd7e increased the user
space stack by 4x to resolve certain stack overflows.  As such it
no longer makes sense to worry about a single extra page which
might or might not be part of the process stack.  There is now
ample headroom for normal usage.

By eliminating this configure check we are also resolving the
following segfault which intentionally occurs at configure time
and may be logged in dmesg.

  conftest[22156]: segfault at 7fbf18a47e48 ip 00000000004007fe
  sp 00007fbf18a4be50 error 6 in conftest[400000+1000]

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
config/user-nptl_guard_within_stack.m4 [deleted file]
config/user.m4
include/sys/zfs_context.h
lib/libzpool/kernel.c

diff --git a/config/user-nptl_guard_within_stack.m4 b/config/user-nptl_guard_within_stack.m4
deleted file mode 100644 (file)
index 421eb1c..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-dnl #
-dnl # Check if the glibc NPTL threading implementation includes the guard area
-dnl # within the stack size allocation, rather than allocating extra space at
-dnl # the end of the stack, as POSIX.1 requires.
-dnl #
-AC_DEFUN([ZFS_AC_CONFIG_USER_STACK_GUARD], [
-
-       AC_MSG_CHECKING([whether pthread stack includes guard])
-
-       saved_CFLAGS="$CFLAGS"
-       CFLAGS="-fstack-check"
-       saved_LDFLAGS="$LDFLAGS"
-       LDFLAGS="-lpthread"
-
-       AC_RUN_IFELSE([AC_LANG_PROGRAM(
-       [
-               #include <pthread.h>
-               #include <sys/resource.h>
-               #include <unistd.h>
-               #include <bits/local_lim.h>
-
-               #define PAGESIZE (sysconf(_SC_PAGESIZE))
-               #define STACK_SIZE 8192
-               #define BUFSIZE 4096
-
-               void * func(void *arg)
-               {
-                       char buf[[BUFSIZE]];
-               }
-       ],
-       [
-               pthread_t tid;
-               pthread_attr_t attr;
-               struct rlimit l;
-
-               l.rlim_cur = 0;
-               l.rlim_max = 0;
-               setrlimit(RLIMIT_CORE, &l);
-               pthread_attr_init(&attr);
-               pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN + STACK_SIZE);
-               pthread_attr_setguardsize(&attr, PAGESIZE);
-               pthread_create(&tid, &attr, func, NULL);
-               pthread_join(tid, NULL);
-       ])],
-       [
-               AC_MSG_RESULT([no])
-       ],
-       [
-               AC_DEFINE([NPTL_GUARD_WITHIN_STACK], 1,
-                       [Define to 1 if NPTL threading implementation includes
-                       guard area in stack allocation])
-               AC_MSG_RESULT([yes])
-       ])
-       CFLAGS="$saved_CFLAGS"
-       LDFLAGS="$saved_LDFLAGS"
-])
index 4fcef3d5b64ffec9f7b2ae7f12ac25b2969ee836..109ebd5f92f2f9dc0ee49f583581e6b5a2b4e8a2 100644 (file)
@@ -10,5 +10,4 @@ AC_DEFUN([ZFS_AC_CONFIG_USER], [
        ZFS_AC_CONFIG_USER_LIBBLKID
        ZFS_AC_CONFIG_USER_LIBSELINUX
        ZFS_AC_CONFIG_USER_FRAME_LARGER_THAN
-       ZFS_AC_CONFIG_USER_STACK_GUARD
 ])
index 6b00a5d5db8051ad2bba436f1705280ead7822bb..53080f38234f4807252d9ca3a59e8eca291d1068 100644 (file)
@@ -190,12 +190,6 @@ extern void vpanic(const char *, __va_list);
 #define        STACK_SIZE              24576   /* Solaris */
 #endif
 
-#ifdef NPTL_GUARD_WITHIN_STACK
-#define        EXTRA_GUARD_BYTES       PAGESIZE
-#else
-#define        EXTRA_GUARD_BYTES       0
-#endif
-
 /* in libzpool, p0 exists only to have its address taken */
 typedef struct proc {
        uintptr_t       this_is_never_used_dont_dereference_it;
index 0e10c8951aee2ddea510a1f0a9338fc0186c7c71..c1ce82d1b73c748c98ac149e172ea03e50c6a9a1 100644 (file)
@@ -175,8 +175,7 @@ zk_thread_create(caddr_t stk, size_t stksize, thread_func_t func, void *arg,
         * on Linux.
         */
 
-       stack = PTHREAD_STACK_MIN + MAX(stksize, STACK_SIZE) * 4 +
-                       EXTRA_GUARD_BYTES;
+       stack = PTHREAD_STACK_MIN + MAX(stksize, STACK_SIZE) * 4;
 
        VERIFY3S(pthread_attr_init(&attr), ==, 0);
        VERIFY3S(pthread_attr_setstacksize(&attr, stack), ==, 0);