summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* elf: Add SVE support for aarch64 rtld-auditazanella/ld-audit-fixesAdhemerval Zanella2021-09-1032-92/+856
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To implement lazy binding is enabled when profiling or auditing used, even when STO_AARCH64_VARIANT_PCS is set. Also, to not incur in performance penalties on architecture without SVE, the PLT entrypoint is set to a newer one, _dl_runtime_profile_sve, which is used iff 'hwcap' has HWCAP_SVE bit set. This should be a fair assumption since SVE has a defined set of registers for argument passing and return values. A new ABI with either different argument passing or different registers would require a different PLT entry, but I assume this would require another symbol flag anyway (or at least a different ELF mark to indicate so). The profile '_dl_runtime_profile_sve' entrypoint assumes the largest SVE register size possible (2048 bits) and thus it requires a quite large stack (8976 bytes). I think it would be possible make the stack requirement dynamic depending of the vector length, but it would make the PLT audit function way more complex. It extends the La_aarch64_vector with a long double pointer to a stack alloced buffer to hold the SVE Z register, along with a pointer to hold the P registers on La_aarch64_regs. It means the if 'lr_sve' is 0 in either La_aarch64_regs or La_aarch64_retval the La_aarch64_vector contains the floating-pointer registers that can be accessed directly (non SVE hardware). Otherwise, 'La_aarch64_vector.z' points to a memory area that holds up to 'lr_sve' bytes for the Z registers, which can be loaded with svld1 intrinsic for instance (as tst-audit28.c does). The P register follows the same logic, with each La_aarch64_regs.lr_sve_pregs pointing to an area of memory 'lr_sve/8' in size. So, to access the FP register as float you can use: static inline float regs_vec_to_float (const La_aarch64_regs *regs, int idx) { float r; if (regs->lr_sve == 0) r = regs->lr_vreg[idx].s; else memcpy (&r, &regs->lr_vreg[idx].z[0], sizeof (r)); return r; } This patch is not complete yet: the tst-audit28 does not check if compiler supports SVE (we would need a configure check to disable for such case), I need to add a proper comment for the _dl_runtime_profile_sve stack layout, the test need to check for the P register state clobbering. I also haven't check the performance penalties with this approach, and maybe the way I am saving/restoring the SVE register might be optimized. In any case, I checked on a SVE machine and at least the testcase work as expected without any regressions. I also did a sniff test on a non SVE machine.
* elf: Fix runtime linker auditing on aarch64 (BZ #26643)Ben Woodard2021-09-1014-48/+741
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The dynamic linker's auditing was not working on aarch64. There were two distinct problems: 1. _dl_runtime_resolve was not preserving x8 the indirect result location register. 2. The NEON Q registers pushed onto the stack by _dl_runtime_resolve() were twice the size of D registers extracted from the stack frame by _dl_runtime_profile(). To fix it the rtld-auditor interfaces is changed for aarch64: * LAV_CURRENT is bumped to v2 and loader will fail to load audit modules that return a version different than the one supported. * The La_aarch64_regs structure was expanded to include x8 and the full sized NEON V registers that are required to be preserved by the ABI. * dl_runtime_profile needed to extract registers saved by _dl_runtime_resolve and put them into the new correctly sized La_aarch64_regs structure. * The return value structure La_aarch64_retval also did not have the correctly sized NEON V registers. Similar to x86, a new La_aarch64_vector type to represent the NEON register is added on the La_aarch64_regs (so each type can be accessed easier). Checked on aarch64-linux-gnu. Co-authored-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* elf: Move LAV_CURRENT to link_lavcurrent.hAdhemerval Zanella2021-09-103-2/+27
|
* elf: Add LA_SYMB_BINDNOWAdhemerval Zanella2021-09-1013-8/+467
|
* elf: Issue la_symbind() for bind-now (BZ #23734)Adhemerval Zanella2021-09-1020-20/+780
|
* elf: Add la_activity during application exitAdhemerval Zanella2021-09-105-0/+277
|
* elf: Add main application on main_map l_nameAdhemerval Zanella2021-09-1011-21/+86
|
* elf: Issue audit la_objopen() for vDSOAdhemerval Zanella2021-09-107-8/+180
|
* elf: Add _dl_audit_pltexitAdhemerval Zanella2021-09-1022-115/+151
| | | | | It consolidates the code required to call la_pltexit() audit callback.
* elf: Add _dl_audit_pltenterAdhemerval Zanella2021-09-103-72/+81
| | | | | It consolidates the code required to call la_pltenter() audit callback.
* elf: Add _dl_audit_preinitAdhemerval Zanella2021-09-104-21/+20
| | | | | It consolidates the code required to call la_preinit() audit callback.
* elf: Add _dl_audit_symbind_alt and _dl_audit_symbindAdhemerval Zanella2021-09-105-123/+130
| | | | | It consolidates the code required to call la_symbind{32,64}() audit callback.
* elf: Add _dl_audit_objcloseAdhemerval Zanella2021-09-104-34/+24
| | | | | It consolidates the code required to call la_objclose() audit callback.
* elf: Add _dl_audit_objsearchAdhemerval Zanella2021-09-103-56/+44
| | | | | It consolidates the code required to call la_objsearch() audit callback.
* elf: Add _dl_audit_activity_map and _dl_audit_activity_nsidAdhemerval Zanella2021-09-106-115/+48
| | | | | It consolidates the code required to call la_activity() audit callback.
* elf: Add _dl_audit_objopenAdhemerval Zanella2021-09-105-38/+52
| | | | It consolidates the code required to call la_objopen() audit callback.
* elf: Fix initial-exec TLS access on audit modules (BZ #28096)Adhemerval Zanella2021-09-107-4/+135
| | | | | | | | | | | | | For ldaudit modules or dependencies with initial-exec TLS, we can not set the initial TLS image on default loader initialization because it would already be set by the ldaudit setup. However, subsequent thread creation would need to follow the default behaviour. This patch fixes by making_dl_new_object() sets a new link_map flag 'l_dont_set_tls_static' only for __RTLD_AUDIT modules. The flag is later reset on _dl_allocate_tls_init(). Checked on x86_64-linux-gnu.
* elf: Suppress audit calls when a (new) namespace is empty (BZ #28062)Vivek Das Mohapatra2021-09-105-2/+239
| | | | | | | | | | For a new Lmid_t the namespace link_map list are empty, so it requires to check if before using it. This can happen for when audit module is used along with dlmopen. Checked on x86_64-linux-gnu. Co-authored-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* elf: Do not fail for failed dlopem on audit modules (BZ #28061)Adhemerval Zanella2021-09-104-2/+87
| | | | | | | | | | | | | | | | | | | | The dl_main() sets the LM_ID_BASE to RT_ADD just before starting to add load new shared objects. The state is set to R_CONSISTENT just after all objects are loaded. However if a audit modules tries to dlmopen() an inexistent module, the _dl_open() will assert that the namespace is in an inconsistent state. This is different than dlopen(), since first it will not use LM_ID_BASE and second _dl_map_object_from_fd() is the sole responsible to set and reset the r_state value. So the assert() on _dl_open() can not really see if the state is consistent since it is _dt_main() that reset is. This patch removes the assert. Checked on x86_64-linux-gnu.
* elf: Add audit tests for modules with TLSDESCAdhemerval Zanella2021-09-106-0/+238
|
* elf: Avoid unnecessary slowdown from profiling with audit (BZ#15533)Adhemerval Zanella2021-09-1012-87/+385
| | | | | | | | | | | | | | The rtld-audit interfaces introduces a slowdown due to enabling profiling instrumentation (as if LD_AUDIT implied LD_PROFILE). However, instrumenting is only necessary if one of audit libraries provides PLT callbacks ( la_pltenter or la_pltexit symbols). Otherwise, the slowdown can be avoided. The following patch adjusts the logic that enables profiling to iterate over all audit modules and check if any of those provides a PLT hook. To keep la_symbind() to work even without PLT callbacks, _dl_fixup now calls the audit callback if the modules implements it. Co-authored-by: Alexander Monakov <amonakov@ispras.ru>
* _Static_assert needs two arguments for compatibility with GCC before 9Florian Weimer2021-09-101-0/+7
| | | | | | | This macro definition enforces two arguments even with newer compilers that accept the single-argument form, too. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* testrun.sh: Add support for --tool=rpctraceSergey Bugaev2021-09-101-2/+7
| | | | | | | | | | rpctrace(1) is a Hurd RPC tracer tool, which is used similar to how strace(1) is used on GNU/Linux. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20210907133325.255690-6-bugaevc@gmail.com> Acked-by: Florian Weimer <fweimer@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
* Update syscall lists for Linux 5.14Joseph Myers2021-09-0826-2/+33
| | | | | | | | Linux 5.14 has two new syscalls, memfd_secret (on some architectures only) and quotactl_fd. Update syscall-names.list and regenerate the arch-syscall.h headers with build-many-glibcs.py update-syscalls. Tested with build-many-glibcs.py.
* Fix failing nss/tst-nss-files-hosts-long with local resolverAurelien Jarno2021-09-071-0/+1
| | | | | | | | | | | | | | | | | | When a local resolver like unbound is listening on the IPv4 loopback address 127.0.0.1, the nss/tst-nss-files-hosts-long test fails. This is due to: - the default resolver in the absence of resolv.conf being 127.0.0.1 - the default DNS NSS database configuration in the absence of nsswitch.conf being 'hosts: dns [!UNAVAIL=return] file' This causes the requests for 'test4' and 'test6' to first be sent to the local resolver, which responds with NXDOMAIN in the likely case those records do no exist. In turn that causes the access to /etc/hosts to be skipped, which is the purpose of that test. Fix that by providing a simple nsswitch.conf file forcing access to /etc/hosts for that test. I have tested that the only changed result in the testsuite is that test.
* MIPS: Setup errno for {f,l,}xstatJiaxun Yang2021-09-073-3/+9
| | | | | | | | | | | {f,l,}xstat stub for MIPS is using INTERNAL_SYSCALL to do xstat syscall for glibc ver, However it leaves errno untouched and thus giving bad errno output. Setup errno properly when syscall returns non-zero. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Use Linux 5.14 in build-many-glibcs.pyJoseph Myers2021-09-071-1/+1
| | | | | | | This patch makes build-many-glibcs.py use Linux 5.14. Tested with build-many-glibcs.py (host-libraries, compilers and glibcs builds).
* locale: Add missing second argument to _Static_assert in C-collate-seq.cFlorian Weimer2021-09-061-1/+1
|
* Update hppa libm-test-ulpsJohn David Anglin2021-09-061-1/+1
|
* Add generic C.UTF-8 locale (Bug 17318)Carlos O'Donell2021-09-0616-34/+1131
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We add a new C.UTF-8 locale. This locale is not builtin to glibc, but is provided as a distinct locale. The locale provides full support for UTF-8 and this includes full code point sorting via STRCMP-based collation (strcmp or wcscmp). The collation uses a new keyword 'codepoint_collation' which drops all collation rules and generates an empty zero rules collation to enable STRCMP usage in collation. This ensures that we get full code point sorting for C.UTF-8 with a minimal 1406 bytes of overhead (LC_COLLATE structure information and ASCII collating tables). The new locale is added to SUPPORTED. Minimal test data for specific code points (minus those not supported by collate-test) is provided in C.UTF-8.in, and this verifies code point sorting is working reasonably across the range. The locale was tested manually with the full set of code points without failure. The locale is harmonized with locales already shipping in various downstream distributions. A new tst-iconv9 test is added which verifies the C.UTF-8 locale is generally usable. Testing for fnmatch, regexec, and recomp is provided by extending bug-regex1, bugregex19, bug-regex4, bug-regex6, transbug, tst-fnmatch, tst-regcomp-truncated, and tst-regex to use C.UTF-8. Tested on x86_64 or i686 without regression. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* Add 'codepoint_collation' support for LC_COLLATE.Carlos O'Donell2021-09-066-229/+286
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Support a new directive 'codepoint_collation' in the LC_COLLATE section of a locale source file. This new directive causes all collation rules to be dropped and instead STRCMP (strcmp or wcscmp) is used for collation of the input character set. This is required to allow for a C.UTF-8 that contains zero collation rules (minimal size) and sorts using code point sorting. To date the only implementation of a locale with zero collation rules is the C/POSIX locale. The C/POSIX locale provides identity tables for _NL_COLLATE_COLLSEQMB and _NL_COLLATE_COLLSEQWC that map to ASCII even though it has zero rules. This has lead to existing fnmatch, regexec, and regcomp implementations that require these tables. It is not correct to use these tables when nrules == 0, but the conservative fix is to provide these tables when nrules == 0. This assures that existing static applications using a new C.UTF-8 locale with 'codepoint_collation' at least have functional range expressions with ASCII e.g. [0-9] or [a-z]. Such static applications would not have the fixes to fnmatch, regexec and regcomp that avoid the use of the tables when nrules == 0. Future fixes to fnmatch, regexec, and regcomp would allow range expressions to use the full set of code points for such ranges. Tested on x86_64 and i686 without regression. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* AArch64: Update A64FX memset not to degrade at 16KBNaohiro Tamura2021-09-061-1/+8
| | | | | | | | | | This patch updates unroll8 code so as not to degrade at the peak performance 16KB for both FX1000 and FX700. Inserted 2 instructions at the beginning of the unroll8 loop, cmp and branch, are a workaround that is found heuristically. Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
* Revert "AArch64: Update A64FX memset not to degrade at 16KB"Szabolcs Nagy2021-09-061-8/+1
| | | | | | Because of wrong commit author. Will recommit it with right author. This reverts commit 23777232c23f80809613bdfa329f63aadf992922.
* Remove "Contributed by" linesSiddhesh Poyarekar2021-09-033303-4023/+10534
| | | | | | | | | | | | | | | | | | | | | | | | | | We stopped adding "Contributed by" or similar lines in sources in 2012 in favour of git logs and keeping the Contributors section of the glibc manual up to date. Removing these lines makes the license header a bit more consistent across files and also removes the possibility of error in attribution when license blocks or files are copied across since the contributed-by lines don't actually reflect reality in those cases. Move all "Contributed by" and similar lines (Written by, Test by, etc.) into a new file CONTRIBUTED-BY to retain record of these contributions. These contributors are also mentioned in manual/contrib.texi, so we just maintain this additional record as a courtesy to the earlier developers. The following scripts were used to filter a list of files to edit in place and to clean up the CONTRIBUTED-BY file respectively. These were not added to the glibc sources because they're not expected to be of any use in future given that this is a one time task: https://gist.github.com/siddhesh/b5ecac94eabfd72ed2916d6d8157e7dc https://gist.github.com/siddhesh/15ea1f5e435ace9774f485030695ee02 Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Port shared code information from the wikiSiddhesh Poyarekar2021-09-032-0/+277
| | | | | | | | | | | | Since the shared code now has special status with respect to copyrights, port them into a more structured format in the source tree and add a python function that parses and returns a dictionary with the information. I need this to exclude these files from the Contributed-by changes and I reckon it would be useful to know these files for future tooling. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* AArch64: Update A64FX memset not to degrade at 16KBNaohiro Tamura via Libc-alpha2021-09-031-1/+8
| | | | | | | | | | This patch updates unroll8 code so as not to degrade at the peak performance 16KB for both FX1000 and FX700. Inserted 2 instructions at the beginning of the unroll8 loop, cmp and branch, are a workaround that is found heuristically. Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
* posix: remove some iso-8859-encoded charactersDJ Delorie2021-09-015-336/+357
| | | | | | | | | | | | | With the increasing adoption of UTF-8, modern editors may (will?) replace iso-8859-encoded characters in the range 0x80..0xff with their UTF-8 equivalent, as will mailers and other tools. This breaks our testsuite and corrupts patches. So, this patch starts replacing these problematic characters with \OCTal sequences instead (adding support for those in tst-fnmatch.c) or with plain ASCII characters (PTESTS). Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* configure: Allow LD to be LLD 13.0.0 or above [BZ #26558]Fangrui Song2021-08-313-9/+99
| | | | | | | | | | | | | | | | | | | | | | | | | When using LLD (LLVM linker) as the linker, configure prints a confusing message. *** These critical programs are missing or too old: GNU ld LLD>=13.0.0 can build glibc --enable-static-pie. (8.0.0 needs one workaround for -Wl,-defsym=_begin=0. 9.0.0 works with --disable-static-pie). XFAIL two tests sysdeps/x86/tst-ifunc-isa-* which have the BZ #28154 issue (LLD follows the PowerPC port of GNU ld for ifunc by placing IRELATIVE relocations in .rela.dyn, triggering a glibc ifunc fragility). The set of dynamic symbols is the same with GNU ld and LLD, modulo unused SHN_ABS version node symbols. For comparison, gold does not support --enable-static-pie yet (--no-dynamic-linker is unsupported BZ #22221), yet has 6 failures more than LLD. gold linked libc.so has larger .dynsym differences with GNU ld and LLD (non-default version symbols are changed to default versions by a version script BZ #28196).
* hurd msync: Drop bogus testSamuel Thibault2021-08-311-3/+0
| | | | | MS_SYNC is actually 0, so we cannot test that both MS_SYNC and MS_ASYNC are set.
* hurd: Fix typo in msyncSamuel Thibault2021-08-311-1/+1
| | | | == has higher priority than &
* x86-64: Use testl to check __x86_string_controlH.J. Lu2021-08-301-2/+2
| | | | | | | Use testl, instead of andl, to check __x86_string_control to avoid updating __x86_string_control. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* i686: Don't include multiarch memove in libc.aH.J. Lu2021-08-301-1/+1
| | | | | On i686, there is no multiarch memove in libc.a, don't include multiarch memove in ifunc-impl-list.c in libc.a.
* support: Add support_wait_for_thread_exitFlorian Weimer2021-08-303-1/+78
|
* Allow #pragma GCC in headers in conformtestJoseph Myers2021-08-271-0/+8
| | | | | | | | | | No "#pragma GCC" pragma allows macro-expansion of its arguments, so no namespace issues arise from use of such pragmas in installed headers. Ignore them in conformtest tests of header namespace. Tested for x86_64, in conjunction with Paul's patch <https://sourceware.org/pipermail/libc-alpha/2021-August/130571.html> adding use of such pragmas to installed headers shared with gnulib.
* nptl: Fix tst-cancel7 and tst-cancelx7 race condition (BZ #14232)Adhemerval Zanella2021-08-261-57/+57
| | | | | | | | | | A mapped temporary file and a semaphore is used to synchronize the pid information on the created file, the semaphore is updated once the file contents is flushed. Checked on x86_64-linux-gnu. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* Use support_open_dev_null_range io/tst-closefrom, misc/tst-close_range, and ↵Adhemerval Zanella2021-08-263-48/+17
| | | | | | | | | posix/tst-spawn5 (BZ #28260) It ensures a continuous range of file descriptor and avoid hitting the RLIMIT_NOFILE. Checked on x86_64-linux-gnu.
* support: Add support_open_dev_null_rangeAdhemerval Zanella2021-08-264-0/+299
| | | | | | | | | It returns a range of file descriptor referring to the '/dev/null' pathname. The function takes care of restarting the open range if a file descriptor is found within the specified range and also increases RLIMIT_NOFILE if required. Checked on x86_64-linux-gnu.
* llio.texi: Wording fixes in description of closefrom()Michael Kerrisk2021-08-261-2/+2
| | | | | | | | | | | Fix two problems. Rather than "larger than", better English is "greater than". Then there is a wordinig error on the following line: "then lowfd" appears to be cruft. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
* Fix error message in memmove test to display correct src pointerSunil K Pandey2021-08-261-1/+1
| | | | Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
* elf: Skip tst-auditlogmod-* if the linker doesn't support --depaudit [BZ #28151]Fangrui Song2021-08-243-1/+41
| | | | | | gold and ld.lld do not support --audit or --depaudit. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>