Auto-sync with upstream branch master

Upstream commit: 2c16cb88a6e5ace0fb7cedca86860ea7bde522a7

- Linux: Move timer helper routines from librt to libc
- Linux: Move mq_unlink from librt to libc
- Linux: Move mq_send, mq_timedsend, __mq_timedsend_time64 to libc
- Linux: Move mq_receive, mq_timedreceive, __mq_timedreceive_time64 to libc
- Linux: Move mq_open, __mq_open_2 from librt to libc
- Linux: Move mq_notify from librt to libc
- Linux: Move mq_getattr from librt to libc
- Linux: Move mq_setattr from librt to libc
- Linux: Move mq_close from librt to libc
- Linux: Move lio_listio, lio_listio64 from librt to libc
- rt: Rework lio_listio implementation
- Linux: Move aio_write, aio_write64 into libc
- Linux: Move aio_suspend, aio_suspend64, __aio_suspend_time64 to libc
- Linux: Move aio_return, aio_return64 into libc
- Linux: Move aio_read, aio_read64 into libc
- Linux: Move aio_fsync, aio_fsync64 into libc
- Linux: Move aio_error, aio_error64 into libc
- Linux: Move aio_cancel, aio_cancel64 into libc
- Linux: Move aio_init from librt into libc
- support: Fix xclone build failures on ia64 and hppa
- elf: Disable most of TLS modid gaps processing [BZ #27135]
- elf: Fix glibc-hwcaps priorities with cache flags mismatches [BZ #27046]
- * NEWS: Clarify _TIME_BITS change.
- x86: Remove unnecessary overflow check from wcsnlen-sse4_1.S
- String: Add three more overflow tests cases to test-strnlen.c
- Consolidate pthread_atfork
- posix: Do not clobber errno by atfork handlers
- posix: Consolidate fork implementation
- support: Add xclone
- x86: Fix tst-cpu-features-cpuinfo on Ryzen 9 (BZ #27873)
- x86: Copy IBT and SHSTK usable only if CET is enabled
- x86: Fix overflow bug in wcsnlen-sse4_1 and wcsnlen-avx2 [BZ #27974]
- x86: Fix overflow bug with wmemchr-sse2 and wmemchr-avx2 [BZ #27974]
- String: Add overflow tests for strnlen, memchr, and strncat [BZ #27974]
- x86-64: Add wcslen optimize for sse4.1
- x86-64: Move strlen.S to multiarch/strlen-vec.S
- hurd: Fix build after 52a5fe70a2
- nptl: Use SA_RESTART for SIGCANCEL handler
- doc: _TIME_BITS defaults may change
- More mcheck -> malloc-check refactoring
- Add NEWS item for gconv-modules.d change
- Handle DT_UNKNOWN in gconv-modules.d
- iconvconfig: Use common gconv module parsing function
- gconv_conf: Split out configuration file processing
- gconv_conf: Remove unused variables
- iconv: Remove alloca use in gconv-modules configuration parsing
- Remove unsused symbols from nptl/Versions
- linux: Only use 64-bit syscall if required for clock_nanosleep
- linux: Only use 64-bit syscall if required for internal futex
- linux: Only use 64-bit syscall if required for utimensat family
- linux: Only use 64-bit syscall if required for sigtimedwait
- linux: Only use 64-bit syscall if required for mq_timedsend
- linux: Only use 64-bit syscall if required for mq_timedreceive
- linux: Only use 64-bit syscall if required for timerfd_settime
- linux: Only use 64-bit syscall if required for semtimedop
- linux: timerfd_gettime minor cleanup
- linux: Remove time64-support
- linux: Remove supports_time64 () from clock_gettime
- linux: Remove supports_time64 () from clock_getres
- linux: Only use 64-bit syscall if required for select
- linux: Only use 64-bit syscall if required for pselect
- linux: Only use 64-bit syscall if required for ppoll
- support: Add support_create_timer
- Use 64 bit time_t stat internally
- malloc: Drop __malloc_initialized from Versions
- tst-mcheck: Rename to tst-malloc-check
- Add hidden prototypes for fsync, fdatasync
- nptl: Move pthreadP.h into sysdeps directory
- rt: Move generic implementation from sysdeps/pthread to rt
- rt: Move shm_unlink into libc
- rt: Move shm_open into libc
- rt: Replace generic stub of shm_unlink with the posix version
- rt: Replace generic stub of shm_open with the posix version
- Fix librt-routines-var issues for !PTHREAD_IN_LIBC
- rt: Lexicographically sort Versions file; librt-routines in Makefile
- elf: Use _dl_catch_error from base namespace in dl-libc.c [BZ #27646]
- Makeconfig: Fix time64-compat.mk target
This commit is contained in:
Florian Weimer 2021-06-27 16:02:30 +02:00
parent 700394c8ed
commit 22321f2b31
4 changed files with 91 additions and 96 deletions

View File

@ -11,16 +11,18 @@ Date: Wed Jun 9 14:12:46 2021 +0200
test ensures that the official names of libc.so, ld.so, and their
versioned names are recognized.
diff --git a/elf/Makefile b/elf/Makefile
index 5c47daee12505a47..1751f5ec6772eceb 100644
index 38d08e03b8979a81..62f7e8a22544ab9d 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -223,7 +223,7 @@ tests += restest1 preloadtest loadfail multiload origtest resolvfail \
@@ -223,7 +223,8 @@ tests += restest1 preloadtest loadfail multiload origtest resolvfail \
tst-single_threaded tst-single_threaded-pthread \
tst-tls-ie tst-tls-ie-dlmopen argv0test \
tst-glibc-hwcaps tst-glibc-hwcaps-prepend tst-glibc-hwcaps-mask \
- tst-tls20 tst-tls21 tst-dlmopen-dlerror
+ tst-tls20 tst-tls21 tst-dlmopen-dlerror tst-dl-is_dso
- tst-tls20 tst-tls21 tst-dlmopen-dlerror tst-dlmopen-gethostbyname
+ tst-tls20 tst-tls21 tst-dlmopen-dlerror tst-dlmopen-gethostbyname \
+ tst-dl-is_dso
# reldep9
tests-internal += loadtest unload unload2 circleload1 \
neededtest neededtest2 neededtest3 neededtest4 \

View File

@ -1,88 +0,0 @@
See: https://sourceware.org/pipermail/libc-alpha/2021-June/128024.html
Until the gap reuse logic is fixed we need to revert the relevant
commit.
This commit reverts the following commit:
commit 572bd547d57a39b6cf0ea072545dc4048921f4c3
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date: Thu Dec 31 13:59:38 2020 +0000
elf: Fix DTV gap reuse logic [BZ #27135]
For some reason only dlopen failure caused dtv gaps to be reused.
It is possible that the intent was to never reuse modids for a
different module, but after dlopen failure all gaps are reused
not just the ones caused by the unfinished dlopened.
So the code has to handle reused modids already which seems to
work, however the data races at thread creation and tls access
(see bug 19329 and bug 27111) may be more severe if slots are
reused so this is scheduled after those fixes. I think fixing
the races are not simpler if reuse is disallowed and reuse has
other benefits, so set GL(dl_tls_dtv_gaps) whenever entries are
removed from the middle of the slotinfo list. The value does
not have to be correct: incorrect true value causes the next
modid query to do a slotinfo walk, incorrect false will leave
gaps and new entries are added at the end.
Fixes bug 27135.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
diff --git a/elf/dl-close.c b/elf/dl-close.c
index 9f31532f4145cec5..3720e47dd19bc830 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -88,11 +88,7 @@ remove_slotinfo (size_t idx, struct dtv_slotinfo_list *listp, size_t disp,
/* If this is not the last currently used entry no need to look
further. */
if (idx != GL(dl_tls_max_dtv_idx))
- {
- /* There is an unused dtv entry in the middle. */
- GL(dl_tls_dtv_gaps) = true;
- return true;
- }
+ return true;
}
while (idx - disp > (disp == 0 ? 1 + GL(dl_tls_static_nelem) : 0))
diff --git a/elf/dl-open.c b/elf/dl-open.c
index d2240d87474e0b85..a066f39bd09131f1 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -899,6 +899,16 @@ no more namespaces available for dlmopen()"));
state if relocation failed, for example. */
if (args.map)
{
+ /* Maybe some of the modules which were loaded use TLS.
+ Since it will be removed in the following _dl_close call
+ we have to mark the dtv array as having gaps to fill the
+ holes. This is a pessimistic assumption which won't hurt
+ if not true. There is no need to do this when we are
+ loading the auditing DSOs since TLS has not yet been set
+ up. */
+ if ((mode & __RTLD_AUDIT) == 0)
+ GL(dl_tls_dtv_gaps) = true;
+
_dl_close_worker (args.map, true);
/* All l_nodelete_pending objects should have been deleted
diff --git a/elf/dl-tls.c b/elf/dl-tls.c
index e531ec5913d61848..2b5161d10ab1b3d9 100644
--- a/elf/dl-tls.c
+++ b/elf/dl-tls.c
@@ -191,7 +191,10 @@ _dl_next_tls_modid (void)
size_t
_dl_count_modids (void)
{
- /* The count is the max unless dlclose or failed dlopen created gaps. */
+ /* It is rare that we have gaps; see elf/dl-open.c (_dl_open) where
+ we fail to load a module and unload it leaving a gap. If we don't
+ have gaps then the number of modids is the current maximum so
+ return that. */
if (__glibc_likely (!GL(dl_tls_dtv_gaps)))
return GL(dl_tls_max_dtv_idx);

View File

@ -1,4 +1,4 @@
%define glibcsrcdir glibc-2.33.9000-728-gaa9a7f6296
%define glibcsrcdir glibc-2.33.9000-805-g2c16cb88a6
%define glibcversion 2.33.9000
# Pre-release tarballs are pulled in from git using a command that is
# effectively:
@ -111,7 +111,7 @@
Summary: The GNU libc libraries
Name: glibc
Version: %{glibcversion}
Release: 26%{?dist}
Release: 27%{?dist}
# In general, GPLv2+ is used by programs, LGPLv2+ is used for
# libraries.
@ -195,7 +195,6 @@ Patch35: glibc-nosymlink-2.patch
Patch36: glibc-nosymlink-3.patch
Patch37: glibc-nosymlink-4.patch
Patch38: glibc-libthread_db-dynsym.patch
Patch39: glibc-revert-dtv-gap-reuse.patch
##############################################################################
# Continued list of core "glibc" package information:
@ -2213,6 +2212,88 @@ fi
%files -f compat-libpthread-nonshared.filelist -n compat-libpthread-nonshared
%changelog
* Sun Jun 27 2021 Florian Weimer <fweimer@redhat.com> - 2.33.9000-27
- Drop glibc-revert-dtv-gap-reuse.patch, applied upstream.
- Auto-sync with upstream branch master,
commit 2c16cb88a6e5ace0fb7cedca86860ea7bde522a7:
- Linux: Move timer helper routines from librt to libc
- Linux: Move mq_unlink from librt to libc
- Linux: Move mq_send, mq_timedsend, __mq_timedsend_time64 to libc
- Linux: Move mq_receive, mq_timedreceive, __mq_timedreceive_time64 to libc
- Linux: Move mq_open, __mq_open_2 from librt to libc
- Linux: Move mq_notify from librt to libc
- Linux: Move mq_getattr from librt to libc
- Linux: Move mq_setattr from librt to libc
- Linux: Move mq_close from librt to libc
- Linux: Move lio_listio, lio_listio64 from librt to libc
- rt: Rework lio_listio implementation
- Linux: Move aio_write, aio_write64 into libc
- Linux: Move aio_suspend, aio_suspend64, __aio_suspend_time64 to libc
- Linux: Move aio_return, aio_return64 into libc
- Linux: Move aio_read, aio_read64 into libc
- Linux: Move aio_fsync, aio_fsync64 into libc
- Linux: Move aio_error, aio_error64 into libc
- Linux: Move aio_cancel, aio_cancel64 into libc
- Linux: Move aio_init from librt into libc
- support: Fix xclone build failures on ia64 and hppa
- elf: Disable most of TLS modid gaps processing [BZ #27135]
- elf: Fix glibc-hwcaps priorities with cache flags mismatches [BZ #27046]
- * NEWS: Clarify _TIME_BITS change.
- x86: Remove unnecessary overflow check from wcsnlen-sse4_1.S
- String: Add three more overflow tests cases to test-strnlen.c
- Consolidate pthread_atfork
- posix: Do not clobber errno by atfork handlers
- posix: Consolidate fork implementation
- support: Add xclone
- x86: Fix tst-cpu-features-cpuinfo on Ryzen 9 (BZ #27873)
- x86: Copy IBT and SHSTK usable only if CET is enabled
- x86: Fix overflow bug in wcsnlen-sse4_1 and wcsnlen-avx2 [BZ #27974]
- x86: Fix overflow bug with wmemchr-sse2 and wmemchr-avx2 [BZ #27974]
- String: Add overflow tests for strnlen, memchr, and strncat [BZ #27974]
- x86-64: Add wcslen optimize for sse4.1
- x86-64: Move strlen.S to multiarch/strlen-vec.S
- hurd: Fix build after 52a5fe70a2
- nptl: Use SA_RESTART for SIGCANCEL handler
- doc: _TIME_BITS defaults may change
- More mcheck -> malloc-check refactoring
- Add NEWS item for gconv-modules.d change
- Handle DT_UNKNOWN in gconv-modules.d
- iconvconfig: Use common gconv module parsing function
- gconv_conf: Split out configuration file processing
- gconv_conf: Remove unused variables
- iconv: Remove alloca use in gconv-modules configuration parsing
- Remove unsused symbols from nptl/Versions
- linux: Only use 64-bit syscall if required for clock_nanosleep
- linux: Only use 64-bit syscall if required for internal futex
- linux: Only use 64-bit syscall if required for utimensat family
- linux: Only use 64-bit syscall if required for sigtimedwait
- linux: Only use 64-bit syscall if required for mq_timedsend
- linux: Only use 64-bit syscall if required for mq_timedreceive
- linux: Only use 64-bit syscall if required for timerfd_settime
- linux: Only use 64-bit syscall if required for semtimedop
- linux: timerfd_gettime minor cleanup
- linux: Remove time64-support
- linux: Remove supports_time64 () from clock_gettime
- linux: Remove supports_time64 () from clock_getres
- linux: Only use 64-bit syscall if required for select
- linux: Only use 64-bit syscall if required for pselect
- linux: Only use 64-bit syscall if required for ppoll
- support: Add support_create_timer
- Use 64 bit time_t stat internally
- malloc: Drop __malloc_initialized from Versions
- tst-mcheck: Rename to tst-malloc-check
- Add hidden prototypes for fsync, fdatasync
- nptl: Move pthreadP.h into sysdeps directory
- rt: Move generic implementation from sysdeps/pthread to rt
- rt: Move shm_unlink into libc
- rt: Move shm_open into libc
- rt: Replace generic stub of shm_unlink with the posix version
- rt: Replace generic stub of shm_open with the posix version
- Fix librt-routines-var issues for !PTHREAD_IN_LIBC
- rt: Lexicographically sort Versions file; librt-routines in Makefile
- elf: Use _dl_catch_error from base namespace in dl-libc.c [BZ #27646]
- Makeconfig: Fix time64-compat.mk target
* Sun Jun 27 2021 Florian Weimer <fweimer@redhat.com> - 2.33.9000-26
- Add automatic requires if building against glibc development snapshots

View File

@ -1 +1 @@
SHA512 (glibc-2.33.9000-728-gaa9a7f6296.tar.xz) = 99af420fe04976754515154aa9b60769624b431bdfeedcdcea62b1357fc6ef0f1f5f84bac203eb5af142d5eff0034fdc25e55b4fe644aec8b3d283f0e0e14bd8
SHA512 (glibc-2.33.9000-805-g2c16cb88a6.tar.xz) = 50431e03ec0e32b2d6c9aed85cc219536d9a896d3c692dc162ea4435a7a5673972fd04f766968f05b264b52eb2306c704eebed74a4916578cf95a96ce92a4d5f