Adhemerval Zanella [Fri, 1 Apr 2022 12:52:14 +0000 (09:52 -0300)]
x86: Remove fabs{f} implementation
For x86_64 is the same as the generic implementation, while for i686
the builtin generates the same code.
Adhemerval Zanella [Fri, 1 Apr 2022 12:51:06 +0000 (09:51 -0300)]
alpha: Remove s_abs implementations
The generic implementation already uses builtins.
DJ Delorie [Tue, 29 Mar 2022 03:53:33 +0000 (23:53 -0400)]
Allow for unpriviledged nested containers
If the build itself is run in a container, we may not be able to
fully set up a nested container for test-container testing.
Notably is the mounting of /proc, since it's critical that it
be mounted from within the same PID namespace as its users, and
thus cannot be bind mounted from outside the container like other
mounts.
This patch defaults to using the parent's PID namespace instead of
creating a new one, as this is more likely to be allowed.
If the test needs an isolated PID namespace, it should add the "pidns"
command to its init script.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Szabolcs Nagy [Tue, 29 Mar 2022 08:50:23 +0000 (09:50 +0100)]
Increase the test timeout of some string tests
Recent changes in test-strncasecmp and test-strncmp pushed the run time
of the tests above the 4 minute limit specified in test-string.h on an
arm tester machine.
Siddhesh Poyarekar [Thu, 31 Mar 2022 16:30:58 +0000 (22:00 +0530)]
realpath: Bring back GNU extension on ENOENT and EACCES [BZ #28996]
The GNU extension for realpath states that if the path resolution fails
with ENOENT or EACCES and the resolved buffer is non-NULL, it will
contain part of the path that failed resolution.
commit
949ad78a189194048df8a253bb31d1d11d919044 broke this when it
omitted the copy on failure. Bring it back partially to continue
supporting this GNU extension.
Resolves: BZ #28996
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: Andreas Schwab <schwab@linux-m68k.org>
Adhemerval Zanella [Thu, 24 Mar 2022 18:17:12 +0000 (15:17 -0300)]
stdlib: Fix tst-getrandom memcmp call
The idea is to check if the up sizeof (buf) are equal, not only
the first byte.
Checked on x86_64-linux-gnu and i686-linux-gnu.
Adhemerval Zanella [Thu, 24 Mar 2022 18:22:55 +0000 (15:22 -0300)]
stdlib: Fix tst-rand48.c printf types
Checked on x86_64-linux-gnu and i686-linux-gnu.
Adhemerval Zanella [Fri, 25 Mar 2022 11:53:42 +0000 (08:53 -0300)]
elf: Remove unused functions from tst-audit25(a,b)
Adhemerval Zanella [Fri, 25 Mar 2022 12:01:48 +0000 (09:01 -0300)]
nptl: Use libc-diag.h with tst-thread-setspecific
And also use libsupport.
Checked on x86_64-linux-gnu and i686-linux-gnu.
Adhemerval Zanella [Fri, 25 Mar 2022 14:13:37 +0000 (11:13 -0300)]
crypt: Remove unused variable on cert test
Checked on x86_64-linux-gnu and i686-linux-gnu.
Adhemerval Zanella [Fri, 25 Mar 2022 14:16:26 +0000 (11:16 -0300)]
elf: Remove unused variables in tests
Checked on x86_64-linux-gnu and i686-linux-gnu.
Adhemerval Zanella [Fri, 25 Mar 2022 14:16:49 +0000 (11:16 -0300)]
elf: Fix wrong fscanf usage on tst-pldd
To take in consideration the extra '\0'.
Checked on x86_64-linux-gnu.
Adhemerval Zanella [Fri, 25 Mar 2022 14:25:22 +0000 (11:25 -0300)]
posix: Remove unused variable on tst-_Fork.c
Checked on x86_64-linux-gnu and i686-linux-gnu.
Adhemerval Zanella [Fri, 25 Mar 2022 14:26:26 +0000 (11:26 -0300)]
resolv: Initialize loop variable on tst-resolv-trailing
Checked on x86_64-linux-gnu and i686-linux-gnu.
Adhemerval Zanella [Fri, 25 Mar 2022 16:57:38 +0000 (13:57 -0300)]
locale: Remove set but unused variable on ld-collate.c
Checked on x86_64-linux-gnu and i686-linux-gnu.
Adhemerval Zanella [Mon, 28 Mar 2022 17:55:52 +0000 (14:55 -0300)]
localedate: Fix printf type on tst_mbrtowc
Checked on x86_64-linux-gnu and i686-linux-gnu.
Adhemerval Zanella [Mon, 28 Mar 2022 17:40:55 +0000 (14:40 -0300)]
localedata: Remove unused variables in tests
Checked on x86_64-linux-gnu and i686-linux-gnu.
Noah Goldstein [Fri, 25 Mar 2022 22:13:33 +0000 (17:13 -0500)]
x86: Small improvements for wcslen
Just a few QOL changes.
1. Prefer `add` > `lea` as it has high execution units it can run
on.
2. Don't break macro-fusion between `test` and `jcc`
3. Reduce code size by removing gratuitous padding bytes (-90
bytes).
geometric_mean(N=20) of all benchmarks New / Original: 0.959
All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Noah Goldstein [Fri, 25 Mar 2022 22:13:32 +0000 (17:13 -0500)]
x86: Small improvements for wcscpy-ssse3
Just a few small QOL changes.
1. Prefer `add` > `lea` as it has high execution units it can run
on.
2. Don't break macro-fusion between `test` and `jcc`
geometric_mean(N=20) of all benchmarks New / Original: 0.973
All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Cristian Rodríguez [Sun, 13 Mar 2022 18:40:24 +0000 (18:40 +0000)]
debug: Improve fdelt_chk error message
It is not a "buffer overflow detected" but an out of range
bit on fd_set
Signed-off-by: Cristian Rodríguez <crrodriguez@opensuse.org>
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Joseph Myers [Mon, 28 Mar 2022 13:16:48 +0000 (13:16 +0000)]
Add HWCAP2_AFP, HWCAP2_RPRES from Linux 5.17 to AArch64 bits/hwcap.h
Add the new HWCAP2_AFP and HWCAP2_RPRES constants from Linux 5.17.
Tested with build-many-glibcs.py for aarch64-linux-gnu.
Noah Goldstein [Wed, 23 Mar 2022 21:57:46 +0000 (16:57 -0500)]
x86: Remove AVX str{n}casecmp
The rational is:
1. SSE42 has nearly identical logic so any benefit is minimal (3.4%
regression on Tigerlake using SSE42 versus AVX across the
benchtest suite).
2. AVX2 version covers the majority of targets that previously
prefered it.
3. The targets where AVX would still be best (SnB and IVB) are
becoming outdated.
All in all the saving the code size is worth it.
All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Noah Goldstein [Thu, 24 Mar 2022 23:56:13 +0000 (18:56 -0500)]
x86: Add EVEX optimized str{n}casecmp
geometric_mean(N=40) of all benchmarks EVEX / SSE42: .621
All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Noah Goldstein [Thu, 24 Mar 2022 23:56:12 +0000 (18:56 -0500)]
x86: Add AVX2 optimized str{n}casecmp
geometric_mean(N=40) of all benchmarks AVX2 / SSE42: .702
All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Noah Goldstein [Wed, 23 Mar 2022 21:57:40 +0000 (16:57 -0500)]
string: Expand page cross test cases in test-strncmp.c
Test cases for when both `s1` and `s2` are near the end of a page
where previously missing.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Noah Goldstein [Wed, 23 Mar 2022 21:57:39 +0000 (16:57 -0500)]
string: Expand page cross test cases in test-strcmp.c
Test cases for when both `s1` and `s2` are near the end of a page
where previously missing.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Noah Goldstein [Wed, 23 Mar 2022 21:57:38 +0000 (16:57 -0500)]
x86: Optimize str{n}casecmp TOLOWER logic in strcmp-sse42.S
Slightly faster method of doing TOLOWER that saves an
instruction.
Also replace the hard coded 5-byte no with .p2align 4. On builds with
CET enabled this misaligned entry to strcasecmp.
geometric_mean(N=40) of all benchmarks New / Original: .920
All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Noah Goldstein [Wed, 23 Mar 2022 21:57:36 +0000 (16:57 -0500)]
x86: Optimize str{n}casecmp TOLOWER logic in strcmp.S
Slightly faster method of doing TOLOWER that saves an
instruction.
Also replace the hard coded 5-byte no with .p2align 4. On builds with
CET enabled this misaligned entry to strcasecmp.
geometric_mean(N=40) of all benchmarks New / Original: .894
All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Noah Goldstein [Wed, 23 Mar 2022 21:57:34 +0000 (16:57 -0500)]
string: Expand page cross tests in test-strncasecmp.c
Add more robust tests that cover all the page cross edge cases.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Noah Goldstein [Wed, 23 Mar 2022 21:57:33 +0000 (16:57 -0500)]
string: Expand page cross tests in test-strcasecmp.c
Add more robust tests that cover all the page cross edge cases.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Noah Goldstein [Wed, 23 Mar 2022 21:57:32 +0000 (16:57 -0500)]
benchtests: Use json-lib in bench-strncasecmp.c
Just QOL change to make parsing the output of the benchtests more
consistent.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Noah Goldstein [Wed, 23 Mar 2022 21:57:31 +0000 (16:57 -0500)]
benchtests: Use json-lib in bench-strcasecmp.c
Just QOL change to make parsing the output of the benchtests more
consistent.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Noah Goldstein [Thu, 24 Mar 2022 20:50:33 +0000 (15:50 -0500)]
x86: Fix fallback for wcsncmp_avx2 in strcmp-avx2.S [BZ #28896]
Overflow case for __wcsncmp_avx2_rtm should be __wcscmp_avx2_rtm not
__wcscmp_avx2.
commit
ddf0992cf57a93200e0c782e2a94d0733a5a0b87
Author: Noah Goldstein <goldstein.w.n@gmail.com>
Date: Sun Jan 9 16:02:21 2022 -0600
x86: Fix __wcsncmp_avx2 in strcmp-avx2.S [BZ# 28755]
Set the wrong fallback function for `__wcsncmp_avx2_rtm`. It was set
to fallback on to `__wcscmp_avx2` instead of `__wcscmp_avx2_rtm` which
can cause spurious aborts.
This change will need to be backported.
All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Noah Goldstein [Wed, 23 Mar 2022 21:57:29 +0000 (16:57 -0500)]
x86: Remove strspn-sse2.S and use the generic implementation
The generic implementation is faster.
geometric_mean(N=20) of all benchmarks New / Original: .710
All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Noah Goldstein [Wed, 23 Mar 2022 21:57:27 +0000 (16:57 -0500)]
x86: Remove strpbrk-sse2.S and use the generic implementation
The generic implementation is faster (see strcspn commit).
All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Noah Goldstein [Wed, 23 Mar 2022 21:57:26 +0000 (16:57 -0500)]
x86: Remove strcspn-sse2.S and use the generic implementation
The generic implementation is faster.
geometric_mean(N=20) of all benchmarks New / Original: .678
All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Noah Goldstein [Wed, 23 Mar 2022 21:57:24 +0000 (16:57 -0500)]
x86: Optimize strspn in strspn-c.c
Use _mm_cmpeq_epi8 and _mm_movemask_epi8 to get strlen instead of
_mm_cmpistri. Also change offset to unsigned to avoid unnecessary
sign extensions.
geometric_mean(N=20) of all benchmarks that dont fallback on
sse2; New / Original: .901
All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Noah Goldstein [Wed, 23 Mar 2022 21:57:22 +0000 (16:57 -0500)]
x86: Optimize strcspn and strpbrk in strcspn-c.c
Use _mm_cmpeq_epi8 and _mm_movemask_epi8 to get strlen instead of
_mm_cmpistri. Also change offset to unsigned to avoid unnecessary
sign extensions.
geometric_mean(N=20) of all benchmarks that dont fallback on
sse2/strlen; New / Original: .928
All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Noah Goldstein [Wed, 23 Mar 2022 21:57:20 +0000 (16:57 -0500)]
benchtests: Use json-lib in bench-strspn.c
Just QOL change to make parsing the output of the benchtests more
consistent.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Noah Goldstein [Wed, 23 Mar 2022 21:57:19 +0000 (16:57 -0500)]
benchtests: Use json-lib in bench-strpbrk.c
Just QOL change to make parsing the output of the benchtests more
consistent.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Noah Goldstein [Wed, 23 Mar 2022 21:57:18 +0000 (16:57 -0500)]
x86: Code cleanup in strchr-evex and comment justifying branch
Small code cleanup for size: -81 bytes.
Add comment justifying using a branch to do NULL/non-null return.
All string/memory tests pass and no regressions in benchtests.
geometric_mean(N=20) of all benchmarks New / Original: .985
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Noah Goldstein [Wed, 23 Mar 2022 21:57:16 +0000 (16:57 -0500)]
x86: Code cleanup in strchr-avx2 and comment justifying branch
Small code cleanup for size: -53 bytes.
Add comment justifying using a branch to do NULL/non-null return.
All string/memory tests pass and no regressions in benchtests.
geometric_mean(N=20) of all benchmarks Original / New: 1.00
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Noah Goldstein [Wed, 23 Mar 2022 21:57:14 +0000 (16:57 -0500)]
benchtests: Add random benchmark in bench-strchr.c
Add benchmark that randomizes whether return should be NULL or pointer
to CHAR. The rationale is on many architectures there is a choice
between a predicate execution option (i.e cmovcc on x86) or a branch.
On x86 the results for cmovcc vs branch are something along the lines
of the following:
perc-zero, Br On Result, Time Br / Time cmov
0.10, 1, ,0.983
0.10, 0, ,1.246
0.25, 1, ,1.035
0.25, 0, ,1.49
0.33, 1, ,1.016
0.33, 0, ,1.579
0.50, 1, ,1.228
0.50, 0, ,1.739
0.66, 1, ,1.039
0.66, 0, ,1.764
0.75, 1, ,0.996
0.75, 0, ,1.642
0.90, 1, ,1.071
0.90, 0, ,1.409
1.00, 1, ,0.937
1.00, 0, ,0.999
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Noah Goldstein [Wed, 23 Mar 2022 21:57:13 +0000 (16:57 -0500)]
benchtests: Use json-lib in bench-strchr.c
Just QOL change to make parsing the output of the benchtests more
consistent.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Joseph Myers [Thu, 24 Mar 2022 15:35:27 +0000 (15:35 +0000)]
Update kernel version to 5.17 in tst-mman-consts.py
This patch updates the kernel version in the test tst-mman-consts.py
to 5.17. (There are no new MAP_* constants covered by this test in
5.17 that need any other header changes.)
Tested with build-many-glibcs.py.
Adhemerval Zanella [Tue, 22 Mar 2022 18:54:38 +0000 (15:54 -0300)]
iconvdata: Fix enum type on UTF-7
Checked on x86_64-linux-gnu.
Adhemerval Zanella [Thu, 10 Mar 2022 20:16:56 +0000 (17:16 -0300)]
nscd: Remove unused variable
Adhemerval Zanella [Thu, 10 Mar 2022 19:49:08 +0000 (16:49 -0300)]
support: Fix support_process_state_wait path size calculation
Use INT_STRLEN_BOUND to proper get the maximum pid_t size. Also
fix the wrong calculation (the 3 should multiply the sizeof (pid_t)).
Checked on x86_64-linux-gnu.
Adhemerval Zanella [Thu, 10 Mar 2022 19:45:58 +0000 (16:45 -0300)]
support: Remove unused extract_8 function
Adhemerval Zanella [Thu, 10 Mar 2022 12:51:20 +0000 (09:51 -0300)]
locale: Remove ununsed wctype_table_get function
Adhemerval Zanella [Thu, 10 Mar 2022 11:08:37 +0000 (08:08 -0300)]
gmon: Remove unused sprofil.c functions
Joseph Myers [Wed, 23 Mar 2022 17:11:56 +0000 (17:11 +0000)]
Update syscall lists for Linux 5.17
Linux 5.17 has one new syscall, set_mempolicy_home_node. Update
syscall-names.list and regenerate the arch-syscall.h headers with
build-many-glibcs.py update-syscalls.
Tested with build-many-glibcs.py.
Adhemerval Zanella [Wed, 9 Mar 2022 21:35:39 +0000 (18:35 -0300)]
Fix ununsed fstatat64_time64_statx
It is only called for legacy ABIs.
Adhemerval Zanella [Wed, 9 Mar 2022 20:24:00 +0000 (17:24 -0300)]
malloc: Fix duplicate inline for do_set_mxfast
Adhemerval Zanella [Mon, 7 Mar 2022 13:43:41 +0000 (10:43 -0300)]
elf: Remove inline _dl_dprintf
It is not used on rtld and ldsodef interfaces are meant to be used
solely on loader. It also removes the only usage of gcc extension
__builtin_va_arg_pack.
Sam James [Tue, 22 Mar 2022 17:33:09 +0000 (17:33 +0000)]
configure.ac: fix bashisms in configure.ac
configure scripts need to be runnable with a POSIX-compliant /bin/sh.
On many (but not all!) systems, /bin/sh is provided by Bash, so errors
like this aren't spotted. Notably Debian defaults to /bin/sh provided
by dash which doesn't tolerate such bashisms as '=='.
This retains compatibility with bash.
Fixes configure warnings/errors like:
```
checking if compiler warns about alias for function with incompatible types... yes
/var/tmp/portage/sys-libs/glibc-2.34-r10/work/glibc-2.34/configure: 4209: test: xyes: unexpected operator
```
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Signed-off-by: Sam James <sam@gentoo.org>
Siddhesh Poyarekar [Tue, 22 Mar 2022 17:10:05 +0000 (22:40 +0530)]
getaddrinfo: Refactor code for readability
The close_retry goto jump is confusing and clumsy to read, so refactor
the code a bit to make it easier to follow.
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
Joseph Myers [Tue, 22 Mar 2022 18:01:16 +0000 (18:01 +0000)]
Use Linux 5.17 in build-many-glibcs.py
This patch makes build-many-glibcs.py use Linux 5.17.
Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).
John David Anglin [Tue, 22 Mar 2022 17:35:54 +0000 (17:35 +0000)]
resolv: Fix unaligned accesses to fields in HEADER struct
The structure HEADER is normally aligned to a word boundary but
sometimes it needs to be accessed when aligned on a byte boundary.
This change defines a new typedef, UHEADER, with alignment 1.
It is used to ensure the fields are accessed with byte loads and
stores when necessary.
V4: Change to res_mkquery.c deleted. Small whitespace fix.
V5: Move UHEADER typedef to resolv/resolv-internal.h. Replace all
HEADER usage with UHEADER in resolv/res_send.c.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Siddhesh Poyarekar [Tue, 3 Aug 2021 15:59:23 +0000 (21:29 +0530)]
gai_init: Avoid jumping from if condition to its else counterpart
Clean up another antipattern where code flows from an if condition to
its else counterpart with a goto.
Most of the change in this patch is whitespace-only; a `git diff -b`
ought to show the actual logic changes.
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
Siddhesh Poyarekar [Tue, 27 Jul 2021 17:19:53 +0000 (22:49 +0530)]
gaiconf_init: Refactor some bits for readability
Split out line processing for `label`, `precedence` and `scopev4` into
separate functions instead of the gotos.
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
Siddhesh Poyarekar [Wed, 2 Mar 2022 06:15:29 +0000 (11:45 +0530)]
gethosts: Return EAI_MEMORY on allocation failure
All other cases of failures due to lack of memory return EAI_MEMORY, so
it seems wrong to return EAI_SYSTEM here. The only reason
convert_hostent_to_gaih_addrtuple could fail is on calloc failure.
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
Siddhesh Poyarekar [Mon, 7 Mar 2022 15:08:31 +0000 (20:38 +0530)]
gaih_inet: Split result generation into its own function
Simplify the loop a wee bit and clean up variable names too.
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
Siddhesh Poyarekar [Mon, 7 Mar 2022 14:54:37 +0000 (20:24 +0530)]
gaih_inet: split loopback lookup into its own function
Flatten the condition nesting and replace the alloca for RET.AT/ATR with
a single array LOCAL_AT[2]. This gets rid of alloca and alloca
accounting.
`git diff -b` is probably the best way to view this change since much of
the diff is whitespace changes.
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
Siddhesh Poyarekar [Mon, 7 Mar 2022 14:18:48 +0000 (19:48 +0530)]
gaih_inet: make gethosts into a function
The macro is quite a pain to debug, so make gethosts into a function to
make it easier to maintain.
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
Siddhesh Poyarekar [Mon, 7 Mar 2022 10:26:22 +0000 (15:56 +0530)]
gaih_inet: separate nss lookup loop into its own function
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
Siddhesh Poyarekar [Mon, 7 Mar 2022 10:23:45 +0000 (15:53 +0530)]
gaih_inet: Split nscd lookup code into its own function.
Add a new member got_ipv6 to indicate if the results have an IPv6
result and use it instead of the local got_ipv6.
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
Siddhesh Poyarekar [Fri, 4 Mar 2022 09:27:12 +0000 (14:57 +0530)]
gaih_inet: Split simple gethostbyname into its own function
Add a free_at flag in gaih_result to indicate if res.at needs to be
freed by the caller.
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
Siddhesh Poyarekar [Mon, 7 Mar 2022 08:38:51 +0000 (14:08 +0530)]
gaih_inet: make numeric lookup a separate routine
Introduce the gaih_result structure and general paradigm for cleanups
that follow to process the lookup request and return a result. A lookup
function (like text_to_binary_address), should return an integer error
code and set members of gaih_result based on what it finds. If the
function does not have a result and no errors have occurred during the
lookup, it should return 0 and res.at should be set to NULL, allowing a
subsequent function to do the lookup until we run out of options.
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
Siddhesh Poyarekar [Thu, 10 Feb 2022 07:57:11 +0000 (13:27 +0530)]
gaih_inet: Simplify service resolution
Refactor the code to split out the service resolution code into a
separate function. Allocate the service tuples array just once to the
size of the typeproto array, thus avoiding the unnecessary pointer
chasing and stack allocations.
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
Siddhesh Poyarekar [Thu, 3 Mar 2022 17:37:42 +0000 (23:07 +0530)]
getaddrinfo: Fix leak with AI_ALL [BZ #28852]
Use realloc in convert_hostent_to_gaih_addrtuple and fix up pointers in
the result list so that a single block is maintained for
hostbyname3_r/hostbyname2_r and freed in gaih_inet. This result is
never merged with any other results, since the hosts database does not
permit merging.
Resolves BZ #28852.
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
Siddhesh Poyarekar [Mon, 7 Mar 2022 16:47:36 +0000 (22:17 +0530)]
gaih_inet: Simplify canon name resolution
Simplify logic for allocation of canon to remove the canonbuf variable;
canon now always points to an allocated block. Also pull the canon name
set into a separate function.
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
Siddhesh Poyarekar [Thu, 17 Mar 2022 06:14:34 +0000 (11:44 +0530)]
Simplify allocations and fix merge and continue actions [BZ #28931]
Allocations for address tuples is currently a bit confusing because of
the pointer chasing through PAT, making it hard to observe the sequence
in which allocations have been made. Narrow scope of the pointer
chasing through PAT so that it is only used where necessary.
This also tightens actions behaviour with the hosts database in
getaddrinfo to comply with the manual text. The "continue" action
discards previous results and the "merge" action results in an immedate
lookup failure. Consequently, chaining of allocations across modules is
no longer necessary, thus opening up cleanup opportunities.
A test has been added that checks some combinations to ensure that they
work correctly.
Resolves: BZ #28931
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
Max Gautier [Mon, 21 Mar 2022 12:25:05 +0000 (09:25 -0300)]
iconv: Add UTF-7-IMAP variant in utf-7.c
UTF-7-IMAP differs from UTF-7 in the followings ways (see RFC 3501[1]
for reference) :
- The shift character is '&' instead of '+'
- There is no "optional direct characters" and the "direct characters"
set is different
- There is no implicit shift back to US-ASCII from BASE64, all BASE64
sequences MUST be terminated with '-'
[1]: https://datatracker.ietf.org/doc/html/rfc3501#section-5.1.3
Signed-off-by: Max Gautier <mg@max.gautier.name>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Max Gautier [Mon, 21 Mar 2022 12:12:05 +0000 (09:12 -0300)]
iconv: make utf-7.c able to use variants
Add infrastructure in utf-7.c to handle variants. The approach comes from
iso646.c
The variant is defined at gconv_init time and is passed as a
supplementary variable.
Signed-off-by: Max Gautier <mg@max.gautier.name>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Max Gautier [Sun, 20 Mar 2022 16:41:05 +0000 (17:41 +0100)]
iconv: Better mapping to RFC for UTF-7
- Direct use of characters instead of arcane arrays
- isxbase64 is not the Modified BASE64 alphabet, but the characters who
needs to trigger an explicit shift back to US-ASCII. Make that clearer
Signed-off-by: Max Gautier <mg@max.gautier.name>
Reviewed-by: Adhemerval Zanellla <adhemerval.zanella@linaro.org>
Max Gautier [Thu, 9 Dec 2021 09:31:49 +0000 (10:31 +0100)]
iconv: Always encode "optional direct" UTF-7 characters
Signed-off-by: Max Gautier <mg@max.gautier.name>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Fri, 18 Mar 2022 20:27:54 +0000 (21:27 +0100)]
stdio-common: Add wide stream coverage to tst-vfprintf-user-type
And use TEST_COMPARE_STRING for the narrow tests.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Fri, 18 Mar 2022 20:27:54 +0000 (21:27 +0100)]
libio: Flush-only _IO_str_overflow must not return EOF (bug 28949)
In general, _IO_str_overflow returns the character passed as an argument
on success. However, if flush-only operation is requested by passing
EOF, returning EOF looks like an error, and the caller cannot tell
whether the operation was successful or not.
_IO_wstr_overflow had the same bug regarding WEOF.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Fri, 18 Mar 2022 20:27:54 +0000 (21:27 +0100)]
libio: Convert tst_swprintf to the test framework
And increase test coverage slightly.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Fri, 18 Mar 2022 17:18:35 +0000 (18:18 +0100)]
scripts/dso-ordering-test.py: Fix C&P error in * callrefs processing
The elf/dso-sort-tests-src subdirectory is not changed by this commit,
so it seems that the cut-and-paste error was not material.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Thu, 17 Mar 2022 09:49:07 +0000 (10:49 +0100)]
stdio-common: Generate ja_JP.EUC-JP locale
It is needed by tst-swprintf.
Florian Weimer [Thu, 17 Mar 2022 09:49:07 +0000 (10:49 +0100)]
stdio-common: Re-flow and sort Makefile variables
Siddhesh Poyarekar [Thu, 17 Mar 2022 05:46:57 +0000 (11:16 +0530)]
nss: Sort tests and tests-container and put one test per line
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
H.J. Lu [Wed, 16 Mar 2022 15:43:48 +0000 (08:43 -0700)]
benchtests: Use "=" instead of ":=" [BZ #28970]
Use "=" instead of ":=" to allow sysdeps Makefiles to add more benches
to bench and benchset. This fixes BZ #28970.
Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>
John David Anglin [Tue, 15 Mar 2022 23:04:39 +0000 (23:04 +0000)]
hppa: Use END instead of PSEUDO_END in swapcontext.S
John David Anglin [Tue, 15 Mar 2022 15:12:03 +0000 (15:12 +0000)]
hppa: Implement swapcontext in assembler (bug 28960)
When swapcontext.c is compiled without -g, the following error occurs:
Error: CFI instruction used without previous .cfi_startproc
Fix by converting swapcontext routine to assembler.
Steve Grubb [Fri, 11 Mar 2022 22:04:46 +0000 (17:04 -0500)]
associate a deallocator for iconv_open
This patch associates iconv_close as a deallocator for iconv_open. This
required moving the iconv_close declaration above iconv_open.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Steve Grubb [Fri, 11 Mar 2022 20:29:06 +0000 (15:29 -0500)]
associate a deallocation for opendir
This patch associates closedir as a deallocation for opendir and fdopendir.
This required moving the closedir declaration above the other 2 functions.
Reviewed-by: Paul Eggert <eggert@cs.ucla.edu>
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Steve Grubb [Fri, 11 Mar 2022 14:40:41 +0000 (09:40 -0500)]
Add access function attributes to epoll_wait
This patch adds write access function attributes to the epoll_wait family of
functions
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Steve Grubb [Thu, 10 Mar 2022 22:31:34 +0000 (17:31 -0500)]
Add access function attributes to grp and shadow headers
This patch adds access function attributes to the re-entrant functions
in grp.h and shadow headers.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Carlos O'Donell [Tue, 8 Mar 2022 19:57:29 +0000 (14:57 -0500)]
Define ISO 639-3 "tok" [BZ #28950]
Effective 2022-01-20 via SIL request 2021-043 the identifier "tok"
is now active for Toki Pona in the code set for ISO 639-3.
References:
https://iso639-3.sil.org/code/tok
https://iso639-3.sil.org/sites/iso639-3/files/change_requests/2021/2021-043.pdf
No regressions on x86_64.
Florian Weimer [Fri, 11 Mar 2022 07:23:56 +0000 (08:23 +0100)]
nss: Protect against errno changes in function lookup (bug 28953)
dlopen may clobber errno. The nss_test_errno module uses an ELF
constructor to achieve that, but there could be internal errors
during dlopen that cause this, too. Therefore, the NSS framework
has to guard against such errno clobbers.
__nss_module_get_function is currently the only function that calls
__nss_module_load, so it is sufficient to save and restore errno
around this call.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Florian Weimer [Fri, 11 Mar 2022 07:23:56 +0000 (08:23 +0100)]
nss: Do not mention NSS test modules in <gnu/lib-names.h>
They are not actually installed. Use the nss_files version instead
in nss/Makefile, similar to how __nss_shlib_revision is derived
from LIBNSS_FILES_SO.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Florian Weimer [Thu, 10 Mar 2022 07:50:51 +0000 (08:50 +0100)]
malloc: Exit early on test failure in tst-realloc
This addresses more (correct) use-after-free warnings reported by
GCC 12 on some targets.
Fixes commit
c094c232eb3246154265bb035182f92fe1b17ab8 ("Avoid
-Wuse-after-free in tests [BZ #26779].").
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Steve Grubb [Thu, 10 Mar 2022 00:26:33 +0000 (05:56 +0530)]
Add some missing access function attributes
This patch adds some missing access function attributes to getrandom /
getentropy and several functions in sys/xattr.h
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
José Bollo [Tue, 8 Mar 2022 08:58:16 +0000 (09:58 +0100)]
libio: Ensure output buffer for wchars (bug #28828)
The _IO_wfile_overflow does not check if the write pointer for wide
data is valid before access, different than _IO_file_overflow. This
leads to crash on some cases, as described by bug 28828.
The minimal sequence to produce the crash was:
#include <stdio.h>
#include <wchar.h>
int main (int ac, char **av)
{
setvbuf (stdout, NULL, _IOLBF, 0);
fgetwc (stdin);
fputwc (10, stdout); /*CRASH HERE!*/
return 0;
}
The "fgetwc(stdin);" is necessary since it triggers the bug by setting
the flag _IO_CURRENTLY_PUTTING on stdout indirectly (file wfileops.c,
function _IO_wfile_underflow, line 213).
Signed-off-by: Jose Bollo <jobol@nonadev.net>
Adhemerval Zanella [Wed, 10 Nov 2021 18:32:42 +0000 (15:32 -0300)]
inet: Return EAI_MEMORY when nrl_domainname() fails to allocate memory
It aligns NI_NOFQDN with default behavior for getnameinfo().
Checked on x86_64-linux-gnu.
Adhemerval Zanella [Wed, 10 Nov 2021 18:26:52 +0000 (15:26 -0300)]
inet: Remove strdupa from nrl_domainname()
We can use the already in place scratch_buffer.
Checked on x86_64-linux-gnu.
Reviewed-by: DJ Delorie <dj@redhat.com>
Adhemerval Zanella [Wed, 10 Nov 2021 17:40:30 +0000 (14:40 -0300)]
inet: Fix getnameinfo (NI_NOFQDN) race condition (BZ#28566)
The 'not_first' is accessed on nrl_domainname() in a non atomically
way, although it is only updated after the lock is taken.
This patch fix the double-checked locking by using acquire-release
atomic operation instead of plain load and by moving the 'not_first'
store only after 'domain' is actually set.
Checked on x86_64-linux-gnu.
Reviewed-by: DJ Delorie <dj@redhat.com>