X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=lib%2Flibzpool%2Fkernel.c;h=704f3d659570aec619b89177b084feca4430841f;hb=4ca9a43644cf651ed3bb533d183cf33525a9fc4a;hp=69fbd44cd1ff03612caec37db11754538caf59b7;hpb=d7e398ce1a3e6f9c705af43955a684685a798c32;p=zfs.git diff --git a/lib/libzpool/kernel.c b/lib/libzpool/kernel.c index 69fbd44..704f3d6 100644 --- a/lib/libzpool/kernel.c +++ b/lib/libzpool/kernel.c @@ -159,9 +159,14 @@ zk_thread_create(caddr_t stk, size_t stksize, thread_func_t func, void *arg, * * We reduce the default stack size in userspace, to ensure * we observe stack overruns in user space as well as in - * kernel space. PTHREAD_STACK_MIN is the minimum stack - * required for a NULL procedure in user space and is added - * in to the stack requirements. + * kernel space. In practice we can't set the userspace stack + * size to 8k because differences in stack usage between kernel + * space and userspace could lead to spurious stack overflows + * (especially when debugging is enabled). Nevertheless, we try + * to set it to the lowest value that works (currently 8k*4). + * PTHREAD_STACK_MIN is the minimum stack required for a NULL + * procedure in user space and is added in to the stack + * requirements. * * Some buggy NPTL threading implementations include the * guard area within the stack size allocations. In @@ -170,7 +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) + + stack = PTHREAD_STACK_MIN + MAX(stksize, STACK_SIZE) * 4 + EXTRA_GUARD_BYTES; VERIFY3S(pthread_attr_init(&attr), ==, 0);