|
|
00db10 |
commit d8b778907e5270fdeb70459842ffbc20bd2ca5e1
|
|
|
00db10 |
Author: Florian Weimer <fweimer@redhat.com>
|
|
|
00db10 |
Date: Thu Jan 11 13:13:14 2018 +0100
|
|
|
00db10 |
|
|
|
00db10 |
nptl: Add tst-minstack-cancel, tst-minstack-exit [BZ #22636]
|
|
|
00db10 |
|
|
|
00db10 |
I verified that without the guard accounting change in commit
|
|
|
00db10 |
630f4cc3aa019ede55976ea561f1a7af2f068639 (Fix stack guard size
|
|
|
00db10 |
accounting) and RTLD_NOW for libgcc_s introduced by commit
|
|
|
00db10 |
f993b8754080ac7572b692870e926d8b493db16c (nptl: Open libgcc.so with
|
|
|
00db10 |
RTLD_NOW during pthread_cancel), the tst-minstack-cancel test fails on
|
|
|
00db10 |
an AVX-512F machine. tst-minstack-exit still passes, and either of
|
|
|
00db10 |
the mentioned commit by itself frees sufficient stack space to make
|
|
|
00db10 |
tst-minstack-cancel pass, too.
|
|
|
00db10 |
|
|
|
00db10 |
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
|
|
00db10 |
|
|
|
00db10 |
Index: glibc-2.17-c758a686/nptl/Makefile
|
|
|
00db10 |
===================================================================
|
|
|
00db10 |
--- glibc-2.17-c758a686.orig/nptl/Makefile
|
|
|
00db10 |
+++ glibc-2.17-c758a686/nptl/Makefile
|
|
|
00db10 |
@@ -267,7 +267,8 @@ tests = tst-typesizes \
|
|
|
00db10 |
tst-vfork1 tst-vfork2 tst-vfork1x tst-vfork2x \
|
|
|
00db10 |
tst-getpid1 tst-getpid2 tst-getpid3 \
|
|
|
00db10 |
tst-initializers1 $(patsubst %,tst-initializers1-%,c89 gnu89 c99 gnu99) \
|
|
|
00db10 |
- tst-mutex-errorcheck
|
|
|
00db10 |
+ tst-mutex-errorcheck \
|
|
|
00db10 |
+ tst-minstack-cancel tst-minstack-exit
|
|
|
00db10 |
xtests = tst-setuid1 tst-setuid1-static tst-mutexpp1 tst-mutexpp6 tst-mutexpp10
|
|
|
00db10 |
test-srcs = tst-oddstacklimit
|
|
|
00db10 |
|
|
|
00db10 |
Index: glibc-2.17-c758a686/nptl/tst-minstack-cancel.c
|
|
|
00db10 |
===================================================================
|
|
|
00db10 |
--- /dev/null
|
|
|
00db10 |
+++ glibc-2.17-c758a686/nptl/tst-minstack-cancel.c
|
|
|
00db10 |
@@ -0,0 +1,48 @@
|
|
|
00db10 |
+/* Test cancellation with a minimal stack size.
|
|
|
00db10 |
+ Copyright (C) 2018 Free Software Foundation, Inc.
|
|
|
00db10 |
+ This file is part of the GNU C Library.
|
|
|
00db10 |
+
|
|
|
00db10 |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
00db10 |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
00db10 |
+ License as published by the Free Software Foundation; either
|
|
|
00db10 |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
00db10 |
+
|
|
|
00db10 |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
00db10 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
00db10 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
00db10 |
+ Lesser General Public License for more details.
|
|
|
00db10 |
+
|
|
|
00db10 |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
00db10 |
+ License along with the GNU C Library; if not, see
|
|
|
00db10 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+/* Note: This test is similar to tst-minstack-exit, but is separate to
|
|
|
00db10 |
+ avoid spurious test passes due to warm-up effects. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+#include <limits.h>
|
|
|
00db10 |
+#include <unistd.h>
|
|
|
00db10 |
+#include <support/check.h>
|
|
|
00db10 |
+#include <support/xthread.h>
|
|
|
00db10 |
+
|
|
|
00db10 |
+static void *
|
|
|
00db10 |
+threadfunc (void *closure)
|
|
|
00db10 |
+{
|
|
|
00db10 |
+ while (1)
|
|
|
00db10 |
+ pause ();
|
|
|
00db10 |
+ return NULL;
|
|
|
00db10 |
+}
|
|
|
00db10 |
+
|
|
|
00db10 |
+static int
|
|
|
00db10 |
+do_test (void)
|
|
|
00db10 |
+{
|
|
|
00db10 |
+ pthread_attr_t attr;
|
|
|
00db10 |
+ xpthread_attr_init (&attr);
|
|
|
00db10 |
+ xpthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN);
|
|
|
00db10 |
+ pthread_t thr = xpthread_create (&attr, threadfunc, NULL);
|
|
|
00db10 |
+ xpthread_cancel (thr);
|
|
|
00db10 |
+ TEST_VERIFY (xpthread_join (thr) == PTHREAD_CANCELED);
|
|
|
00db10 |
+ xpthread_attr_destroy (&attr);
|
|
|
00db10 |
+ return 0;
|
|
|
00db10 |
+}
|
|
|
00db10 |
+
|
|
|
00db10 |
+#include <support/test-driver.c>
|
|
|
00db10 |
Index: glibc-2.17-c758a686/nptl/tst-minstack-exit.c
|
|
|
00db10 |
===================================================================
|
|
|
00db10 |
--- /dev/null
|
|
|
00db10 |
+++ glibc-2.17-c758a686/nptl/tst-minstack-exit.c
|
|
|
00db10 |
@@ -0,0 +1,46 @@
|
|
|
00db10 |
+/* Test that pthread_exit works with the minimum stack size.
|
|
|
00db10 |
+ Copyright (C) 2018 Free Software Foundation, Inc.
|
|
|
00db10 |
+ This file is part of the GNU C Library.
|
|
|
00db10 |
+
|
|
|
00db10 |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
00db10 |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
00db10 |
+ License as published by the Free Software Foundation; either
|
|
|
00db10 |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
00db10 |
+
|
|
|
00db10 |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
00db10 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
00db10 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
00db10 |
+ Lesser General Public License for more details.
|
|
|
00db10 |
+
|
|
|
00db10 |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
00db10 |
+ License along with the GNU C Library; if not, see
|
|
|
00db10 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+/* Note: This test is similar to tst-minstack-cancel, but is separate
|
|
|
00db10 |
+ to avoid spurious test passes due to warm-up effects. */
|
|
|
00db10 |
+
|
|
|
00db10 |
+#include <limits.h>
|
|
|
00db10 |
+#include <unistd.h>
|
|
|
00db10 |
+#include <support/check.h>
|
|
|
00db10 |
+#include <support/xthread.h>
|
|
|
00db10 |
+
|
|
|
00db10 |
+static void *
|
|
|
00db10 |
+threadfunc (void *closure)
|
|
|
00db10 |
+{
|
|
|
00db10 |
+ pthread_exit (threadfunc);
|
|
|
00db10 |
+ return NULL;
|
|
|
00db10 |
+}
|
|
|
00db10 |
+
|
|
|
00db10 |
+static int
|
|
|
00db10 |
+do_test (void)
|
|
|
00db10 |
+{
|
|
|
00db10 |
+ pthread_attr_t attr;
|
|
|
00db10 |
+ xpthread_attr_init (&attr);
|
|
|
00db10 |
+ xpthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN);
|
|
|
00db10 |
+ pthread_t thr = xpthread_create (&attr, threadfunc, NULL);
|
|
|
00db10 |
+ TEST_VERIFY (xpthread_join (thr) == threadfunc);
|
|
|
00db10 |
+ xpthread_attr_destroy (&attr);
|
|
|
00db10 |
+ return 0;
|
|
|
00db10 |
+}
|
|
|
00db10 |
+
|
|
|
00db10 |
+#include <support/test-driver.c>
|