aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-09-30stdlib: Fix __getrandom_nocancel type and arc4random usage (BZ #29638)Adhemerval Zanella
Using an unsigned type prevents the fallback to be used if kernel does not support getrandom syscall. Checked on x86_64-linux-gnu. Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com> (cherry picked from commit 13db9ee2cb3b77e25f852be7d6952882e1be6f00)
2022-09-28get_nscd_addresses: Fix subscript typos [BZ #29605]Jörg Sonnenberger
Fix the subscript on air->family, which was accidentally set to COUNT when it should have remained as I. Resolves: BZ #29605 Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org> (cherry picked from commit c9226c03da0276593a0918eaa9a14835183343e8)
2022-09-21m68k: Enforce 4-byte alignment on internal locks (BZ #29537)Adhemerval Zanella
A new internal definition, __LIBC_LOCK_ALIGNMENT, is used to force the 4-byte alignment only for m68k, other architecture keep the natural alignment of the type used internally (and hppa does not require 16-byte alignment for kernel-assisted CAS). Reviewed-by: Florian Weimer <fweimer@redhat.com> (cherry picked from commit aeb4d2e9815d459e2640a31f5abb8ef803830107)
2022-09-21gconv: Use 64-bit interfaces in gconv_parseconfdir (bug 29583)Florian Weimer
It's possible that inode numbers are outside the 32-bit range. The existing code only handles the in-libc case correctly, and still uses the legacy interfaces when building iconv. Suggested-by: Helge Deller <deller@gmx.de> (cherry picked from commit f97905f24631097af325d6a231093071c3077a5f)
2022-09-20elf: Implement force_first handling in _dl_sort_maps_dfs (bug 28937)Florian Weimer
The implementation in _dl_close_worker requires that the first element of l_initfini is always this very map (“We are always the zeroth entry, and since we don't include ourselves in the dependency analysis start at 1.”). Rather than fixing that assumption, this commit adds an implementation of the force_first argument to the new dependency sorting algorithm. This also means that the directly dlopen'ed shared object is always initialized last, which is the least surprising behavior in the presence of cycles. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> (cherry picked from commit 1df71d32fe5f5905ffd5d100e5e9ca8ad6210891)
2022-09-20elf: Rename _dl_sort_maps parameter from skip to force_firstFlorian Weimer
The new implementation will not be able to skip an arbitrary number of objects. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> (cherry picked from commit dbb75513f5cf9285c77c9e55777c5c35b653f890)
2022-09-20scripts/dso-ordering-test.py: Generate program run-time dependenciesFlorian Weimer
The main program needs to depend on all shared objects, even objects that have link-time dependencies among shared objects. Filtering out shared objects that already have an link-time dependencies is not necessary here; make will do this automatically. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> (cherry picked from commit 183d99737298bb3200f0610fdcd1c7549c8ed560)
2022-09-15elf: Fix hwcaps string size overestimationJavier Pello
Commit dad90d528259b669342757c37dedefa8577e2636 added glibc-hwcaps support for LD_LIBRARY_PATH and, for this, it adjusted the total string size required in _dl_important_hwcaps. However, in doing so it inadvertently altered the calculation of the size required for the power set strings, as the computation of the power set string size depended on the first value assigned to the total variable, which is later shifted, resulting in overallocation of string space. Fix this now by using a different variable to hold the string size required for glibc-hwcaps. Signed-off-by: Javier Pello <devel@otheo.eu> (cherry picked from commit a23820f6052a740246fdc7dcd9c43ce8eed0c45a)
2022-09-13elf: Run tst-audit-tlsdesc, tst-audit-tlsdesc-dlopen everywhereFlorian Weimer
The test is valid for all TLS models, but we want to make a reasonable effort to test the GNU2 model specifically. For example, aarch64 defaults to GNU2, but does not have -mtls-dialect=gnu2, and the test was not run there. Suggested-by: Martin Coufal <mcoufal@redhat.com> (cherry picked from commit dd2315a866a4ac2b838ea1cb10c5ea1c35d51a2f) Fixes early backport commit 924e4f3eaa502ce82fccf8537f021a796d158771 ("elf: Call __libc_early_init for reused namespaces (bug 29528)"); it had a wrong conflict resolution.
2022-09-13NEWS: Note bug 12154 and bug 29305 as fixedFlorian Weimer
2022-09-13resolv: Fix building tst-resolv-invalid-cname for earlier C standardsFlorian Weimer
This fixes this compiler error: tst-resolv-invalid-cname.c: In function ‘test_mode_to_string’: tst-resolv-invalid-cname.c:164:10: error: label at end of compound statement case test_mode_num: ^~~~~~~~~~~~~ Fixes commit 9caf782276ecea4bc86fc94fbb52779736f3106d ("resolv: Add new tst-resolv-invalid-cname"). (cherry picked from commit d09aa4a17229bcaa2ec7642006b12612498582e7)
2022-09-13nss_dns: Rewrite _nss_dns_gethostbyname4_r using current interfacesFlorian Weimer
Introduce struct alloc_buffer to this function, and use it and struct ns_rr_cursor in gaih_getanswer_slice. Adjust gaih_getanswer and gaih_getanswer_noaaaa accordingly. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org> (cherry picked from commit 1d495912a746e2a1ffb780c9a81fd234ec2464e8)
2022-09-13resolv: Add new tst-resolv-invalid-cnameFlorian Weimer
This test checks resolution through CNAME chains that do not contain host names (bug 12154). Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org> (cherry picked from commit 9caf782276ecea4bc86fc94fbb52779736f3106d)
2022-09-13nss_dns: In gaih_getanswer_slice, skip strange aliases (bug 12154)Florian Weimer
If the name is not a host name, skip adding it to the result, instead of reporting query failure. This fixes bug 12154 for getaddrinfo. This commit still keeps the old parsing code, and only adjusts when a host name is copied. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org> (cherry picked from commit 32b599ac8c21c4c332cc3900a792a1395bca79c7)
2022-09-13nss_dns: Rewrite getanswer_r to match getanswer_ptr (bug 12154, bug 29305)Florian Weimer
Allocate the pointer arrays only at the end, when their sizes are known. This addresses bug 29305. Skip over invalid names instead of failing lookups. This partially fixes bug 12154 (for gethostbyname, fixing getaddrinfo requires different changes). Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org> (cherry picked from commit d101d836e7e4bd1d4e4972b0e0bd0a55c9b650fa)
2022-09-13nss_dns: Remove remnants of IPv6 address mappingFlorian Weimer
res_use_inet6 always returns false since commit 3f8b44be0a658266adff5 ("resolv: Remove support for RES_USE_INET6 and the inet6 option"). Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org> (cherry picked from commit a7fc30b522a0cd7c8c5e7e285b9531b704e02f04)
2022-09-13nss_dns: Rewrite _nss_dns_gethostbyaddr2_r and getanswer_ptrFlorian Weimer
The simplification takes advantage of the split from getanswer_r. It fixes various aliases issues, and optimizes NSS buffer usage. The new DNS packet parsing helpers are used, too. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org> (cherry picked from commit e32547d661a43da63368e488b6cfa9c53b4dcf92)
2022-09-13nss_dns: Split getanswer_ptr from getanswer_rFlorian Weimer
And expand the use of name_ok and qtype in getanswer_ptr (the former also in getanswer_r). After further cleanups, not much code will be shared between the two functions. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org> (cherry picked from commit 0dcc43e9981005540bf39dc7bf33fbab62cf9e84)
2022-09-13resolv: Add DNS packet parsing helpers geared towards wire formatFlorian Weimer
The public parser functions around the ns_rr record type produce textual domain names, but usually, this is not what we need while parsing DNS packets within glibc. This commit adds two new helper functions, __ns_rr_cursor_init and __ns_rr_cursor_next, for writing packet parsers, and struct ns_rr_cursor, struct ns_rr_wire as supporting types. In theory, it is possible to avoid copying the owner name into the rname field in __ns_rr_cursor_next, but this would need more functions that work on compressed names. Eventually, __res_context_send could be enhanced to preserve the result of the packet parsing that is necessary for matching the incoming UDP packets, so that this works does not have to be done twice. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org> (cherry picked from commit 857c890d9b42c50c8a94b76d47d4a61ab6d2f49c)
2022-09-13resolv: Add internal __ns_name_length_uncompressed functionFlorian Weimer
This function is useful for checking that the question name is uncompressed (as it should be). Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org> (cherry picked from commit 78b1a4f0e49064e5dfb686c7cd87bd4df2640b29)
2022-09-13resolv: Add the __ns_samebinaryname functionFlorian Weimer
During packet parsing, only the binary name is available. If the name equality check is performed before conversion to text, we can sometimes skip the last step. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org> (cherry picked from commit 394085a34d25a51513019a4dc411acd3527fbd33)
2022-09-13resolv: Add internal __res_binary_hnok functionFlorian Weimer
During package parsing, only the binary representation is available, and it is convenient to check that directly for conformance with host name requirements. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org> (cherry picked from commit c79327bf00a4be6d60259227acc78ef80ead3622)
2022-09-13resolv: Add tst-resolv-aliasesFlorian Weimer
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org> (cherry picked from commit 87aa98aa80627553a66bdcad2701fd6307723645)
2022-09-13resolv: Add tst-resolv-byaddr for testing reverse lookupFlorian Weimer
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org> (cherry picked from commit 0b99828d54e5d1fc8f5ad3edf5ba262ad2e9c5b0)
2022-09-06nscd: Fix netlink cache invalidation if epoll is used [BZ #29415]Fabian Vogt
Processes cache network interface information such as whether IPv4 or IPv6 are enabled. This is only checked again if the "netlink timestamp" provided by nscd changed, which is triggered by netlink socket activity. However, in the epoll handler for the netlink socket, it was missed to assign the new timestamp to the nscd database. The handler for plain poll did that properly, copy that over. This bug caused that e.g. processes which started before network configuration got unusuable addresses from getaddrinfo, like IPv6 only even though only IPv4 is available: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1041 It's a bit hard to reproduce, so I verified this by checking the timestamp on calls to __check_pf manually. Without this patch it's stuck at 1, now it's increasing on network changes as expected. Signed-off-by: Fabian Vogt <fvogt@suse.de> (cherry picked from commit 02ca25fef2785974011e9c5beecc99b900b69fd7)
2022-09-06Add NEWS entry for CVE-2022-39046Siddhesh Poyarekar
(cherry picked from commit 76fe56020e7ef354685b2284580ac1630c078a2b)
2022-09-05syslog: Remove extra whitespace between timestamp and message (BZ#29544)Adhemerval Zanella
The rfc3164 clear states that a single space character must follow the timestamp field. Checked on x86_64-linux-gnu.
2022-08-31elf: Restore how vDSO dependency is printed with LD_TRACE_LOADED_OBJECTS (BZ ↵Adhemerval Zanella
#29539) The d7703d3176d225d5743b21811d888619eba39e82 changed how vDSO like dependencies are printed, instead of just the name and address it follows other libraries mode and prints 'name => path'. Unfortunately, this broke some ldd consumer that uses the output to filter out the program's dependencies. For instance CMake bundleutilities module [1], where GetPrequirite uses the regex to filter out 'name => path' [2]. This patch restore the previous way to print just the name and the mapping address. Checked on x86_64-linux-gnu. [1] https://github.com/Kitware/CMake/tree/master/Tests/BundleUtilities [2] https://github.com/Kitware/CMake/blob/master/Modules/GetPrerequisites.cmake#L733 Reviewed-by: Florian Weimer <fweimer@redhat.com> (cherry picked from commit 1e903124cec4492463d075c6c061a2a772db77bf)
2022-08-31Apply asm redirections in wchar.h before first useRaphael Moreira Zinsly
Similar to d0fa09a770, but for wchar.h. Fixes [BZ #27087] by applying all long double related asm redirections before using functions in bits/wchar2.h. Moves the function declarations from wcsmbs/bits/wchar2.h to a new file wcsmbs/bits/wchar2-decl.h that will be included first in wcsmbs/wchar.h. Tested with build-many-glibcs.py. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> (cherry picked from commit c7509d49c4e8fa494120c5ead21338559dad16f5)
2022-08-30elf: Call __libc_early_init for reused namespaces (bug 29528)Florian Weimer
libc_map is never reset to NULL, neither during dlclose nor on a dlopen call which reuses the namespace structure. As a result, if a namespace is reused, its libc is not initialized properly. The most visible result is a crash in the <ctype.h> functions. To prevent similar bugs on namespace reuse from surfacing, unconditionally initialize the chosen namespace to zero using memset. (cherry picked from commit d0e357ff45a75553dee3b17ed7d303bfa544f6fe)
2022-08-30syslog: Fix large messages (BZ#29536)Adhemerval Zanella
The a583b6add407c17cd change did not handle large messages that would require a heap allocation correctly, where the message itself is not take in consideration. This patch fixes it and extend the tst-syslog to check for large messages as well. Checked on x86_64-linux-gnu. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org> (cherry picked from commit 52a5be0df411ef3ff45c10c7c308cb92993d15b1)
2022-08-24Linux: Fix enum fsconfig_command detection in <sys/mount.h>Florian Weimer
The #ifdef FSOPEN_CLOEXEC check did not work because the macro was always defined in this header prior to the check, so that the <linux/mount.h> contents did not matter. Fixes commit 774058d72942249f71d74e7f2b639f77184160a6 ("linux: Fix sys/mount.h usage with kernel headers"). (cherry picked from commit 2955ef4b7c9b56fcd7abfeddef7ee83c60abff98)
2022-08-24linux: Fix sys/mount.h usage with kernel headersAdhemerval Zanella
Now that kernel exports linux/mount.h and includes it on linux/fs.h, its definitions might clash with glibc exports sys/mount.h. To avoid the need to rearrange the Linux header to be always after glibc one, the glibc sys/mount.h is changed to: 1. Undefine the macros also used as enum constants. This covers prior inclusion of <linux/mount.h> (for instance MS_RDONLY). 2. Include <linux/mount.h> based on the usual __has_include check (needs to use __has_include ("linux/mount.h") to paper over GCC bugs. 3. Define enum fsconfig_command only if FSOPEN_CLOEXEC is not defined. (FSOPEN_CLOEXEC should be a very close proxy.) 4. Define struct mount_attr if MOUNT_ATTR_SIZE_VER0 is not defined. (Added in the same commit on the Linux side.) This patch also adds some tests to check if including linux/fs.h and linux/mount.h after and before sys/mount.h does work. Checked on x86_64-linux-gnu. Reviewed-by: Florian Weimer <fweimer@redhat.com> (cherry picked from commit 774058d72942249f71d74e7f2b639f77184160a6)
2022-08-24linux: Use compile_c_snippet to check linux/mount.h availabilityAdhemerval Zanella
Checked on x86_64-linux-gnu. Reviewed-by: Florian Weimer <fweimer@redhat.com> (cherry picked from commit e1226cdc6b209539a92d32d5b620ba53fd35abf3)
2022-08-24linux: Mimic kernel defition for BLOCK_SIZEAdhemerval Zanella
To avoid possible warnings if the kernel header is included before sys/mount.h. Reviewed-by: Florian Weimer <fweimer@redhat.com> (cherry picked from commit c68b6044bc7945716431f1adc091b17c39b80a06)
2022-08-24linux: Use compile_c_snippet to check linux/pidfd.h availabilityAdhemerval Zanella
Instead of tying to a specific kernel version. Checked on x86_64-linux-gnu. Reviewed-by: Florian Weimer <fweimer@redhat.com> (cherry picked from commit 1542019b69b7ec7b2cd34357af035e406d153631)
2022-08-24glibcextract.py: Add compile_c_snippetAdhemerval Zanella
It might be used on tests to check if a snippet build with the provided compiler and flags. Reviewed-by: Florian Weimer <fweimer@redhat.com> (cherry picked from commit 841afa116e32b3c7195475769c26bf46fd870d32)
2022-08-22NEWS: Add entry for bug 28846Arjun Shankar
2022-08-22socket: Check lengths before advancing pointer in CMSG_NXTHDRArjun Shankar
The inline and library functions that the CMSG_NXTHDR macro may expand to increment the pointer to the header before checking the stride of the increment against available space. Since C only allows incrementing pointers to one past the end of an array, the increment must be done after a length check. This commit fixes that and includes a regression test for CMSG_FIRSTHDR and CMSG_NXTHDR. The Linux, Hurd, and generic headers are all changed. Tested on Linux on armv7hl, i686, x86_64, aarch64, ppc64le, and s390x. [BZ #28846] Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org> (cherry picked from commit 9c443ac4559a47ed99859bd80d14dc4b6dd220a1)
2022-08-22alpha: Fix generic brk system call emulation in __brk_call (bug 29490)Florian Weimer
The kernel special-cases the zero argument for alpha brk, and we can use that to restore the generic Linux error handling behavior. Fixes commit b57ab258c1140bc45464b4b9908713e3e0ee35aa ("Linux: Introduce __brk_call for invoking the brk system call"). (cherry picked from commit e7ad26ee3cb74e61d0637c888f24dd478d77af58)
2022-08-16Linux: Terminate subprocess on late failure in tst-pidfd (bug 29485)Florian Weimer
Reviewed-by: Carlos O'Donell <carlos@redhat.com> (cherry picked from commit f82e05ebb295cadd35f7372f652c72264da810ad)
2022-08-11elf: Replace `strcpy` call with `memcpy` [BZ #29454]Noah Goldstein
GCC normally does this optimization for us in strlen_pass::handle_builtin_strcpy but only for optimized build. To avoid needing to include strcpy.S in the rtld build to support the debug build, just do the optimization by hand. (cherry picked from commit 483cfe1a6a33d6335b1901581b41040d2d412511)
2022-08-05Update syscall lists for Linux 5.19Joseph Myers
Linux 5.19 has no new syscalls, but enables memfd_secret in the uapi headers for RISC-V. Update the version number in syscall-names.list to reflect that it is still current for 5.19 and regenerate the arch-syscall.h headers with build-many-glibcs.py update-syscalls. Tested with build-many-glibcs.py. (cherry picked from commit fccadcdf5bed7ee67a6cef4714e0b477d6c8472c)
2022-08-04dlfcn: Pass caller pointer to static dlopen implementation (bug 29446)Florian Weimer
Fixes commit 0c1c3a771eceec46e66ce1183cf988e2303bd373 ("dlfcn: Move dlopen into libc"). (cherry picked from commit ed0185e4129130cbe081c221efb758fb400623ce)
2022-08-01wcsmbs: Add missing test-c8rtomb/test-mbrtoc8 dependencyH.J. Lu
Make test-c8rtomb.out and test-mbrtoc8.out depend on $(gen-locales) for xsetlocale (LC_ALL, "de_DE.UTF-8"); xsetlocale (LC_ALL, "zh_HK.BIG5-HKSCS"); Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com> (cherry picked from commit e03f5ccd6cc8f829416156eac75acee501626c1f)
2022-08-01stdlib: Suppress gcc diagnostic that char8_t is a keyword in C++20 in uchar.h.Tom Honermann
gcc 13 issues the following diagnostic for the uchar.h header when the -Wc++20-compat option is enabled in C++ modes that do not enable char8_t as a builtin type (C++17 and earlier by default; subject to _GNU_SOURCE and the gcc -f[no-]char8_t option). warning: identifier ‘char8_t’ is a keyword in C++20 [-Wc++20-compat] This change modifies the uchar.h header to suppress the diagnostic through the use of '#pragma GCC diagnostic' directives for gcc 10 and later (the -Wc++20-compat option was added in gcc version 10). Unfortunately, a bug in gcc currently prevents those directives from having the intended effect as reported at https://gcc.gnu.org/PR106423. A patch for that issue has been submitted and is available in the email thread archive linked below. https://gcc.gnu.org/pipermail/gcc-patches/2022-July/598736.html (cherry picked from commit 825f84f133bd840347dc49229b6d831f07d04775)
2022-07-29Create ChangeLog.old/ChangeLog.25.glibc-2.36Carlos O'Donell
2022-07-29Prepare for glibc 2.36 release.Carlos O'Donell
Update version.h, and include/features.h.
2022-07-29Update install.texi, and regenerate INSTALL.Carlos O'Donell
2022-07-29Update NEWS bug list.Carlos O'Donell