]> sourceware.org Git - glibc.git/log
glibc.git
2 years agostdlib: Fix tst-getrandom memcmp call
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.

2 years agostdlib: Fix tst-rand48.c printf types
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.

2 years agoelf: Remove unused functions from tst-audit25(a,b)
Adhemerval Zanella [Fri, 25 Mar 2022 11:53:42 +0000 (08:53 -0300)]
elf: Remove unused functions from tst-audit25(a,b)

2 years agonptl: Use libc-diag.h with tst-thread-setspecific
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.

2 years agocrypt: Remove unused variable on cert test
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.

2 years agoelf: Remove unused variables in tests
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.

2 years agoelf: Fix wrong fscanf usage on tst-pldd
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.

2 years agoposix: Remove unused variable on tst-_Fork.c
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.

2 years agoresolv: Initialize loop variable on tst-resolv-trailing
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.

2 years agolocale: Remove set but unused variable on ld-collate.c
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.

2 years agolocaledate: Fix printf type on tst_mbrtowc
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.

2 years agolocaledata: Remove unused variables in tests
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.

2 years agox86: Small improvements for wcslen
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>
2 years agox86: Small improvements for wcscpy-ssse3
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>
2 years agodebug: Improve fdelt_chk error message
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>
2 years agoAdd HWCAP2_AFP, HWCAP2_RPRES from Linux 5.17 to AArch64 bits/hwcap.h
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.

2 years agox86: Remove AVX str{n}casecmp
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>
2 years agox86: Add EVEX optimized str{n}casecmp
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>
2 years agox86: Add AVX2 optimized str{n}casecmp
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>
2 years agostring: Expand page cross test cases in test-strncmp.c
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>
2 years agostring: Expand page cross test cases in test-strcmp.c
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>
2 years agox86: Optimize str{n}casecmp TOLOWER logic in strcmp-sse42.S
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>
2 years agox86: Optimize str{n}casecmp TOLOWER logic in strcmp.S
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>
2 years agostring: Expand page cross tests in test-strncasecmp.c
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>
2 years agostring: Expand page cross tests in test-strcasecmp.c
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>
2 years agobenchtests: Use json-lib in bench-strncasecmp.c
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>
2 years agobenchtests: Use json-lib in bench-strcasecmp.c
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>
2 years agox86: Fix fallback for wcsncmp_avx2 in strcmp-avx2.S [BZ #28896]
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>
2 years agox86: Remove strspn-sse2.S and use the generic implementation
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>
2 years agox86: Remove strpbrk-sse2.S and use the generic implementation
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>
2 years agox86: Remove strcspn-sse2.S and use the generic implementation
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>
2 years agox86: Optimize strspn in strspn-c.c
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>
2 years agox86: Optimize strcspn and strpbrk in strcspn-c.c
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>
2 years agobenchtests: Use json-lib in bench-strspn.c
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>
2 years agobenchtests: Use json-lib in bench-strpbrk.c
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>
2 years agox86: Code cleanup in strchr-evex and comment justifying branch
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>
2 years agox86: Code cleanup in strchr-avx2 and comment justifying branch
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>
2 years agobenchtests: Add random benchmark in bench-strchr.c
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>
2 years agobenchtests: Use json-lib in bench-strchr.c
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>
2 years agoUpdate kernel version to 5.17 in tst-mman-consts.py
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.

2 years agoiconvdata: Fix enum type on UTF-7
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.

2 years agonscd: Remove unused variable
Adhemerval Zanella [Thu, 10 Mar 2022 20:16:56 +0000 (17:16 -0300)]
nscd: Remove unused variable

2 years agosupport: Fix support_process_state_wait path size calculation
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.

2 years agosupport: Remove unused extract_8 function
Adhemerval Zanella [Thu, 10 Mar 2022 19:45:58 +0000 (16:45 -0300)]
support: Remove unused extract_8 function

2 years agolocale: Remove ununsed wctype_table_get function
Adhemerval Zanella [Thu, 10 Mar 2022 12:51:20 +0000 (09:51 -0300)]
locale: Remove ununsed wctype_table_get function

2 years agogmon: Remove unused sprofil.c functions
Adhemerval Zanella [Thu, 10 Mar 2022 11:08:37 +0000 (08:08 -0300)]
gmon: Remove unused sprofil.c functions

2 years agoUpdate syscall lists for Linux 5.17
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.

2 years agoFix ununsed fstatat64_time64_statx
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.

2 years agomalloc: Fix duplicate inline for do_set_mxfast
Adhemerval Zanella [Wed, 9 Mar 2022 20:24:00 +0000 (17:24 -0300)]
malloc: Fix duplicate inline for do_set_mxfast

2 years agoelf: Remove inline _dl_dprintf
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.

2 years agoconfigure.ac: fix bashisms in configure.ac
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>
2 years agogetaddrinfo: Refactor code for readability
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>
2 years agoUse Linux 5.17 in build-many-glibcs.py
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).

2 years agoresolv: Fix unaligned accesses to fields in HEADER struct
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>
2 years agogai_init: Avoid jumping from if condition to its else counterpart
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>
2 years agogaiconf_init: Refactor some bits for readability
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>
2 years agogethosts: Return EAI_MEMORY on allocation failure
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>
2 years agogaih_inet: Split result generation into its own function
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>
2 years agogaih_inet: split loopback lookup into its own function
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>
2 years agogaih_inet: make gethosts into a function
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>
2 years agogaih_inet: separate nss lookup loop into its own function
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>
2 years agogaih_inet: Split nscd lookup code into its own function.
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>
2 years agogaih_inet: Split simple gethostbyname into its own function
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>
2 years agogaih_inet: make numeric lookup a separate routine
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>
2 years agogaih_inet: Simplify service resolution
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>
2 years agogetaddrinfo: Fix leak with AI_ALL [BZ #28852]
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>
2 years agogaih_inet: Simplify canon name resolution
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>
2 years agoSimplify allocations and fix merge and continue actions [BZ #28931]
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>
2 years agoiconv: Add UTF-7-IMAP variant in utf-7.c
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>
2 years agoiconv: make utf-7.c able to use variants
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>
2 years agoiconv: Better mapping to RFC for UTF-7
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>
2 years agoiconv: Always encode "optional direct" UTF-7 characters
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>
2 years agostdio-common: Add wide stream coverage to tst-vfprintf-user-type
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>
2 years agolibio: Flush-only _IO_str_overflow must not return EOF (bug 28949)
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>
2 years agolibio: Convert tst_swprintf to the test framework
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>
2 years agoscripts/dso-ordering-test.py: Fix C&P error in * callrefs processing
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>
2 years agostdio-common: Generate ja_JP.EUC-JP locale
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.

2 years agostdio-common: Re-flow and sort Makefile variables
Florian Weimer [Thu, 17 Mar 2022 09:49:07 +0000 (10:49 +0100)]
stdio-common: Re-flow and sort Makefile variables

2 years agonss: Sort tests and tests-container and put one test per line
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>
2 years agobenchtests: Use "=" instead of ":=" [BZ #28970]
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>
2 years agohppa: Use END instead of PSEUDO_END in swapcontext.S
John David Anglin [Tue, 15 Mar 2022 23:04:39 +0000 (23:04 +0000)]
hppa: Use END instead of PSEUDO_END in swapcontext.S

2 years agohppa: Implement swapcontext in assembler (bug 28960)
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.

2 years agoassociate a deallocator for iconv_open
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>
2 years agoassociate a deallocation for opendir
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>
2 years agoAdd access function attributes to epoll_wait
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>
2 years agoAdd access function attributes to grp and shadow headers
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>
2 years agoDefine ISO 639-3 "tok" [BZ #28950]
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.

2 years agonss: Protect against errno changes in function lookup (bug 28953)
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>
2 years agonss: Do not mention NSS test modules in <gnu/lib-names.h>
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>
2 years agomalloc: Exit early on test failure in tst-realloc
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>
2 years agoAdd some missing access function attributes
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>
2 years agolibio: Ensure output buffer for wchars (bug #28828)
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>
2 years agoinet: Return EAI_MEMORY when nrl_domainname() fails to allocate memory
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.

2 years agoinet: Remove strdupa from nrl_domainname()
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>
2 years agoinet: Fix getnameinfo (NI_NOFQDN) race condition (BZ#28566)
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>
2 years agobenchtests: make compare_strings.py accept string as attribute value
Su Lifan [Fri, 25 Feb 2022 08:58:07 +0000 (16:58 +0800)]
benchtests: make compare_strings.py accept string as attribute value

Commit ac759b1fbf28a82d99afde9046f8b72c7cba5dae added attribute
"overlap" to bench-memmove-walk, whose value is a string. This change
makes compare_strings.py fail since benchout_strings.schema.json
requires the values of attributes to be number.

This patch relaxes such constraint.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2 years agox86_64: Fix svml_d_tanh8_core_avx512.S code formatting
Sunil K Pandey [Mon, 7 Mar 2022 18:47:15 +0000 (10:47 -0800)]
x86_64: Fix svml_d_tanh8_core_avx512.S code formatting

This commit contains following formatting changes

1. Instructions proceeded by a tab.
2. Instruction less than 8 characters in length have a tab
   between it and the first operand.
3. Instruction greater than 7 characters in length have a
   space between it and the first operand.
4. Tabs after `#define`d names and their value.
5. 8 space at the beginning of line replaced by tab.
6. Indent comments with code.
7. Remove redundent .text section.
8. 1 space between line content and line comment.
9. Space after all commas.

Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
2 years agox86_64: Fix svml_d_tanh4_core_avx2.S code formatting
Sunil K Pandey [Mon, 7 Mar 2022 18:47:15 +0000 (10:47 -0800)]
x86_64: Fix svml_d_tanh4_core_avx2.S code formatting

This commit contains following formatting changes

1. Instructions proceeded by a tab.
2. Instruction less than 8 characters in length have a tab
   between it and the first operand.
3. Instruction greater than 7 characters in length have a
   space between it and the first operand.
4. Tabs after `#define`d names and their value.
5. 8 space at the beginning of line replaced by tab.
6. Indent comments with code.
7. Remove redundent .text section.
8. 1 space between line content and line comment.
9. Space after all commas.

Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
2 years agox86_64: Fix svml_d_tanh2_core_sse4.S code formatting
Sunil K Pandey [Mon, 7 Mar 2022 18:47:15 +0000 (10:47 -0800)]
x86_64: Fix svml_d_tanh2_core_sse4.S code formatting

This commit contains following formatting changes

1. Instructions proceeded by a tab.
2. Instruction less than 8 characters in length have a tab
   between it and the first operand.
3. Instruction greater than 7 characters in length have a
   space between it and the first operand.
4. Tabs after `#define`d names and their value.
5. 8 space at the beginning of line replaced by tab.
6. Indent comments with code.
7. Remove redundent .text section.
8. 1 space between line content and line comment.
9. Space after all commas.

Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
2 years agox86_64: Fix svml_s_tanhf8_core_avx2.S code formatting
Sunil K Pandey [Mon, 7 Mar 2022 18:47:15 +0000 (10:47 -0800)]
x86_64: Fix svml_s_tanhf8_core_avx2.S code formatting

This commit contains following formatting changes

1. Instructions proceeded by a tab.
2. Instruction less than 8 characters in length have a tab
   between it and the first operand.
3. Instruction greater than 7 characters in length have a
   space between it and the first operand.
4. Tabs after `#define`d names and their value.
5. 8 space at the beginning of line replaced by tab.
6. Indent comments with code.
7. Remove redundent .text section.
8. 1 space between line content and line comment.
9. Space after all commas.

Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
This page took 0.079717 seconds and 5 git commands to generate.