aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-12-22elf: Add TLS modid reuse test for bug 29039Szabolcs Nagy5-0/+113
This is a minimal regression test for bug 29039 which only affects targets with TLSDESC and a reproducer requires that 1) Have modid gaps (closed modules) with old generation. 2) Update a DTV to a newer generation (needs a newer dlopen). 3) But do not update the closed gap entry in that DTV. 4) Reuse the modid gap for a new module (another dlopen). 5) Use dynamic TLSDESC in that new module with old generation (bug). 6) Access TLS via this TLSDESC and the now outdated DTV. However step (3) in practice rarely happens: during DTV update the entries for closed modids are initialized to "unallocated" and then dynamic TLSDESC calls __tls_get_addr independently of its generation. The only exception to this is DTV setup at thread creation (gaps are initialized to NULL instead of unallocated) or DTV resize where the gap entries are outside the previous DTV array (again NULL instead of unallocated, and this requires loading > DTV_SURPLUS modules). So the bug can only cause NULL (+ offset) dereference, not use after free. And the easiest way to get (3) is via thread creation. Note that step (5) requires that the newly loaded module has larger TLS than the remaining optional static TLS. And for (6) there cannot be other TLS access or dlopen in the thread that updates the DTV. Tested on aarch64-linux-gnu. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> (cherry picked from commit 980450f12685326729d63ff72e93a996113bf073)
2023-12-22elf: Fix TLS modid reuse generation assignment (BZ 29039)Hector Martin1-0/+1
_dl_assign_tls_modid() assigns a slotinfo entry for a new module, but does *not* do anything to the generation counter. The first time this happens, the generation is zero and map_generation() returns the current generation to be used during relocation processing. However, if a slotinfo entry is later reused, it will already have a generation assigned. If this generation has fallen behind the current global max generation, then this causes an obsolete generation to be assigned during relocation processing, as map_generation() returns this generation if nonzero. _dl_add_to_slotinfo() eventually resets the generation, but by then it is too late. This causes DTV updates to be skipped, leading to NULL or broken TLS slot pointers and segfaults. Fix this by resetting the generation to zero in _dl_assign_tls_modid(), so it behaves the same as the first time a slot is assigned. _dl_add_to_slotinfo() will still assign the correct static generation later during module load, but relocation processing will no longer use an obsolete generation. Note that slotinfo entry (aka modid) reuse typically happens after a dlclose and only TLS access via dynamic tlsdesc is affected. Because tlsdesc is optimized to use the optional part of static TLS, dynamic tlsdesc can be avoided by increasing the glibc.rtld.optional_static_tls tunable to a large enough value, or by LD_PRELOAD-ing the affected modules. Fixes bug 29039. Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com> (cherry picked from commit 3921c5b40f293c57cb326f58713c924b0662ef59)
2023-12-10LoongArch: Delete excessively allocated memory.caiyinyu1-34/+34
Backported from glibc 2.39 development.
2023-12-07elf: Fix wrong break removal from 8ee878592cAdhemerval Zanella1-0/+1
Reported-by: Alexander Monakov <amonakov@ispras.ru> (cherry picked from commit 546a1ba664626603660b595662249d524e429013)
2023-11-25sysdeps: sem_open: Clear O_CREAT when semaphore file is expected to exist ↵Sergio Durigan Junior2-6/+6
[BZ #30789] When invoking sem_open with O_CREAT as one of its flags, we'll end up in the second part of sem_open's "if ((oflag & O_CREAT) == 0 || (oflag & O_EXCL) == 0)", which means that we don't expect the semaphore file to exist. In that part, open_flags is initialized as "O_RDWR | O_CREAT | O_EXCL | O_CLOEXEC" and there's an attempt to open(2) the file, which will likely fail because it won't exist. After that first (expected) failure, some cleanup is done and we go back to the label "try_again", which lives in the first part of the aforementioned "if". The problem is that, in that part of the code, we expect the semaphore file to exist, and as such O_CREAT (this time the flag we pass to open(2)) needs to be cleaned from open_flags, otherwise we'll see another failure (this time unexpected) when trying to open the file, which will lead the call to sem_open to fail as well. This can cause very strange bugs, especially with OpenMPI, which makes extensive use of semaphores. Fix the bug by simplifying the logic when choosing open(2) flags and making sure O_CREAT is not set when the semaphore file is expected to exist. A regression test for this issue would require a complex and cpu time consuming logic, since to trigger the wrong code path is not straightforward due the racy condition. There is a somewhat reliable reproducer in the bug, but it requires using OpenMPI. This resolves BZ #30789. See also: https://bugs.launchpad.net/ubuntu/+source/h5py/+bug/2031912 Signed-off-by: Sergio Durigan Junior <sergiodj@sergiodj.net> Co-Authored-By: Simon Chopin <simon.chopin@canonical.com> Co-Authored-By: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org> Fixes: 533deafbdf189f5fbb280c28562dd43ace2f4b0f ("Use O_CLOEXEC in more places (BZ #15722)") (cherry picked from commit f957f47df75b9fab995754011491edebc6feb147)
2023-10-19Revert "elf: Move l_init_called_next to old place of l_text_end in link map"Florian Weimer1-4/+4
This reverts commit d3ba6c1333b10680ce5900a628108507d9d4b844. Reason: Preserve internal ABI.
2023-10-18Revert "elf: Always call destructors in reverse constructor order (bug 30785)"Florian Weimer7-176/+173
This reverts commit a3189f66a5f2fe86568286fa025fa153be04c6c0. Reason for revert: Incompatibility with existing applications.
2023-10-18Revert "elf: Remove unused l_text_end field from struct link_map"Florian Weimer5-3/+18
This reverts commit 750f19526ae71aac801c77a3f7ef5374890c09b7. Reason for revert: Restore ABI after revert of commit a3189f66a5f.
2023-10-02tunables: Terminate if end of input is reached (CVE-2023-4911)Siddhesh Poyarekar3-15/+44
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> (cherry picked from commit 1056e5b4c3f2d90ed2b4a55f96add28da2f4c8fa)
2023-10-02Propagate GLIBC_TUNABLES in setxid binariesSiddhesh Poyarekar1-1/+0
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> (cherry picked from commit 0d5f9ea97f1b39f2a855756078771673a68497e1)
2023-09-26Document CVE-2023-4806 and CVE-2023-5156 in NEWSSiddhesh Poyarekar1-0/+9
These are tracked in BZ #30884 and BZ #30843. Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org> (cherry picked from commit fd134feba35fa839018965733b34d28a09a075dd)
2023-09-26Fix leak in getaddrinfo introduced by the fix for CVE-2023-4806 [BZ #30843]Romain Geissler3-3/+24
This patch fixes a very recently added leak in getaddrinfo. This was assigned CVE-2023-5156. Resolves: BZ #30884 Related: BZ #30842 Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org> (cherry picked from commit ec6b95c3303c700eb89eebeda2d7264cc184a796)
2023-09-15manual/jobs.texi: Add missing @item EPERM for getpgidMark Wielaard1-0/+1
The missing @item makes it look like errno will be set to ESRCH if a cross-session getpgid is not permitted. Found by ulfvonbelow on irc. (cherry picked from commit 5a21cefd5abab1b99eda1fbf84204a9bf41662ab)
2023-09-15string: Fix tester build with fortify enable with gcc < 12Mahesh Bodapati1-3/+8
When building with fortify enabled, GCC < 12 issues a warning on the fortify strncat wrapper might overflow the destination buffer (the failure is tied to -Werror). Checked on ppc64 and x86_64. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> (cherry picked from commit f1c7ed0859a45929136836341741c7cd70f428cb)
2023-09-15iconv: restore verbosity with unrecognized encoding names (bug 30694)Andreas Schwab1-1/+1
Commit 91927b7c76 ("Rewrite iconv option parsing [BZ #19519]") changed the iconv program to call __gconv_open directly instead of the iconv_open wrapper, but the former does not set errno. Update the caller to interpret the return codes like iconv_open does. (cherry picked from commit fc72b6d7d818ab2868920af956d1542d03342a4d)
2023-09-15getaddrinfo: Fix use after free in getcanonname (CVE-2023-4806)Siddhesh Poyarekar7-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> (cherry picked from commit 973fe93a5675c42798b2161c6f29c01b0e243994)
2023-09-13CVE-2023-4527: Stack read overflow with large TCP responses in no-aaaa modeFlorian Weimer4-1/+141
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. (cherry picked from commit bd77dd7e73e3530203be1c52c8a29d08270cb25d)
2023-09-11NEWS: Add the 2.38.1 bug listFlorian Weimer1-3/+3
2023-09-11elf: Move l_init_called_next to old place of l_text_end in link mapFlorian Weimer1-4/+4
This preserves all member offsets and the GLIBC_PRIVATE ABI for backporting.
2023-09-11elf: Remove unused l_text_end field from struct link_mapFlorian Weimer5-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> (cherry picked from commit 53df2ce6885da3d0e89e87dca7b095622296014f)
2023-09-11elf: Always call destructors in reverse constructor order (bug 30785)Florian Weimer8-173/+186
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> (cherry picked from commit 6985865bc3ad5b23147ee73466583dd7fdf65892)
2023-09-11elf: Do not run constructors for proxy objectsFlorian Weimer1-2/+6
Otherwise, the ld.so constructor runs for each audit namespace and each dlmopen namespace. (cherry picked from commit f6c8204fd7fabf0cf4162eaf10ccf23258e4d10e)
2023-09-08libio: Fix oversized __io_vtablesAdam Jackson1-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> (cherry picked from commit 8cb69e054386f980f9ff4d93b157861d72b2019e)
2023-09-07io: Fix record locking contants for powerpc64 with __USE_FILE_OFFSET64Aurelien Jarno4-1/+6
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> (cherry picked from commit 434bf72a94de68f0cc7fbf3c44bf38c1911b70cb)
2023-08-24sysdeps: tst-bz21269: fix -Wreturn-typeSam James1-2/+0
Thanks to Andreas Schwab for reporting. Fixes: 652b9fdb77d9fd056d4dd26dad2c14142768ab49 Signed-off-by: Sam James <sam@gentoo.org> (cherry picked from commit 369f373057073c307938da91af16922bda3dff6a)
2023-08-24sysdeps: tst-bz21269: handle ENOSYS & skip appropriatelySam James1-1/+10
SYS_modify_ldt requires CONFIG_MODIFY_LDT_SYSCALL to be set in the kernel, which some distributions may disable for hardening. Check if that's the case (unset) and mark the test as UNSUPPORTED if so. Reviewed-by: DJ Delorie <dj@redhat.com> Signed-off-by: Sam James <sam@gentoo.org> (cherry picked from commit 652b9fdb77d9fd056d4dd26dad2c14142768ab49)
2023-08-24sysdeps: tst-bz21269: fix test parameterSam James1-1/+1
All callers pass 1 or 0x11 anyway (same meaning according to man page), but still. Reviewed-by: DJ Delorie <dj@redhat.com> Signed-off-by: Sam James <sam@gentoo.org> (cherry picked from commit e0b712dd9183d527aae4506cd39564c14af3bb28)
2023-08-22malloc: Remove bin scanning from memalign (bug 30723)Florian Weimer3-166/+11
On the test workload (mpv --cache=yes with VP9 video decoding), the bin scanning has a very poor success rate (less than 2%). The tcache scanning has about 50% success rate, so keep that. Update comments in malloc/tst-memalign-2 to indicate the purpose of the tests. Even with the scanning removed, the additional merging opportunities since commit 542b1105852568c3ebc712225ae78b ("malloc: Enable merging of remainders in memalign (bug 30723)") are sufficient to pass the existing large bins test. Remove leftover variables from _int_free from refactoring in the same commit. Reviewed-by: DJ Delorie <dj@redhat.com> (cherry picked from commit 0dc7fc1cf094406a138e4d1bcf9553e59edcf89d)
2023-08-22malloc: Enable merging of remainders in memalign (bug 30723)Florian Weimer1-76/+121
Previously, calling _int_free from _int_memalign could put remainders into the tcache or into fastbins, where they are invisible to the low-level allocator. This results in missed merge opportunities because once these freed chunks become available to the low-level allocator, further memalign allocations (even of the same size are) likely obstructing merges. Furthermore, during forwards merging in _int_memalign, do not completely give up when the remainder is too small to serve as a chunk on its own. We can still give it back if it can be merged with the following unused chunk. This makes it more likely that memalign calls in a loop achieve a compact memory layout, independently of initial heap layout. Drop some useless (unsigned long) casts along the way, and tweak the style to more closely match GNU on changed lines. Reviewed-by: DJ Delorie <dj@redhat.com> (cherry picked from commit 542b1105852568c3ebc712225ae78b8c8ba31a78)
2023-08-17i686: Fix build with --disable-multiarchAdhemerval Zanella6-2/+10
Since i686 provides the fortified wrappers for memcpy, mempcpy, memmove, and memset on the same string implementation, the static build tries to optimized it by not tying the fortified wrappers to string routine (to avoid pulling the fortify function if they are not required). Checked on i686-linux-gnu building with different option: default and --disable-multi-arch plus default, --disable-default-pie, --enable-fortify-source={2,3}, and --enable-fortify-source={2,3} with --disable-default-pie. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org> (cherry picked from commit c73c96a4a1af1326df7f96eec58209e1e04066d8)
2023-08-17x86_64: Fix build with --disable-multiarch (BZ 30721)Adhemerval Zanella3-1/+5
With multiarch disabled, the default memmove implementation provides the fortify routines for memcpy, mempcpy, and memmove. However, it does not provide the internal hidden definitions used when building with fortify enabled. The memset has a similar issue. Checked on x86_64-linux-gnu building with different options: default and --disable-multi-arch plus default, --disable-default-pie, --enable-fortify-source={2,3}, and --enable-fortify-source={2,3} with --disable-default-pie. Tested-by: Andreas K. Huettel <dilfridge@gentoo.org> Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org> (cherry picked from commit 51cb52214fcd72849c640b12f5099ed3ac776181)
2023-08-12x86: Fix incorrect scope of setting `shared_per_thread` [BZ# 30745]Noah Goldstein1-4/+3
The: ``` if (shared_per_thread > 0 && threads > 0) shared_per_thread /= threads; ``` Code was accidentally moved to inside the else scope. This doesn't match how it was previously (before af992e7abd). This patch fixes that by putting the division after the `else` block. (cherry picked from commit 084fb31bc2c5f95ae0b9e6df4d3cf0ff43471ede)
2023-08-11nscd: Do not rebuild getaddrinfo (bug 30709)Florian Weimer6-80/+13
The nscd daemon caches hosts data from NSS modules verbatim, without filtering protocol families or sorting them (otherwise separate caches would be needed for certain ai_flags combinations). The cache implementation is complete separate from the getaddrinfo code. This means that rebuilding getaddrinfo is not needed. The only function actually used is __bump_nl_timestamp from check_pf.c, and this change moves it into nscd/connections.c. Tested on x86_64-linux-gnu with -fexceptions, built with build-many-glibcs.py. I also backported this patch into a distribution that still supports nscd and verified manually that caching still works. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org> (cherry picked from commit 039ff51ac7e02db1cfc0c23e38ac7bfbb00221d1)
2023-08-06x86: Fix for cache computation on AMD legacy cpus.Sajan Karumanchi1-27/+199
Some legacy AMD CPUs and hypervisors have the _cpuid_ '0x8000_001D' set to Zero, thus resulting in zeroed-out computed cache values. This patch reintroduces the old way of cache computation as a fail-safe option to handle these exceptions. Fixed 'level4_cache_size' value through handle_amd(). Reviewed-by: Premachandra Mallappa <premachandra.mallappa@amd.com> Tested-by: Florian Weimer <fweimer@redhat.com>
2023-08-06stdlib: Improve tst-realpath compatibility with source fortificationFlorian Weimer1-1/+6
On GCC before 11, IPA can make the fortified realpath aware that the buffer size is not large enough (8 bytes instead of PATH_MAX bytes). Fix this by using a buffer that is large enough. (cherry picked from commit 510fc20d73de12c85823d9996faac74666e9c2e7)
2023-07-31NEWS: Fix typosglibc-2.38Andreas K. Hüttel1-2/+3
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2023-07-30Create ChangeLog.old/ChangeLog.27Andreas K. Hüttel1-0/+10676
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2023-07-30Increase version numbersAndreas K. Hüttel2-3/+3
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2023-07-30INSTALL: regenerateAndreas K. Hüttel1-7/+7
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2023-07-30NEWS: minor wording fixesAndreas K. Hüttel1-2/+2
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2023-07-30install.texi: Build was tested with binutils 2.41 (just released)Andreas K. Hüttel1-1/+1
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2023-07-27install.texi: Update versions of most recent build toolsAndreas K. Hüttel1-7/+7
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2023-07-27contrib.texi: Update for 2.38Andreas K. Hüttel1-7/+103
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2023-07-27<sys/platform/x86.h>: Add APX supportH.J. Lu5-0/+14
Add support for Intel Advanced Performance Extensions: https://www.intel.com/content/www/us/en/developer/articles/technical/advanced-performance-extensions-apx.html to <sys/platform/x86.h>.
2023-07-27translations: update cs, nl, viAndreas K. Hüttel3-9/+84
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2023-07-26string: Fix tester build with fortify enable with gcc 6Adhemerval Zanella Netto1-0/+9
When building with fortify enabled, GCC 6 issues an warning the fortify wrapper might overflow the destination buffer. However, GCC does not provide a specific flag to disable the warning (the failure is tied to -Werror). So to avoid disable all errors, only enable the check for GCC 7 or newer. Checked on i686-linux-gnu. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2023-07-26linux: Fix i686 with gcc6Adhemerval Zanella Netto1-0/+9
On __convert_scm_timestamps GCC 6 issues an warning that tvts[0]/tvts[1] maybe be used uninitialized, however it would be used if type is set to a value different than 0 (done by either COMPAT_SO_TIMESTAMP_OLD or COMPAT_SO_TIMESTAMPNS_OLD) which will fallthrough to 'common' label. It does not show with gcc 7 or more recent versions. Checked on i686-linux-gnu. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2023-07-26i386: Remove memset_chk-nonshared.SAdhemerval Zanella Netto4-30/+6
Similar to memcpy, mempcpy, and memmove there is no need for an specific memset_chk-nonshared.S. It can be provided by memset-ia32.S itself for static library. Checked on i686-linux-gnu. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2023-07-26i386: Fix build with --enable-fortify=3Adhemerval Zanella Netto4-65/+1
The i386 string routines provide multiple internal definitions for memcpy, memmove, and mempcpy chk routines: $ objdump -t libc.a | grep __memcpy_chk 00000000 g F .text 0000000e __memcpy_chk 00000000 g F .text 00000013 __memcpy_chk $ objdump -t libc.a | grep __mempcpy_chk 00000000 g F .text 0000000e __mempcpy_chk 00000000 g F .text 00000013 __mempcpy_chk $ objdump -t libc.a | grep __memmove_chk 00000000 g F .text 0000000e __memmove_chk 00000000 g F .text 00000013 __memmove_chk Although is not an issue for normal static builds, with fortify=3 glibc itself might use the fortify chk functions and thus static build might fail with multiple definitions. For instance: x86_64-glibc-linux-gnu-gcc -m32 -march=i686 -o [...]math/test-signgam-uchar-static -nostdlib -nostartfiles -static -static-pie [...] x86_64-glibc-linux-gnu/bin/ld: [...]/libc.a(mempcpy-ia32.o): in function `__mempcpy_chk': [...]/glibc-git/string/../sysdeps/i386/i686/mempcpy.S:32: multiple definition of `__mempcpy_chk'; [...]/libc.a(mempcpy_chk-nonshared.o):[...]/debug/../sysdeps/i386/mempcpy_chk.S:28: first defined here collect2: error: ld returned 1 exit status make[2]: *** [../Rules:298: There is no need for mem*-nonshared.S, the __mem*_chk routines are already provided by the assembly routines. Checked on i686-linux-gnu with gcc 13 built with fortify=1,2,3 and without fortify. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2023-07-26posix: Fix test-errno build with fortify enableAdhemerval Zanella Netto1-1/+7
With gcc 11.3.1, building with -D_FORTIFY_SOURCE=2 shows: In function ‘getgroups’, inlined from ‘do_test’ at test-errno.c:129:12: ../misc/sys/cdefs.h:195:6: error: argument 1 value -1 is negative [-Werror=stringop-overflow=] 195 | ? __ ## f ## _alias (__VA_ARGS__) \ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../posix/bits/unistd.h:115:10: note: in expansion of macro ‘__glibc_fortify’ 115 | return __glibc_fortify (getgroups, __size, sizeof (__gid_t), | ^~~~~~~~~~~~~~~ ../posix/bits/unistd.h: In function ‘do_test’: ../posix/bits/unistd-decl.h:135:28: note: in a call to function ‘__getgroups_alias’ declared with attribute ‘access (write_only, 2, 1)’ 135 | extern int __REDIRECT_NTH (__getgroups_alias, (int __size, __gid_t __list[]), | ^~~~~~~~~~~~~~~~~ ../misc/sys/cdefs.h:264:6: note: in definition of macro ‘__REDIRECT_NTH’ 264 | name proto __asm__ (__ASMNAME (#alias)) __THROW It builds fine with gcc 12 and gcc 13. Checked on x86_64-linux-gnu. Reviewed-by: Carlos O'Donell <carlos@redhat.com>