commit e32e0dabf5aaac1627b3d111cde27812fe98c3ef (HEAD -> gentoo/2.37, gentoo/gentoo/2.37)
Author:     Siddhesh Poyarekar <siddhesh@sourceware.org>
AuthorDate: Fri Sep 15 13:51:12 2023 -0400
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Sat Sep 16 11:34:24 2023 +0200

    getaddrinfo: Fix use after free in getcanonname (CVE-2023-4806)
    
    When an NSS plugin only implements the _gethostbyname2_r and
    _getcanonname_r callbacks, getaddrinfo could use memory that was freed
    during tmpbuf resizing, through h_name in a previous query response.
    
    The backing store for res->at->name when doing a query with
    gethostbyname3_r or gethostbyname2_r is tmpbuf, which is reallocated in
    gethosts during the query.  For AF_INET6 lookup with AI_ALL |
    AI_V4MAPPED, gethosts gets called twice, once for a v6 lookup and second
    for a v4 lookup.  In this case, if the first call reallocates tmpbuf
    enough number of times, resulting in a malloc, th->h_name (that
    res->at->name refers to) ends up on a heap allocated storage in tmpbuf.
    Now if the second call to gethosts also causes the plugin callback to
    return NSS_STATUS_TRYAGAIN, tmpbuf will get freed, resulting in a UAF
    reference in res->at->name.  This then gets dereferenced in the
    getcanonname_r plugin call, resulting in the use after free.
    
    Fix this by copying h_name over and freeing it at the end.  This
    resolves BZ #30843, which is assigned CVE-2023-4806.
    
    Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
    (cherry picked from commit 973fe93a5675c42798b2161c6f29c01b0e243994)
    (cherry picked from commit 6529a7466c935f36e9006b854d6f4e1d4876f942)

 nss/Makefile                                       | 15 +++++-
 nss/nss_test_gai_hv2_canonname.c                   | 56 +++++++++++++++++++
 nss/tst-nss-gai-hv2-canonname.c                    | 63 ++++++++++++++++++++++
 nss/tst-nss-gai-hv2-canonname.h                    |  1 +
 nss/tst-nss-gai-hv2-canonname.root/postclean.req   |  0
 .../tst-nss-gai-hv2-canonname.script               |  2 +
 sysdeps/posix/getaddrinfo.c                        | 25 ++++++---
 7 files changed, 152 insertions(+), 10 deletions(-)

commit 75357676237e8dcbb4d8fdd8e3526e598df9cf3a
Author:     Florian Weimer <fweimer@redhat.com>
AuthorDate: Wed Sep 13 14:10:56 2023 +0200
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Sat Sep 16 11:34:07 2023 +0200

    CVE-2023-4527: Stack read overflow with large TCP responses in no-aaaa mode
    
    Without passing alt_dns_packet_buffer, __res_context_search can only
    store 2048 bytes (what fits into dns_packet_buffer).  However,
    the function returns the total packet size, and the subsequent
    DNS parsing code in _nss_dns_gethostbyname4_r reads beyond the end
    of the stack-allocated buffer.
    
    Fixes commit f282cdbe7f436c75864e5640a4 ("resolv: Implement no-aaaa
    stub resolver option") and bug 30842.
    
    (cherry picked from commit bd77dd7e73e3530203be1c52c8a29d08270cb25d)
    (cherry picked from commit b7529346025a130fee483d42178b5c118da971bb)

 NEWS                          |   7 +++
 resolv/Makefile               |   2 +
 resolv/nss_dns/dns-host.c     |   2 +-
 resolv/tst-resolv-noaaaa-vc.c | 129 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 139 insertions(+), 1 deletion(-)

commit 03940e8389194d69a9029fa19c784ef2c977c914
Author:     Florian Weimer <fweimer@redhat.com>
AuthorDate: Mon Sep 11 09:17:52 2023 +0200
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Sat Sep 16 11:33:46 2023 +0200

    elf: Move l_init_called_next to old place of l_text_end in link map
    
    This preserves all member offsets and the GLIBC_PRIVATE ABI
    for backporting.
    
    (cherry picked from commit 1a7cbe52c8955beae477cf9c6d88f4bc04f626c1)

 include/link.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

commit 7cd01d1c152040fd5b1a1dd3a3b23a7d7aba6c5e
Author:     Florian Weimer <fweimer@redhat.com>
AuthorDate: Fri Sep 8 13:02:06 2023 +0200
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Sat Sep 16 11:33:30 2023 +0200

    elf: Remove unused l_text_end field from struct link_map
    
    It is a left-over from commit 52a01100ad011293197637e42b5be1a479a2
    ("elf: Remove ad-hoc restrictions on dlopen callers [BZ #22787]").
    
    When backporting commmit 6985865bc3ad5b23147ee73466583dd7fdf65892
    ("elf: Always call destructors in reverse constructor order
    (bug 30785)"), we can move the l_init_called_next field to this
    place, so that the internal GLIBC_PRIVATE ABI does not change.
    
    Reviewed-by: Carlos O'Donell <carlos@redhat.com>
    Tested-by: Carlos O'Donell <carlos@redhat.com>
    (cherry picked from commit 53df2ce6885da3d0e89e87dca7b095622296014f)
    (cherry picked from commit bdb594afa515d0150f8f092c45e04942d20ecb61)

 elf/dl-load.c    | 2 +-
 elf/dl-load.h    | 7 ++-----
 elf/rtld.c       | 6 ------
 elf/setup-vdso.h | 4 ----
 include/link.h   | 2 --
 5 files changed, 3 insertions(+), 18 deletions(-)

commit 609363677685560d41324342c5e906665f6cb294
Author:     Florian Weimer <fweimer@redhat.com>
AuthorDate: Fri Sep 8 12:32:14 2023 +0200
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Sat Sep 16 11:33:12 2023 +0200

    elf: Always call destructors in reverse constructor order (bug 30785)
    
    The current implementation of dlclose (and process exit) re-sorts the
    link maps before calling ELF destructors.  Destructor order is not the
    reverse of the constructor order as a result: The second sort takes
    relocation dependencies into account, and other differences can result
    from ambiguous inputs, such as cycles.  (The force_first handling in
    _dl_sort_maps is not effective for dlclose.)  After the changes in
    this commit, there is still a required difference due to
    dlopen/dlclose ordering by the application, but the previous
    discrepancies went beyond that.
    
    A new global (namespace-spanning) list of link maps,
    _dl_init_called_list, is updated right before ELF constructors are
    called from _dl_init.
    
    In dl_close_worker, the maps variable, an on-stack variable length
    array, is eliminated.  (VLAs are problematic, and dlclose should not
    call malloc because it cannot readily deal with malloc failure.)
    Marking still-used objects uses the namespace list directly, with
    next and next_idx replacing the done_index variable.
    
    After marking, _dl_init_called_list is used to call the destructors
    of now-unused maps in reverse destructor order.  These destructors
    can call dlopen.  Previously, new objects do not have l_map_used set.
    This had to change: There is no copy of the link map list anymore,
    so processing would cover newly opened (and unmarked) mappings,
    unloading them.  Now, _dl_init (indirectly) sets l_map_used, too.
    (dlclose is handled by the existing reentrancy guard.)
    
    After _dl_init_called_list traversal, two more loops follow.  The
    processing order changes to the original link map order in the
    namespace.  Previously, dependency order was used.  The difference
    should not matter because relocation dependencies could already
    reorder link maps in the old code.
    
    The changes to _dl_fini remove the sorting step and replace it with
    a traversal of _dl_init_called_list.  The l_direct_opencount
    decrement outside the loader lock is removed because it appears
    incorrect: the counter manipulation could race with other dynamic
    loader operations.
    
    tst-audit23 needs adjustments to the changes in LA_ACT_DELETE
    notifications.  The new approach for checking la_activity should
    make it clearer that la_activty calls come in pairs around namespace
    updates.
    
    The dependency sorting test cases need updates because the destructor
    order is always the opposite order of constructor order, even with
    relocation dependencies or cycles present.
    
    There is a future cleanup opportunity to remove the now-constant
    force_first and for_fini arguments from the _dl_sort_maps function.
    
    Fixes commit 1df71d32fe5f5905ffd5d100e5e9ca8ad62 ("elf: Implement
    force_first handling in _dl_sort_maps_dfs (bug 28937)").
    
    Reviewed-by: DJ Delorie <dj@redhat.com>
    (cherry picked from commit 6985865bc3ad5b23147ee73466583dd7fdf65892)
    (cherry picked from commit a7e34a667585f675143563569688756f4f4a6e47)

 NEWS                       |   1 +
 elf/dl-close.c             | 113 +++++++++++++++++++++------------
 elf/dl-fini.c              | 152 ++++++++++++++++-----------------------------
 elf/dl-init.c              |  16 +++++
 elf/dso-sort-tests-1.def   |  19 ++----
 elf/tst-audit23.c          |  44 +++++++------
 include/link.h             |   4 ++
 sysdeps/generic/ldsodefs.h |   4 ++
 8 files changed, 180 insertions(+), 173 deletions(-)

commit a6cb4584c219a437e179c67368e22705422720a8
Author:     Florian Weimer <fweimer@redhat.com>
AuthorDate: Tue Aug 22 13:56:25 2023 +0200
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Sat Sep 16 11:32:47 2023 +0200

    elf: Do not run constructors for proxy objects
    
    Otherwise, the ld.so constructor runs for each audit namespace
    and each dlmopen namespace.
    
    (cherry picked from commit f6c8204fd7fabf0cf4162eaf10ccf23258e4d10e)
    (cherry picked from commit 3d24d1903d6a57f4dc91e7aa834799146125c3d9)

 elf/dl-init.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

commit ff9dba906d902077612a432e8f082075cb829e94
Author:     Aurelien Jarno <aurelien@aurel32.net>
AuthorDate: Mon Aug 28 23:30:37 2023 +0200
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Sat Sep 16 11:32:29 2023 +0200

    io: Fix record locking contants for powerpc64 with __USE_FILE_OFFSET64
    
    Commit 5f828ff824e3b7cd1 ("io: Fix F_GETLK, F_SETLK, and F_SETLKW for
    powerpc64") fixed an issue with the value of the lock constants on
    powerpc64 when not using __USE_FILE_OFFSET64, but it ended-up also
    changing the value when using __USE_FILE_OFFSET64 causing an API change.
    
    Fix that by also checking that define, restoring the pre
    4d0fe291aed3a476a commit values:
    
    Default values:
    - F_GETLK: 5
    - F_SETLK: 6
    - F_SETLKW: 7
    
    With -D_FILE_OFFSET_BITS=64:
    - F_GETLK: 12
    - F_SETLK: 13
    - F_SETLKW: 14
    
    At the same time, it has been noticed that there was no test for io lock
    with __USE_FILE_OFFSET64, so just add one.
    
    Tested on x86_64-linux-gnu, i686-linux-gnu and
    powerpc64le-unknown-linux-gnu.
    
    Resolves: BZ #30804.
    Co-authored-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
    Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
    (cherry picked from commit 434bf72a94de68f0cc7fbf3c44bf38c1911b70cb)
    (cherry picked from commit be26b29262bbae080acb8bb16855df6ac4c57c98)

 NEWS                                         | 2 ++
 io/Makefile                                  | 4 +++-
 io/tst-fcntl-lock-lfs.c                      | 2 ++
 sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h | 2 +-
 4 files changed, 8 insertions(+), 2 deletions(-)

commit e1df3aea91964019167e3c8c921a7b352b9cacff
Author:     Sergey Bugaev <bugaevc@gmail.com>
AuthorDate: Sun Mar 19 18:09:47 2023 +0300
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Sat Sep 16 11:32:14 2023 +0200

    hurd: Make exception subcode a long
    
    On EXC_BAD_ACCESS, exception subcode is used to pass the faulting memory
    address, so it needs to be (at least) pointer-sized. Thus, make it into
    a long. This matches the corresponding change in GNU Mach.
    Message-Id: <20230319151017.531737-5-bugaevc@gmail.com>
    
    (cherry picked from commit d8ee5d614bc485f6d1752dfa0d60524b20945a56)
    (cherry picked from commit 0d500bfdc0ce6e4d9c1446a45aa90b292446042a)

 hurd/catch-exc.c   | 2 +-
 hurd/hurd/signal.h | 5 +++--
 hurd/hurdfault.c   | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

commit 86e01e21cfd28e4d32bcde407ad65fa8ae4caecb
Author:     Noah Goldstein <goldstein.w.n@gmail.com>
AuthorDate: Thu Aug 10 19:28:24 2023 -0500
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Sat Sep 16 11:31:57 2023 +0200

    x86: Fix incorrect scope of setting `shared_per_thread` [BZ# 30745]
    
    The:
    
    ```
        if (shared_per_thread > 0 && threads > 0)
          shared_per_thread /= threads;
    ```
    
    Code was accidentally moved to inside the else scope.  This doesn't
    match how it was previously (before af992e7abd).
    
    This patch fixes that by putting the division after the `else` block.
    
    (cherry picked from commit 084fb31bc2c5f95ae0b9e6df4d3cf0ff43471ede)
    (cherry picked from commit f94ff95e936d41e28697bd4eac04954139b93558)

 sysdeps/x86/dl-cacheinfo.h | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

commit 738db5231a31ed6f5e3a86a3b6b3dc03d6382b3f
Author:     Noah Goldstein <goldstein.w.n@gmail.com>
AuthorDate: Tue Jul 18 10:27:59 2023 -0500
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Sat Sep 16 11:31:38 2023 +0200

    x86: Use `3/4*sizeof(per-thread-L3)` as low bound for NT threshold.
    
    On some machines we end up with incomplete cache information. This can
    make the new calculation of `sizeof(total-L3)/custom-divisor` end up
    lower than intended (and lower than the prior value). So reintroduce
    the old bound as a lower bound to avoid potentially regressing code
    where we don't have complete information to make the decision.
    Reviewed-by: DJ Delorie <dj@redhat.com>
    
    (cherry picked from commit 8b9a0af8ca012217bf90d1dc0694f85b49ae09da)
    (cherry picked from commit cc8243fb0b711ab05ac6dcf235f0555025921b5e)

 sysdeps/x86/dl-cacheinfo.h | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

commit 34f5d350f5364379978dc80db1f54ec65ea5ea4e
Author:     Noah Goldstein <goldstein.w.n@gmail.com>
AuthorDate: Mon Jul 17 23:14:33 2023 -0500
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Sat Sep 16 11:31:22 2023 +0200

    x86: Fix slight bug in `shared_per_thread` cache size calculation.
    
    After:
    ```
        commit af992e7abdc9049714da76cae1e5e18bc4838fb8
        Author: Noah Goldstein <goldstein.w.n@gmail.com>
        Date:   Wed Jun 7 13:18:01 2023 -0500
    
            x86: Increase `non_temporal_threshold` to roughly `sizeof_L3 / 4`
    ```
    
    Split `shared` (cumulative cache size) from `shared_per_thread` (cache
    size per socket), the `shared_per_thread` *can* be slightly off from
    the previous calculation.
    
    Previously we added `core` even if `threads_l2` was invalid, and only
    used `threads_l2` to divide `core` if it was present. The changed
    version only included `core` if `threads_l2` was valid.
    
    This change restores the old behavior if `threads_l2` is invalid by
    adding the entire value of `core`.
    Reviewed-by: DJ Delorie <dj@redhat.com>
    
    (cherry picked from commit 47f747217811db35854ea06741be3685e8bbd44d)
    (cherry picked from commit 80a8c858a59e963f546a23a745f505ff9b6b1699)

 sysdeps/x86/dl-cacheinfo.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

commit 459838c9983595fd8c6f9d6cc0fcfbe1e9e65e28
Author:     Noah Goldstein <goldstein.w.n@gmail.com>
AuthorDate: Wed Jun 7 13:18:01 2023 -0500
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Sat Sep 16 11:31:03 2023 +0200

    x86: Increase `non_temporal_threshold` to roughly `sizeof_L3 / 4`
    
    Current `non_temporal_threshold` set to roughly '3/4 * sizeof_L3 /
    ncores_per_socket'. This patch updates that value to roughly
    'sizeof_L3 / 4`
    
    The original value (specifically dividing the `ncores_per_socket`) was
    done to limit the amount of other threads' data a `memcpy`/`memset`
    could evict.
    
    Dividing by 'ncores_per_socket', however leads to exceedingly low
    non-temporal thresholds and leads to using non-temporal stores in
    cases where REP MOVSB is multiple times faster.
    
    Furthermore, non-temporal stores are written directly to main memory
    so using it at a size much smaller than L3 can place soon to be
    accessed data much further away than it otherwise could be. As well,
    modern machines are able to detect streaming patterns (especially if
    REP MOVSB is used) and provide LRU hints to the memory subsystem. This
    in affect caps the total amount of eviction at 1/cache_associativity,
    far below meaningfully thrashing the entire cache.
    
    As best I can tell, the benchmarks that lead this small threshold
    where done comparing non-temporal stores versus standard cacheable
    stores. A better comparison (linked below) is to be REP MOVSB which,
    on the measure systems, is nearly 2x faster than non-temporal stores
    at the low-end of the previous threshold, and within 10% for over
    100MB copies (well past even the current threshold). In cases with a
    low number of threads competing for bandwidth, REP MOVSB is ~2x faster
    up to `sizeof_L3`.
    
    The divisor of `4` is a somewhat arbitrary value. From benchmarks it
    seems Skylake and Icelake both prefer a divisor of `2`, but older CPUs
    such as Broadwell prefer something closer to `8`. This patch is meant
    to be followed up by another one to make the divisor cpu-specific, but
    in the meantime (and for easier backporting), this patch settles on
    `4` as a middle-ground.
    
    Benchmarks comparing non-temporal stores, REP MOVSB, and cacheable
    stores where done using:
    https://github.com/goldsteinn/memcpy-nt-benchmarks
    
    Sheets results (also available in pdf on the github):
    https://docs.google.com/spreadsheets/d/e/2PACX-1vS183r0rW_jRX6tG_E90m9qVuFiMbRIJvi5VAE8yYOvEOIEEc3aSNuEsrFbuXw5c3nGboxMmrupZD7K/pubhtml
    Reviewed-by: DJ Delorie <dj@redhat.com>
    Reviewed-by: Carlos O'Donell <carlos@redhat.com>
    
    (cherry picked from commit af992e7abdc9049714da76cae1e5e18bc4838fb8)
    (cherry picked from commit 1caf9552699a79573e4202a592b3e819e63bc020)

 sysdeps/x86/dl-cacheinfo.h | 72 ++++++++++++++++++++++++++++------------------
 1 file changed, 44 insertions(+), 28 deletions(-)

commit 1233c09c99218e2cd8748d12408fa8aa9076369c (tag: gentoo/glibc-2.37-6)
Author:     Adhemerval Zanella <adhemerval.zanella@linaro.org>
AuthorDate: Mon Jul 10 17:01:00 2023 -0300
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Fri Jul 28 23:47:34 2023 +0200

    sparc: Fix la_symbind for bind-now (BZ 23734)
    
    The sparc ABI has multiple cases on how to handle JMP_SLOT relocations,
    (sparc_fixup_plt/sparc64_fixup_plt).  For BINDNOW, _dl_audit_symbind
    will be responsible to setup the final relocation value; while for
    lazy binding _dl_fixup/_dl_profile_fixup will call the audit callback
    and tail cail elf_machine_fixup_plt (which will call
    sparc64_fixup_plt).
    
    This patch fixes by issuing the SPARC specific routine on bindnow and
    forwarding the audit value to elf_machine_fixup_plt for lazy resolution.
    It fixes the la_symbind for bind-now tests on sparc64 and sparcv9:
    
      elf/tst-audit24a
      elf/tst-audit24b
      elf/tst-audit24c
      elf/tst-audit24d
    
    Checked on sparc64-linux-gnu and sparcv9-linux-gnu.
    Tested-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
    
    (cherry picked from commit dddc88587a7f48cbb361d9929ec23d790164eef8)
    (cherry picked from commit 58f7431fd77c0a6dd8df08d50c51ee3e7f09825f)

 elf/dl-audit.c                 |  6 +++---
 elf/dl-runtime.c               |  5 +++--
 elf/do-rel.h                   |  6 ++++--
 sysdeps/generic/dl-lookupcfg.h |  2 +-
 sysdeps/generic/ldsodefs.h     |  4 ++--
 sysdeps/hppa/dl-lookupcfg.h    |  2 +-
 sysdeps/ia64/dl-lookupcfg.h    |  2 +-
 sysdeps/powerpc/dl-lookupcfg.h |  4 ++--
 sysdeps/sparc/dl-lookupcfg.h   | 49 ++++++++++++++++++++++++++++++++++++++++++
 9 files changed, 66 insertions(+), 14 deletions(-)

commit 408793ccb476ef798b67d2ef1846e2b0cba1c827
Author:     Adhemerval Zanella <adhemerval.zanella@linaro.org>
AuthorDate: Mon Apr 3 14:18:14 2023 -0300
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Fri Jul 28 23:47:14 2023 +0200

    nptl: Fix tst-cancel30 on sparc64
    
    As indicated by sparc kernel-features.h, even though sparc64 defines
    __NR_pause,  it is not supported (ENOSYS).  Always use ppoll or the
    64 bit time_t variant instead.
    
    (cherry picked from commit 370da8a121c3ba9eeb2f13da15fc0f21f4136b25)
    (cherry picked from commit 260d4b742bc36744aa2282421547f1a7b483d2f8)

 sysdeps/pthread/tst-cancel30.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

commit e62082aa8f9796f67f2c37177717d754851b271d
Author:     Florian Weimer <fweimer@redhat.com>
AuthorDate: Fri Jul 7 10:11:26 2023 +0200
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Fri Jul 28 23:46:56 2023 +0200

    elf: _dl_find_object may return 1 during early startup (bug 30515)
    
    Success is reported with a 0 return value, and failure is -1.
    Enhance the kitchen sink test elf/tst-audit28 to cover
    _dl_find_object as well.
    
    Fixes commit 5d28a8962dcb ("elf: Add _dl_find_object function")
    and bug 30515.
    
    Reviewed-by: Carlos O'Donell <carlos@redhat.com>
    Tested-by: Carlos O'Donell <carlos@redhat.com>
    (cherry picked from commit 1bcfe0f732066ae5336b252295591ebe7e51c301)
    (cherry picked from commit 3f4b4e2cdd529266ea5a2c6c5e0c66bab81bfd0e)

 NEWS                 |  1 +
 elf/dl-find_object.c |  2 +-
 elf/tst-auditmod28.c | 11 +++++++++++
 3 files changed, 13 insertions(+), 1 deletion(-)

commit 523e46736771663e7117c9389ecad465065dc003
Author:     Siddhesh Poyarekar <siddhesh@sourceware.org>
AuthorDate: Thu Jul 6 11:09:44 2023 -0400
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Fri Jul 28 23:46:38 2023 +0200

    realloc: Limit chunk reuse to only growing requests [BZ #30579]
    
    The trim_threshold is too aggressive a heuristic to decide if chunk
    reuse is OK for reallocated memory; for repeated small, shrinking
    allocations it leads to internal fragmentation and for repeated larger
    allocations that fragmentation may blow up even worse due to the dynamic
    nature of the threshold.
    
    Limit reuse only when it is within the alignment padding, which is 2 *
    size_t for heap allocations and a page size for mmapped allocations.
    There's the added wrinkle of THP, but this fix ignores it for now,
    pessimizing that case in favor of keeping fragmentation low.
    
    This resolves BZ #30579.
    
    Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
    Reported-by: Nicolas Dusart <nicolas@freedelity.be>
    Reported-by: Aurelien Jarno <aurelien@aurel32.net>
    Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
    Tested-by: Aurelien Jarno <aurelien@aurel32.net>
    (cherry picked from commit 2fb12bbd092b0c10f1f2083216e723d2406e21c4)
    (cherry picked from commit 0930ff8eb35cb493c945f176c3c9ab320f4d1b86)

 malloc/malloc.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

commit 68b135f6d214e7961b90757e60c44eff852a8ee0
Author:     John David Anglin <danglin@gcc.gnu.org>
AuthorDate: Sat Jul 1 18:26:18 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Fri Jul 28 23:46:18 2023 +0200

    hppa: xfail debug/tst-ssp-1 when have-ssp is yes (gcc-12 and later)
    
    (cherry picked from commit 8dcb1a5181cb1e935ae0f565cbf66c21916d7814)

 sysdeps/unix/sysv/linux/hppa/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

commit 0ac4481b117d74a2b731af09f6f2e1c68aea59f8
Author:     Adhemerval Zanella <adhemerval.zanella@linaro.org>
AuthorDate: Tue May 30 16:40:38 2023 -0300
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Fri Jul 28 23:46:01 2023 +0200

    io: Fix F_GETLK, F_SETLK, and F_SETLKW for powerpc64
    
    Different than other 64 bit architectures, powerpc64 defines the
    LFS POSIX lock constants  with values similar to 32 ABI, which
    are meant to be used with fcntl64 syscall.  Since powerpc64 kABI
    does not have fcntl, the constants are adjusted with the
    FCNTL_ADJUST_CMD macro.
    
    The 4d0fe291aed3a476a changed the logic of generic constants
    LFS value are equal to the default values; which is now wrong
    for powerpc64.
    
    Fix the value by explicit define the previous glibc constants
    (powerpc64 does not need to use the 32 kABI value, but it simplifies
    the FCNTL_ADJUST_CMD which should be kept as compatibility).
    
    Checked on powerpc64-linux-gnu and powerpc-linux-gnu.
    
    (cherry picked from commit 5f828ff824e3b7cd133ef905b8ae25ab8a8f3d66)
    (cherry picked from commit 3593050c27dcf691f670fd3fa9d347c99351ed2f)

 sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h | 6 ++++++
 1 file changed, 6 insertions(+)

commit f54fa331f4d5eaa72e7b7c5b4666b66e2ae1ffee
Author:     Adhemerval Zanella <adhemerval.zanella@linaro.org>
AuthorDate: Wed May 24 16:24:19 2023 -0300
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Fri Jul 28 23:45:42 2023 +0200

    io: Fix record locking contants on 32 bit arch with 64 bit default time_t (BZ#30477)
    
    For architecture with default 64 bit time_t support, the kernel
    does not provide LFS and non-LFS values for F_GETLK, F_GETLK, and
    F_GETLK (the default value used for 64 bit architecture are used).
    
    This is might be considered an ABI break, but the currenct exported
    values is bogus anyway.
    
    The POSIX lockf is not affected since it is aliased to lockf64,
    which already uses the LFS values.
    
    Checked on i686-linux-gnu and the new tests on a riscv32.
    
    Reviewed-by: Carlos O'Donell <carlos@redhat.com>
    (cherry picked from commit 4d0fe291aed3a476a3b59c4ecfae9d35ac0f15e8)
    (cherry picked from commit e2974d26ce228f2d70827659ae6616cbead1b1c4)

 NEWS                                       |  1 +
 io/Makefile                                |  3 +-
 io/tst-fcntl-lock.c                        | 97 ++++++++++++++++++++++++++++++
 io/tst-lockf.c                             | 58 ++++++++++--------
 sysdeps/unix/sysv/linux/bits/fcntl-linux.h |  2 +-
 5 files changed, 135 insertions(+), 26 deletions(-)

commit b7656cf050b7763a50667765579c26422c70ff93
Author:     H.J. Lu <hjl.tools@gmail.com>
AuthorDate: Tue May 23 16:44:01 2023 -0700
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Fri Jul 28 23:45:17 2023 +0200

    Document BZ #20975 fix
    
    (cherry picked from commit 0e3e9dbb0ea3e0a4885e3dc075cdfe92fc29da66)

 NEWS | 1 +
 1 file changed, 1 insertion(+)

commit 1bf89e837aeb39a024a338907e837c64986cfee0
Author:     H.J. Lu <hjl.tools@gmail.com>
AuthorDate: Thu Apr 27 13:06:15 2023 -0700
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Fri Jul 28 23:44:59 2023 +0200

    __check_pf: Add a cancellation cleanup handler [BZ #20975]
    
    There are reports for hang in __check_pf:
    
    https://github.com/JoeDog/siege/issues/4
    
    It is reproducible only under specific configurations:
    
    1. Large number of cores (>= 64) and large number of threads (> 3X of
    the number of cores) with long lived socket connection.
    2. Low power (frequency) mode.
    3. Power management is enabled.
    
    While holding lock, __check_pf calls make_request which calls __sendto
    and __recvmsg.  Since __sendto and __recvmsg are cancellation points,
    lock held by __check_pf won't be released and can cause deadlock when
    thread cancellation happens in __sendto or __recvmsg.  Add a cancellation
    cleanup handler for __check_pf to unlock the lock when cancelled by
    another thread.  This fixes BZ #20975 and the siege hang issue.
    
    (cherry picked from commit a443bd3fb233186038b8b483959ecb7978d1abea)
    (cherry picked from commit f5d377c896b95fefc712b0fd5e5804ae3f48d392)

 sysdeps/unix/sysv/linux/Makefile   |  2 ++
 sysdeps/unix/sysv/linux/check_pf.c | 15 +++++++++++++++
 2 files changed, 17 insertions(+)

commit 36bcdec84705182d522000817504ea8515417ad4
Author:     Joseph Myers <joseph@codesourcery.com>
AuthorDate: Wed Feb 22 21:36:34 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Fri Jul 28 23:44:31 2023 +0200

    Ignore MAP_VARIABLE in tst-mman-consts.py
    
    Linux 6.2 removed the hppa compatibility MAP_VARIABLE define.  That
    means that, whether or not we remove it in glibc, it needs to be
    ignored in tst-mman-consts.py (since this macro comparison
    infrastructure expects that new kernel header versions only add new
    macros, not remove old ones).
    
    Tested with build-many-glibcs.py for hppa-linux-gnu (Linux 6.2
    headers).
    
    (cherry picked from commit 01e09ab0574758e0afff4333511866278ce7c84f)
    (cherry picked from commit b4f76ecc9eab5d0e278530361d00e48f4c871387)

 sysdeps/unix/sysv/linux/tst-mman-consts.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

commit a3502594cb381d0304c193d33bf3791b6195d7d3 (tag: gentoo/glibc-2.37-5)
Author:     Florian Weimer <fweimer@redhat.com>
AuthorDate: Fri Apr 28 17:55:39 2023 +0200
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Tue May 9 00:17:02 2023 +0200

    gmon: Revert addition of tunables to the manual
    
    These tunables had to be removed over GLIBC_PRIVATE ABI stability
    concerns.
    
    (cherry picked from commit 7c32cb7dd88cf100b0b412163896e30aa2ee671a)

 manual/tunables.texi | 59 ----------------------------------------------------
 1 file changed, 59 deletions(-)

commit b31637610f8b80538867c7e7bcce0e705e634ada
Author:     Florian Weimer <fweimer@redhat.com>
AuthorDate: Fri Apr 28 17:07:38 2023 +0200
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Tue May 9 00:16:47 2023 +0200

    gmon: Revert addition of tunables to preserve GLIBC_PRIVATE ABI
    
    Otherwise, processes are likely to crash during concurrent updates
    to a new glibc version on the stable release branch.
    
    The test gmon/tst-mcount-overflow depends on those tunables, so
    it has to be removed as well.
    
    (cherry picked from commit a908c18d47925d23f5b85a21c1b81254fc0c3a44)

 gmon/Makefile | 14 +-------------
 gmon/gmon.c   | 16 ----------------
 2 files changed, 1 insertion(+), 29 deletions(-)

commit 7a59a556f119715b7af18c62ffe93fe473d8b42a
Author:     Simon Kissane <skissane@gmail.com>
AuthorDate: Sat Feb 11 08:58:02 2023 +1100
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Tue May 9 00:16:30 2023 +0200

    gmon: fix memory corruption issues [BZ# 30101]
    
    V2 of this patch fixes an issue in V1, where the state was changed to ON not
    OFF at end of _mcleanup. I hadn't noticed that (counterintuitively) ON=0 and
    OFF=3, hence zeroing the buffer turned it back on. So set the state to OFF
    after the memset.
    
    1. Prevent double free, and reads from unallocated memory, when
       _mcleanup is (incorrectly) called two or more times in a row,
       without an intervening call to __monstartup; with this patch, the
       second and subsequent calls effectively become no-ops instead.
       While setting tos=NULL is minimal fix, safest action is to zero the
       whole gmonparam buffer.
    
    2. Prevent memory leak when __monstartup is (incorrectly) called two
       or more times in a row, without an intervening call to _mcleanup;
       with this patch, the second and subsequent calls effectively become
       no-ops instead.
    
    3. After _mcleanup, treat __moncontrol(1) as __moncontrol(0) instead.
       With zeroing of gmonparam buffer in _mcleanup, this stops the
       state incorrectly being changed to GMON_PROF_ON despite profiling
       actually being off. If we'd just done the minimal fix to _mcleanup
       of setting tos=NULL, there is risk of far worse memory corruption:
       kcount would point to deallocated memory, and the __profil syscall
       would make the kernel write profiling data into that memory,
       which could have since been reallocated to something unrelated.
    
    4. Ensure __moncontrol(0) still turns off profiling even in error
       state. Otherwise, if mcount overflows and sets state to
       GMON_PROF_ERROR, when _mcleanup calls __moncontrol(0), the __profil
       syscall to disable profiling will not be invoked. _mcleanup will
       free the buffer, but the kernel will still be writing profiling
       data into it, potentially corrupted arbitrary memory.
    
    Also adds a test case for (1). Issues (2)-(4) are not feasible to test.
    
    Signed-off-by: Simon Kissane <skissane@gmail.com>
    Reviewed-by: DJ Delorie <dj@redhat.com>
    (cherry picked from commit bde121872001d8f3224eeafa5b7effb871c3fbca)
    (cherry picked from commit ff3a71ec1fc02757b38c9c3209118d14dd10c7b6)

 NEWS                |  1 +
 gmon/Makefile       | 15 ++++++++++++++-
 gmon/gmon.c         | 26 +++++++++++++++++++-------
 gmon/tst-mcleanup.c | 31 +++++++++++++++++++++++++++++++
 4 files changed, 65 insertions(+), 8 deletions(-)

commit 10c44b2edee400d74d525bdfd6c93e70a35bc8be
Author:     Simon Kissane <skissane@gmail.com>
AuthorDate: Sat Feb 11 20:12:13 2023 +1100
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Tue May 9 00:16:10 2023 +0200

    gmon: improve mcount overflow handling [BZ# 27576]
    
    When mcount overflows, no gmon.out file is generated, but no message is printed
    to the user, leaving the user with no idea why, and thinking maybe there is
    some bug - which is how BZ 27576 ended up being logged. Print a message to
    stderr in this case so the user knows what is going on.
    
    As a comment in sys/gmon.h acknowledges, the hardcoded MAXARCS value is too
    small for some large applications, including the test case in that BZ. Rather
    than increase it, add tunables to enable MINARCS and MAXARCS to be overridden
    at runtime (glibc.gmon.minarcs and glibc.gmon.maxarcs). So if a user gets the
    mcount overflow error, they can try increasing maxarcs (they might need to
    increase minarcs too if the heuristic is wrong in their case.)
    
    Note setting minarcs/maxarcs too large can cause monstartup to fail with an
    out of memory error. If you set them large enough, it can cause an integer
    overflow in calculating the buffer size. I haven't done anything to defend
    against that - it would not generally be a security vulnerability, since these
    tunables will be ignored in suid/sgid programs (due to the SXID_ERASE default),
    and if you can set GLIBC_TUNABLES in the environment of a process, you can take
    it over anyway (LD_PRELOAD, LD_LIBRARY_PATH, etc). I thought about modifying
    the code of monstartup to defend against integer overflows, but doing so is
    complicated, and I realise the existing code is susceptible to them even prior
    to this change (e.g. try passing a pathologically large highpc argument to
    monstartup), so I decided just to leave that possibility in-place.
    
    Add a test case which demonstrates mcount overflow and the tunables.
    
    Document the new tunables in the manual.
    
    Signed-off-by: Simon Kissane <skissane@gmail.com>
    Reviewed-by: DJ Delorie <dj@redhat.com>
    (cherry picked from commit 31be941e4367c001b2009308839db5c67bf9dcbc)
    (cherry picked from commit d230623264e300ac1c827cb83ad7818f122a6a98)

 NEWS                              |  1 +
 elf/dl-tunables.list              | 13 +++++++
 gmon/Makefile                     | 22 +++++++++++-
 gmon/gmon.c                       | 29 +++++++++++++---
 gmon/mcount.c                     |  5 +++
 gmon/sys/gmon.h                   |  6 ++--
 gmon/tst-mcount-overflow-check.sh | 45 ++++++++++++++++++++++++
 gmon/tst-mcount-overflow.c        | 72 +++++++++++++++++++++++++++++++++++++++
 manual/tunables.texi              | 59 ++++++++++++++++++++++++++++++++
 9 files changed, 245 insertions(+), 7 deletions(-)

commit a0e4c7a707b4f42340809cbfd44720646d3d87e3
Author:     Леонид Юрьев (Leonid Yuriev) <leo@yuriev.ru>
AuthorDate: Sat Feb 4 14:41:38 2023 +0300
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Tue May 9 00:15:49 2023 +0200

    gmon: Fix allocated buffer overflow (bug 29444)
    
    The `__monstartup()` allocates a buffer used to store all the data
    accumulated by the monitor.
    
    The size of this buffer depends on the size of the internal structures
    used and the address range for which the monitor is activated, as well
    as on the maximum density of call instructions and/or callable functions
    that could be potentially on a segment of executable code.
    
    In particular a hash table of arcs is placed at the end of this buffer.
    The size of this hash table is calculated in bytes as
       p->fromssize = p->textsize / HASHFRACTION;
    
    but actually should be
       p->fromssize = ROUNDUP(p->textsize / HASHFRACTION, sizeof(*p->froms));
    
    This results in writing beyond the end of the allocated buffer when an
    added arc corresponds to a call near from the end of the monitored
    address range, since `_mcount()` check the incoming caller address for
    monitored range but not the intermediate result hash-like index that
    uses to write into the table.
    
    It should be noted that when the results are output to `gmon.out`, the
    table is read to the last element calculated from the allocated size in
    bytes, so the arcs stored outside the buffer boundary did not fall into
    `gprof` for analysis. Thus this "feature" help me to found this bug
    during working with https://sourceware.org/bugzilla/show_bug.cgi?id=29438
    
    Just in case, I will explicitly note that the problem breaks the
    `make test t=gmon/tst-gmon-dso` added for Bug 29438.
    There, the arc of the `f3()` call disappears from the output, since in
    the DSO case, the call to `f3` is located close to the end of the
    monitored range.
    
    Signed-off-by: Леонид Юрьев (Leonid Yuriev) <leo@yuriev.ru>
    
    Another minor error seems a related typo in the calculation of
    `kcountsize`, but since kcounts are smaller than froms, this is
    actually to align the p->froms data.
    
    Co-authored-by: DJ Delorie <dj@redhat.com>
    Reviewed-by: Carlos O'Donell <carlos@redhat.com>
    (cherry picked from commit 801af9fafd4689337ebf27260aa115335a0cb2bc)
    (cherry picked from commit 5d750495db62eeb3c5a62b80a1747b552db664fb)

 NEWS        | 1 +
 gmon/gmon.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

commit 8ff6e9a3e6c2d183e73740c811aa6674564613b5
Author:     Adam Yi <ayi@janestreet.com>
AuthorDate: Tue Mar 7 07:30:02 2023 -0500
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Tue May 9 00:15:29 2023 +0200

    posix: Fix system blocks SIGCHLD erroneously [BZ #30163]
    
    Fix bug that SIGCHLD is erroneously blocked forever in the following
    scenario:
    
    1. Thread A calls system but hasn't returned yet
    2. Thread B calls another system but returns
    
    SIGCHLD would be blocked forever in thread B after its system() returns,
    even after the system() in thread A returns.
    
    Although POSIX does not require, glibc system implementation aims to be
    thread and cancellation safe. This bug was introduced in
    5fb7fc96350575c9adb1316833e48ca11553be49 when we moved reverting signal
    mask to happen when the last concurrently running system returns,
    despite that signal mask is per thread. This commit reverts this logic
    and adds a test.
    
    Signed-off-by: Adam Yi <ayi@janestreet.com>
    Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
    (cherry picked from commit 436a604b7dc741fc76b5a6704c6cd8bb178518e7)
    (cherry picked from commit 78ab913eabc7715f959e87e3c510aa6773a1cda6)

 NEWS                         |  1 +
 stdlib/tst-system.c          | 26 +++++++++++++++++++++++
 support/Makefile             |  2 ++
 support/dtotimespec-time64.c | 27 ++++++++++++++++++++++++
 support/dtotimespec.c        | 50 ++++++++++++++++++++++++++++++++++++++++++++
 support/shell-container.c    | 28 +++++++++++++++++++++++++
 support/timespec.h           |  4 ++++
 sysdeps/posix/system.c       |  6 +++---
 8 files changed, 141 insertions(+), 3 deletions(-)

commit ab502a0349b85286f01dc2d7932d63e65c1ab706
Author:     Florian Weimer <fweimer@redhat.com>
AuthorDate: Mon Apr 3 17:23:11 2023 +0200
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Tue May 9 00:15:12 2023 +0200

    x86_64: Fix asm constraints in feraiseexcept (bug 30305)
    
    The divss instruction clobbers its first argument, and the constraints
    need to reflect that.  Fortunately, with GCC 12, generated code does
    not actually change, so there is no externally visible bug.
    
    Suggested-by: Jakub Jelinek <jakub@redhat.com>
    Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
    (cherry picked from commit 5d1ccdda7b0c625751661d50977f3dfbc73f8eae)
    (cherry picked from commit 9cc2f41e52079869b64ee94d81f10626838f63de)

 NEWS                             | 1 +
 sysdeps/x86_64/fpu/fraiseexcpt.c | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

commit 229fb1a83cfd9ca89ac6002c21d11768c35b7666
Author:     Florian Weimer <fweimer@redhat.com>
AuthorDate: Tue Feb 21 09:20:28 2023 +0100
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Tue May 9 00:14:44 2023 +0200

    gshadow: Matching sgetsgent, sgetsgent_r ERANGE handling (bug 30151)
    
    Before this change, sgetsgent_r did not set errno to ERANGE, but
    sgetsgent only check errno, not the return value from sgetsgent_r.
    Consequently, sgetsgent did not detect any error, and reported
    success to the caller, without initializing the struct sgrp object
    whose address was returned.
    
    This commit changes sgetsgent_r to set errno as well.  This avoids
    similar issues in applications which only change errno.
    
    Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
    (cherry picked from commit 969e9733c7d17edf1e239a73fa172f357561f440)
    (cherry picked from commit 97ad4c64b9b65f4aacfef0176c1ab52264d94a9a)

 NEWS | 1 +
 1 file changed, 1 insertion(+)

commit fca36fd1c57118f55ee075f635135cf88d04daf3
Author:     Sam James <sam@gentoo.org>
AuthorDate: Tue Feb 21 09:27:26 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Tue May 9 00:14:02 2023 +0200

    stdio-common: tests: don't double-define _FORTIFY_SOURCE
    
    Exactly the same as 35bcb08eaa953c9b8bef6ab2486dc4361e1f26c0.
    
    If using -D_FORITFY_SOURCE=3 (in my case, I've patched GCC to add
    =3 instead of =2 (we've done =2 for years in Gentoo)), building
    glibc tests will fail on tst-bz11319-fortify2 like:
    ```
    <command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror]
    <built-in>: note: this is the location of the previous definition
    cc1: all warnings being treated as errors
    ```
    
    It's just because we're always setting -D_FORTIFY_SOURCE=2
    rather than unsetting it first. If F_S is already 2, it's harmless,
    but if it's another value (say, 1, or 3), the compiler will bawk.
    
    (I'm not aware of a reason this couldn't be tested with =3,
    but the toolchain support is limited for that (too new), and we want
    to run the tests everywhere possible.)
    
    As Siddhesh noted previously, we could implement some fallback
    logic to determine the maximal F_S value supported by the toolchain,
    which is a bit easier now that autoconf-archive has been updated for F_S=3
    (https://github.com/autoconf-archive/autoconf-archive/pull/269), but let's
    revisit this if it continues to crop up.
    
    Signed-off-by: Sam James <sam@gentoo.org>
    Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
    (cherry picked from commit ecf8ae6704d5034fc2d5e29e5dc88dbca981581e)
    (cherry picked from commit 1d63573f81945a489ea169636fa11850bc74716b)

 stdio-common/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

commit 009844bd9afb60882b503f49eb634ef370b2d9dd
Author:     Arsen Arsenović <arsen@gentoo.org>
AuthorDate: Tue Mar 7 11:29:35 2023 +0100
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Mon May 8 23:42:27 2023 +0200

    elf: Add missing dependency between resolvfail and testobj1.so
    
    It was possible to run this test individually and have it fail because
    it can't find testobj1.so.  This patch adds that dependency, to prevent
    such issues.
    
    Reviewed-by: Florian Weimer <fweimer@redhat.com>
    (cherry picked from commit f7e751affbedf67e16ef97e9da430bd67d793891)

 elf/Makefile | 1 +
 1 file changed, 1 insertion(+)

commit dc2ae0658733805d0deed56ee630836e107b89d8
Author:     Arsen Arsenović <arsen@gentoo.org>
AuthorDate: Tue Mar 7 11:29:34 2023 +0100
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Mon May 8 23:42:17 2023 +0200

    elf: Add -z lazy to some more tests
    
    Some toolchains, such as that used on Gentoo Hardened, set -z now out of
    the box.  This trips up a couple of tests.
    
    Reviewed-by: Florian Weimer <fweimer@redhat.com>
    (cherry picked from commit 6c7388d0b95ef9ae39fbe6f733e2c5049769c4f9)

 elf/Makefile | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

commit 4a99d09c68732cfac2c8efb6b963f25f42b43805 (tag: gentoo/glibc-2.37-4)
Author:     Florian Weimer <fweimer@redhat.com>
AuthorDate: Tue Feb 21 09:20:28 2023 +0100
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Tue Apr 11 00:38:43 2023 +0200

    gshadow: Matching sgetsgent, sgetsgent_r ERANGE handling (bug 30151)
    
    Before this change, sgetsgent_r did not set errno to ERANGE, but
    sgetsgent only check errno, not the return value from sgetsgent_r.
    Consequently, sgetsgent did not detect any error, and reported
    success to the caller, without initializing the struct sgrp object
    whose address was returned.
    
    This commit changes sgetsgent_r to set errno as well.  This avoids
    similar issues in applications which only change errno.
    
    Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
    (cherry picked from commit 969e9733c7d17edf1e239a73fa172f357561f440)

 gshadow/Makefile        |  2 +-
 gshadow/sgetsgent_r.c   |  5 +++-
 gshadow/tst-sgetsgent.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 74 insertions(+), 2 deletions(-)

commit 11fcbaca45b3f25bab261b17c5b46832de24208f (tag: gentoo/glibc-2.37-3)
Author:     Joan Bruguera <joanbrugueram@gmail.com>
AuthorDate: Sat Feb 18 21:52:15 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Thu Feb 23 23:08:35 2023 +0100

    elf: Restore ldconfig libc6 implicit soname logic [BZ #30125]
    
    While cleaning up old libc version support, the deprecated libc4 code was
    accidentally kept in `implicit_soname`, instead of the libc6 code.
    
    This causes additional symlinks to be created by `ldconfig` for libraries
    without a soname, e.g. a library `libsomething.123.456.789` without a soname
    will create a `libsomething.123` -> `libsomething.123.456.789` symlink.
    
    As the libc6 version of the `implicit_soname` code is a trivial `xstrdup`,
    just inline it and remove `implicit_soname` altogether.
    
    Some further simplification looks possible (e.g. the call to `create_links`
    looks like a no-op if `soname == NULL`, other than the verbose printfs), but
    logic is kept as-is for now.
    
    Fixes: BZ #30125
    Fixes: 8ee878592c4a ("Assume only FLAG_ELF_LIBC6 suport")
    Signed-off-by: Joan Bruguera <joanbrugueram@gmail.com>
    
    Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
    (cherry picked from commit 1b0ea8c5d886fedabd611a569b5ec58a6f5153e6)
    (cherry picked from commit 590d0e089b06f158ded713f5e5600eaa66dcea44)

 NEWS                                         |  2 ++
 elf/Makefile                                 | 14 ++++++++
 elf/ldconfig.c                               |  4 +--
 elf/readlib.c                                | 19 -----------
 elf/tst-ldconfig-soname-lib-with-soname.c    |  1 +
 elf/tst-ldconfig-soname-lib-without-soname.c |  1 +
 elf/tst-ldconfig-soname.sh                   | 49 ++++++++++++++++++++++++++++
 sysdeps/generic/ldconfig.h                   |  2 --
 8 files changed, 69 insertions(+), 23 deletions(-)

commit 12dd16c80471a986c7e01fd134794581bbb9813a
Author:     Vitaly Buka <vitalybuka@google.com>
AuthorDate: Sat Feb 18 12:53:41 2023 -0800
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Thu Feb 23 23:08:07 2023 +0100

    stdlib: Undo post review change to 16adc58e73f3 [BZ #27749]
    
    Post review removal of "goto restart" from
    https://sourceware.org/pipermail/libc-alpha/2021-April/125470.html
    introduced a bug when some atexit handers skipped.
    
    Signed-off-by: Vitaly Buka <vitalybuka@google.com>
    
    Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
    (cherry picked from commit fd78cfa72ea2bab30fdb4e1e0672b34471426c05)
    (cherry picked from commit 790e504a172a5ef7399b3e3f481d76394dce0a23)

 stdlib/Makefile                |  1 +
 stdlib/exit.c                  |  7 ++--
 stdlib/test-atexit-recursive.c | 75 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 81 insertions(+), 2 deletions(-)

commit 3e7452792297e2d224f473dbc6b9d3259e9d2e5d
Author:     Florian Weimer <fweimer@redhat.com>
AuthorDate: Wed Feb 8 18:11:04 2023 +0100
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Thu Feb 23 23:07:43 2023 +0100

    elf: Smoke-test ldconfig -p against system /etc/ld.so.cache
    
    The test is sufficient to detect the ldconfig bug fixed in
    commit 9fe6f6363886aae6b2b210cae3ed1f5921299083 ("elf: Fix 64 time_t
    support for installed statically binaries").
    
    Reviewed-by: Carlos O'Donell <carlos@redhat.com>
    (cherry picked from commit 9fd63e35371b9939e9153907c6a753e6960b68ad)
    (cherry picked from commit d8e1a7590d375159fb5aac07ad8111ab4699e994)

 elf/Makefile          |  6 ++++
 elf/tst-ldconfig-p.sh | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 83 insertions(+)

commit bb5e6edec2f9c73a16bc127f8baa22a64977393a (tag: gentoo/glibc-2.37-2)
Author:     Carlos O'Donell <carlos@redhat.com>
AuthorDate: Mon Feb 6 10:36:32 2023 -0500
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Wed Feb 8 15:03:19 2023 +0100

    NEWS: Document CVE-2023-25139.
    
    Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
    (cherry picked from commit 67c37737ed474d25fd4dc535dfd822c426e6b971)
    (cherry picked from commit 6fe86ecd787a2624cd638131629ba9a824040308)

 NEWS | 9 +++++++++
 1 file changed, 9 insertions(+)

commit 6b914951502185f6c2de134801d9642a0ead1321
Author:     Carlos O'Donell <carlos@redhat.com>
AuthorDate: Thu Jan 19 12:50:20 2023 +0100
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Wed Feb 8 15:02:55 2023 +0100

    Account for grouping in printf width (bug 30068)
    
    This is a partial fix for mishandling of grouping when formatting
    integers.  It properly computes the width in the presence of grouping
    characters when the width is larger than the number of significant
    digits. The precision related issue is documented in bug 23432.
    
    Co-authored-by: Andreas Schwab <schwab@suse.de>
    (cherry picked from commit c980549cc6a1c03c23cc2fe3e7b0fe626a0364b0)
    (cherry picked from commit 07b9521fc6369d000216b96562ff7c0ed32a16c4)

 stdio-common/Makefile               |  2 ++
 stdio-common/tst-grouping3.c        | 54 +++++++++++++++++++++++++++++++++++++
 stdio-common/vfprintf-process-arg.c | 22 +++++++++++----
 3 files changed, 73 insertions(+), 5 deletions(-)

commit 94c6e75618c55c724b33f4e39dcd38c87f619d79
Author:     Andreas Schwab <schwab@suse.de>
AuthorDate: Thu Jan 26 14:25:05 2023 +0100
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Wed Feb 8 01:09:33 2023 +0100

    Use 64-bit time_t interfaces in strftime and strptime (bug 30053)
    
    Both functions use time_t only internally, so the ABI is not affected.
    
    (cherry picked from commit 41349f6f67c83e7bafe49f985b56493d2c4c9c77)
    (cherry picked from commit fb7b95dc47b0d5ecd48339512d091b6b23e7d900)

 NEWS                        |  6 ++++++
 time/Makefile               |  3 ++-
 time/strftime_l.c           |  4 ++++
 time/strptime_l.c           |  4 +++-
 time/tst-strftime4-time64.c |  1 +
 time/tst-strftime4.c        | 52 +++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 68 insertions(+), 2 deletions(-)

commit 56f12fb5b392c27d74a2d39861173f3779c526d6
Author:     caiyinyu <caiyinyu@loongson.cn>
AuthorDate: Tue Jan 31 20:40:10 2023 +0800
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Wed Feb 8 01:09:18 2023 +0100

    LoongArch: Add new relocation types.
    
    (cherry picked from commit 9f8513dc64119a424b312db97cef5d87d376defa)

 elf/elf.h | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

commit 91a357e3926a220fe79094a46ef8c6e5db75866e
Author:     Siddhesh Poyarekar <siddhesh@sourceware.org>
AuthorDate: Thu Feb 2 07:49:02 2023 -0500
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Thu Feb 2 19:54:25 2023 +0100

    cdefs: Limit definition of fortification macros
    
    Define the __glibc_fortify and other macros only when __FORTIFY_LEVEL >
    0.  This has the effect of not defining these macros on older C90
    compilers that do not have support for variable length argument lists.
    
    Also trim off the trailing backslashes from the definition of
    __glibc_fortify and __glibc_fortify_n macros.
    
    Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
    Reviewed-by: Florian Weimer <fweimer@redhat.com>
    (cherry picked from commit 2337e04e21ba6040926ec871e403533f77043c40)
    (cherry picked from commit 020b43544a26237d752eae4a715c403f29226542)

 misc/sys/cdefs.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

commit c15bbc6a0bb9c4ae58e88afb86d60bcd627b8f44
Author:     Andreas K. Hüttel <dilfridge@gentoo.org>
AuthorDate: Fri Jan 27 20:48:15 2023 +0100
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Thu Feb 2 19:52:59 2023 +0100

    Make stdlib/testmb compile when _FORTIFY_SOURCE is not predefined 2
    
    Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>

 stdlib/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

commit a242e26190a227a9ce65af12f214eee2e0ae5aba (tag: gentoo/glibc-2.37-1)
Author:     Adhemerval Zanella <adhemerval.zanella@linaro.org>
AuthorDate: Fri Jan 27 14:28:34 2023 -0300
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Wed Feb 1 20:52:41 2023 +0100

    linux: Use getdents64 on readdir64 compat implementation
    
    It uses a similar strategy from the non-LFS readdir that also
    uses getdents64 internally and uses a translation buffer to return
    the compat readdir64 entry.
    
    It allows to remove __old_getdents64.
    
    Checked on i686-linux-gnu.

 sysdeps/unix/sysv/linux/dirstream.h  | 13 ++++-
 sysdeps/unix/sysv/linux/getdents64.c | 93 ------------------------------------
 sysdeps/unix/sysv/linux/olddirent.h  |  2 -
 sysdeps/unix/sysv/linux/readdir64.c  | 50 ++++++++++++++-----
 4 files changed, 50 insertions(+), 108 deletions(-)

commit d24c3327778018501a864f4e609ff487306d1129
Author:     Adhemerval Zanella <adhemerval.zanella@linaro.org>
AuthorDate: Fri Jan 27 14:28:33 2023 -0300
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Wed Feb 1 20:52:38 2023 +0100

    linux: Add __old_readdir64_unlocked
    
    And use it __old_readdir64_r.
    
    Checked on i686-linux-gnu.

 sysdeps/unix/sysv/linux/olddirent.h   |  2 +
 sysdeps/unix/sysv/linux/readdir64.c   | 24 +++++++----
 sysdeps/unix/sysv/linux/readdir64_r.c | 79 ++++++++---------------------------
 3 files changed, 35 insertions(+), 70 deletions(-)

commit 48a4199f90b3cb2fc9057f238a6f5cb9c151de1c
Author:     Adhemerval Zanella <adhemerval.zanella@linaro.org>
AuthorDate: Fri Jan 27 14:28:32 2023 -0300
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Wed Feb 1 20:52:36 2023 +0100

    linux: Add __readdir64_unlocked
    
    And use it on readdir_r implementation.
    
    Checked on i686-linux-gnu.

 include/dirent.h                      |  1 +
 sysdeps/unix/sysv/linux/readdir64.c   | 20 ++++++---
 sysdeps/unix/sysv/linux/readdir64_r.c | 80 ++++++++---------------------------
 3 files changed, 33 insertions(+), 68 deletions(-)

commit f5752e44d6541f6616688a9f7ecdce787f6ea0b4
Author:     Adhemerval Zanella <adhemerval.zanella@linaro.org>
AuthorDate: Fri Jan 27 14:28:31 2023 -0300
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Wed Feb 1 20:52:33 2023 +0100

    linux: Set internal DIR filepos as off64_t (BZ #23960, BZ #24050)
    
    It allows to obtain the expected entry offset on telldir and set
    it correctly on seekdir on platforms where long int is smaller
    than off64_t.
    
    On such cases opendir creates a map entry between the DIR d_off
    offset and the returned long int (the telldir return value).
    seekdir will then set the correct offset from the internal list
    using the telldir as the list key.
    
    It also removes the overflow check on readdir and the returned value
    will be truncated by the non-LFS off_t size.  As Joseph has noted
    in BZ #23960 comment #22, d_off is an opaque value and since
    telldir/seekdir works regardless of the returned dirent d_off value.
    
    Finally it removes the requirement to check for overflow values on
    telldir (BZ #24050).
    
    Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc-linux-gnu,
    and arm-linux-gnueabihf.

 dirent/tst-seekdir.c                        |   8 ++
 sysdeps/unix/sysv/linux/Makefile            |   1 +
 sysdeps/unix/sysv/linux/alpha/bits/dirent.h |   3 +
 sysdeps/unix/sysv/linux/bits/dirent.h       |   4 +
 sysdeps/unix/sysv/linux/closedir.c          |   4 +
 sysdeps/unix/sysv/linux/dirstream.h         |   6 +-
 sysdeps/unix/sysv/linux/opendir.c           |   3 +
 sysdeps/unix/sysv/linux/readdir.c           |  11 ++-
 sysdeps/unix/sysv/linux/rewinddir.c         |   5 +
 sysdeps/unix/sysv/linux/seekdir.c           |  35 ++++++-
 sysdeps/unix/sysv/linux/telldir.c           |  35 +++++++
 sysdeps/unix/sysv/linux/telldir.h           |  65 +++++++++++++
 sysdeps/unix/sysv/linux/tst-opendir-nolfs.c | 146 ++++++++++++++++++++++++++++
 13 files changed, 319 insertions(+), 7 deletions(-)

commit 533237b781a8a803953480d1a995da0bc814c273
Author:     Adhemerval Zanella <adhemerval.zanella@linaro.org>
AuthorDate: Fri Jan 27 14:28:30 2023 -0300
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Wed Feb 1 20:52:30 2023 +0100

    linux: Use getdents64 on non-LFS readdir
    
    The non-LFS opendir reserves a translation entry to be used to return
    the entry and the dirent64 struct is translated to the temporary buffer
    on each readdir call.
    
    Entries that overflow d_off/d_ino and the buffer reallocation failure
    (in case of large d_name) are ignored.
    
    Checked on x86_64-linux-gnu and i686-linux-gnu.

 dirent/tst-scandir.c                |  6 ++-
 include/dirent.h                    |  2 +-
 sysdeps/unix/sysv/linux/dirstream.h |  5 +++
 sysdeps/unix/sysv/linux/readdir.c   | 83 +++++++++++++++++++++++++------------
 4 files changed, 67 insertions(+), 29 deletions(-)

commit 5f3622b3ae40e5a06f8ec8b7af7823758c7330e6
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: Sat Jul 11 20:06:51 2020 +0300
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Wed Feb 1 20:52:27 2023 +0100

    Fix miscompilation on ia64's gcc-10
    
    Bug: https://bugs.gentoo.org/723268
    Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>

 sysdeps/unix/sysv/linux/ia64/dl-sysdep.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

commit 9b8c53ad246c97eb93b93d701ee52e766d3b73e4
Author:     Andreas K. Hüttel <dilfridge@gentoo.org>
AuthorDate: Fri Dec 14 20:43:04 2018 +0100
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Wed Feb 1 20:52:24 2023 +0100

    Force -O0 in conform tests to survive $CC changes
    
    In bug #659030 Gentoo started passing user's CFLAGS via $CC variable.
    conform tests should but are not ready to handle -O1/-O2 yet.
    Tests fail to validate headers due to inlining of weak symbol aliases
    and other problems. Let's force it back to -O0 until it's fixed upstream.
    
    Original patch by Sergei, ported to the new python test framework by Andreas
    
    Bug: https://bugs.gentoo.org/659030
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
    Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>

 conform/conformtest.py   | 6 ++++--
 conform/linknamespace.py | 4 +++-
 2 files changed, 7 insertions(+), 3 deletions(-)

commit 248740bb97be20b276c5d4d7c435ebb068e2d218
Author:     Andreas K. Hüttel <dilfridge@gentoo.org>
AuthorDate: Mon Oct 22 22:34:13 2018 +0200
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Wed Feb 1 20:52:21 2023 +0100

    Adapt to Gentoo-specific /etc/mail/aliases
    
    Patch by pacho2
    
    Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
    (cherry picked from commit 4e616cda056f471b799beba2b1cedc787ad4ecc0)
    Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>

 nss/nss_files/files-alias.c    |  2 +-
 nss/tst-nss-files-alias-leak.c | 18 +++++++++---------
 support/support_chroot.c       |  8 +++++++-
 3 files changed, 17 insertions(+), 11 deletions(-)

commit b56fc66ad6e0a9d4a203623084ff7d1c47bd9d04
Author:     Mike Frysinger <vapier@gentoo.org>
AuthorDate: Tue Aug 3 00:34:59 2021 +0200
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: Wed Feb 1 20:52:18 2023 +0100

    Disable ldconfig during install
    
    Do not bother running ldconfig on DESTDIR.  It's a waste of time as we
    won't use the result (portage will rebuild the cache after install).
    Also, the Gentoo sandbox does not currently catch chroot() behavior so
    we end up (incorrectly) flagging it as a violation as a write to /etc.
    
    http://sourceware.org/ml/libc-alpha/2012-08/msg00118.html
    https://bugs.gentoo.org/431038
    Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>

 Makefile | 1 +
 1 file changed, 1 insertion(+)
