xenstore: Increase stack size for xs reader thread
authorIan Jackson <ian.jackson@citrix.com>
Fri, 22 Feb 2019 13:38:13 +0000 (13:38 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 10 Jan 2020 17:09:30 +0000 (17:09 +0000)
Because of a glibc bug, PTHREAD_STACK_MIN can be too small for any
thread.  Especially on Intel machines with AVX, as reported in
Debian bug #900746.

In recent Xen this is worked around more comprehensively in:
   448c03b3cbe1487
   tools/xenstore: try to get minimum thread stack size for watch thread
but this is not a good candidate for an upstream stable
backport because it introduces new linking dependencies etc.

So bodge it by doubling the size.  This is almost entirely risk-free.
Even if in theory someone might be using libxenstore in a very highly
multithreaded program, we only steal one extra 16k of address space.

Closes: #900746
Reported-by: Christian Schwamborn <christian.schwamborn@nswit.de>
Suggested-by: Damian Pietras <damianp@daper.net>
Tested-by: Damian Pietras <damianp@daper.net>
Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
Gbp-Pq: Name 0033-xenstore-Increase-stack-size-for-xs-reader-thread.patch

shim/tools/xenstore/xs.c
tools/xenstore/xs.c

index abffd9cd808dddadf27be42b6cda1847822d6849..3891e4907c8339e0b61104efdf4d220f5b64b31f 100644 (file)
@@ -800,7 +800,7 @@ bool xs_watch(struct xs_handle *h, const char *path, const char *token)
        struct iovec iov[2];
 
 #ifdef USE_PTHREAD
-#define DEFAULT_THREAD_STACKSIZE (16 * 1024)
+#define DEFAULT_THREAD_STACKSIZE (32 * 1024)
 #define READ_THREAD_STACKSIZE                                  \
        ((DEFAULT_THREAD_STACKSIZE < PTHREAD_STACK_MIN) ?       \
        PTHREAD_STACK_MIN : DEFAULT_THREAD_STACKSIZE)
index be82927528cae2eee792ecc4833dd25d0d7dd096..f25ccd7bd4708571f53d5e404a060efde3a555d4 100644 (file)
@@ -725,7 +725,7 @@ bool xs_watch(struct xs_handle *h, const char *path, const char *token)
        struct iovec iov[2];
 
 #ifdef USE_PTHREAD
-#define DEFAULT_THREAD_STACKSIZE (16 * 1024)
+#define DEFAULT_THREAD_STACKSIZE (32 * 1024)
 #define READ_THREAD_STACKSIZE                                  \
        ((DEFAULT_THREAD_STACKSIZE < PTHREAD_STACK_MIN) ?       \
        PTHREAD_STACK_MIN : DEFAULT_THREAD_STACKSIZE)