aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-12-04x86_64: Add glibc-hwcaps supportFlorian Weimer
The subdirectories match those in the x86-64 psABI: https://gitlab.com/x86-psABIs/x86-64-ABI/-/commit/77566eb03bc6a326811cb7e9a6b9396884b67c7c Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-12-04elf: Add glibc-hwcaps subdirectory support to ld.so cache processingFlorian Weimer
This recognizes the DL_CACHE_HWCAP_EXTENSION flag in cache entries, and picks the supported cache entry with the highest priority. The elf/tst-glibc-hwcaps-prepend-cache test documents a non-desired aspect of the current cache implementation: If the cache selects a DSO that does not exist on disk, _dl_map_object falls back to open_path, which may or may not find an alternative implementation. This is an existing limitation that also applies to the legacy hwcaps processing for ld.so.cache. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-12-04elf: Process glibc-hwcaps subdirectories in ldconfigFlorian Weimer
Libraries from these subdirectories are added to the cache with a special hwcap bit DL_CACHE_HWCAP_EXTENSION, so that they are ignored by older dynamic loaders. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-12-04elf: Implement tail merging of strings in ldconfigFlorian Weimer
This simplifies the string table construction in elf/cache.c because there is no more need to keep track of offsets explicitly; the string table implementation does this internally. This change slightly reduces the size of the cache on disk. The file format does not change as a result. The strings are null-terminated, without explicit length, so tail merging is transparent to readers. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-12-04elf: Implement a string table for ldconfig, with tail mergingFlorian Weimer
This will be used in ldconfig to reduce the ld.so.cache size slightly. Tail merging is an optimization where a pointer points into another string if the first string is a suffix of the second string. The hash function FNV-1a was chosen because it is simple and achieves good dispersion even for short strings (so that the hash table bucket count can be a power of two). It is clearly superior to the hsearch hash and the ELF hash in this regard. The hash table uses chaining for collision resolution. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-12-04elf: Add extension mechanism to ld.so.cacheFlorian Weimer
A previously unused new-format header field is used to record the address of an extension directory. This change adds a demo extension which records the version of ldconfig which builds a file. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-12-04elf: Add endianness markup to ld.so.cache (bug 27008)Florian Weimer
Use a reserved byte in the new format cache header to indicate whether the file is in little endian or big endian format. Eventually, this information could be used to provide a unified cache for qemu-user and similiar scenarios. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-12-04elf: Add glibc-hwcaps support for LD_LIBRARY_PATHFlorian Weimer
This hacks non-power-set processing into _dl_important_hwcaps. Once the legacy hwcaps handling goes away, the subdirectory handling needs to be reworked, but it is premature to do this while both approaches are still supported. ld.so supports two new arguments, --glibc-hwcaps-prepend and --glibc-hwcaps-mask. Each accepts a colon-separated list of glibc-hwcaps subdirectory names. The prepend option adds additional subdirectories that are searched first, in the specified order. The mask option restricts the automatically selected subdirectories to those listed in the option argument. For example, on systems where /usr/lib64 is on the library search path, --glibc-hwcaps-prepend=valgrind:debug causes the dynamic loader to search the directories /usr/lib64/glibc-hwcaps/valgrind and /usr/lib64/glibc-hwcaps/debug just before /usr/lib64 is searched. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-12-03elf: Synchronize <elf.h> section header flags with binutilsFlorian Weimer
binutils 2.36 will add SHF_GNU_RETAIN support. SHF_GNU_BUILD_NOTE was also missing from the glibc header.
2020-12-03x86: Fix THREAD_SELF definition to avoid ld.so crash (bug 27004)Jakub Jelinek
The previous definition of THREAD_SELF did not tell the compiler that %fs (or %gs) usage is invalid for the !DL_LOOKUP_GSCOPE_LOCK case in _dl_lookup_symbol_x. As a result, ld.so could try to use the TCB before it was initialized. As the comment in tls.h explains, asm volatile is undesirable here. Using the __seg_fs (or __seg_gs) namespace does not interfere with optimization, and expresses that THREAD_SELF is potentially trapping.
2020-12-03htl: Add hidden def for __pthread_create/detachSamuel Thibault
to avoid a PLT.
2020-12-03manual: Clarify File Access Modes section and add O_PATHFlorian Weimer
Kees Cook reported that the current text is misleading: <https://lore.kernel.org/lkml/202005150847.2B1ED8F81@keescook/>
2020-12-03htl: Add missing symbolsSamuel Thibault
hurd/hurdsig.c needs to detect whether __pthread_detach and __pthread_create are available, so they need to be exposed.
2020-12-02Revert "linux: Move xmknod{at} to compat symbols"Adhemerval Zanella
This reverts commit 81b83ff61f95f30ad53d6075247af0ea61a0b16e to move __xmknod{at} back to default symbols. ABIs with default symbol version of 2.33 or newer (such as riscv32) continue to just provide the mknod* symbols. The idea is to not force static libraries built against old glibc to update against new glibcs (since they reference the the xmknod{at} symbols). Checked on x86_64-linux-gnu and i686-linux-gnu.
2020-12-02Revert "linux: Move {f}xstat{at} to compat symbols"Adhemerval Zanella
This reverts commit 20b39d59467b0c1d858e89ded8b0cebe55e22f60 to move {f}xstat{at} back to default symbols. ABIs with default symbol version of 2.33 or newer (such as riscv32) continue to just provide the stat symbols. The idea is to not force static libraries built against old glibc to update against new glibcs (since they reference the old {f}xstat{at} symbols). Checked on x86_64-linux-gnu and i686-linux-gnu.
2020-12-02elf.h: Fix spelling of EM_TILE64 commentFlorian Weimer
Reported-By: Jakub Jelinek <jakub@redhat.com>
2020-12-01nptl: Fix __futex_clocklock64 return error check [BZ #26964]Lucas A. M. Magalhaes
The earlier implementation of this, __lll_clocklock, calls lll_clockwait that doesn't return the futex syscall error codes. It always tries again if that fails. However in the current implementation, when the futex returns EAGAIN, __futex_clocklock64 will also return EGAIN, even if the futex is taken. This patch fixes the EAGAIN issue and also adds a check for EINTR. As futex syscall can return EINTR if the thread is interrupted by a signal. In this case I'm assuming the function should continue trying to lock as there is no mention to about it on POSIX. Also add a test for both scenarios. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-11-30powerpc64le: ifunc select *f128 routines in multiarch modePaul E. Murphy
Programatically generate simple wrappers for interesting libm *f128 objects. Selected functions are transcendental functions or those with trivial compiler builtins. This can result in a 2-3x speedup (e.g logf128 and expf128). A second set of implementation files are generated which include the first implementation encountered along the search path. This usually works, except when a wrapper is overriden and makefile search order slightly diverges from include order. Likewise, wrapper object files are created for each generated file. These hold the ifunc selection routines which export ABI. Next, several shared headers are intercepted to control renaming of asm function redirects are used first, and sometimes macro renames if the former is impractical. Notably, if the request machine supports hardware IEEE128 (i.e POWER9 and newer) this ifunc machinery is disabled. Likewise existing ifunc support for float128 is consolidated into this (e.g sqrtf128 and fmaf128). Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
2020-11-30y2038: Convert aio_suspend to support 64 bit timeLukasz Majewski
The aio_suspend function has been converted to support 64 bit time. This change uses (in aio_misc.h): - __futex_abstimed_wait64 (instead of futex_reltimed_wait) - __futex_abstimed_wait_cancellable64 (instead of futex_reltimed_wait_cancellable) from ./sysdeps/nptl/futex-helpers.h The aio_suspend() accepts relative timeout, which then is converted to absolute one. The i686-gnu port (HURD) do not define DONT_NEED_AIO_MISC_COND and as it doesn't (yet) support 64 bit time it uses not converted pthread_cond_timedwait(). The __aio_suspend() is supposed to be run on ports with __TIMESIZE !=64 and __WORDSIZE==32. It internally utilizes __aio_suspend_time64() and hence the conversion from 32 bit struct timespec to 64 bit one is required. For ports supporting 64 bit time the __aio_suspend_time64() will be used either via alias (to __aio_suspend when __TIMESIZE==64) or redirection (when -D_TIME_BITS=64 is passed). Build tests: ./src/scripts/build-many-glibcs.py glibcs Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-11-30Fix typo in NEWS fileShuo Wang
2020-11-27nptl: Add EOVERFLOW checks for futex callsAdhemerval Zanella
Some futex-internal calls require additional check for EOVERFLOW (as indicated by [1] [2] [3]). For both mutex and rwlock code, EOVERFLOW is handle as ETIMEDOUT; since it indicate to the caller that the blocking operation could not be issued. For mutex it avoids a possible issue where PTHREAD_MUTEX_ROBUST_* might assume EOVERFLOW indicate futex has succeed, and for PTHREAD_MUTEX_PP_* it avoid a potential busy infinite loop. For rwlock and semaphores, it also avoids potential busy infinite loops. Checked on x86_64-linux-gnu and i686-linux-gnu, although EOVERFLOW won't be possible with current usage (since all timeouts on 32-bit architectures with 32-bit time_t support will be in the range of 32-bit time_t). [1] https://sourceware.org/pipermail/libc-alpha/2020-November/120079.html [2] https://sourceware.org/pipermail/libc-alpha/2020-November/120080.html [3] https://sourceware.org/pipermail/libc-alpha/2020-November/120127.html
2020-11-27nptl: Fix PTHREAD_PRIO_PROTECT timed lockAdhemerval Zanella
The 878fe624d4 changed lll_futex_timed_wait, which expects a relative timeout, with a __futex_abstimed_wait64, which expects an absolute timeout. However the code still passes a relative timeout. Also, the PTHREAD_PRIO_PROTECT support for clocks different than CLOCK_REALTIME was broken since the inclusion of pthread_mutex_clocklock (9d20e22e46) since lll_futex_timed_wait always use CLOCK_REALTIME. This patch fixes by removing the relative time calculation. It also adds some xtests that tests both thread and inter-process usage. Checked on x86_64-linux-gnu.
2020-11-27sh: Add sh4 fpu Implies folderAdhemerval Zanella
The commit 605f38177db (sh: Split BE/LE abilist) did not take in consideration the SH4 fpu support. Checked with a build for sh4-linux-gnu and manually checked that the implementations at sysdeps/sh/sh4/fpu/ are selected. John Paul Adrian Glaubitz also confirmed it fixes the build issues he encontered.
2020-11-26io: nftw/ftw: Fix stack overflow with large nopenfd [BZ #26353]Xiaoming Ni
The nopenfd value is used as argument for the internal buffer on ftw_statup, which is allocated with alloca and might trigger a stack overflow for large values. This patch replaces the memory allocation to use malloc instead. Checked on x86_64-linux-gnu. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-11-26elf: Introduce enum opt_format in the ldconfig implementationFlorian Weimer
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-11-26support: Add support_copy_fileFlorian Weimer
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-11-25NEWS entry for commit b4f020c9b408fb3d1d3d4901c4a71839145f8791Florian Weimer
2020-11-25timezone: Change zdump installation to bin directoryPrasanth R
Commit 3bc4186c7a9, tzdata changed the zdump installation to bin directory, which creates duplicates of zdump in the Root filesystem.
2020-11-25nptl: Return EINVAL for invalid clock for pthread_clockjoin_npAdhemerval Zanella
The align the GNU extension with the others one that accept specify which clock to wait for (such as pthread_mutex_clocklock). Check on x86_64-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
2020-11-25nptl: Return EINVAL for pthread_mutex_clocklock/PI with CLOCK_MONOTONIC [BZ ↵Adhemerval Zanella
#26801] Linux futex FUTEX_LOCK_PI operation only supports CLOCK_REALTIME, so pthread_mutex_clocklock operation with priority aware mutexes may fail depending of the input timeout. Also, it is not possible to convert a CLOCK_MONOTONIC to a CLOCK_REALTIME due the possible wall clock time change which might invalid the requested timeout. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
2020-11-25nptl: Replace lll_futex_wake with futex-internal.hAdhemerval Zanella
The idea is to make NPTL implementation to use on the functions provided by futex-internal.h. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
2020-11-25nptl: Replace lll_futex_supported_clockid with futex-internal.hAdhemerval Zanella
The idea is to make NPTL implementation to use on the functions provided by futex-internal.h. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
2020-11-25nptl: Replace lll_futex_{timed_}wait by futex-internal.hAdhemerval Zanella
The idea is to make NPTL implementation to use on the functions provided by futex-internal.h. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
2020-11-25nptl: Replace lll_timedwait with __futex_abstimed_wait64Adhemerval Zanella
Checked with x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
2020-11-25nptl: Replace __futex_clocklock_wait64 with __futex_abstimed_wait64Adhemerval Zanella
For non null timeouts, the __futex_clocklock_wait64 creates an a relative timeout by subtracting the current time from the input argument. The same behavior can be obtained with FUTEX_WAIT_BITSET without the need to calculate the relative timeout. Besides consolidate the code it also avoid the possible relative timeout issues [1]. The __futex_abstimed_wait64 needs also to return EINVAL syscall errors. Checked on x86_64-linux-gnu and i686-linux-gnu. [1] https://sourceware.org/pipermail/libc-alpha/2020-November/119881.html Reviewed-by: Lukasz Majewski <lukma@denx.de>
2020-11-25nptl: Remove _futex_clock_wait_bitset64Adhemerval Zanella
It can be replaced with a __futex_abstimed_wait64 call. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
2020-11-25nptl: Consolidate __futex_abstimed_wait_{cancelable}64Adhemerval Zanella
The only different is how to issue the syscall. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
2020-11-25nptl: Extend __futex_abstimed_wait_cancelable64 commentAdhemerval Zanella
And add a small optimization to avoid setting the operation for the 32-bit time fallback operation. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
2020-11-25nptl: Remove clockwait_tidAdhemerval Zanella
It can be replaced with a __futex_abstimed_wait_cancelable64 call, with the advantage that there is no need to further clock adjustments to create a absolute timeout. It allows to remove the now ununsed futex_timed_wait_cancel64 internal function. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
2020-11-25nptl: Remove futex_wait_cancelableAdhemerval Zanella
It is used solely on __pthread_cond_wait_common and the call can be replaced by a __futex_abstimed_wait_cancelable64 one. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
2020-11-25nptl: Remove unused internal futex functionsAdhemerval Zanella
The __futex_abstimed_wait usage was remove with 3102e28bd11 and the __futex_abstimed_wait_cancelable by 323592fdc92 and b8d3e8fbaac. The futex_lock_pi can be replaced by a futex_lock_pi64. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
2020-11-25Mark mtrace tests UNSUPPORTED if bug-ga2.mtrace or tst-leaks2.mtrace are missingStefan Liebler
Starting with commit 29fddfc7dfd6444fa61a256e9a0d0127545e1f2e, the tests posix/bug-ga2 and resolv/tst-leaks2 are test-container tests. If test-container.c returns with EXIT_UNSUPPORTED, the tests with mtrace() are not executed and the mtrace files do not exist. Therefore the "mtrace-analysis-part" of those tests are marked UNSUPPORTED if the mtrace files are missing. Reported-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com> Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
2020-11-24elf: Fix uninitialized variable for _dl_writeShuo Wang
Variable ret in elf/dl-write.c is uninitialized, which should get return value from __writev.
2020-11-24powerpc: Make PT_THREAD_POINTER available to assembly codeMatheus Castanho
PT_THREAD_POINTER is currenty defined inside a #ifndef __ASSEMBLER__ block, but its usage should not be limited to C code, as it can be useful when accessing the TLS from assembly code as well. Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
2020-11-23Use libnss_files.so for tests posix/bug-ga2 and resolv/tst-leaks2 [BZ #26821]Stefan Liebler
The tests posix/bug-ga2-mem and resolv/mtrace-tst-leaks2 are failing on fedora 33 as mtrace reports memory leaks. The /etc/nsswitch.conf differs between Fedora 32: hosts: files dns myhostname Fedora 33: hosts: files resolve [!UNAVAIL=return] myhostname dns Therefore /lib64/libnss_resolve.so.2 (from systemd) and the dependencies libgcc_s.so.1 and libpthread.so.0 are loaded. Usually all malloc'ed resources from getaddrinfo / gethostbyname are freed and the libraries are dlclose'd in nss/nsswitch.c:libc_freeres_fn (free_mem). Unfortunately, /lib64/libnss_resolve.so.2 is marked with DF_1_NODELETE. As this library is not unmapped, you'll see "Memory not freed". Therefore those tests are now only relying on libnss_files.so by making them test-container tests and providing the required configuration files. By moving the tests to tests-container, those are now running with "make check". Therefore the mtrace part of the tests are also moved from "make xcheck" to "make check". bug-ga2.c is now using test-driver.c in order to support WAIT_FOR_DEBUGGER environment variable.
2020-11-23hurd report-wait: Fix stpcpy usageSamuel Thibault
We shall not overflow the size of the description parameter. This makes describe_number and describe_port behave like strpcpy (except for not filling all the end of buffer with zeroes) and _S_msg_report_wait use series of stpncpy-like call. If we were to overflow, we can now detect it and return ENOMEM.
2020-11-23hurd S_msg_report_wait: Fix detecting fd portsSamuel Thibault
_hurd_init_dtable stays set to non-NULL, so we have to run through both _hurd_init_dtable and _hurd_dtable.
2020-11-23hurd S_msg_report_wait: Fix reporting portsSamuel Thibault
This fixes the parameter order of MSG_EXAMINE, thus fixing the detection of e.g. fd ports for nicer output in ps WAIT output.
2020-11-22hurd: Fix strcpy callsSamuel Thibault
strcpy cannot be used with overlapping buffer, we have to use memmove instead. strcpy also cannot be safely used when the destination buffer is smaller that the source, we need to use strncpy to truncate the source if needed.
2020-11-22hurd: Fix _S_msg_get/set_env_variable prototypeSamuel Thibault
_S_msg_get_env_variable and _S_msg_set_env_variable are taking string_t, not char *. Fixes a warning with gcc 11.