[Bug dynamic-link/34361] FAIL elf/tst-rtld-dash-dash and elf/tst-rtld-does-not-exist

"danglin at gcc dot gnu.org via Glibc-bugs" <[email protected]> Wed, 08 Jul 2026 17:52:21 +0000
Newsgroups gmane.comp.lib.glibc.bugs
Message-ID <[email protected]/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=34361

John David Anglin <danglin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl.tools at gmail dot com

--- Comment #1 from John David Anglin <danglin at gcc dot gnu.org> ---
Fails were introduced by this commit:

dave@mx3210:~/gnu/glibc/glibc$ git bisect good
53d909a283085c82bdcc71e1cf06c0899506b664 is the first bad commit
commit 53d909a283085c82bdcc71e1cf06c0899506b664
Author: H.J. Lu <[email protected]>
Date:   Mon Apr 13 08:23:05 2026 +0800

    elf: Support THP segment load with madvise enabled THP

    The current THP segment load approach works only when THP is enabled
    with always in the kernel.  If THP is enabled with madvise in the
    kernel, to enable THP segment load in an application, madvise should
    be called with MADV_HUGEPAGE on all THP eligible PT_LOAD segments:

    1. Define DL_MAP_DEFAULT_THP_PAGESIZE in hugepages.h and default it to 0.
    If DL_MAP_DEFAULT_THP_PAGESIZE is defined, assume kernel THP madvise mode.
    If kernel THP mode is always or never, there is an extra madvise call
    which has no impact.  DL_MAP_DEFAULT_THP_PAGESIZE is defined for x86-64
    and 64-bit loongarch.
    2. Update _dl_map_segment_align to support madvise THP mode.  This fixes
    BZ #34079.
    3. Call _dl_executable_postprocess in rtld_setup_main_map for dynamic
    executables and in LIBC_START_MAIN for static executables, which calls
    madvise with MADV_HUGEPAGE on all THP eligible PT_LOAD segments in
    executable.  This fixes BZ #34080 for both dynamic and static executables.
    4. Call _dl_postprocess_loadcmd_extra in _dl_postprocess_loadcmd, which
    calls madvise with MADV_HUGEPAGE on all THP eligible PT_LOAD segments
    when loading an object after they have been mapped in.  This fixes
    BZ #34080 for shared objects.
    5. Set the maximum page alignment on THP tests to THP page size as the
    default maximum page alignment may be smaller than THP page size.
    6. Add tests to verify that large executable PT_LOAD segments in
    executables are mapped at addresses aligned to THP page size when the
    kernel is configured to use THP in "always" mode or "madvise" mode by
    inspecting /proc/self/maps to check that the mapping address is aligned
    to THP page size reported by the kernel.  Also verify that madvise is
    called with MADV_HUGEPAGE when the glibc tunable glibc.elf.thp=1 is used
    and madvise isn't called with MADV_HUGEPAGE when the glibc tunable
    glibc.elf.thp=0 is used.

    Skip these tests if THP page size cannot be determined or if THP is not
    enabled in "always" mode nor "madvise" mode.

    Quote WANG Rui <[email protected]>:

    From benchmarking a clang build of the Linux kernel on x86_64 with
    your patch in THP madvise mode, I observed that iTLB misses were
    reduced, similar to what we see in THP always mode.

    NB: Some THP tests fail on arm due to limitations of arm32 kABI:

    https://sourceware.org/bugzilla/show_bug.cgi?id=34096

    Signed-off-by: H.J. Lu <[email protected]>
    Reviewed-by: Adhemerval Zanella  <[email protected]>

 csu/libc-start.c                                   |   6 +
 elf/dl-load.h                                      |   3 +
 elf/dl-support.c                                   |   6 +
 elf/rtld.c                                         |  14 +-
 support/support_check_hugetlb.c                    |  66 ++++++--
 support/support_check_hugetlb.h                    |  12 ++
 sysdeps/generic/dl-exec-post.h                     |  34 ++++
 sysdeps/generic/dl-load-post.h                     |  23 +++
 sysdeps/generic/hugepages.h                        |  19 ++-
 sysdeps/generic/ldsodefs.h                         |   9 +
 sysdeps/unix/sysv/linux/Makefile                   | 187 ++++++++++++++++++++-
 sysdeps/unix/sysv/linux/arm/Makefile               |   7 +
 sysdeps/unix/sysv/linux/dl-exec-post.h             | 137 +++++++++++++++
 sysdeps/unix/sysv/linux/dl-load-post.h             |  42 +++++
 sysdeps/unix/sysv/linux/dl-map-segment-align.c     |  34 ++--
 sysdeps/unix/sysv/linux/dl-map-segment-align.h     |  17 +-
 sysdeps/unix/sysv/linux/ldsodefs.h                 |   3 +
 sysdeps/unix/sysv/linux/loongarch/Makefile         |   3 +
 .../lp64/{dl-map-segment-align.h => hugepages.h}   |   4 +-
 sysdeps/unix/sysv/linux/strace-tst-thp.sh          |  62 +++++++
 sysdeps/unix/sysv/linux/tst-thp-1-no-s-code-pde.c  |  19 +++
 .../unix/sysv/linux/tst-thp-1-no-s-code-static.c   |  19 +++
 sysdeps/unix/sysv/linux/tst-thp-1-no-s-code.c      |  19 +++
 sysdeps/unix/sysv/linux/tst-thp-1-pde.c            |  19 +++
 sysdeps/unix/sysv/linux/tst-thp-1-static.c         |  19 +++
 sysdeps/unix/sysv/linux/tst-thp-1.c                |  28 +++
 sysdeps/unix/sysv/linux/tst-thp-align-check.h      |  67 ++++++++
 sysdeps/unix/sysv/linux/tst-thp-align.c            | 123 +-------------
 sysdeps/unix/sysv/linux/x86_64/hugepages.h         |  22 +++
 29 files changed, 848 insertions(+), 175 deletions(-)
 create mode 100644 sysdeps/generic/dl-exec-post.h
 create mode 100644 sysdeps/generic/dl-load-post.h
 create mode 100644 sysdeps/unix/sysv/linux/dl-exec-post.h
 create mode 100644 sysdeps/unix/sysv/linux/dl-load-post.h
 rename sysdeps/unix/sysv/linux/loongarch/lp64/{dl-map-segment-align.h =>
hugepages.h} (90%)
 create mode 100644 sysdeps/unix/sysv/linux/strace-tst-thp.sh
 create mode 100644 sysdeps/unix/sysv/linux/tst-thp-1-no-s-code-pde.c
 create mode 100644 sysdeps/unix/sysv/linux/tst-thp-1-no-s-code-static.c
 create mode 100644 sysdeps/unix/sysv/linux/tst-thp-1-no-s-code.c
 create mode 100644 sysdeps/unix/sysv/linux/tst-thp-1-pde.c
 create mode 100644 sysdeps/unix/sysv/linux/tst-thp-1-static.c
 create mode 100644 sysdeps/unix/sysv/linux/tst-thp-1.c
 create mode 100644 sysdeps/unix/sysv/linux/tst-thp-align-check.h
 create mode 100644 sysdeps/unix/sysv/linux/x86_64/hugepages.h

-- 
You are receiving this mail because:
You are on the CC list for the bug.