aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-08-30resolv: Fix building tst-resolv-invalid-cname for earlier C standardsFlorian Weimer1-1/+1
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").
2022-08-30syslog: Fix large messages (BZ#29536)Adhemerval Zanella2-28/+142
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>
2022-08-30posix: Fix macro expansion producing 'defined' has undefined behaviorAdhemerval Zanella1-3/+7
The NEED_CHECK_SPEC is defined as: #define NEED_CHECK_SPEC \ (!defined _XBS5_ILP32_OFF32 || !defined _XBS5_ILP32_OFFBIG \ || !defined _XBS5_LP64_OFF64 || !defined _XBS5_LPBIG_OFFBIG \ || !defined _POSIX_V6_ILP32_OFF32 || !defined _POSIX_V6_ILP32_OFFBIG \ || !defined _POSIX_V6_LP64_OFF64 || !defined _POSIX_V6_LPBIG_OFFBIG \ || !defined _POSIX_V7_ILP32_OFF32 || !defined _POSIX_V7_ILP32_OFFBIG \ || !defined _POSIX_V7_LP64_OFF64 || !defined _POSIX_V7_LPBIG_OFFBIG) Which is undefined behavior accordingly to C Standard (Preprocessing directives, p4). Checked on x86_64-linux-gnu.
2022-08-30stdlib: Fix macro expansion producing 'defined' has undefined behaviorAdhemerval Zanella1-3/+6
The FPIOCONST_HAVE_EXTENDED_RANGE is defined as: #define FPIOCONST_HAVE_EXTENDED_RANGE \ ((!defined __NO_LONG_DOUBLE_MATH && __LDBL_MAX_EXP__ > 1024) \ || __HAVE_DISTINCT_FLOAT128) Which is undefined behavior accordingly to C Standard (Preprocessing directives, p4). Checked on x86_64-linux-gnu.
2022-08-30S390: Always use svc 0Stefan Liebler13-66/+46
On s390x syscalls are triggered by svc instruction. One can pass the syscall number encoded in the instruction "svc 123" or by storing it in r1: lghi r1,123 svc 0 If the syscall number is encoded in the instruction, this can cause broken syscall restarts. Therefore this patch is now just passing the syscall number in r1. See also kernel-commit: "s390/signal: switch to using vdso for sigreturn and syscall restart" https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/arch/s390/[%e2%80%a6]call.c?h=v6.0-rc1&id=df29a7440c4b5c65765c8f60396b3b13063e24e9 As information, the "svc 0" feature was introduced in kernel 2.5.62: commit b5aad611393ef2e132e3648fa4c6e56a9cfa8708
2022-08-30nss_dns: Rewrite _nss_dns_gethostbyname4_r using current interfacesFlorian Weimer1-281/+162
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>
2022-08-30resolv: Add new tst-resolv-invalid-cnameFlorian Weimer2-0/+409
This test checks resolution through CNAME chains that do not contain host names (bug 12154). Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2022-08-30nss_dns: In gaih_getanswer_slice, skip strange aliases (bug 12154)Florian Weimer1-4/+4
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>
2022-08-30nss_dns: Rewrite getanswer_r to match getanswer_ptr (bug 12154, bug 29305)Florian Weimer1-298/+180
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>
2022-08-30nss_dns: Remove remnants of IPv6 address mappingFlorian Weimer4-201/+9
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>
2022-08-30nss_dns: Rewrite _nss_dns_gethostbyaddr2_r and getanswer_ptrFlorian Weimer1-303/+102
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>
2022-08-30nss_dns: Split getanswer_ptr from getanswer_rFlorian Weimer1-52/+268
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>
2022-08-30resolv: Add DNS packet parsing helpers geared towards wire formatFlorian Weimer5-0/+461
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>
2022-08-30resolv: Add internal __ns_name_length_uncompressed functionFlorian Weimer4-0/+220
This function is useful for checking that the question name is uncompressed (as it should be). Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2022-08-30resolv: Add the __ns_samebinaryname functionFlorian Weimer4-0/+128
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>
2022-08-30resolv: Add internal __res_binary_hnok functionFlorian Weimer2-5/+12
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>
2022-08-30resolv: Add tst-resolv-aliasesFlorian Weimer2-0/+256
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2022-08-30resolv: Add tst-resolv-byaddr for testing reverse lookupFlorian Weimer3-0/+360
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2022-08-30LoongArch: Use __builtin_{fmax,fmaxf,fmin,fminf} with GCC >= 13Xi Ruoyao2-0/+20
GCC 13 compiles these built-ins to {fmax,fmin}.{s/d} instruction, use them instead of the generic implementation. Link: https://gcc.gnu.org/r13-2085 Signed-off-by: Xi Ruoyao <xry111@xry111.site>
2022-08-30LoongArch: Fix ptr mangling/demangling features.caiyinyu3-19/+18
2022-08-29nscd: Fix netlink cache invalidation if epoll is used [BZ #29415]Fabian Vogt1-1/+2
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>
2022-08-29Add test for bug 29530Andreas Schwab2-0/+41
This tests for a bug that was introduced in commit edc1686af0 ("vfprintf: Reuse work_buffer in group_number") and fixed as a side effect of commit 6caddd34bd ("Remove most vfprintf width/precision-dependent allocations (bug 14231, bug 26211).").
2022-08-29Makeconfig: Set pie-ccflag to -fPIE by default [BZ# 29514]Richard Henderson2-4/+1
We should default to the larger code model, in order to support larger applications built with -static -pie. This should be consistent with pic-ccflag, which defaults to -fPIC. Remove the now redundant override from sysdeps/sparc/Makefile. Note that -fno-pie and -fno-PIE have the same effect. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2022-08-29hurd: Fix vm_size_t incoherenciesSamuel Thibault12-14/+18
In gnumach, 3e1702a65fb3 ("add rpc_versions for vm types") changed the type of vm_size_t, making it always a unsigned long. This made it incompatible on x86 with size_t. Even if we may want to revert it to unsigned int, it's better to fix the types of parameters according to the .defs files.
2022-08-27mach: Make xpg_strerror_r set a message on errorSamuel Thibault1-6/+10
posix advises to have strerror_r fill a message even when we are returning an error. This makes mach's xpg_strerror_r do this, like the generic version does. Spotted by the libunistring testsuite test-strerror_r
2022-08-27mach: Fix incoherency between perror and strerrorSamuel Thibault1-1/+1
08d2024b4167 ("string: Simplify strerror_r") inadvertently made __strerror_r print unknown error system in decimal while the original code was printing it in hexadecimal. perror was kept printing in hexadecimal in 725eeb4af14c ("string: Use tls-internal on strerror_l"), let us keep both coherent. This also fixes a duplicate ':' Spotted by the libunistring testsuite test-perror2
2022-08-26elf: Call __libc_early_init for reused namespaces (bug 29528)Florian Weimer5-5/+136
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.
2022-08-26csu: Change start code license to have link exceptionSzabolcs Nagy4-10/+76
The start code can get linked into dynamic linked executables where LGPL would require shipping the source or linkable binaries when the executable is distributed. On some targets the license exception was missing in start.S (which is compiled into crt1.o and Scrt1.o which may end up linked into PDE and PIE binaries). I did not review what other code may end up in executables, just fixed the start.S license inconsistency across targets. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2022-08-25s390: Move hwcaps/platform names out of _rtld_global_roFlorian Weimer5-64/+44
Changes to these arrays are often backported to stable releases, but additions to these arrays shift the offsets of the following _rltd_global_ro members, thus breaking the GLIBC_PRIVATE ABI. Obviously, this change is itself an internal ABI break, but at least it will avoid further ABI breaks going forward. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2022-08-25Revert "Detect ld.so and libc.so version inconsistency during startup"Florian Weimer17-198/+45
This reverts commit 6f85dbf102ad7982409ba0fe96886caeb6389fef. Once this change hits the release branches, it will require relinking of all statically linked applications before static dlopen works again, for the majority of updates on release branches: The NEWS file is regularly updated with bug references, so the __libc_early_init suffix changes, and static dlopen cannot find the function anymore. While this ABI check is still technically correct (we do require rebuilding & relinking after glibc updates to keep static dlopen working), it is too drastic for stable release branches. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2022-08-24Add NT_LOONGARCH_* from Linux 5.19 to elf.hJoseph Myers1-0/+9
Add the new NT_LOONGARCH_* constants from Linux 5.19 to glibc's elf.h. Tested for x86_64.
2022-08-24Detect ld.so and libc.so version inconsistency during startupFlorian Weimer17-45/+198
The files NEWS, include/link.h, and sysdeps/generic/ldsodefs.h contribute to the version fingerprint used for detection. The fingerprint can be further refined using the --with-extra-version-id configure argument. _dl_call_libc_early_init is replaced with _dl_lookup_libc_early_init. The new function is used store a pointer to libc.so's __libc_early_init function in the libc_map_early_init member of the ld.so namespace structure. This function pointer can then be called directly, so the separate invocation function is no longer needed. The versioned symbol lookup needs the symbol versioning data structures, so the initialization of libc_map and libc_map_early_init is now done from _dl_check_map_versions, after this information becomes available. (_dl_map_object_from_fd does not set this up in time, so the initialization code had to be moved from there.) This means that the separate initialization code can be removed from dl_main because _dl_check_map_versions covers all maps, including the initial executable loaded by the kernel. The lookup still happens before relocation and the invocation of IFUNC resolvers, so IFUNC resolvers are protected from ABI mismatch. The __libc_early_init function pointer is not protected because so little code runs between the pointer write and the invocation (only dynamic linker code and IFUNC resolvers). Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2022-08-23Merge getopt patch from GnulibPaul Eggert1-1/+2
* posix/getopt.c [!_LIBC]: Merge _WIN32 patch from Gnulib so that these source files are identical. This makes no difference for glibc.
2022-08-23Merge _GL_UNUSED C23 patch from GnulibPaul Eggert2-4/+4
* posix/getopt.c (_getopt_initialize): * sysdeps/posix/tempname.c (try_dir, try_nocreate): Put _GL_UNUSED before args instead of after. This makes no difference for glibc. It is needed for Gnulib when being compiled on non-GCC C23 compilers.
2022-08-24LoongArch: Fix dl-machine.h code formatting.Xi Ruoyao1-8/+4
No functional change.
2022-08-23scripts/glibcelf.py: Add hashing supportFlorian Weimer2-0/+38
ELF and GNU hashes can now be computed using the elf_hash and gnu_hash functions. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2022-08-22hurd: Fix starting static binaries with stack protection enabledSamuel Thibault2-2/+22
gcc introduces gs:0x14 accesses in most functions, so we need some tcbhead to be ready very early during initialization. This configures a static area which can be referenced by various protected functions, until proper TLS is set up.
2022-08-22htl: Make pthread*_cond_timedwait register wref before releasing mutexSamuel Thibault2-8/+12
Otherwise another thread could be rightly trying to destroy the condition, see e.g. tst-cond20.
2022-08-22htl: make __pthread_hurd_cond_timedwait_internal check mutex is heldSamuel Thibault1-0/+4
Like __pthread_cond_timedwait_internal already does.
2022-08-22Add AArch64 HWCAP2_* constants from Linux 5.19Joseph Myers1-0/+9
Linux 5.19 adds more HWCAP2_* values for AArch64; add these to its bits/hwcap.h header in glibc. Tested with build-many-glibcs.py for aarch64-linux-gnu.
2022-08-22Add AGROUP from Linux 5.19 to sys/acct.h, remove Alpha version (bug 29502)Joseph Myers2-64/+3
Linux 5.19 adds a new accounting flag AGROUP; add it to the enumeration in sys/acct.h. This shows up that the Alpha-specific variant of this header has a different set of constants and struct acct, which appear to be the constants and structure layout from Linux 2.0. These were changed some time between Linux 2.0 and Linux 2.2; I see no evidence of an Alpha-specific layout or set of constants, but haven't checked the detailed Linux kernel history between those versions. Rather, it looks like tha Alpha-specific header was originally needed because of the use of types in the kernel structure (such as uid_t and gid_t) that had different sizes on Alpha, and when glibc was updated for changes to the structure and constants in the kernel 1998-10-02 Andreas Jaeger <aj@arthur.rhein-neckar.de> * sysdeps/unix/sysv/linux/sys/acct.h: Bring in sync with current linux 2.1 version. that simply omitted to do anything about the Alpha version. Thus, remove the Alpha version in order to get the updated definitions into use on Alpha, as I don't think the interfaces are actually different for Alpha with any kernel version supported by glibc. Tested for x86_64, and with build-many-glibcs.py for alpha-linux-gnu.
2022-08-22alpha: Fix generic brk system call emulation in __brk_call (bug 29490)Florian Weimer1-4/+3
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").
2022-08-19hurd: Assume non-suid during bootstrapSamuel Thibault1-2/+7
We do not have a hurd data block only when bootstrapping the system, in which case we don't have a notion of suid yet anyway. This is needed, otherwise init_standard_fds would check that standard file descriptors are allocated, which is meaningless during bootstrap.
2022-08-18Use binutils 2.39 branch in build-many-glibcs.pyJoseph Myers1-1/+1
This patch makes build-many-glibcs.py use binutils 2.39 branch. Tested with build-many-glibcs.py (compilers and glibcs builds). Note: binutils 2.39 shows the same failures for i686-linux-gnu-no-pie, x86_64-linux-gnu-no-pie and x86_64-linux-gnu-x32-no-pie building the glibc testsuite as binutils mainline does.
2022-08-18S390: Fix werror=unused-variable in ifunc-impl-list.c.Stefan Liebler1-1/+3
If the architecture level set is high enough, no IFUNCs are used at all and the variable i would be unused. Then the build fails with: ../sysdeps/s390/multiarch/ifunc-impl-list.c: In function ‘__libc_ifunc_impl_list’: ../sysdeps/s390/multiarch/ifunc-impl-list.c:76:10: error: unused variable ‘i’ [-Werror=unused-variable] 76 | size_t i = max; | ^ cc1: all warnings being treated as errors
2022-08-18Ensure calculations happen with desired rounding mode in y1lf128Michael Hudson-Doyle1-0/+3
math/test-float128-y1 fails on x86_64 and ppc64el with gcc 12 and -O3, because code inside a block guarded by SET_RESTORE_ROUNDL is being moved after the rounding mode has been restored. Use math_force_eval to prevent this (and insert some math_opt_barrier calls to prevent code from being moved before the rounding mode is set). Fixes #29463 Reviewed-By: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2022-08-17localedata: Convert French language locales (fr_*) to UTF-8Florian Weimer5-47/+47
2022-08-16Linux: Fix enum fsconfig_command detection in <sys/mount.h>Florian Weimer1-3/+3
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").
2022-08-16elf: Run tst-audit-tlsdesc, tst-audit-tlsdesc-dlopen everywhereFlorian Weimer1-16/+24
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>
2022-08-15Move ip_mreqn structure from Linux to genericSamuel Thibault2-8/+13
I.e. from sysdeps/unix/sysv/linux/bits/in.h to netinet/in.h It is following both the BSD and Linux definitions. Reviewed-by: Florian Weimer <fweimer@redhat.com>