aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
AgeCommit message (Collapse)Author
2022-10-27aarch64: morello: string: dummy c memrchrSzabolcs Nagy
2022-10-27aarch64: morello: purecap rawmemchrCarlos Eduardo Seo
Modified rawmemchr to support Arm Morello Capabilities.
2022-10-27aarch64: morello: string: dummy c strchrnulSzabolcs Nagy
2022-10-27aarch64: morello: string: dummy c strlenSzabolcs Nagy
2022-10-27aarch64: morello: string: dummy c strnlenSzabolcs Nagy
2022-10-27aarch64: morello: string: dummy c strcpy and stpcpySzabolcs Nagy
2022-10-27aarch64: morello: string: dummy c strcmpSzabolcs Nagy
2022-10-27aarch64: morello: string: dummy c strncmpSzabolcs Nagy
2022-10-27aarch64: morello: string: dummy c strchrSzabolcs Nagy
2022-10-27aarch64: morello: string: dummy c strrchrSzabolcs Nagy
2022-10-27aarch64: morello: string: dummy c strspnSzabolcs Nagy
avoids out of bound access of the generic implementation.
2022-10-27aarch64: morello: string: dummy c strcspnSzabolcs Nagy
avoids out of bounds access of the generic implementation.
2022-10-27aarch64: morello: update sysdep.h for purecap ABICarlos Eduardo Seo
Add macro definitions for purecap ABI in sysdep.h.
2022-10-27TODO(gcc): cheri: work around a gcc bug in _dl_setup_stack_chk_guardSzabolcs Nagy
morello purecap gcc in some cases inlines 16byte memcpy as a capability load, which is wrong if the source or dest may be unaligned. stack guard only needs random for the address portion since only that part is compared, so 8 byte is enough with 64 bit addresses, but the current code is only right on little endian systems. TODO: drop when gcc is fixed
2022-10-27cheri: __LP64__ is not defined for purecap ABICarlos Eduardo Seo
There is no ideal ABI macro, so we assume __CHERI_PURE_CAPABILITY__ implies 64 bit long, 64 bit address and 128 bit pointer.
2022-10-27aarch64: morello: use separate c++-types.dataSzabolcs Nagy
The c++ mangling ABI for intptr_t and pthread_t are different on morello.
2022-10-27aarch64: morello: use separate localplt data for morelloSzabolcs Nagy
There is no longer PLT reference to matherr in libm.
2022-10-27aarch64: morello: Add separate lp64 and morello linux abilistsSzabolcs Nagy
The base symbol version is 2.36.
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: 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-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-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-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-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-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>
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-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-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-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)