about summary refs log tree commit diff
path: root/stdlib/Makefile
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2020-12-29 12:24:28 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-01-20 11:13:53 -0300
commit961d7cff51332b7b4ed98d4530a98f73355dda4b (patch)
treea99241d06c8e58419c5bf65f14f149aa2620f4b3 /stdlib/Makefile
parent1006250ea2d683e684f65911d738bd84f55c06c1 (diff)
downloadglibc-961d7cff51332b7b4ed98d4530a98f73355dda4b.tar.gz
glibc-961d7cff51332b7b4ed98d4530a98f73355dda4b.tar.xz
glibc-961d7cff51332b7b4ed98d4530a98f73355dda4b.zip
stdlib: Add testcase for BZ #26241
Old implementation of realpath allocates a PATH_MAX using alloca for
each symlink in the path, leading to MAXSYMLINKS times PATH_MAX
maximum stack usage.

The test create a symlink with __eloop_threshold() loops and creates
a thread with minimum stack size (obtained through
support_small_stack_thread_attribute).  The thread issues a stack
allocations that fill the thread allocated stack minus some slack
plus and the realpath usage (which assumes a bounded stack usage).
If realpath uses more than about 2 * PATH_MAX plus some slack it
triggers a stackoverflow.

Checked on x86_64-linux-gnu and i686-linux-gnu.

Reviewed-by: DJ Delorie <dj@redhat.com>
Diffstat (limited to 'stdlib/Makefile')
-rw-r--r--stdlib/Makefile3
1 files changed, 2 insertions, 1 deletions
diff --git a/stdlib/Makefile b/stdlib/Makefile
index 0d2b8b0520..b3b30ab73e 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -86,7 +86,7 @@ tests		:= tst-strtol tst-strtod testmb testrand testsort testdiv   \
 		   tst-makecontext-align test-bz22786 tst-strtod-nan-sign \
 		   tst-swapcontext1 tst-setcontext4 tst-setcontext5 \
 		   tst-setcontext6 tst-setcontext7 tst-setcontext8 \
-		   tst-setcontext9 tst-bz20544
+		   tst-setcontext9 tst-bz20544 tst-canon-bz26341
 
 tests-internal	:= tst-strtod1i tst-strtod3 tst-strtod4 tst-strtod5i \
 		   tst-tls-atexit tst-tls-atexit-nodelete
@@ -101,6 +101,7 @@ LDLIBS-test-atexit-race = $(shared-thread-library)
 LDLIBS-test-at_quick_exit-race = $(shared-thread-library)
 LDLIBS-test-cxa_atexit-race = $(shared-thread-library)
 LDLIBS-test-on_exit-race = $(shared-thread-library)
+LDLIBS-tst-canon-bz26341 = $(shared-thread-library)
 
 LDLIBS-test-dlclose-exit-race = $(shared-thread-library) $(libdl)
 LDFLAGS-test-dlclose-exit-race = $(LDFLAGS-rdynamic)