Bug 1984813 - autofs: FTBFS due to dynamic PTHREAD_STACK_MIN (glibc 2.34 related)
Summary: autofs: FTBFS due to dynamic PTHREAD_STACK_MIN (glibc 2.34 related)
Keywords:
Status: VERIFIED
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: autofs
Version: CentOS Stream
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: beta
: ---
Assignee: Ian Kent
QA Contact: Kun Wang
URL:
Whiteboard:
Depends On: 1984808
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-07-22 09:41 UTC by Florian Weimer
Modified: 2021-12-02 13:43 UTC (History)
3 users (show)

Fixed In Version: autofs-5.1.7-23.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1984808
Environment:
Last Closed:
Type: Bug
Target Upstream Version:


Attachments (Terms of Use)

Description Florian Weimer 2021-07-22 09:41:22 UTC
+++ 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,
                 from /usr/include/bits/posix1_lim.h:161,
                 from /usr/include/dirent.h:233,
                 from automount.c:22:
automount.c:87:37: error: initializer element is not constant
   87 | size_t detached_thread_stack_size = PTHREAD_STACK_MIN * 144;
      |                                     ^~~~~~~~~~~~~~~~~
make[1]: 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):

commit ef4886702177f1bbeba66858181a7db44ca8ebd6
Author: Ian Kent <raven@themaw.net>
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 <raven@themaw.net>

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.

Comment 1 Ian Kent 2021-07-22 11:30:20 UTC
Right, I'll fix it in Rawhide first, ;)

Comment 4 Ian Kent 2021-07-30 07:25:31 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.