aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-10-27aarch64: morello: Add purecap abi-variants on linuxSzabolcs Nagy
2022-10-27aarch64: morello: configure change for purecap abiSzabolcs Nagy
Detect default-abi and add aarch64-purecap make variable. Purecap abi sets HIDDEN_VAR_NEEDS_DYNAMIC_RELOC and unsets SUPPORT_STATIC_PIE.
2022-10-27aarch64: morello: Use separate lp64 and morello sysdep directoriesSzabolcs Nagy
Provide separate directories for lp64 and purecap abi related sysdep functionality. purecap may be better name than morello, but we started with morello and that is more future compatible with alternative cheri-like extensions on top of aarch64.
2022-10-27aarch64: morello: add purecap support to build-many-glibcs.pySzabolcs Nagy
aarch64-linux-gnu compiler is a lp64,purecap multilib gcc and supported glibc variants: aarch64-linux-gnu aarch64-linux-gnu-purecap aarch64-linux-gnu-purecap-nopie aarch64-linux-gnu_purecap compiler is a default purecap gcc, with supported glibc variants: aarch64-linux-gnu_purecap aarch64-linux-gnu_purecap-nopie purecap libgomp and libitm builds fail so disabled for now.
2022-10-27aarch64: Use fewer ifdefs in bits/fcntl.hSzabolcs Nagy
This simplifies adding the Morello purecap abi target.
2022-10-27aarch64: cleanup MOVL definition in sysdep.hSzabolcs Nagy
PTR_REG is for ILP32, there is no point using it under __LP64__.
2022-10-27libio: adjust _IO_FILE / _IO_FILE_complete for 128 bit pointersSzabolcs Nagy
The size of the reserved space has to be adjusted because it underflows with 16 byte pointers. With the new value there should be enough space for 2 more pointers in the struct on CHERI targets.
2022-10-27static: glibc-bug: NL_CURRENT_INDIRECT is broken so disable itSzabolcs Nagy
nl_langinfo_l ignores its locale argument with NL_CURRENT_INDIRECT which is wrong when that argument does not match the current thread's locale. upstream glibc is not tested with static linking so this is not found.
2022-10-27cheri: Fix elf/tst-dlmodcount testSzabolcs Nagy
switch statement does not work for intptr_t, use a large int type that's guaranteed to work.
2022-10-27Fix stdlib/test-dlclose-exit-race to not hangSzabolcs Nagy
Use the standard wrapper that kills the test after a timeout.
2022-10-27Fix resource/bug-ulimit1 testSzabolcs Nagy
ulimit is a variadic function and the second argument must have type long (or unsigned long).
2022-10-27Fix elf/tst-dlmopen-twice to support enough link namespacesSzabolcs Nagy
The test dlmopens 10 namespaces recursively, which requires a glibc tunable setting, otherwise it may run out of static TLS.
2022-10-27Fix missing NUL terminator in stdio-common/scanf13 testSzabolcs Nagy
sscanf is only defined on nul terminated string input, but '\0' was missing in this test which caused _IO_str_init_static_internal to read OOB on the stack when computing the bounds of the string.
2022-10-27Fix malloc/tst-scratch_buffer OOB accessSzabolcs Nagy
The test used scratch_buffer_dupfree incorrectly: - The passed in size must be <= buf.length. - Must be called at most once on a buf object since it frees it. - After it is called buf.data and buf.length must not be accessed. All of these were violated, the test happened to work because the buffer was on the stack, which meant the test copied out-of-bounds bytes from the stack into a new buffer and then compared those bytes. Run one test and avoid the issues above.
2022-10-27Fix off-by-one OOB read in elf/tst-tls20Szabolcs Nagy
The int mods[nmods] array on the stack was overread by one.
2022-10-27Fix off-by-one OOB write in iconv/tst-iconv-mtSzabolcs Nagy
The iconv buffer sizes must not include the \0 string terminator. When \0 cannot be part of a valid character encoding glibc iconv would copy it to the output as expected, but then later the explicit output termination with *outbufpos = '\0' is out of bounds.
2022-10-27Use uintptr_t in string/tester for pointer alignmentSzabolcs Nagy
The code assumed unsigned long can represent pointers.
2022-10-27Fix the symbolic link of multilib dirsSzabolcs Nagy
If dir contains several / then "ln -s . $dir" does not link it to the current directory. Use the existing rellns.sh script to compute the correct relative path to .
2022-10-27elf: Fix alloca size in _dl_debug_vdprintfSzabolcs Nagy
The alloca size did not consider the optional width parameter for padding which could cause buffer underflow. The width is currently used e.g. by _dl_map_object_from_fd which passes 2 * sizeof(void *) which can be larger than the alloca buffer size on targets where sizeof(void *) >= 2 * sizeof(unsigned long). Even if large width is not used on existing targets it is better to fix the formatting code to avoid surprises.
2022-10-27malloc: Fix alignment logic in obstackSzabolcs Nagy
If sizeof(ptrdiff_t) < sizeof(void*) the alignment logic was wrong: incorrectly assumed that base was already sufficiently aligned. Use more robust alignment logic: this one should work on any target. Note: this is an installed header so it must be namespace clean and portable hence it uses unsigned long for the alignment offset.
2022-10-27malloc: Use uintptr_t in alloc_bufferSzabolcs Nagy
The values represnt pointers and not sizes. The members of struct alloc_buffer are already uintptr_t.
2022-10-27malloc: Use uintptr_t for pointer alignmentCarlos Eduardo Seo
Avoid integer casts that assume unsigned long can represent pointers.
2022-10-27Use uintptr_t in fts for pointer alignmentSzabolcs Nagy
The code assumed unsigned long can represent pointers.
2022-10-27Fix invalid pointer dereference in wcpcpy_chkSzabolcs Nagy
The src pointer is const and points to a different object, so accessing dest via src is invalid.
2022-10-27Fix invalid pointer dereference in wcscpy_chkSzabolcs Nagy
The src pointer is const and points to a different object, so accessing dest via src is invalid.
2022-10-27aarch64: Fix the extension header write in getcontext and swapcontextSzabolcs Nagy
The extension header is two 32bit words and in the last header both should be 0. There is plenty space in the __reserved area, but it's better not to write more than we mean to.
2022-10-27aarch64: Don't build wordcopySzabolcs Nagy
Use an empty wordcopy.c to avoid building the generic one. It does not seem to be used anywhere.
2022-10-27scripts: Use bool in tunables initializerSzabolcs Nagy
The initializer for a tunable_t set the bool initialized flag to NULL. This causes a build failure when pointer to bool conversion warns.
2022-10-27Fix OOB read in stdlib thousand grouping parsing [BZ #29727]Szabolcs Nagy
__correctly_grouped_prefixmb only worked with thousands_len == 1, otherwise it read past the end of cp or thousands. This affects scanf formats like %'d, %'f and the internal but exposed __strto{l,ul,f,d,..}_internal with grouping flag set and an LC_NUMERIC locale where thousands_len > 1. Avoid OOB access by considering thousands_len when initializing cp. This fixes bug 29727. Found by the morello port with strict bounds checking where FAIL: stdlib/tst-strtod4 FAIL: stdlib/tst-strtod5i crashed using a locale with thousands_len==3.
2022-10-26math: Fix asin and acos invalid exception with old gccSzabolcs Nagy
This works around a gcc issue where it const folded inf/inf into nan, preventing the invalid exception to be signalled. (x-x)/(x-x) is more robust against optimizations and works for all out of bounds values including x==nan. The gcc issue https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95115 should be fixed on release branches starting from gcc-10, but it is better to change the code in case glibc is built with older gcc.
2022-10-26elf: Reinstate on DL_DEBUG_BINDINGS _dl_lookup_symbol_xAdhemerval Zanella
The prelink removal done by 6628c742b2c16e wrongly removed the debug support. Checked on x86_64-linux-gnu. (cherry picked from commit 891a7958a28eac6d4af1517dd2896fef5e4951d4)
2022-10-25linux: Fix generic struct_stat for 64 bit time (BZ# 29657)Adhemerval Zanella
The generic Linux struct_stat misses the conditionals to use bits/struct_stat_time64_helper.h in the __USE_TIME_BITS64 for architecture that uses __TIMESIZE == 32 (currently csky and nios2). Since newer ports should not support 32 bit time_t, the generic implementation should be used as default. For arm, hppa, and sh a copy of default struct_stat is added, while for csky and nios a new one based on generic is used, along with conditionals to use bits/struct_stat_time64_helper.h. The default struct_stat is also replaced with the generic one. Checked on aarch64-linux-gnu and arm-linux-gnueabihf. (cherry picked from commit 7a6ca82f8007ddbd43e2b8fce806ba7101ee47f5)
2022-10-24Avoid undefined behaviour in ibm128 implementation of llroundl (BZ #29488)Aurelien Jarno
Detecting an overflow edge case depended on signed overflow of a long long. Replace the additions and the overflow checks by __builtin_add_overflow(). Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com> (cherry picked from commit 2b5478569e72ee4820a6e163d306690c9c0eaf5e)
2022-10-24Fix BZ #29463 in the ibm128 implementation of y1l tooMichael Hudson-Doyle
Avoid moving code across SET_RESTORE_ROUNDL in order to fix [BZ #29463]. Tested-by: Aurelien Jarno <aurelien@aurel32.net> Reviewed-by: Aurelien Jarno <aurelien@aurel32.net> Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com> (cherry picked from commit b6e37b7805b0182c3e25cdab39ebf5f001c04d05)
2022-10-14elf: Do not completely clear reused namespace in dlmopen (bug 29600)Florian Weimer
The data in the _ns_debug member must be preserved, otherwise _dl_debug_initialize enters an infinite loop. To be conservative, only clear the libc_map member for now, to fix bug 29528. Fixes commit d0e357ff45a75553dee3b17ed7d303bfa544f6fe ("elf: Call __libc_early_init for reused namespaces (bug 29528)"), by reverting most of it. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com> (cherry picked from commit 2c42257314536b94cc8d52edede86e94e98c1436)
2022-10-13nss: Use shared prefix in IPv4 address in tst-reload1Florian Weimer
Otherwise, sorting based on the longest-matching prefix in getaddrinfo can reorder the addresses in ways the test does not expect, depending on the IPv4 address of the host. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org> (cherry picked from commit c02e29a0ba47d636281e1a026444a1a0a254aa12)
2022-10-13nss: Fix tst-nss-files-hosts-long on single-stack hosts (bug 24816)Florian Weimer
getent implicitly passes AI_ADDRCONFIG to getaddrinfo by default. Use --no-addrconfig to suppress that, so that both IPv4 and IPv6 lookups succeed even if the address family is not supported by the host. Reviewed-by: Carlos O'Donell <carlos@redhat.com> (cherry picked from commit c75d20b5b27b0a60f0678236f51a4d3b0b058c00)
2022-10-13nss: Implement --no-addrconfig option for getentFlorian Weimer
The ahosts, ahostsv4, ahostsv6 commands unconditionally pass AI_ADDRCONFIG to getaddrinfo, which is not always desired. Reviewed-by: Carlos O'Donell <carlos@redhat.com> (cherry picked from commit a623f13adfac47c8634a7288e08f821a846bc650)
2022-10-09Ensure calculations happen with desired rounding mode in y1lf128Michael Hudson-Doyle
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> (cherry picked from commit 2b274fd8c9c776cf70fcdb8356e678ada522a7b0)
2022-10-04nscd: Drop local address tuple variable [BZ #29607]Siddhesh Poyarekar
When a request needs to be resent (e.g. due to insufficient buffer space), the references to subsequent tuples in the local variable are stale and should not be used. This used to work by accident before, but since 1d495912a it no longer does. Instead of trying to reset it, just let gethostbyname4_r write into TUMPBUF6 for us, thus maintaining a consistent state at all times. This is now consistent with what is done in gaih_inet for getaddrinfo. Resolves: BZ #29607 Reported-by: Holger Hoffstätte <holger@applied-asynchrony.com> Tested-by: Holger Hoffstätte <holger@applied-asynchrony.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com> (cherry picked from commit 6e33e5c4b73cea7b8aa3de0947123db16200fb65)
2022-10-03x86-64: Require BMI1/BMI2 for AVX2 strrchr and wcsrchr implementationsAurelien Jarno
The AVX2 strrchr and wcsrchr implementation uses the 'blsmsk' instruction which belongs to the BMI1 CPU feature and the 'shrx' instruction, which belongs to the BMI2 CPU feature. Fixes: df7e295d18ff ("x86: Optimize {str|wcs}rchr-avx2") Partially resolves: BZ #29611 Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com> (cherry picked from commit 7e8283170c5d6805b609a040801d819e362a6292)
2022-10-03x86-64: Require BMI2 and LZCNT for AVX2 memrchr implementationAurelien Jarno
The AVX2 memrchr implementation uses the 'shlxl' instruction, which belongs to the BMI2 CPU feature and uses the 'lzcnt' instruction, which belongs to the LZCNT CPU feature. Fixes: af5306a735eb ("x86: Optimize memrchr-avx2.S") Partially resolves: BZ #29611 Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com> (cherry picked from commit 3c0c78afabfed4b6fc161c159e628fbf14ff370b)
2022-10-03x86-64: Require BMI2 for AVX2 (raw|w)memchr implementationsAurelien Jarno
The AVX2 memchr, rawmemchr and wmemchr implementations use the 'bzhi' and 'sarx' instructions, which belongs to the BMI2 CPU feature. Fixes: acfd088a1963 ("x86: Optimize memchr-avx2.S") Partially resolves: BZ #29611 Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com> (cherry picked from commit e3e7fab7fe5186d18ca2046d99ba321c27db30ad)
2022-10-03x86-64: Require BMI2 for AVX2 wcs(n)cmp implementationsAurelien Jarno
The AVX2 wcs(n)cmp implementations use the 'bzhi' instruction, which belongs to the BMI2 CPU feature. NB: It also uses the 'tzcnt' BMI1 instruction, but it is executed as BSF as BSF if the CPU doesn't support TZCNT, and produces the same result for non-zero input. Partially fixes: b77b06e0e296 ("x86: Optimize strcmp-avx2.S") Partially resolves: BZ #29611 Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com> (cherry picked from commit f31a5a884ed84bd37032729d4d1eb9d06c9f3c29)
2022-10-03x86-64: Require BMI2 for AVX2 strncmp implementationAurelien Jarno
The AVX2 strncmp implementations uses the 'bzhi' instruction, which belongs to the BMI2 CPU feature. NB: It also uses the 'tzcnt' BMI1 instruction, but it is executed as BSF as BSF if the CPU doesn't support TZCNT, and produces the same result for non-zero input. Partially fixes: b77b06e0e296 ("x86: Optimize strcmp-avx2.S") Partially resolves: BZ #29611 Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com> (cherry picked from commit fc7de1d9b99ae1676bc626ddca422d7abee0eb48)
2022-10-03x86-64: Require BMI2 for AVX2 strcmp implementationAurelien Jarno
The AVX2 strcmp implementation uses the 'bzhi' instruction, which belongs to the BMI2 CPU feature. NB: It also uses the 'tzcnt' BMI1 instruction, but it is executed as BSF as BSF if the CPU doesn't support TZCNT, and produces the same result for non-zero input. Partially fixes: b77b06e0e296 ("x86: Optimize strcmp-avx2.S") Partially resolves: BZ #29611 Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com> (cherry picked from commit 4d64c6445735e9b34e2ac8e369312cbfc2f88e17)
2022-10-03x86-64: Require BMI2 for AVX2 str(n)casecmp implementationsAurelien Jarno
The AVX2 str(n)casecmp implementations use the 'bzhi' instruction, which belongs to the BMI2 CPU feature. NB: It also uses the 'tzcnt' BMI1 instruction, but it is executed as BSF as BSF if the CPU doesn't support TZCNT, and produces the same result for non-zero input. Partially fixes: b77b06e0e296 ("x86: Optimize strcmp-avx2.S") Partially resolves: BZ #29611 Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com> (cherry picked from commit 10f79d3670b036925da63dc532b122d27ce65ff8)
2022-10-03x86: include BMI1 and BMI2 in x86-64-v3 levelAurelien Jarno
The "System V Application Binary Interface AMD64 Architecture Processor Supplement" mandates the BMI1 and BMI2 CPU features for the x86-64-v3 level. Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com> (cherry picked from commit b80f16adbd979831bf25ea491e1261e81885c2b6)
2022-10-01hppa: undef __ASSUME_SET_ROBUST_LISTJohn David Anglin
QEMU does not support support set_robust_list. Thus, we need to enable detection of set_robust_list system call. Signed-off-by: John David Anglin <dave.anglin@bell.net>
2022-10-01hppa: Fix initialization of dp register [BZ 29635]John David Anglin
After upgrading glibc to Debian 2.35-1, gdb faulted on startup and dropped core in a function call in the main application. This was caused by not initializing the global dp register for the main application early enough. Restore the code to initialize dp in _dl_start_user. It was removed when code was added to initialize dp in elf_machine_runtime_setup. Signed-off-by: John David Anglin <dave.anglin@bell.net>