• Re: Threading support (on HP-UX)

    From Greg Hudson@ghudson@mit.edu to Osipov, Michael (IN IT IN) on Wed Sep 17 01:54:58 2025
    From Newsgroup: comp.protocols.kerberos

    On 9/16/25 14:09, Osipov, Michael (IN IT IN) via Kerberos wrote:
    Using HP-UX 11.31 and MIT Kerberos 1.22.1.

    We will take pull requests to fix HP-UX support (provided that they are
    tested and complete for what they set out to do), but can't proactively
    fix things or speak authoritatively to how the code behaves on that
    platform.

    configure: WARNING:-a-a missing thread-safe function: gethostbyname_r
    configure: WARNING:-a-a missing thread-safe function: getservbyname_r

    These functions are only used in fake-addrinfo.c. If the library winds
    up using getaddrinfo()/getnameinfo() directly (as I think it should),
    then configure.ac not finding these functions shouldn't be a concern
    aside from the spurious warnings.

    While I was able to find the define in the generated Makefiles, neither -lpthread or -mt with "grep -r ^PTHREAD_LIBS-a --include=Makefile ."

    The design intent in 2005 was to avoid linking against libpthread,
    because it degraded performance in single-threaded programs. Instead,
    we use weak references (where we can) to invoke pthreads functions when libpthreads is loaded in the process, or do nothing when it is not.

    To that end, aclocal.m4 has:

    hpux*)
    # These are the flags that "gcc -pthread" adds. But we don't

    # want "-pthread" because that has link-time effects, and we

    # don't exclude CFLAGS when linking. *sigh*

    PTHREAD_CFLAGS="-D_REENTRANT -D_THREAD_SAFE
    -D_POSIX_C_SOURCE=199506L"

    but I don't know if weak reference support was tested on HP-UX at the time.

    It's probable that this 2005 design qualifies as too clever in 2025.
    OpenSSL's libcrypto appears to link directly against libpthread, and it
    is a much more widely-used library than libkrb5 or libgssapi_krb5.

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Greg Hudson@ghudson@mit.edu to Osipov, Michael (IN IT IN) on Wed Sep 17 14:41:16 2025
    From Newsgroup: comp.protocols.kerberos

    On 9/17/25 06:31, Osipov, Michael (IN IT IN) wrote:
    if [ -r ../../lib/libgssapi_krb5.so ]; then SHLIB_PATH=`echo -L../../
    lib | sed -e "s/-L//g" -e "s/ /:/g"` KRB5_CONFIG=../../config-files/
    krb5.conf LC_ALL=C-a ./reload; fi
    Assertion failed: destructors_set[keynum] == 0, file threads.c, line 351

    This test program loads libgssapi_krb5, uses it minimally, and unloads
    it, all repeated twice. The assertion failure means that the library initializer ran both times it was loaded, but the library finalizer
    didn't run in between. So something is wrong with the library finalizer support for HP-UX as determined by include/k5-platform.h and the
    autoconf stuff. If there is a flag to block unloading when building a
    shared library, like the ELF "-z nodelete" flag, that would be the best
    fix; see the lib_unload_prevented variable in config/shlib.conf.

    --- Synchronet 3.21a-Linux NewsLink 1.2