]> git.ipfire.org Git - thirdparty/glibc.git/commit - stdlib/Makefile
stdlib: Add testcase for BZ #26241
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 29 Dec 2020 15:24:28 +0000 (12:24 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Wed, 20 Jan 2021 14:13:53 +0000 (11:13 -0300)
commit961d7cff51332b7b4ed98d4530a98f73355dda4b
treea99241d06c8e58419c5bf65f14f149aa2620f4b3
parent1006250ea2d683e684f65911d738bd84f55c06c1
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>
stdlib/Makefile
stdlib/tst-canon-bz26341.c [new file with mode: 0644]