+++ This bug was initially created as a clone of Bug #1984808 +++
Building autofs fails with:
gcc -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_REENTRANT -D_FILE_OFFSET_BITS=64 -I/usr/include/tirpc -D_REENTRANT -D_FILE_OFFSET_BITS=64 -I/usr/include/tirpc -rdynamic -fPIE -D_GNU_SOURCE -I../include -DAUTOFS_LIB_DIR=\"/usr/lib64/autofs\" -DAUTOFS_MAP_DIR=\"/etc\" -DAUTOFS_CONF_DIR=\"/etc/sysconfig\" -DAUTOFS_FIFO_DIR=\"/run\" -DAUTOFS_FLAG_DIR=\"/run\" -DVERSION_STRING=\"5.1.7-18.fc35\" -DWITH_SYSTEMD -I/usr/include/libxml2 -c automount.c
In file included from /usr/include/bits/local_lim.h:81,
automount.c:87:37: error: initializer element is not constant
87 | size_t detached_thread_stack_size = PTHREAD_STACK_MIN * 144;
make: Leaving directory '/builddir/build/BUILD/autofs-5.1.7/daemon'
This use of PTHREAD_STACK_MIN is a bit strange because the computed stack size varies wildly between architectures. And it was done deliberately to *increase* stack size (most uses of PTHREAD_STACK_MIN intend to do the opposite):
Author: Ian Kent <firstname.lastname@example.org>
Date: Fri Apr 21 08:17:52 2017 +0800
autofs-5.1.2 - increase worker thread per-thread stack size
automount(8) uses a worker thread per-thread stack size of 1M which is
sufficient for its needs.
But some glibc functions (such as nscd_getgr_r()) use alloca() to allocate
working storage that can have an arbitary size. Since alloca() never fails
there is no way to check for stack overflow. This has been fixed in more
recent versions of glibc.
But for older version of glibc all that can be done by automount to avoid
this is to increase the stack size.
Signed-off-by: Ian Kent <email@example.com>
Maybe this can be disabled for glibc 2.34 and later. Due to the symbol version changes in glibc 2.34, the compiled binary cannot run on earlier glibc versions, so a compile-time check would be safe in this case.
Right, I'll fix it in Rawhide first, ;)
The glibc functions that lead to autofs needing to use PTHREAD_STACK_MIN have
changed in glibc some time ago now.
So the original code that resulted in autofs needing this is now gone.
So there's no reason there should be any regressions due to this change.