aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-12-16htl: Get sem_open/sem_close/sem_unlink support [BZ #25524]Samuel Thibault
This just moves the existing nptl implementation to reuse as it is in htl.
2020-12-16pthread: Move semaphore initialization for open to semaphoreP.hSamuel Thibault
This allows to easily reuse all of the sem_open/sem_close/sem_unlink implementations in the various ports.
2020-12-16Mark __libc_freeres_fn as used [BZ #27002]H.J. Lu
GCC 11 with commit 6fbec038f7a7ddf29f074943611b53210d17c40c Author: H.J. Lu <hjl.tools@gmail.com> Date: Mon Feb 3 11:55:43 2020 -0800 Use SHF_GNU_RETAIN to preserve symbol definitions places used symbols in SECTION_RETAIN sections if assembler supports it. Mark __libc_freeres_fn as used to avoid gconv_dl.c: In function 'free_mem': gconv_dl.c:191:1: error: 'do_release_all' without 'used' attribute and 'free_mem' with 'used' attribute are placed in a section with the same name [-Werror=attributes] 191 | do_release_all (void *nodep) | ^~~~~~~~~~~~~~ In file included from <command-line>: gconv_dl.c:202:18: note: 'free_mem' was declared here 202 | libc_freeres_fn (free_mem) | ^~~~~~~~ ./../include/libc-symbols.h:316:15: note: in definition of macro 'libc_freeres_fn' 316 | static void name (void) | ^~~~ cc1: all warnings being treated as errors
2020-12-16Update syscall lists for Linux 5.10.Joseph Myers
Linux 5.10 has one new syscall, process_madvise. Update syscall-names.list and regenerate the arch-syscall.h headers with build-many-glibcs.py update-syscalls. Tested with build-many-glibcs.py.
2020-12-16htl: Add pshared semaphore supportSamuel Thibault
The implementation is extremely similar to the nptl implementation, but with slight differences in the futex interface. This fixes some of BZ 25521.
2020-12-16hurd: Add LLL_PRIVATE and LLL_SHAREDSamuel Thibault
2020-12-16hurd: Add __libc_open and __libc_closeSamuel Thibault
Needed by libpthread for sem_open and sem_close
2020-12-16htl: Add futex-internal.hSamuel Thibault
That provides futex_supports_pshared
2020-12-16hurd: Add __lll_abstimed_wait_intrSamuel Thibault
For semaphores, we need an interruptible version of low-level locks.
2020-12-16hurd: make lll_* take a variable instead of a ptrSamuel Thibault
To be coherent with other ports, let's make lll_* take a variable, and rename those that keep taking a ptr into __lll_*.
2020-12-16hurd: Rename LLL_INITIALIZER to LLL_LOCK_INITIALIZERSamuel Thibault
To get coherent with other ports.
2020-12-15Use Linux 5.10 in build-many-glibcs.py.Joseph Myers
This patch makes build-many-glibcs.py use Linux 5.10. Tested with build-many-glibcs.py (host-libraries, compilers and glibcs builds).
2020-12-15elf: Record libc.so link map when it is the main program (bug 20972)Florian Weimer
Otherwise, it will not participate in the dependency sorting. Fixes commit 9ffa50b26b0cb5d3043adf6d3d0b1ea735acc147 ("elf: Include libc.so.6 as main program in dependency sort (bug 20972)"). Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2020-12-15Use GMP 6.2.1 in build-many-glibcs.py.Joseph Myers
This patch makes build-many-glibcs.py use the recent GMP 6.2.1 release. Tested with build-many-glibcs.py (host-libraries, compilers and glibcs builds).
2020-12-15aarch64: remove the strlen_asimd symbolSzabolcs Nagy
This symbol is not in the implementation reserved namespace for static linking and it was never used: it seems it was mistakenly added in the orignal strlen_asimd commit 436e4d5b965abe592d26150cb518accf9ded8fe4
2020-12-15aarch64: fix static PIE start code for BTI [BZ #27068]Guillaume Gardet
A bti c was missing from rcrt1.o which made all -static-pie binaries fail at program startup on BTI enabled systems. Fixes bug 27068.
2020-12-15elf: Fix failure handling in _dl_map_object_from_fdSzabolcs Nagy
The failure paths in _dl_map_object_from_fd did not clean every potentially allocated resource up. Handle l_phdr, l_libname and mapped segments in the common failure handling code. There are various bits that may not be cleaned properly on failure (e.g. executable stack, incomplete dl_map_segments) fixing those need further changes. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-12-15elf: inline lose for error handlingSzabolcs Nagy
_dl_map_object_from_fd has complex error handling with cleanups. It was managed by a separate function to avoid code bloat at every failure case, but since the code was changed to use gotos there is no longer such code bloat from inlining. Maintaining a separate error handling function is harder as it needs to access local state which has to be passed down. And the same lose function was used in open_verify which is error prone. The goto labels are changed since there is no longer a call. The new code generates slightly smaller binary. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-12-14Remove strtoimax, strtoumax, wcstoimax, wcstoumax inlinesJoseph Myers
inttypes.h has inline implementations of the strtoimax, strtoumax, wcstoimax and wcstoumax functions, despite the corresponding stdlib.h and wchar.h inlines having been removed in 2007 (commit 9b2e9577b228350b15d88303b00097dd58e8d29b). Remove those inlines, thereby eliminating all references to the corresponding __*_internal functions from installed headers (so they could be made into compat symbols in future if desired). Tested for x86_64 and x86.
2020-12-14nsswitch: handle missing actions properlyDJ Delorie
Some internal functions need to know if a database has a nonzero list of actions; success getting the database does not guarantee that. Add checks for such as needed. Skip the ":" in each nsswitch.conf line so as not to add a dummy action libnss_:.so See also https://bugzilla.redhat.com/show_bug.cgi?id=1906066 Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2020-12-14x86: Remove the default REP MOVSB threshold tunable value [BZ #27061]H.J. Lu
Since we can't tell if the tunable value is set by user or not: https://sourceware.org/bugzilla/show_bug.cgi?id=27069 remove the default REP MOVSB threshold tunable value so that the correct default value will be set correctly by init_cacheinfo (). Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2020-12-12elf.h: Remove SHF_GNU_BUILD_NOTE.Mark Wielaard
SHF_GNU_BUILD_NOTE was a binutils experiment. And it is no longer needed. It was also removed from binutils.
2020-12-12elf.h: fix spelling typos in commentsDmitry V. Levin
Since elf.h is a public header file copied to other projects, try to make it free from spelling typos. This change fixes the following spelling typos in comments of elf.h: Auxialiary -> Auxiliary tenatively -> tentatively compatability -> compatibility
2020-12-12Fix spelling and grammar in several commentsJonny Grant
2020-12-11malloc: Detect infinite-loop in _int_free when freeing tcache [BZ#27052]W. Hashimoto
If linked-list of tcache contains a loop, it invokes infinite loop in _int_free when freeing tcache. The PoC which invokes such infinite loop is on the Bugzilla(#27052). This loop should terminate when the loop exceeds mp_.tcache_count and the program should abort. The affected glibc version is 2.29 or later. Reviewed-by: DJ Delorie <dj@redhat.com>
2020-12-11elf: Fix dl-load.cSzabolcs Nagy
Rebasing broke commit 38a3836011f3fe3290a94ab136dcb5f3c5c9f4e2 it was supposed to move code.
2020-12-11elf: Include libc.so.6 as main program in dependency sort (bug 20972)Florian Weimer
_dl_map_object_deps always sorts the initially loaded object first during dependency sorting. This means it is relocated last in dl_open_worker. This results in crashes in IFUNC resolvers without lazy bindings if libraries are preloaded that refer to IFUNCs in libc.so.6: the resolvers are called when libc.so.6 has not been relocated yet, so references to _rtld_global_ro etc. crash. The fix is to check against the libc.so.6 link map recorded by the __libc_early_init framework, and let it participate in the dependency sort. This fixes bug 20972. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2020-12-11support: Add support_slibdir_prefix variableFlorian Weimer
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2020-12-11aarch64: Use mmap to add PROT_BTI instead of mprotect [BZ #26831]Szabolcs Nagy
Re-mmap executable segments if possible instead of using mprotect to add PROT_BTI. This allows using BTI protection with security policies that prevent mprotect with PROT_EXEC. If the fd of the ELF module is not available because it was kernel mapped then mprotect is used and failures are ignored. To protect the main executable even when mprotect is filtered the linux kernel will have to be changed to add PROT_BTI to it. The delayed failure reporting is mainly needed because currently _dl_process_gnu_properties does not propagate failures such that the required cleanups happen. Using the link_map_machine struct for error propagation is not ideal, but this seemed to be the least intrusive solution. Fixes bug 26831. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-12-11elf: Pass the fd to note processingSzabolcs Nagy
To handle GNU property notes on aarch64 some segments need to be mmaped again, so the fd of the loaded ELF module is needed. When the fd is not available (kernel loaded modules), then -1 is passed. The fd is passed to both _dl_process_pt_gnu_property and _dl_process_pt_note for consistency. Target specific note processing functions are updated accordingly. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-12-11elf: Move note processing after l_phdr is updatedSzabolcs Nagy
Program headers are processed in two pass: after the first pass load segments are mmapped so in the second pass target specific note processing logic can access the notes. The second pass is moved later so various link_map fields are set up that may be useful for note processing such as l_phdr. The second pass should be before the fd is closed so that is available. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-12-11aarch64: align address for BTI protection [BZ #26988]Szabolcs Nagy
Handle unaligned executable load segments (the bfd linker is not expected to produce such binaries, but other linkers may). Computing the mapping bounds follows _dl_map_object_from_fd more closely now. Fixes bug 26988. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-12-11aarch64: Fix missing BTI protection from dependencies [BZ #26926]Szabolcs Nagy
The _dl_open_check and _rtld_main_check hooks are not called on the dependencies of a loaded module, so BTI protection was missed on every module other than the main executable and directly dlopened libraries. The fix just iterates over dependencies to enable BTI. Fixes bug 26926.
2020-12-11Fix linknamespace errors in nss_database.c if build with -Os.Stefan Liebler
Starting with recent commits, I get 43 conform/.../linknamespace FAILs: - nss: Introduce <nss_module.h> - <nss_action.h>: New abstraction for combining NSS modules and NSS actions - nss: Implement <nss_database.h> (see nss/nss_database.c) - nsswitch: use new internal API (core) - nsswitch: user new internal API (tests) - nsswitch: use new internal API (callers) e.g. conform/XPG42/wordexp.h/linknamespace.out [initial] wordexp -> [libc.a(wordexp.o)] __getpwnam_r -> [libc.a(getpwnam_r.o)] __nss_database_custom -> [libc.a(nsswitch.o)] __nss_database_get -> [libc.a(nss_database.o)] feof_unlocked [initial] wordexp -> [libc.a(wordexp.o)] __getpwnam_r -> [libc.a(getpwnam_r.o)] __nss_database_custom -> [libc.a(nsswitch.o)] __nss_database_get -> [libc.a(nss_database.o)] ferror_unlocked This patch is just using __ferror_unlocked and __feof_unlocked instead of the non "__" prefixed ones. Reviewed-by: DJ Delorie <dj@redhat.com>
2020-12-11treewide: fix incorrect spelling of indices in commentsDmitry V. Levin
Replace 'indeces' with 'indices', the most annoying of these typos were those found in elf.h which is a public header file copied to other projects.
2020-12-10linux: Consolidate brk implementationAdhemerval Zanella
It removes all the arch-specific assembly implementation. The outliers are alpha, where its kernel ABI explict return -ENOMEM in case of failure; and i686, where it can't use "call *%gs:SYSINFO_OFFSET" during statup in static PIE. Also some ABIs exports an additional ___brk_addr symbol and to handle it an internal HAVE_INTERNAL_BRK_ADDR_SYMBOL is added. Checked on x86_64-linux-gnu, i686-linux-gnu, adn with builsd for the affected ABIs. Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
2020-12-10elf: Include <sys/param.h> in cache.cFlorian Weimer
The roundup macro is defined there. Relying on an indirect definition is brittle.
2020-12-10s390x: Add glibc-hwcaps supportFlorian Weimer
Subdirectories z13, z14, z15 can be selected, mostly based on the level of support for vector instructions. Co-Authored-By: Stefan Liebler <stli@linux.ibm.com>
2020-12-10elf: Fix run-time dependencies of tst-dlopen-fail-2Florian Weimer
The misattributed dependencies can cause failures in parallel testing if the dependencies have not been built yet. Fixes commit a332bd1518af518c984fad73eba6f46dc5b2b2d4 ("elf: Add elf/tst-dlopenfail-2 [BZ #25396]").
2020-12-10Handle out-of-memory case in svc_tcp.c/svc_unix.c:rendezvous_request.Stefan Liebler
If glibc is build with -O3 on at least 390 (-m31) or x86 (-m32), gcc 11 dumps this warning: svc_tcp.c: In function 'rendezvous_request': svc_tcp.c:274:3: error: 'memcpy' offset [0, 15] is out of the bounds [0, 0] [-Werror=array-bounds] 274 | memcpy (&xprt->xp_raddr, &addr, sizeof (addr)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors In out-of-memory case, if one of the mallocs in makefd_xprt function returns NULL, a message is dumped, makefd_xprt returns NULL and the subsequent memcpy would copy to NULL. Instead of a segfaulting, we delay a bit (see also __svc_accept_failed and Bug 14889 (CVE-2011-4609) - svc_run() produces high cpu usage when accept() fails with EMFILE (CVE-2011-4609). The same applies to svc_unix.c. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-12-09elf: Fix incorrect comparison in sort_priorities_by_nameFlorian Weimer
Reported-By: Stefan Liebler <stli@linux.ibm.com>
2020-12-09S390: Derive float_t from FLT_EVAL_METHODMarius Hillenbrand
float_t supposedly represents the type that is used to evaluate float expressions internally. While the isa supports single-precision float operations, the port of glibc to s390 incorrectly deferred to the generic definitions which, back then, tied float_t to double. gcc by default evaluates float in single precision, so that scenario violates the C standard (sections 5.2.4.2.2 and 7.12 in C11/C17). With -fexcess-precision=standard, gcc evaluates float in double precision, which aligns with the standard yet at the cost of added conversion instructions. With this patch, we drop the s390-specific definition of float_t and defer to the default behavior, which aligns float_t with the compiler-defined FLT_EVAL_METHOD in a standard-compliant way. Checked on s390x-linux-gnu with 31-bit and 64-bit builds.
2020-12-09Fix parsing of /sys/devices/system/cpu/online (bug 25859)Andreas Schwab
The file contains comma-separated ranges, not spaces.
2020-12-08Make strtoimax, strtoumax, wcstoimax, wcstoumax into aliasesJoseph Myers
The functions strtoimax, strtoumax, wcstoimax, wcstoumax currently have three implementations each (wordsize-32, wordsize-64 and dummy implementation in stdlib/ using #error), defining the functions as thin wrappers round corresponding *_internal functions. Simplify the code by changing them into aliases of functions such as strtol and wcstoull. This is more consistent with how e.g. imaxdiv is handled. Tested for x86_64 and x86.
2020-12-08Fixed typos in "NEWS for version 2.32"Paul Zimmermann
2020-12-08Add NEWS entry for CVE-2020-29562 (BZ #26923)Siddhesh Poyarekar
BZ #26923 now has a CVE entry, so add a NEWS entry for it.
2020-12-07iconv: Fix incorrect UCS4 inner loop bounds (BZ#26923)Michael Colavita
Previously, in UCS4 conversion routines we limit the number of characters we examine to the minimum of the number of characters in the input and the number of characters in the output. This is not the correct behavior when __GCONV_IGNORE_ERRORS is set, as we do not consume an output character when we skip a code unit. Instead, track the input and output pointers and terminate the loop when either reaches its limit. This resolves assertion failures when resetting the input buffer in a step of iconv, which assumes that the input will be fully consumed given sufficient output space.
2020-12-06x86: Rename readelflib.cH.J. Lu
Rename linux/i386/readelflib.c to linux/x86/readelflib.c and remove x86_64/readelflib.c.
2020-12-04nsswitch: use new internal API (callers)DJ Delorie
Stitch new ABI and types throughout all NSS callers. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2020-12-04nsswitch: user new internal API (tests)DJ Delorie
Testsuite support and new test for new API. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>