aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-07-21io: Add time64 alias for fcntlFlorian Weimer
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2021-07-21misc: Add time64 alias for ioctlFlorian Weimer
Reviewed-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2021-07-21RISC-V: Update rv64 ULPsDarius Rad
Generated on a Microsemi Polarfire Icicle Kit running Linux version 5.6.18. Same ULPs were also produced on QEMU 5.2.0 running Linux 5.10.46-1.
2021-07-20resolv: Do not install libnss_dns.a, libnss_dns.soFlorian Weimer
Fixes commit e1fcf21474c5b522f ("resolv: Move nss_dns into libc").
2021-07-19hurd: Add support for spawn_do_closefromSamuel Thibault
2021-07-19elf: Fix tst-cpu-features-cpuinfo on some AMD systems (BZ #28090)Adhemerval Zanella
The SSBD feature is implemented in 2 different ways on AMD processors: newer systems (Zen3) provides AMD_SSBD (function 8000_0008, EBX[24]), while older system provides AMD_VIRT_SSBD (function 8000_0008, EBX[25]). However for AMD_VIRT_SSBD, kernel shows both 'ssdb' and 'virt_ssdb' on /proc/cpuinfo; while for AMD_SSBD only 'ssdb' is provided. This now check is AMD_SSBD is set to check for 'ssbd', otherwise check if AMD_VIRT_SSDB is set to check for 'virt_ssbd'. Checked on x86_64-linux-gnu on a Ryzen 9 5900x. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2021-07-19i386: Add the clone3 wrapperH.J. Lu
extern int clone3 (struct clone_args *__cl_args, size_t __size, int (*__func) (void *__arg), void *__arg); Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2021-07-19nss: Directly load nss_dns, without going through dlsym/dlopenFlorian Weimer
This partially fixes static-only NSS support (bug 27959): The dns module no longer needs dlopen. Support for disabling dlopen altogher remains to be added. This commit introduces module_load_builtin into nss/nss_module.c, which handles the common parts of loading the built-in nss_files and nss_dns modules. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-07-19resolv: Move nss_dns into libcFlorian Weimer
No abilist updates are needed because the symbols were GLIBC_PRIVATE. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-07-19resolv: Move res_query functions into libcFlorian Weimer
This switches to public symbols without __ prefixes, due to improved namespace management in glibc. The script was used with --no-new-version to move the symbols __res_nquery, __res_nquerydomain, __res_nsearch, __res_query, __res_querydomain, __res_search, res_query, res_querydomain, res_search. The public symbols res_nquery, res_nquerydomain, res_nsearch, res_ownok, res_query, res_querydomain, res_search were added with make update-all-abi. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-07-19resolv: Move res_mkquery, res_nmkquery into libcFlorian Weimer
This switches to public symbols without __ prefixes, due to improved namespace management in glibc. The symbols res_mkquery, __res_mkquery, __res_nmkquery were moved with the script (using --no-new-version). res_mkquery@@GLIBC_2.34, res_nmkquery@@GLIBC_2.34 were added using make update-all-abi. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-07-19resolv: Move res_send, res_nsend into libcFlorian Weimer
Switch to public symbols without __ prefix (due to improved namespace management). __res_send, __res_nsend were moved using the script (with --no-new-version). res_send@@GLIBC_2.34 and res_nsend@@GLIBC_2.34 were added using make update-all-abi. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2021-07-19resolv: Move res_hostalias into its own file, along with hostaliasFlorian Weimer
These deprecated symbols continue to be exported from libresolv. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-07-19resolv: Move __res_context_hostalias into its own file and into libcFlorian Weimer
And reformat it to GNU style. Remove the unecessary setbuf call. Use __fgets_unlocked for PLT avoidance; no locking is required here. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-07-19resolv: Move res_queriesmatch to its own file and into libcFlorian Weimer
And reformat it to GNU style. The treatment of this function matches res_nameinquery, for the reasons stated there. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-07-19resolv: Move res_nameinquery to its own file and into libcFlorian Weimer
And reformat to GNU style. This deprecated function is used in the implementation of the stub resolver (for now). Keep the public symbol in libresolv for now (so that no new symbol version is needed), and add a forwarder to libresolv. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-07-19resolv: Move ns_samename into its own file, and into libcFlorian Weimer
But only as an internal symbol, __libc_ns_samename. The libresolv ABI is preserved. This is because the function is deprecated, and it does not make sense to add new symbol versions for deprecated functions. Also reformat the implementation to GNU style. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-07-19resolv: Move ns_makecanon into its own file, and into libcFlorian Weimer
But only as an internal symbol, __libc_ns_makecanon. The libresolv ABI is preserved. This is because the function is deprecated, and it does not make sense to add new symbol versions for deprecated functions. Also reformat the implementation to GNU style. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-07-19resolv: Move res_isourserver to its own file and reformat to GNU styleFlorian Weimer
Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-07-19resolv: Move __res_get_nsaddr to its own file and into libcFlorian Weimer
Eliminate the use of the EXT macro from it because it does not add clarity. The function was added to res_send.c in 2015, and the copyright year reflects that. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-07-19resolv: Rename res_comp.c to res-name-checking.c and move into libcFlorian Weimer
This reflects what the remaining functions in the file do. The __res_dnok, __res_hnok, __res_mailok, __res_ownok were moved with the script, using --no-new-version, and turned into compat symbols. __libc_res_dnok@@GLIBC_PRIVATE and __libc_res_hnok@@GLIBC_PRIVATE are added for internal use, to avoid accidentally binding to compatibility symbols. The new public symbols res_dnok, res_hnok, res_mailok, res_ownok were added using make update-all-abi. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-07-19resolv: Move dn_skipname to its own file and into libcFlorian Weimer
And reformat it to GNU style. dn_skipname is used outside glibc, so do not deprecate it, and export it as dn_skipname (not __dn_skipname). Due to internal users, provide a __libc_dn_skipname alias, and keep __dn_skipname as a pure compatibility symbol. __dn_skipname@GLIBC_2.0 was moved using the script, and dn_skipname@@GLIBC_2.34 was added using make update-all-abi. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-07-19resolv: Move dn_comp to its own file and into libcFlorian Weimer
And reformat it to GNU style. dn_comp is used in various programs, so keep it as a non-deprecated symbol. Switch to dn_comp (not __dn_comp) for the ABI name. There are no internal users, so interposition is not a problem. The __dn_comp symbol was moved with scripts/move-symbol-to-libc.py --no-new-version. dn_comp@@GLIBC_2.34 was added with make update-all-abi. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-07-19resolv: Move _getlong, _getshort, __putlong, __putshort to res-putgetFlorian Weimer
And reformat to GNU style. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-07-19resolv: Move dn_expand to its own file and into libcFlorian Weimer
And reformat to GNU style. This switches back to the dn_expand name for the ABI symbol and turns __dn_expand into a compatibility symbol. With the improved namespace management in current glibc, it is no longer necessary to use a private namespace symbol. To avoid old code binding to a GLIBC_PRIVATE symbol by accident, use __libc_dn_expand for the internal symbol name. The symbols dn_expand, __dnexpand were moved using scripts/move-symbol-to-libc.py, followed by an adjustment to make dn_expand the only GLIBC_2.34 symbol. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-07-19resolv: Move ns_name_compress into its own file and into libcFlorian Weimer
And reformat to GNU style. The symbol was moved using scripts/move-symbol-to-libc.py. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-07-19resolv: Move ns_name_pack into its own file and into libcFlorian Weimer
And reformat to GNU style, and eliminate the labellen function. The symbol was moved using scripts/move-symbol-to-libc.py. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-07-19resolv: Move ns_name_pton into its own file and into libcFlorian Weimer
And reformat to GNU style, and eliminate the digits variable. The symbol was moved using scripts/move-symbol-to-libc.py. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-07-19resolv: Move ns_name_uncompress into its own file and into libcFlorian Weimer
And reformat to GNU style. Check for negative error returns (instead of -1). The symbol was moved using scripts/move-symbol-to-libc.py. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-07-19resolv: Move ns_name_skip to its own file and into libc (bug 28091)Florian Weimer
And reformat to GNU style. Avoid out-of-bounds pointer arithmetic. This also results in a fix of bug 28091 due to the additional packet length checks. The symbol was moved using scripts/move-symbol-to-libc.py. Reviewed-by: Carlos O'Donell <carlos@systemhalted.org>
2021-07-19resolv: Deprecate legacy interfaces in libresolvFlorian Weimer
Debugging interfaces: p_*, fp_*, and sym_* could conceivably be used to produce debug out, but these functions have not been updated to parse more resource records, so they are not very useful today. Likewise for ns_sprintrr and ns_sprintrrf. ns_format_ttl and ns_parse_ttl are related to these. Internal implementation details: res_isourserver is probably only useful in the implementation of a stub resolver, and so is res_nameinquery. Unclear semantics and bad performance: ns_samedomain, ns_subdomain, ns_makecanon, ns_samename do textual converions & copies instead of checking equivalence of the wire format. inet_neta cannot handle IPv6 addresses. res_hostalias has been superseded by getaddrinfo with AI_CANONNAME. hostalias is not thread-safe. Some functions have int as size arguments instead of size_t, so they do not follow current coding practices. However, dn_expand and b64_ntop are somewhat widely used (to name just two examples), so deprecating them seems problematic. Reviewed-by: Carlos O'Donell <carlos@systemhalted.org>
2021-07-19tst-safe-linking: make false positives even more improbableSiddhesh Poyarekar
There is a 1 in 16 chance of a corruption escaping safe-linking and to guard against spurious failures, tst-safe-linking runs each subtest 10 times to ensure that the chance is reduced to 1 in 2^40. However, in the 1 in 16 chance that a corruption does escape safe linking, it could well be caught by other sanity checks we do in malloc, which then results in spurious test failures like below: test test_fastbin_consolidate failed with a different error expected: malloc_consolidate(): unaligned fastbin chunk detected actual: malloc_consolidate(): invalid chunk size This failure is seen more frequently on i686; I was able to reproduce it in about 5 min of running it in a loop. Guard against such failures by recording them and retrying the test. Also, do not fail the test if we happened to get defeated by the 1 in 2^40 odds if in at least one of the instances it was detected by other checks. Finally, bolster the odds to 2^64 by running 16 times instead of 10. The test still has a chance of failure so it is still flaky in theory. However in practice if we see a failure here then it's more likely that there's a bug than it being an issue with the test. Add more printfs and also dump them to stdout so that in the event the test actually fails, we will have some data to try and understand why it may have failed. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2021-07-18htl: Do not expose pthread hidden proto outside libpthreadSamuel Thibault
Only libpthread.so can access them.
2021-07-16elf: Fix a wrong array access on tst-tls20Adhemerval Zanella
Check on x86_64-linux-gnu with --enable-stack-protector=all.
2021-07-15elf: Add -Wl,--no-as-needed for tst-tls-manydynamic*mod-dep-bad.so (BZ #28089)Adhemerval Zanella
The tests explicit requires the dependencies and it is required for the case the toolchain defaults to -Wl,--as-needed. Checked on x86_64-linux-gnu.
2021-07-15resolv: Move ns_name_unpack to its own file and into libcFlorian Weimer
Reformat to GNU style. Avoid out-of-bounds buffer arithmetic. Eliminate the labellen function. The symbol was moved using scripts/move-symbol-to-libc.py. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-07-15resolv: Remove unnecessary res_isourserver_p call from send_dgFlorian Weimer
As the comment indicates, the check is unnecessary due to the way the UDP socket is set up. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-07-15resolv: Move ns_name_ntop to its own file and into libcFlorian Weimer
Reformat to GNU style. Avoid out-of-bounds pointer arithmetic (e.g., use eom - dn < 2 instead of dn + 1 >= eom). Inline the labellen function and fold the compression pointer check into the length check (l >= 64). Assume ASCII encoding. The symbol was moved using scripts/move-symbol-to-libc.py. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-07-15nss_dns: Do not use deprecated packet parsing functionsFlorian Weimer
Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-07-15resolv: Sort Makefile routines and Versions lexicographicallyFlorian Weimer
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-07-15socket: Add hidden prototype for setsockoptFlorian Weimer
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-07-14elf: Fix DTV gap reuse logic (BZ #27135)Adhemerval Zanella
This is updated version of the 572bd547d57a (reverted by 40ebfd016ad2) that fixes the _dl_next_tls_modid issues. This issue with 572bd547d57a patch is the DTV entry will be only update on dl_open_worker() with the update_tls_slotinfo() call after all dependencies are being processed by _dl_map_object_deps(). However _dl_map_object_deps() itself might call _dl_next_tls_modid(), and since the _dl_tls_dtv_slotinfo_list::map is not yet set the entry will be wrongly reused. This patch fixes by renaming the _dl_next_tls_modid() function to _dl_assign_tls_modid() and by passing the link_map so it can set the slotinfo value so a subsequente _dl_next_tls_modid() call will see the entry as allocated. The intermediary value is cleared up on remove_slotinfo() for the case a library fails to load with RTLD_NOW. This patch fixes BZ #27135. Checked on x86_64-linux-gnu. Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
2021-07-14Fix linknamespace errors and local-plt-usages in nss_files.Stefan Liebler
After commit f9c8b11ed7726b858cd7b7cea0d3d7c5233d78cf "nss: Access nss_files through direct references", when building with -Os, multiple conform/.../linknamespace tests and elf/check-localplt are failing: Extra PLT reference: libc.so: fgetc_unlocked Extra PLT reference: libc.so: getline Or e.g.: [initial] glob -> [libc.a(glob.o)] __getpwnam_r -> [libc.a(getpwnam_r.o)] __nss_database_custom -> [libc.a(nsswitch.o)] __nss_module_get_function -> [libc.a(nss_module.o)] __nss_files_functions -> [libc.a(nss_files_functions.o)] _nss_files_endaliasent -> [libc.a(files-alias.o)] feof_unlocked [initial] glob -> [libc.a(glob.o)] __getpwnam_r -> [libc.a(getpwnam_r.o)] __nss_database_custom -> [libc.a(nsswitch.o)] __nss_module_get_function -> [libc.a(nss_module.o)] __nss_files_functions -> [libc.a(nss_files_functions.o)] _nss_files_endaliasent -> [libc.a(files-alias.o)] fgetc_unlocked [initial] glob -> [libc.a(glob.o)] __getpwnam_r -> [libc.a(getpwnam_r.o)] __nss_database_custom -> [libc.a(nsswitch.o)] __nss_module_get_function -> [libc.a(nss_module.o)] __nss_files_functions -> [libc.a(nss_files_functions.o)] _nss_files_endnetgrent -> [libc.a(files-netgrp.o)] getline This patch is using the hidden symbols where possible. Instead of fputc_unlocked, __putc_unlocked is used. (Compare to commit eeaa19f75e52d2d48074ae0c423f2311d67c42c6 "mntent: Use __putc_unlocked instead of fputc_unlocked")
2021-07-14Add static tests for __clone_internalH.J. Lu
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2021-07-14x86-64: Add the clone3 wrapperH.J. Lu
extern int clone3 (struct clone_args *__cl_args, size_t __size, int (*__func) (void *__arg), void *__arg); Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2021-07-14Add an internal wrapper for clone, clone2 and clone3H.J. Lu
The clone3 system call (since Linux 5.3) provides a superset of the functionality of clone and clone2. It also provides a number of API improvements, including the ability to specify the size of the child's stack area which can be used by kernel to compute the shadow stack size when allocating the shadow stack. Add: extern int __clone_internal (struct clone_args *__cl_args, int (*__func) (void *__arg), void *__arg); to provide an abstract interface for clone, clone2 and clone3. 1. Simplify stack management for thread creation by passing both stack base and size to create_thread. 2. Consolidate clone vs clone2 differences into a single file. 3. Call __clone3 if HAVE_CLONE3_WAPPER is defined. If __clone3 returns -1 with ENOSYS, fall back to clone or clone2. 4. Use only __clone_internal to clone a thread. Since the stack size argument for create_thread is now unconditional, always pass stack size to create_thread. 5. Enable the public clone3 wrapper in the future after it has been added to all targets. NB: Sandbox will return ENOSYS on clone3 in both Chromium: The following revision refers to this bug: https://chromium.googlesource.com/chromium/src/+/218438259dd795456f0a48f67cbe5b4e520db88b commit 218438259dd795456f0a48f67cbe5b4e520db88b Author: Matthew Denton <mpdenton@chromium.org> Date: Thu Jun 03 20:06:13 2021 Linux sandbox: return ENOSYS for clone3 Because clone3 uses a pointer argument rather than a flags argument, we cannot examine the contents with seccomp, which is essential to preventing sandboxed processes from starting other processes. So, we won't be able to support clone3 in Chromium. This CL modifies the BPF policy to return ENOSYS for clone3 so glibc always uses the fallback to clone. Bug: 1213452 Change-Id: I7c7c585a319e0264eac5b1ebee1a45be2d782303 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2936184 Reviewed-by: Robert Sesek <rsesek@chromium.org> Commit-Queue: Matthew Denton <mpdenton@chromium.org> Cr-Commit-Position: refs/heads/master@{#888980} [modify] https://crrev.com/218438259dd795456f0a48f67cbe5b4e520db88b/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc and Firefox: https://hg.mozilla.org/integration/autoland/rev/ecb4011a0c76 Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2021-07-14nss: Fix build error with --disable-nscdCooper Qu
The error is as follows: nss_module.c: In function 'module_load_nss_files': nss_module.c:117:7: error: 'is_nscd' undeclared (first use in this function) 117 | if (is_nscd) | ^~~~~~~ nss_module.c:117:7: note: each undeclared identifier is reported only once for each function it appears in nss_module.c:119:51: error: 'nscd_init_cb' undeclared (first use in this function); did you mean 'nscd_init'? 119 | void (*cb) (size_t, struct traced_file *) = nscd_init_cb; | ^~~~~~~~~~~~ | nscd_init
2021-07-13htl: Fix linking static examples against libpthreadSamuel Thibault
libpthread.a uses some mach and hurd RPCs so we need to link them in.
2021-07-13htl: Let libc call __pthread_mutex_{,try,un}lockSamuel Thibault
Now that NPTL was moved to libc, libc makes internal __pthread calls, so htl has to expose them internally.
2021-07-13posix: Ignore non opened files on tst-spawn5Adhemerval Zanella
The make program might open a pipe for its job server, which triggers an invalid check on the spawned process. This patch now passes the lowest file descriptor as ithe first argument, so only the range that was actually opened is checked. Checked on x86_64-linux-gnu and i686-linux-gnu and centos7 (which triggers the issue).