about summary refs log tree commit diff
Commit message (Collapse)AuthorAgeFilesLines
* resolv: Fix a comment typo in __resolv_conf_loadArjun Shankar2023-09-291-1/+1
| | | | The file being referred to is host.conf, not hosts.conf.
* Remove unused -DRESOLVER getaddrinfo build flagArjun Shankar2023-09-291-1/+1
| | | | | | | | 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.
* C2x scanf %wN, %wfN supportJoseph Myers2023-09-288-0/+598
| | | | | | | | | 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.
* test-container: Use nftw instead of rm -rfAdhemerval Zanella2023-09-281-23/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* hurd: Drop REG_GSFS and REG_ESDS from x86_64's ucontextSamuel Thibault2023-09-284-16/+8
| | | | These are useless on x86_64, and __NGREG was actually wrong with them.
* elf: Fix compile error with -DNDEBUG [BZ #18755]Qingqing Li2023-09-271-1/+1
| | | | | | | | | | | | | Compilation fails when building with -DNDEBUG after commit a3189f66a5f2fe86568286fa025fa153be04c6c0. Here is the error: dl-close.c: In function ‘_dl_close_worker’: dl-close.c:140:22: error: unused variable ‘nloaded’ [-Werror=unused-variable] 140 | const unsigned int nloaded = ns->_ns_nloaded; Add __attribute_maybe_unused__ for‘nloaded’to fix it. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* MIPS: Add relocation typesYing Huang2023-09-271-1/+59
| | | | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* MIPS: Add new section type SHT_MIPS_ABIFLAGSYing Huang2023-09-271-0/+1
| | | | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* MIPS: Add ELF file header flagsYing Huang2023-09-271-1/+47
| | | | | | | | | | | Now binutils use some E_MIPS_* macros and EF_MIPS_* macros, it is difficult to decide which style macro we should use when we want to add new ELF file header flags. IRIX used to use EF_MIPS_* macros and in elf/elf.h there also has comments "The following are unofficial names and should not be used". So we should use EF_MIPS_* to keep same style with the beginning. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* fegetenv_and_set_rn now uses the builtins provided by GCC.Manjunath Matti2023-09-271-0/+9
| | | | | | | | | | | | | | | | | | | | On powerpc, SET_RESTORE_ROUND uses inline assembly to optimize the prologue get/save/set rounding mode operations for POWER9 and later by using 'mffscrn' where possible, this was introduced by commit f1c56cdff09f650ad721fae026eb6a3651631f3d. GCC version 14 onwards supports builtins as __builtin_set_fpscr_rn which now returns the FPSCR fields in a double. This feature is available on Power9 when the __SET_FPSCR_RN_RETURNS_FPSCR__ macro is defined. GCC commit ef3bbc69d15707e4db6e2f198c621effb636cc26 adds this feature. Changes are done to use __builtin_set_fpscr_rn instead of mffscrn or mffscrni in __fe_mffscrn(rn). Suggested-by: Carl Love <cel@us.ibm.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* io: Do not implement fstat with fstatatAdhemerval Zanella2023-09-273-12/+68
| | | | | | | | | | | | | | | | AT_EMPTY_PATH is a requirement to implement fstat over fstatat, however it does not prevent the kernel to read the path argument. It is not an issue, but on x86-64 with SMAP-capable CPUs the kernel is forced to perform expensive user memory access. After that regular lookup is performed which adds even more overhead. Instead, issue the fstat syscall directly on LFS fstat implementation (32 bit architectures will still continue to use statx, which is required to have 64 bit time_t support). it should be even a small performance gain on non x86_64, since there is no need to handle the path argument. Checked on x86_64-linux-gnu.
* libio: Add nonnull attribute for most FILE * arguments in stdio.hXi Ruoyao2023-09-263-78/+99
| | | | | | | | | | | | | | | | | | | | | | During the review of a GCC analyzer test case, we found most stdio functions accepting a FILE * argument expect it to be nonnull and just segfault when the argument is NULL. Add nonnull attribute for them. fflush and fflush_unlocked are well defined when __stream is NULL so they are not touched. For fputs, fgets, fread, fwrite, fprintf, vfprintf, and their unlocked version, if __stream is empty but there is nothing to read or write, they did not segfault. But the standard disallow __stream to be empty here, so nonnull attribute is also added for them. Note that this may blow up some old code already subtly broken. Also add __nonnull for _chk variants and __fortify_function versions for them. Signed-off-by: Xi Ruoyao <xry111@xry111.site> Reviewed-by: Alejandro Colomar <alx@kernel.org> Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* AArch64: Remove -0.0 check from vector sinWilco Dijkstra2023-09-262-12/+2
| | | | | | | Remove the unnecessary extra checks for sin (-0.0) from vector sin/sinf, improving performance. Passes regress. Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
* Document CVE-2023-4806 and CVE-2023-5156 in NEWSSiddhesh Poyarekar2023-09-261-0/+9
| | | | | | These are tracked in BZ #30884 and BZ #30843. Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* elf: Add dummy declaration of _dl_audit_objclose for !SHAREDFlorian Weimer2023-09-261-1/+8
| | | | | | This allows us to avoid some #ifdef SHARED conditionals. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Fix leak in getaddrinfo introduced by the fix for CVE-2023-4806 [BZ #30843]Romain Geissler2023-09-253-3/+24
| | | | | | This patch fixes a very recently added leak in getaddrinfo. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* elf: dl-lookup: Remove unused alloca.h includeJoe Simmons-Talbott2023-09-211-1/+0
|
* Remove unused localedata/th_TH.inMike FABIAN2023-09-211-178/+0
|
* Adapt collation in th_TH locale to use the iso14651_t1_common file and sync ↵Mike FABIAN2023-09-213-741/+252
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the collation with CLDR I made it to agree as much as possible with the rules from CLDR (see: https://github.com/unicode-org/cldr/blob/main/common/collation/th.xml). It seems to be impossible to follow the CLDR rules &[before 1]๚<ฯ # should be "variable" and &๛<ๆ # should be "variable" exactly though. These ask for a primary difference in punctuation characters whose primary weight should be "IGNORE". But using a secondary differnence instead still sorts the test data correctly and the previously used collation in th_TH used tertiary differences for these characters. There was old localedata/th_TH.in test data in TIS-620 encoding which was not used (it was not in the localedata/Makefile). I converted this to UTF-8 and moved it to localedata/th_TH.UTF-8.in and added it to localedata/Makefile. Using the existing collation rules in the th_TH locale did not sort that test file completely correct, I think my new collation rules based on iso14651_t1 are better.
* Revert "LoongArch: Add glibc.cpu.hwcap support."caiyinyu2023-09-2111-329/+8
| | | | This reverts commit a53451559dc9cce765ea5bcbb92c4007e058e92b.
* Update kernel version to 6.5 in header constant testsJoseph Myers2023-09-202-2/+2
| | | | | | | | | | This patch updates the kernel version in the tests tst-mman-consts.py and tst-pidfd-consts.py to 6.5. (There are no new constants covered by these tests in 6.5 that need any other header changes; tst-mount-consts.py was updated separately along with a header constant addition.) Tested with build-many-glibcs.py.
* LoongArch: Add glibc.cpu.hwcap support.caiyinyu2023-09-1911-8/+329
| | | | | | | | | | | | | | | | | | | | | | | | | Key Points: 1. On lasx & lsx platforms, We must use _dl_runtime_{profile, resolve}_{lsx, lasx} to save vector registers. 2. Via "tunables", users can choose str/mem_{lasx,lsx,unaligned} functions with `export GLIBC_TUNABLES=glibc.cpu.hwcaps=LASX,...`. Note: glibc.cpu.hwcaps doesn't affect _dl_runtime_{profile, resolve}_{lsx, lasx} selection. Usage Notes: 1. Only valid inputs: LASX, LSX, UAL. Case-sensitive, comma-separated, no spaces. 2. Example: `export GLIBC_TUNABLES=glibc.cpu.hwcaps=LASX,UAL` turns on LASX & UAL. Unmentioned features turn off. With default ifunc: lasx > lsx > unaligned > aligned > generic, effect is: lasx > unaligned > aligned > generic; lsx off. 3. Incorrect GLIBC_TUNABLES settings will show error messages. For example: On lsx platforms, you cannot enable lasx features. If you do that, you will get error messages. 4. Valid input examples: - GLIBC_TUNABLES=glibc.cpu.hwcaps=LASX: lasx > aligned > generic. - GLIBC_TUNABLES=glibc.cpu.hwcaps=LSX,UAL: lsx > unaligned > aligned > generic. - GLIBC_TUNABLES=glibc.cpu.hwcaps=LASX,UAL,LASX,UAL,LSX,LASX,UAL: Repetitions allowed but not recommended. Results in: lasx > lsx > unaligned > aligned > generic.
* math: Add a no-mathvec flag for sin (-0.0)Wilco Dijkstra2023-09-184-28/+33
| | | | | | | | Add support for a no-mathvec flag to gen-auto-libm-tests.c. Update input test sin (-0.0) to be skipped in vector math libraries and regenerate testcases. Reviewed-By: Paul Zimmermann <Paul.Zimmermann@inria.fr>
* Update to Unicode 15.1.0 [BZ #30854]Mike FABIAN2023-09-1614-2814/+3155
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unicode 15.1.0 Support: Character encoding, character type info, and transliteration tables are all updated to Unicode 15.1.0, using the generator scripts contributed by Mike FABIAN (Red Hat). Total removed characters in newly generated CHARMAP: 0 Total changed characters in newly generated CHARMAP: 0 Total added characters in newly generated CHARMAP: 627 Total removed characters in newly generated WIDTH: 0 Total changed characters in newly generated WIDTH: 0 Total added characters in newly generated WIDTH: 627 alpha: Added 622 characters in new ctype which were not in old ctype graph: Added 627 characters in new ctype which were not in old ctype print: Added 627 characters in new ctype which were not in old ctype punct: Added 5 characters in new ctype which were not in old ctype The five characters added to punct are: 2FFC;IDEOGRAPHIC DESCRIPTION CHARACTER SURROUND FROM RIGHT;So;0;ON;;;;;N;;;;; 2FFD;IDEOGRAPHIC DESCRIPTION CHARACTER SURROUND FROM LOWER RIGHT;So;0;ON;;;;;N;;;;; 2FFE;IDEOGRAPHIC DESCRIPTION CHARACTER HORIZONTAL REFLECTION;So;0;ON;;;;;N;;;;; 2FFF;IDEOGRAPHIC DESCRIPTION CHARACTER ROTATION;So;0;ON;;;;;N;;;;; 31EF;IDEOGRAPHIC DESCRIPTION CHARACTER SUBTRACTION;So;0;ON;;;;;N;;;;; The Unicode announcement blog entry says "[...] adds 627 characters, [...] additions include 622 CJK unified ideographs in a new block, [...]", so that looks OK. The Unicode blog mentions "six completely new emoji" but they don't appear here as they are all sequences and not single code points. Resolves: BZ #30854 Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* localedata/unicode-gen/utf8_gen.py: adapt regexp to get relevant lines from ↵Mike FABIAN2023-09-161-1/+1
| | | | | | EastAsianWidth.txt Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Fix regexp syntax warnings in localedata/unicode-gen/ctype_compatibility.pyMike FABIAN2023-09-161-13/+13
| | | | | | | | | Fix these: $ python -m py_compile ./ctype_compatibility.py ./ctype_compatibility.py:146: SyntaxWarning: invalid escape sequence '\)' Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* getaddrinfo: Fix use after free in getcanonname (CVE-2023-4806)Siddhesh Poyarekar2023-09-157-10/+152
| | | | | | | | | | | | | | | | | | | | | | | When an NSS plugin only implements the _gethostbyname2_r and _getcanonname_r callbacks, getaddrinfo could use memory that was freed during tmpbuf resizing, through h_name in a previous query response. The backing store for res->at->name when doing a query with gethostbyname3_r or gethostbyname2_r is tmpbuf, which is reallocated in gethosts during the query. For AF_INET6 lookup with AI_ALL | AI_V4MAPPED, gethosts gets called twice, once for a v6 lookup and second for a v4 lookup. In this case, if the first call reallocates tmpbuf enough number of times, resulting in a malloc, th->h_name (that res->at->name refers to) ends up on a heap allocated storage in tmpbuf. Now if the second call to gethosts also causes the plugin callback to return NSS_STATUS_TRYAGAIN, tmpbuf will get freed, resulting in a UAF reference in res->at->name. This then gets dereferenced in the getcanonname_r plugin call, resulting in the use after free. Fix this by copying h_name over and freeing it at the end. This resolves BZ #30843, which is assigned CVE-2023-4806. Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* LoongArch: Change to put magic number to .rodata sectiondengjianbo2023-09-151-10/+10
| | | | | Change to put magic number to .rodata section in memmove-lsx, and use pcalau12i and %pc_lo12 with vld to get the data.
* LoongArch: Add ifunc support for strrchr{aligned, lsx, lasx}dengjianbo2023-09-157-0/+578
| | | | | | | | | | | | | | | | According to glibc strrchr microbenchmark test results, this implementation could reduce the runtime time as following: Name Percent of rutime reduced strrchr-lasx 10%-50% strrchr-lsx 0%-50% strrchr-aligned 5%-50% Generic strrchr is implemented by function strlen + memrchr, the lasx version will compare with generic strrchr implemented by strlen-lasx + memrchr-lasx, the lsx version will compare with generic strrchr implemented by strlen-lsx + memrchr-lsx, the aligned version will compare with generic strrchr implemented by strlen-aligned + memrchr-generic.
* LoongArch: Add ifunc support for strcpy, stpcpy{aligned, unaligned, lsx, lasx}dengjianbo2023-09-1512-0/+963
| | | | | | | | | | | | | | | | | | | | According to glibc strcpy and stpcpy microbenchmark test results(changed to use generic_strcpy and generic_stpcpy instead of strlen + memcpy), comparing with the generic version, this implementation could reduce the runtime as following: Name Percent of rutime reduced strcpy-aligned 8%-45% strcpy-unaligned 8%-48%, comparing with the aligned version, unaligned version takes less instructions to copy the tail of data which length is less than 8. it also has better performance in case src and dest cannot be both aligned with 8bytes strcpy-lsx 20%-80% strcpy-lasx 15%-86% stpcpy-aligned 6%-43% stpcpy-unaligned 8%-48% stpcpy-lsx 10%-80% stpcpy-lasx 10%-87%
* LoongArch: Replace deprecated $v0 with $a0 to eliminate 'as' Warnings.caiyinyu2023-09-151-1/+1
|
* LoongArch: Add lasx/lsx support for _dl_runtime_profile.caiyinyu2023-09-157-179/+331
|
* Add MOVE_MOUNT_BENEATH from Linux 6.5 to sys/mount.hJoseph Myers2023-09-142-2/+3
| | | | | | | | This patch adds the MOVE_MOUNT_BENEATH constant from Linux 6.5 to glibc's sys/mount.h and updates tst-mount-consts.py to reflect these constants being up to date with that Linux kernel version. Tested with build-many-glibcs.py.
* CVE-2023-4527: Stack read overflow with large TCP responses in no-aaaa modeFlorian Weimer2023-09-134-2/+137
| | | | | | | | | | | Without passing alt_dns_packet_buffer, __res_context_search can only store 2048 bytes (what fits into dns_packet_buffer). However, the function returns the total packet size, and the subsequent DNS parsing code in _nss_dns_gethostbyname4_r reads beyond the end of the stack-allocated buffer. Fixes commit f282cdbe7f436c75864e5640a4 ("resolv: Implement no-aaaa stub resolver option") and bug 30842.
* resolv: Fix some unaligned accesses in resolver [BZ #30750]John David Anglin2023-09-132-2/+4
| | | | Signed-off-by: John David Anglin <dave.anglin@bell.net>
* Update syscall lists for Linux 6.5Joseph Myers2023-09-1228-2/+31
| | | | | | | | Linux 6.5 has one new syscall, cachestat, and also enables the cacheflush syscall for hppa. Update syscall-names.list and regenerate the arch-syscall.h headers with build-many-glibcs.py update-syscalls. Tested with build-many-glibcs.py.
* ia64: Work around miscompilation and fix build on ia64's gcc-10 and laterSergei Trofimovich2023-09-111-1/+3
| | | | | | | | | | | | | Needed since gcc-10 enabled -fno-common by default. [In use in Gentoo since gcc-10, no problems observed. Also discussed with and reviewed by Jessica Clarke from Debian. Andreas] Bug: https://bugs.gentoo.org/723268 Reviewed-by: Carlos O'Donell <carlos@redhat.com> Signed-off-by: Sergei Trofimovich <slyich@gmail.com> Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* stdio: Remove __libc_message alloca usageJoe Simmons-Talbott2023-09-112-35/+41
| | | | | | | | Use a fixed size array instead. The maximum number of arguments is set by macro tricks. Co-authored-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* htl: avoid exposing the vm_region symbolSamuel Thibault2023-09-091-1/+1
|
* libio: Fix oversized __io_vtablesAdam Jackson2023-09-081-1/+4
| | | | | | | | | | | IO_VTABLES_LEN is the size of the struct array in bytes, not the number of __IO_jump_t's in the array. Drops just under 384kb from .rodata on LP64 machines. Fixes: 3020f72618e ("libio: Remove the usage of __libc_IO_vtables") Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Florian Weimer <fweimer@redhat.com> Tested-by: Florian Weimer <fweimer@redhat.com>
* Use Linux 6.5 in build-many-glibcs.pyJoseph Myers2023-09-081-1/+1
| | | | | | | This patch makes build-many-glibcs.py use Linux 6.5. Tested with build-many-glibcs.py (host-libraries, compilers and glibcs builds).
* elf: Remove unused l_text_end field from struct link_mapFlorian Weimer2023-09-085-18/+3
| | | | | | | | | | | | | It is a left-over from commit 52a01100ad011293197637e42b5be1a479a2 ("elf: Remove ad-hoc restrictions on dlopen callers [BZ #22787]"). When backporting commmit 6985865bc3ad5b23147ee73466583dd7fdf65892 ("elf: Always call destructors in reverse constructor order (bug 30785)"), we can move the l_init_called_next field to this place, so that the internal GLIBC_PRIVATE ABI does not change. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
* elf: Always call destructors in reverse constructor order (bug 30785)Florian Weimer2023-09-087-173/+179
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current implementation of dlclose (and process exit) re-sorts the link maps before calling ELF destructors. Destructor order is not the reverse of the constructor order as a result: The second sort takes relocation dependencies into account, and other differences can result from ambiguous inputs, such as cycles. (The force_first handling in _dl_sort_maps is not effective for dlclose.) After the changes in this commit, there is still a required difference due to dlopen/dlclose ordering by the application, but the previous discrepancies went beyond that. A new global (namespace-spanning) list of link maps, _dl_init_called_list, is updated right before ELF constructors are called from _dl_init. In dl_close_worker, the maps variable, an on-stack variable length array, is eliminated. (VLAs are problematic, and dlclose should not call malloc because it cannot readily deal with malloc failure.) Marking still-used objects uses the namespace list directly, with next and next_idx replacing the done_index variable. After marking, _dl_init_called_list is used to call the destructors of now-unused maps in reverse destructor order. These destructors can call dlopen. Previously, new objects do not have l_map_used set. This had to change: There is no copy of the link map list anymore, so processing would cover newly opened (and unmarked) mappings, unloading them. Now, _dl_init (indirectly) sets l_map_used, too. (dlclose is handled by the existing reentrancy guard.) After _dl_init_called_list traversal, two more loops follow. The processing order changes to the original link map order in the namespace. Previously, dependency order was used. The difference should not matter because relocation dependencies could already reorder link maps in the old code. The changes to _dl_fini remove the sorting step and replace it with a traversal of _dl_init_called_list. The l_direct_opencount decrement outside the loader lock is removed because it appears incorrect: the counter manipulation could race with other dynamic loader operations. tst-audit23 needs adjustments to the changes in LA_ACT_DELETE notifications. The new approach for checking la_activity should make it clearer that la_activty calls come in pairs around namespace updates. The dependency sorting test cases need updates because the destructor order is always the opposite order of constructor order, even with relocation dependencies or cycles present. There is a future cleanup opportunity to remove the now-constant force_first and for_fini arguments from the _dl_sort_maps function. Fixes commit 1df71d32fe5f5905ffd5d100e5e9ca8ad62 ("elf: Implement force_first handling in _dl_sort_maps_dfs (bug 28937)"). Reviewed-by: DJ Delorie <dj@redhat.com>
* io: Fix record locking contants for powerpc64 with __USE_FILE_OFFSET64Aurelien Jarno2023-09-073-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 5f828ff824e3b7cd1 ("io: Fix F_GETLK, F_SETLK, and F_SETLKW for powerpc64") fixed an issue with the value of the lock constants on powerpc64 when not using __USE_FILE_OFFSET64, but it ended-up also changing the value when using __USE_FILE_OFFSET64 causing an API change. Fix that by also checking that define, restoring the pre 4d0fe291aed3a476a commit values: Default values: - F_GETLK: 5 - F_SETLK: 6 - F_SETLKW: 7 With -D_FILE_OFFSET_BITS=64: - F_GETLK: 12 - F_SETLK: 13 - F_SETLKW: 14 At the same time, it has been noticed that there was no test for io lock with __USE_FILE_OFFSET64, so just add one. Tested on x86_64-linux-gnu, i686-linux-gnu and powerpc64le-unknown-linux-gnu. Resolves: BZ #30804. Co-authored-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* manual: Fix ld.so diagnostics menu/section structureFlorian Weimer2023-09-061-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | And shorten the section/node names a bit, so that the menu entries become easier to read. Texinfo 6.5 fails to process the previous structure: ./dynlink.texi:56: warning: node `Dynamic Linker Introspection' is next for `Dynamic Linker Diagnostics' in sectioning but not in menu ./dynlink.texi:56: warning: node up `Dynamic Linker Diagnostics' in menu `Dynamic Linker Invocation' and in sectioning `Dynamic Linker' differ ./dynlink.texi:1: node `Dynamic Linker' lacks menu item for `Dynamic Linker Diagnostics' despite being its Up target ./dynlink.texi:226: warning: node prev `Dynamic Linker Introspection' in menu `Dynamic Linker Invocation' and in sectioning `Dynamic Linker Diagnostics' differ Texinfo 7.0.2 does not report an error. This fixes commit f21962ddfc8bb23e92597da1f98e313dbde11cc1 ("manual: Document ld.so --list-diagnostics output"). Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
* getaddrinfo: Get rid of allocaJoe Simmons-Talbott2023-09-061-15/+9
| | | | | Use a scratch_buffer rather than alloca to avoid potential stack overflow.
* riscv: Add support for XTheadBb in string-fz[a,i].hChristoph Müllner2023-09-062-2/+7
| | | | | | | | | | | | | | | | | XTheadBb has similar instructions like Zbb, which allow optimized string processing: * th.ff0: find-first zero is a CLZ instruction. * th.tstnbz: Similar like orc.b, but with a bit-inverted result. The instructions are documented here: https://github.com/T-head-Semi/thead-extension-spec/tree/master/xtheadbb These instructions can be found in the T-Head C906 and the C910. Tested with the string tests. Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* getcanonname: Fix a typoSiddhesh Poyarekar2023-09-051-1/+1
| | | | | | | | This code is generally unused in practice since there don't seem to be any NSS modules that only implement _nss_MOD_gethostbyname2_r and not _nss_MOD_gethostbyname3_r. Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* linux: Add pidfd_getpidAdhemerval Zanella Netto2023-09-0544-0/+520
| | | | | | | | | | | | | | | | | | | | | | | | This interface allows to obtain the associated process ID from the process file descriptor. It is done by parsing the procps fdinfo information. Its prototype is: pid_t pidfd_getpid (int fd) It returns the associated pid or -1 in case of an error and sets the errno accordingly. The possible errno values are those from open, read, and close (used on procps parsing), along with: - EBADF if the FD is negative, does not have a PID associated, or if the fdinfo fields contain a value larger than pid_t. - EREMOTE if the PID is in a separate namespace. - ESRCH if the process is already terminated. Checked on x86_64-linux-gnu on Linux 4.15 (no CLONE_PIDFD or waitid support), Linux 5.4 (full support), and Linux 6.2. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* posix: Add pidfd_spawn and pidfd_spawnp (BZ 30349)Adhemerval Zanella Netto2023-09-0566-150/+788
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Returning a pidfd allows a process to keep a race-free handle for a child process, otherwise, the caller will need to either use pidfd_open (which still might be subject to TOCTOU) or keep the old racy interface base on pid_t. To correct use pifd_spawn, the kernel must support not only returning the pidfd with clone/clone3 but also waitid (P_PIDFD) (added on Linux 5.4). If kernel does not support the waitid, pidfd return ENOSYS. It avoids the need to racy workarounds, such as reading the procfs fdinfo to get the pid to use along with other wait interfaces. These interfaces are similar to the posix_spawn and posix_spawnp, with the only difference being it returns a process file descriptor (int) instead of a process ID (pid_t). Their prototypes are: int pidfd_spawn (int *restrict pidfd, const char *restrict file, const posix_spawn_file_actions_t *restrict facts, const posix_spawnattr_t *restrict attrp, char *const argv[restrict], char *const envp[restrict]) int pidfd_spawnp (int *restrict pidfd, const char *restrict path, const posix_spawn_file_actions_t *restrict facts, const posix_spawnattr_t *restrict attrp, char *const argv[restrict_arr], char *const envp[restrict_arr]); A new symbol is used instead of a posix_spawn extension to avoid possible issues with language bindings that might track the return argument lifetime. Although on Linux pid_t and int are interchangeable, POSIX only states that pid_t should be a signed integer. Both symbols reuse the posix_spawn posix_spawn_file_actions_t and posix_spawnattr_t, to void rehash posix_spawn API or add a new one. It also means that both interfaces support the same attribute and file actions, and a new flag or file action on posix_spawn is also added automatically for pidfd_spawn. Also, using posix_spawn plumbing allows the reusing of most of the current testing with some changes: - waitid is used instead of waitpid since it is a more generic interface. - tst-posix_spawn-setsid.c is adapted to take into consideration that the caller can check for session id directly. The test now spawns itself and writes the session id as a file instead. - tst-spawn3.c need to know where pidfd_spawn is used so it keeps an extra file description unused. Checked on x86_64-linux-gnu on Linux 4.15 (no CLONE_PIDFD or waitid support), Linux 5.4 (full support), and Linux 6.2. Reviewed-by: Florian Weimer <fweimer@redhat.com>