Commit Graph

38810 Commits

Author SHA1 Message Date
Noah Goldstein
a6fbf4d51e 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>
2022-03-25 11:46:13 -05:00
Noah Goldstein
ece0eaa3f8 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>
2022-03-25 11:46:13 -05:00
Noah Goldstein
4c5200dd9f 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>
2022-03-25 11:46:13 -05:00
Joseph Myers
23808a422e 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.
2022-03-24 15:35:27 +00:00
Adhemerval Zanella
11ba44f3a7 iconvdata: Fix enum type on UTF-7
Checked on x86_64-linux-gnu.
2022-03-23 15:35:35 -03:00
Adhemerval Zanella
06e91f1a2e nscd: Remove unused variable 2022-03-23 15:33:17 -03:00
Adhemerval Zanella
0374b487a7 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.
2022-03-23 15:28:18 -03:00
Adhemerval Zanella
2a16484a75 support: Remove unused extract_8 function 2022-03-23 15:03:17 -03:00
Adhemerval Zanella
41397b9337 locale: Remove ununsed wctype_table_get function 2022-03-23 14:32:23 -03:00
Adhemerval Zanella
33f4d09bdc gmon: Remove unused sprofil.c functions 2022-03-23 14:29:25 -03:00
Joseph Myers
8ef9196b26 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.
2022-03-23 17:11:56 +00:00
Adhemerval Zanella
c7f05bd534 Fix ununsed fstatat64_time64_statx
It is only called for legacy ABIs.
2022-03-23 13:33:16 -03:00
Adhemerval Zanella
a4ea49f85e malloc: Fix duplicate inline for do_set_mxfast 2022-03-23 12:28:44 -03:00
Adhemerval Zanella
f60e45ba10 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.
2022-03-23 10:42:01 -03:00
Sam James
cb7b1c9014 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>
2022-03-22 21:53:43 -04:00
Siddhesh Poyarekar
d3f2c2c8b5 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>
2022-03-23 06:55:39 +05:30
Joseph Myers
f7fbb99652 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).
2022-03-22 18:01:16 +00:00
John David Anglin
05dec22d7b 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>
2022-03-22 17:35:54 +00:00
Siddhesh Poyarekar
bc0d18d873 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>
2022-03-22 19:41:46 +05:30
Siddhesh Poyarekar
06890c7ba5 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>
2022-03-22 19:41:42 +05:30
Siddhesh Poyarekar
b587456c0e 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>
2022-03-22 19:39:46 +05:30
Siddhesh Poyarekar
ac4653ef50 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>
2022-03-22 19:39:45 +05:30
Siddhesh Poyarekar
657472b2a5 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>
2022-03-22 19:39:44 +05:30
Siddhesh Poyarekar
cfa3bd48cb 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>
2022-03-22 19:39:42 +05:30
Siddhesh Poyarekar
906cecbe08 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>
2022-03-22 19:39:33 +05:30
Siddhesh Poyarekar
e7e5315b7f 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>
2022-03-22 19:39:20 +05:30
Siddhesh Poyarekar
b44389cb7f 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>
2022-03-22 19:39:18 +05:30
Siddhesh Poyarekar
26dea46119 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>
2022-03-22 19:39:17 +05:30
Siddhesh Poyarekar
8d6cf99f2f 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>
2022-03-22 19:39:16 +05:30
Siddhesh Poyarekar
3004604607 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>
2022-03-22 19:39:14 +05:30
Siddhesh Poyarekar
d01411f6bc 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>
2022-03-22 19:39:12 +05:30
Siddhesh Poyarekar
1c37b8022e 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>
2022-03-22 19:38:36 +05:30
Max Gautier
9df157b4ed 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>
2022-03-21 13:23:57 -03:00
Max Gautier
ef7b963280 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>
2022-03-21 13:23:56 -03:00
Max Gautier
09abb567a9 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>
2022-03-21 09:25:52 -03:00
Max Gautier
cd08388523 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>
2022-03-21 09:25:43 -03:00
Florian Weimer
59c30d5708 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>
2022-03-18 21:40:03 +01:00
Florian Weimer
88ed43ff0c 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>
2022-03-18 21:40:02 +01:00
Florian Weimer
6fece2968a libio: Convert tst_swprintf to the test framework
And increase test coverage slightly.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2022-03-18 21:40:01 +01:00
Florian Weimer
a2211c76c3 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>
2022-03-18 18:18:45 +01:00
Florian Weimer
e297d33c73 stdio-common: Generate ja_JP.EUC-JP locale
It is needed by tst-swprintf.
2022-03-17 10:50:26 +01:00
Florian Weimer
46c75c9aa2 stdio-common: Re-flow and sort Makefile variables 2022-03-17 10:50:26 +01:00
Siddhesh Poyarekar
e2f68b54e8 nss: Sort tests and tests-container and put one test per line
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2022-03-17 11:16:57 +05:30
H.J. Lu
564f7ae7b4 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>
2022-03-16 08:48:36 -07:00
John David Anglin
7a5c440102 hppa: Use END instead of PSEUDO_END in swapcontext.S 2022-03-15 23:04:39 +00:00
John David Anglin
d05e6dc8d1 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.
2022-03-15 15:12:03 +00:00
Steve Grubb
260a430dd8 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>
2022-03-14 20:02:49 +05:30
Steve Grubb
0e12ca0241 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>
2022-03-14 20:02:46 +05:30
Steve Grubb
0c03669626 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>
2022-03-14 20:02:43 +05:30
Steve Grubb
a35b8b225d 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>
2022-03-14 20:02:30 +05:30