aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-10-24Remove 'shadow' and merge into 'nss'Arjun Shankar
The majority of shadow routines are entry points for nss functionality. This commit removes the 'shadow' subdirectory and moves all functionality and tests to 'nss'. References to shadow/ are accordingly changed. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2023-10-24Remove 'pwd' and merge into 'nss'Arjun Shankar
The majority of pwd routines are entry points for nss functionality. This commit removes the 'pwd' subdirectory and moves all functionality and tests to 'nss'. References to pwd/ are accordingly changed. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2023-10-24Remove 'gshadow' and merge into 'nss'Arjun Shankar
The majority of gshadow routines are entry points for nss functionality. This commit removes the 'gshadow' subdirectory and moves all functionality and tests to 'nss'. References to gshadow/ are accordingly changed. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2023-10-24Remove 'grp' and merge into 'nss' and 'posix'Arjun Shankar
The majority of grp routines are entry points for nss functionality. This commit removes the 'grp' subdirectory and moves all nss-relevant functionality and all tests to 'nss', and the 'setgroups' stub into 'posix' (alongside the 'getgroups' stub). References to grp/ are accordingly changed. In addition, compat-initgroups.c, a fallback implementation of initgroups is renamed to initgroups-fallback.c so that the build system does not confuse it for nss_compat/compat-initgroups.c. Build time improves very slightly; e.g. down from an average of 45.5s to 44.5s on an 8-thread mobile x86_64 CPU. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2023-10-23malloc: Fix tst-tcfree3 build csky-linux-gnuabiv2 with fortify sourceAdhemerval Zanella
With gcc 13.1 with --enable-fortify-source=2, tst-tcfree3 fails to build on csky-linux-gnuabiv2 with: ../string/bits/string_fortified.h: In function ‘do_test’: ../string/bits/string_fortified.h:26:8: error: inlining failed in call to ‘always_inline’ ‘memcpy’: target specific option mismatch 26 | __NTH (memcpy (void *__restrict __dest, const void *__restrict __src, | ^~~~~~ ../misc/sys/cdefs.h:81:62: note: in definition of macro ‘__NTH’ 81 | # define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct | ^~~ tst-tcfree3.c:45:3: note: called from here 45 | memcpy (c, a, 32); | ^~~~~~~~~~~~~~~~~ Instead of relying on -O0 to avoid malloc/free to be optimized away, disable the builtin. Reviewed-by: DJ Delorie <dj@redhat.com>
2023-10-23test-container: disable ld.so system cache on DSO detectionSimon Chopin
When building the testroot, the script runs the newly built ld.so on a couple of binaries in order to copy over any additional libraries needed. However, if the dependencies are found in the system cache, it will be copied over using that path. This is problematic if the system ld.so and the one built don't have the exact same search configuration. We encountered this in Ubuntu, where we build a variant of libc with -fno-omit-frame-pointer for accurate performance profiling. This variant is built using a non-standard slibdir to be able to be co-installed with the default library (e.g. slibdir = /lib/libc6-prof). Since we have /lib pointing to /usr/lib, any additional dependency should still be reachable via /usr. However, resolving via the cache might result in the additional DSOs being copied into $testroot/lib, out of the search path in the container. The problem has been triggered by 1d5024f4f052c12e404d42d3b5bfe9c3e9fd27c4 ("support: Build with exceptions and asynchronous unwind tables [BZ #30587]") which introduced a dependency on libgcc_s.so.1 under some circumstances. Downstream bug: https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/2031495 Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2023-10-23aarch64: Add vector implementations of exp10 routinesJoe Ramsay
Double-precision routines either reuse the exp table (AdvSIMD) or use SVE FEXPA intruction.
2023-10-23aarch64: Add vector implementations of log10 routinesJoe Ramsay
A table is also added, which is shared between AdvSIMD and SVE log10.
2023-10-23aarch64: Add vector implementations of log2 routinesJoe Ramsay
A table is also added, which is shared between AdvSIMD and SVE log2.
2023-10-23aarch64: Add vector implementations of exp2 routinesJoe Ramsay
Some routines reuse table from v_exp_data.c
2023-10-23aarch64: Add vector implementations of tan routinesJoe Ramsay
This includes some utility headers for evaluating polynomials using various schemes.
2023-10-20elf: ldconfig should skip temporary files created by package managersFlorian Weimer
This avoids crashes due to partially written files, after a package update is interrupted. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2023-10-20tst-spawn-cgroup.c: Fix argument order of UNSUPPORTED message.Stefan Liebler
The arguments for "expected" and "got" are mismatched. Furthermore this patch is dumping both values as hex. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Reviewed-by: Florian Weimer <fweimer@redhat.com>
2023-10-19Add NT_PPC_DEXCR and NT_PPC_HASHKEYR from Linux 6.5 to elf.hJoseph Myers
Linux 6.5 adds constants NT_PPC_DEXCR and NT_PPC_HASHKEYR. Add these to glibc's elf.h. Tested for x86_64.
2023-10-19s390: Fix undefined behaviour in feenableexcept, fedisableexcept [BZ #30960]Stefan Liebler
If feenableexcept or fedisableexcept gets excepts=FE_INVALID=0x80 as input, we have a signed left shift: 0x80 << 24 which is not representable as int and thus is undefined behaviour according to C standard. This patch casts excepts as unsigned int before shifting, which is defined. For me, the observed undefined behaviour is that the shift is done with "unsigned"-instructions, which is exactly what we want. Furthermore, I don't get any exception-flags. After the fix, the code is using the same instruction sequence as before.
2023-10-18elf: Do not print the cache entry if --inhibit-cache is usedAdhemerval Zanella
So --help informs the correct shared library search path. Reviewed-by: Florian Weimer <fweimer@redhat.com>
2023-10-18Revert "elf: Always call destructors in reverse constructor order (bug 30785)"Florian Weimer
This reverts commit 6985865bc3ad5b23147ee73466583dd7fdf65892. Reason for revert: The commit changes the order of ELF destructor calls too much relative to what applications expect or can handle. In particular, during process exit and _dl_fini, after the revert commit, we no longer call the destructors of the main program first; that only happens after some dlopen'ed objects have been destructed. This robs applications of an opportunity to influence destructor order by calling dlclose explicitly from the main program's ELF destructors. A couple of different approaches involving reverse constructor order were tried, and none of them worked really well. It seems we need to keep the dependency sorting in _dl_fini. There is also an ambiguity regarding nested dlopen calls from ELF constructors: Should those destructors run before or after the object that called dlopen? Commit 6985865bc3ad5b2314 used reverse order of the start of ELF constructor calls for destructors, but arguably using completion of constructors is more correct. However, that alone is not sufficient to address application compatibility issues (it does not change _dl_fini ordering at all).
2023-10-18Revert "elf: Fix compile error with -DNDEBUG [BZ #18755]"Florian Weimer
This reverts commit 964d15a007d7fb1258f2ad7c8cf4afcfb9a65719. Reason for revert: Conflicts with revert of commit 6985865bc3ad5b23147.
2023-10-17Add strlcat/wcslcat testcase.Sunil K Pandey
This patch implements comprehensive tests for strlcat/wcslcat functions. Tests are mostly derived from strncat test suites and modified to incorporate strlcat/wcslcat specifications. Reviewed-by: DJ Delorie <dj@redhat.com>
2023-10-17Add strlcpy/wcslcpy testcaseSunil K Pandey
This patch implements comprehensive tests for strlcpy/wcslcpy functions. Tests are mostly derived from strncpy test suites and modified to incorporate strlcpy/wcslcpy specifications. Reviewed-by: DJ Delorie <dj@redhat.com>
2023-10-17Add LE DSCP code point from RFC-8622.Bruno Victal
Signed-off-by: Bruno Victal <mirai@makinata.eu> Reviewed-by: Florian Weimer <fweimer@redhat.com>
2023-10-17Add HWCAP2_MOPS from Linux 6.5 to AArch64 bits/hwcap.hJoseph Myers
Linux 6.5 adds a new AArch64 HWCAP2 value, HWCAP2_MOPS. Add it to glibc's bits/hwcap.h. Tested with build-many-glibcs.py for aarch64-linux-gnu.
2023-10-16Add SCM_SECURITY, SCM_PIDFD to bits/socket.hJoseph Myers
Linux 6.5 adds a constant SCM_PIDFD (recall that the non-uapi linux/socket.h, where this constant is added, is in fact a header providing many constants that are part of the kernel/userspace interface). This shows up that SCM_SECURITY, from the same set of definitions and added in Linux 2.6.17, is also missing from glibc, although glibc has the first two constants from this set, SCM_RIGHTS and SCM_CREDENTIALS; add both missing constants to glibc. Tested for x86_64.
2023-10-16Add AT_HANDLE_FID from Linux 6.5 to bits/fcntl-linux.hJoseph Myers
Linux 6.5 adds a constant AT_HANDLE_FID; add it to glibc. Because this is a flag for the function name_to_handle_at declared in bits/fcntl-linux.h, put the flag there rather than alongside other AT_* flags in (OS-independent) fcntl.h. Tested for x86_64.
2023-10-16Avoid maybe-uninitialized warning in __kernel_rem_pio2Andreas Schwab
With GCC 14 on 32-bit x86 the compiler emits a maybe-uninitialized warning: ../sysdeps/ieee754/dbl-64/k_rem_pio2.c: In function '__kernel_rem_pio2': ../sysdeps/ieee754/dbl-64/k_rem_pio2.c:364:20: error: 'fq' may be used uninitialized [-Werror=maybe-uninitialized] 364 | y[0] = fq[0]; y[1] = fq[1]; y[2] = fw; | ~~^~~ This is similar to the warning that is suppressed in the other branch of the switch. Help the compiler knowing that the variable is always initialized, which also makes the suppression obsolete.
2023-10-16Fix WAIT_FOR_DEBUGGER for container tests.Stefan Liebler
For container tests, gdb needs to set the sysroot to the corresponding testroot.root directory. The assumption was that PIDs < 3 means that we are running within a container. Starting with commit 2fe64148a81f0d78050c302f34a6853d21f7cae4 "Allow for unpriviledged nested containers", the default is to use the PID namespace of the parent. Thus support_test_main.c does not recognize our container anymore. This patch now assumes that we are running inside a container if test-container.c has set PID_OUTSIDE_CONTAINER and always uses this PID independent of having a new PID namespace or not. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2023-10-12stdlib: fix grouping verification with multi-byte thousands separator (bug ↵Andreas Schwab
30964) The grouping verification only worked for a single-byte thousands separator. With a multi-byte separator it returned as if no separators were present. The actual parsing in str_to_mpn will then go wrong when there are multiple adjacent multi-byte separators in the number.
2023-10-09build-many-glibcs: Check for required system toolsDJ Delorie
Notes for future devs: * Add tools as you find they're needed, with version 0,0 * Bump version when you find an old tool that doesn't work * Don't add a version just because you know it works Co-authored-by: Lukasz Majewski <lukma@denx.de> Co-authored-by: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
2023-10-06x86: Prepare `strrchr-evex` and `strrchr-evex512` for AVX10Noah Goldstein
This commit refactors `strrchr-evex` and `strrchr-evex512` to use a common implementation: `strrchr-evex-base.S`. The motivation is `strrchr-evex` needed to be refactored to not use 64-bit masked registers in preperation for AVX10. Once vec-width masked register combining was removed, the EVEX and EVEX512 implementations can easily be implemented in the same file without any major overhead. The net result is performance improvements (measured on TGL) for both `strrchr-evex` and `strrchr-evex512`. Although, note there are some regressions in the test suite and it may be many of the cases that make the total-geomean of improvement/regression across bench-strrchr are cold. The point of the performance measurement is to show there are no major regressions, but the primary motivation is preperation for AVX10. Benchmarks where taken on TGL: https://www.intel.com/content/www/us/en/products/sku/213799/intel-core-i711850h-processor-24m-cache-up-to-4-80-ghz/specifications.html EVEX geometric_mean(N=5) of all benchmarks New / Original : 0.74 EVEX512 geometric_mean(N=5) of all benchmarks New / Original: 0.87 Full check passes on x86.
2023-10-05aarch64: Optimise vecmath logsJoe Ramsay
* Transpose table layout for improved memory access * Use half-vector special comparisons for AdvSIMD * Improve register use near special-case branches - Due to the presence of a function call, return value would get mov-d out of x0 in order to facilitate PCS. By moving the final computation after the branch this can be avoided Also change SVE routines to use overloaded intrinsics for readability.
2023-10-05aarch64: Cosmetic change in SVE exp routinesJoe Ramsay
Use overloaded intrinsics for readability. Codegen does not change, however while we're bringing the routines up-to-date with recent improvements to other routines in AOR it is worth copying this change over as well.
2023-10-05aarch64: Optimize SVE cos & cosfJoe Ramsay
Saves a mov by ensuring return value does not need to be moved out of the way before special-case branch. Also change to use overloaded intrinsics.
2023-10-05aarch64: Improve vecmath sin routinesJoe Ramsay
* Update ULP comment reflecting a new observed max in [-pi/2, pi/2] * Use the same polynomial in AdvSIMD and SVE, rather than FTRIG instructions * Improve register use near special-case branch Also use overloaded intrinsics for SVE.
2023-10-04nss: Get rid of alloca usage in makedb's write_output.Joe Simmons-Talbott
Replace alloca usage with a scratch_buffer. Reviewed-by: Arjun Shankar <arjun@redhat.com>
2023-10-04debug: Add regression tests for BZ 30932Adhemerval Zanella
Checked on x86_64-linux-gnu. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-10-04Fix FORTIFY_SOURCE false positiveVolker Weißmann
When -D_FORTIFY_SOURCE=2 was given during compilation, sprintf and similar functions will check if their first argument is in read-only memory and exit with *** %n in writable segment detected *** otherwise. To check if the memory is read-only, glibc reads frpm the file "/proc/self/maps". If opening this file fails due to too many open files (EMFILE), glibc will now ignore this error. Fixes [BZ #30932] Signed-off-by: Volker Weißmann <volker.weissmann@gmx.de> Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-10-04nss: Rearrange and sort Makefile variablesArjun Shankar
Rearrange lists of routines, tests, etc. into one-per-line in nss/Makefile and sort them using scripts/sort-makefile-lines.py. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-10-04inet: Rearrange and sort Makefile variablesArjun Shankar
Rearrange lists of routines, tests, etc. into one-per-line in inet/Makefile and sort them using scripts/sort-makefile-lines.py. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-10-04Fix off-by-one OOB write in iconv/tst-iconv-mtSzabolcs Nagy
The iconv buffer sizes must not include the \0 string terminator. And the output termination with *outbufpos = '\0' was OOB. Consistently use non-null-terminated buffer sizes. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2023-10-02tunables: Terminate if end of input is reached (CVE-2023-4911)Siddhesh Poyarekar
The string parsing routine may end up writing beyond bounds of tunestr if the input tunable string is malformed, of the form name=name=val. This gets processed twice, first as name=name=val and next as name=val, resulting in tunestr being name=name=val:name=val, thus overflowing tunestr. Terminate the parsing loop at the first instance itself so that tunestr does not overflow. This also fixes up tst-env-setuid-tunables to actually handle failures correct and add new tests to validate the fix for this CVE. Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2023-10-02Propagate GLIBC_TUNABLES in setxid binariesSiddhesh Poyarekar
GLIBC_TUNABLES scrubbing happens earlier than envvar scrubbing and some tunables are required to propagate past setxid boundary, like their env_alias. Rely on tunable scrubbing to clean out GLIBC_TUNABLES like before, restoring behaviour in glibc 2.37 and earlier. Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2023-10-02Linux: add ST_NOSYMFOLLOWKir Kolyshkin
Linux v5.10 added a mount option MS_NOSYMFOLLOW, which was added to glibc in commit 0ca21427d950755b. Add the corresponding statfs/statvfs flag bit, ST_NOSYMFOLLOW. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2023-10-02resolve: Remove __res_context_query alloca usageAdhemerval Zanella
The bufsize on current Linux build is: size_t bufsize = (type == 439963904 ? 2 : 1) * (12 + 4 + 255 + 1); So with upper bound as 544 (2 * (12 + 4 + 255 + 1)). However, it might increase to 2 * PACKETSIZE later with malloc. The default scratch_buffer should fullfill the most usual allocation requirement. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Joe Simmons-Talbott <josimmon@redhat.com>
2023-10-02mips: dl-machine-reject-phdr: Get rid of alloca.Joe Simmons-Talbott
Read directly into the mips_abiflags struct rather than reading the entire segment and using alloca when the passed buffer is not big enough. Checked with build-many-glibcs.py on mips-linux-gnu Tested-by: Ying Huang <ying.huang@oss.cipunited.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2023-09-29x86: Add support for AVX10 preset and vec size in cpu-featuresNoah Goldstein
This commit add support for the new AVX10 cpu features: https://cdrdv2-public.intel.com/784267/355989-intel-avx10-spec.pdf We add checks for: - `AVX10`: Check if AVX10 is present. - `AVX10_{X,Y,Z}MM`: Check if a given vec class has AVX10 support. `make check` passes and cpuid output was checked against GNR/DMR on an emulator.
2023-09-29resolv: Fix a comment typo in __resolv_conf_loadArjun Shankar
The file being referred to is host.conf, not hosts.conf.
2023-09-29Remove unused -DRESOLVER getaddrinfo build flagArjun Shankar
getaddrinfo doesn't look for any RESOLVER defines for conditional compilation. Therefore, remove the unnecessary -DRESOLVER build flag in getaddrinfo's CFLAGS. Checked on x86_64 for code generation changes; none found.
2023-09-28C2x scanf %wN, %wfN supportJoseph Myers
ISO C2x defines scanf length modifiers wN (for intN_t / int_leastN_t / uintN_t / uint_leastN_t) and wfN (for int_fastN_t / uint_fastN_t). Add support for those length modifiers, similar to the printf support previously added. Tested for x86_64 and x86.
2023-09-28test-container: Use nftw instead of rm -rfAdhemerval Zanella
If the binary to run is 'env', test-containers skips it and adds any required environment variable on the process envs variables. This simplifies the required code to spawn new process (no need to build an env-like program). However, this is an issue for recursive_remove if there is any LD_PRELOAD, since test-container will not prepend the loader command along with required paths. If the required preloaded library can not be loaded by the system glibc, the 'post-clean rsync' will eventually fail. One example is if system glibc does not support DT_RELR and the built glibc does, the nss/tst-nss-gai-hv2-canonname test fails with: ../scripts/evaluate-test.sh nss/tst-nss-gai-hv2-canonname $? false false 86_64-linux-gnu/nss/tst-nss-gai-hv2-canonname.test-result rm: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_ABI_DT_RELR' not found (required by x86_64-linux-gnu/malloc/libc_malloc_debug.so) Instead trying to figure out the required loader arguments on how to spawn the 'rm -rf', replace the command with a nftw call. Checked on x86_64-linux-gnu. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org> Reviewed-by: Stefan Liebler <stli@linux.ibm.com>
2023-09-28hurd: Drop REG_GSFS and REG_ESDS from x86_64's ucontextSamuel Thibault
These are useless on x86_64, and __NGREG was actually wrong with them.