Skip to content

Commit

Permalink
Remove NPTL_GUARD_WITHIN_STACK
Browse files Browse the repository at this point in the history
Commit 4b2f65b 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>
  • Loading branch information
behlendorf committed Jan 29, 2013
1 parent 9759c60 commit 79c6e4c
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 65 deletions.
56 changes: 0 additions & 56 deletions config/user-nptl_guard_within_stack.m4

This file was deleted.

1 change: 0 additions & 1 deletion config/user.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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
])
6 changes: 0 additions & 6 deletions include/sys/zfs_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions lib/libzpool/kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 79c6e4c

Please sign in to comment.