aboutsummaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* getdirentries.2: remove unnecessary spacePiotr Pawel Stefaniak2021-04-111-1/+1
|
* rtld: make dlerror() thread-localKonstantin Belousov2021-04-102-0/+25
| | | | | | | | PR: 95339 Discussed with: arichardson Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29633
* rtld: workaround for broken ABIKonstantin Belousov2021-04-102-0/+11
| | | | | | | | | | | | | | | | Right now, libthr does not initialize RtldLockInfo.rtli_version when calling _rtld_thread_init(), which makes versioning the interface troublesome. Add a workaround: if the calling object of _rtld_thread_init() exports the "_pli_rtli_version" symbol, then consider rtli_version initialized. Otherwise, forcibly set it to RTLI_VERSION_ONE, currently defined as RTLI_VERSION. Export "_pli_rtli_version" from libthr and properly initialize rtli_version. Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29633
* Only use -fp-exception-behavior=maytrap on x86, for nowDimitry Andric2021-04-101-1/+2
| | | | | | | | | | | | | | | After 3b00222f156d, it turns out that clang only supports strict floating point semantics for SystemZ and x86 at the moment, while for other architectures it is still experimental. Therefore, only use -fp-exception-behavior=maytrap on x86 for now, otherwise this option results in "error: overriding currently unsupported use of floating point exceptions on this target [-Werror,-Wunsupported-floating-point-opt]" on other architectures. Fixes: 3b00222f156d PR: 254911 MFC after: 1 week
* libnv: Use PICFLAG rather than -fPICKristof Provost2021-04-101-1/+1
| | | | | | Suggested by: andrew MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate")
* Avoid raising unexpected floating point exceptions in libmDimitry Andric2021-04-101-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | When using clang with x86_64 CPUs that support AVX, some floating point transformations may raise exceptions that would not have been raised by the original code. To avoid this, use the -fp-exception-behavior=maytrap flag, introduced in clang 10.0.0. In particular, this fixes a number of test failures with ctanhf(3) and ctanf(3), when libm is compiled with -mavx. An unexpected FE_INVALID exception is then raised, because clang emits vdivps instructions to perform certain divides. (The vdivps instruction operates on multiple single-precision float operands simultaneously, but the exceptions may be influenced by unused parts of the XMM registers. In this particular case, it was calculating 0 / 0, which results in FE_INVALID.) If -fp-exception-behavior=maytrap is specified however, clang uses vdivss instructions instead, which work on one operand, and should not raise unexpected exceptions. Reported by: olivier Reviewed by: arichardson PR: 254911 MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29686
* libpfctl: Fix u_* countersKristof Provost2021-04-102-10/+6
| | | | | | | | | | | | | | struct pf_rule had a few counter_u64_t counters. Those couldn't be usefully comminicated with userspace, so the fields were doubled up in uint64_t u_* versions. Now that we use struct pfctl_rule (i.e. a fully userspace version) we can safely change the structure and remove this wart. Reviewed by: glebius MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29645
* libpfctl: Switch to pfctl_ruleKristof Provost2021-04-102-8/+145
| | | | | | | | | | | Stop using the kernel's struct pf_rule, switch to libpfctl's pfctl_rule. Now that we use nvlists to communicate with the kernel these structures can be fully decoupled. Reviewed by: glebius MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29644
* pfctl: Move ioctl abstraction functions into libpfctlKristof Provost2021-04-104-0/+594
| | | | | | | | Introduce a library to wrap the pf ioctl interface. MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29562
* libnv: Build PICKristof Provost2021-04-101-0/+1
| | | | | | | | | Build libnv as position independent code so we can use it from shared libraries. MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29561
* libc dl_iterate_phdr(): dlpi_tls_data is wrongKonstantin Belousov2021-04-091-2/+4
| | | | | | | | | | | This is the same change as d36d681615170590, but for libc static implementaion of dl_iterate_phdr(). Reported by: emacsray@gmail.com PR: 254774 Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29623
* libc: implement __tls_get_addr() for static binariesKonstantin Belousov2021-04-091-8/+15
| | | | | | Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29623
* libc: add _get_tp() private functionKonstantin Belousov2021-04-0917-6/+441
| | | | | | | | which returns pointer to tcb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29623
* libc: include rtld.h into static implementations of rtld interfaceKonstantin Belousov2021-04-095-37/+58
| | | | | | | | and resolve naming conficts Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29623
* libc: constify dummy error message string for dlfcnKonstantin Belousov2021-04-091-2/+2
| | | | | | Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29623
* Avoid -pedantic warnings about using _Generic in __fp_type_selectDimitry Andric2021-04-081-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | When compiling parts of math.h with clang using a C standard before C11, and using -pedantic, it will result in warnings similar to: bug254714.c:5:11: warning: '_Generic' is a C11 extension [-Wc11-extensions] return !isfinite(1.0); ^ /usr/include/math.h:111:21: note: expanded from macro 'isfinite' ^ /usr/include/math.h:82:39: note: expanded from macro '__fp_type_select' ^ This is because the block that enables use of _Generic is conditional not only on C11, but also on whether the compiler advertises support for C generic selections via __has_extension(c_generic_selections). To work around the warning without having to pessimize the code, use the __extension__ keyword, which is supported by both clang and gcc. While here, remove the check for __clang__, as _Generic has been supported for a long time by gcc too now. Reported by: yuri PR: 254714 MFC after: 1 week
* Remove the last users of ARM_TP_ADDRESSAndrew Turner2021-04-084-26/+0
| | | | | | | | | This was only needed on 32-bit arm prior to ARMv6. As we only support ARMv6 or later remove it. Reviewed by: mannu Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D29624
* fileargs: fix double caching of the same fileMariusz Zaborski2021-04-071-2/+6
| | | | | | In situations when the current file name wasn't the first element on the list we were cleaning the current name too early. This might cause us to pre-cache the same file twice.
* rtld dl_iterate_phdr(): dlpi_tls_data is wrongKonstantin Belousov2021-04-061-2/+5
| | | | | | | | | | dl_iterate_phdr() dlpi_tls_data should provide the TLS module segment address, and not the TLS init segment address as it does now. Reported by: emacsray@gmail.com PR: 254774 Sponsored by: The FreeBSD Foundation MFC after: 1 week
* libc: Fix the WITH_HESIOD buildMark Johnston2021-04-052-2/+2
| | | | | Reported by: Daniel Braniss <danny@cs.huji.ac.il> MFC after: 1 week
* amd64 fabs.S: use '.section .rodata' instead of '.rodata'Konstantin Belousov2021-04-041-1/+1
| | | | | | | | Seems to be an issue with older gnu as Reported by: rscheff Sponsored by: The FreeBSD Foundation MFC after: 6 days
* amd64 fabs.S: put signbit into rodata instead of textKonstantin Belousov2021-04-041-0/+1
| | | | | | Noted by: jrtc27 MFC after: 1 week Sponsored by: The FreeBSD Foundation
* libc/<arch>/sys/cerror.S: fix typoKonstantin Belousov2021-04-034-4/+4
| | | | | Sponsored by: The FreeBSD Foundation MFC after: 3 days
* amd64 fabs(3): move signbit to .textKonstantin Belousov2021-04-031-1/+1
| | | | | | | There is no reason for signbit quad to be writeable. Sponsored by: The FreeBSD Foundation MFC after: 1 week
* libc: use standard LF line endings, not CRLFEd Maste2021-04-033-805/+805
|
* pam: add option to not prompt for password if it's set to emptyEdward Tomasz Napierala2021-04-033-1/+22
| | | | | | | | | | | Add a new option to pam_unix(8), "emptyok", which makes it not prompt for password, if it's set to an empty one. It is similar to "nullok", which makes it not prompt for password if the hash itself is empty. Reviewed By: markj Sponsored By: NetApp, Inc. Sponsored By: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D27569
* libnetmap: reset errno in nmreq_register_decode()Vincenzo Maffione2021-04-021-0/+2
| | | | | | | The reset is necessary at the beginning of the function, because of the errno logic in the error path (set errno to EINVAL if not set). If errno is already set when calling the function, and the function fails, the previous errno value will be inherited.
* netmap: several typo fixesVincenzo Maffione2021-04-021-2/+2
| | | | No functional changes intended.
* libfetch: Retry with proxy auth when server returns 407Renato Botelho2021-04-011-6/+49
| | | | | | | | | | PR: 220468 Submitted by: Egil Hasting <egil.hasting@higen.org> (based on) Reviewed by: kevans, kp Approved by: kp MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29533
* resolv_test: Fix racy exit check, remove mutexes, and reduce outputAlex Richardson2021-03-301-87/+87
| | | | | | | | | | | | | | | Instead of polling nleft[i] (without appropriate memory barriers!) and using sleep() to detect the exit just call pthread_join() on all threads. Also replace the use of a mutex that guarding the increments with atomic fetch_add. This should reduce the runtime of this test on SMP systems. Finally, remove all the debug printfs unless DEBUG_OUTPUT is set in the environment. Test Plan: still fails sometimes on qemu (but maybe less often?) Reviewed By: jhb Differential Revision: https://reviews.freebsd.org/D29390
* libnetmap: restore changes in 26c29e743bbdbb82762540f72d4bc449bae2e092Vincenzo Maffione2021-03-301-5/+10
| | | | | | Commit f8113f0a65ada9367bcbfa6e0d5d8a8451dd8ac2 accidentally reverted some fixes introduced by 26c29e743bbdbb82762540f72d4bc449bae2e092. This change restores them.
* libnetmap: add support for the offset featuresVincenzo Maffione2021-03-294-15/+144
| | | | | | | | The companion libnetmap changes for the "offsets" kernel support added in a6d768d845c173823785c. This includes code to parse the "@offset=NNN" option that can be appended to the port name by any nmport_* application. Example: # pkt-gen -i 'netmap:em0@offset=16'
* sh(1): autocomplete commandsPiotr Pawel Stefaniak2021-03-291-1/+1
| | | | | | | | | | Without this patch, sh can autocomplete file names but not commands from $PATH. Use libedit's facility to execute custom function for autocomplete, but yield to the library's standard autocomplete function when cursor is not at position 0. Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D29361
* [PowerPC64] Port optimized strcpy to PPC64LELeandro Lupori2021-03-252-9/+64
| | | | | | | | Submitted by: Bruno Larsen <bruno.larsen@eldorado.org.br> Reviewed by: luporl, bdragon (IRC) MFC after: 1 week Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D29067
* [PowerPC64] Enforce natural alignment in bcopyLeandro Lupori2021-03-251-0/+34
| | | | | | | | | | | | | | POWER architecture CPUs (Book-S) require natural alignment for cache-inhibited storage accesses. Since we can't know the caching model for a page ahead of time, always enforce natural alignment in bcopy. This fixes a SIGBUS when calling the function with misaligned pointers on POWER7. Submitted by: Bruno Larsen <bruno.larsen@eldorado.org.br> Reviewed by: luporl, bdragon (IRC) MFC after: 1 week Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D28776
* lib/libc/net/nsdispatch.c: Fix missing unlock and add locking annotationsAlex Richardson2021-03-251-72/+129
| | | | | | | | | | | | | The error cases (goto fin) of _nsdispatch were missing the unlock. This change also drops the checks for __isthreaded since the pthread stubs are already no-ops if threads are not being used. Dropping those conditionals allows clang's thread safety analysis to deal with the file and also makes the code a bit more readable. While touching the file also add a few more assertions in debug mode that the right locks are held. Reviewed By: markj Differential Revision: https://reviews.freebsd.org/D29372
* RISC-V: Fix feenableexcept return valueAlex Richardson2021-03-251-1/+1
| | | | | | | | | | The man page says "The feenableexcept(), fedisableexcept(), and fegetexcept() functions return a bitmap of the exceptions that were unmasked prior to the call.", so we should return zero not -1. Reviewed By: mhorne MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D29386
* libc: Some enhancements to syslog(3)Dmitry Wagin2021-03-231-1/+14
| | | | | | | | | | | | | - Defined MAXLINE constant (8192 octets by default instead 2048) for centralized limit setting up. It sets maximum number of characters of the syslog message. RFC5424 doesn't limit maximum size of the message. Named after MAXLINE in syslogd(8). - Fixed size of fmt_cpy buffer up to MAXLINE for rendering formatted (%m) messages. - Introduced autoexpansion of sending socket buffer up to MAXLINE. MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D27205
* Silence unused parameter warnings in the RISC-V fenv.hAlex Richardson2021-03-221-3/+3
| | | | | | | | After increasing the lib/msun/tests WARNS to 6, this triggers a compilation error for RISC-V. Fixes: 87d65c747a43 ("lib/msun: Allow building tests with WARNS=6") Reported by: Jenkins
* lib/msun/tests: Drop WARNS=6Alex Richardson2021-03-221-2/+0
| | | | | | This is the default already, so there is no need to override it. Reported by: kevans
* lib/msun/tests: Re-enable csqrt_test on AArch64Alex Richardson2021-03-221-4/+0
| | | | | | | | The LLVM bug was fixed a long time ago and with D29076 this test actually passes now. Reviewed By: andrew Differential Revision: https://reviews.freebsd.org/D29092
* Fix lib/msun/tests/csqrt_test on platforms with 128-bit long doubleAlex Richardson2021-03-221-9/+17
| | | | | | | | | | If long double has more than 64 mantissa bits, using uint64_t to hold the mantissa bits will truncate the value and result in test failures. To fix this problem use __uint128_t since all platforms that have __LDBL_MANT_DIG__ > 64 also have compiler support for 128-bit integers. Reviewed By: rlibby Differential Revision: https://reviews.freebsd.org/D29076
* Fix unused functions in invtrig_test.cAlex Richardson2021-03-221-2/+8
| | | | | | | | | | | | | | I only tested the WARNS=6 change on AArch64 and AMD64, but this file has unused functions for architectures with LDBL_PREC == 53. While touching this file change the LDBL_PREC == 53 checks to i386 checks. The long double tests should only be disabled for i386 (due to the rather odd rounding mode that it uses) not all architectures where long double is the same as double. PR: 205449 Fixes: 87d65c747a43 ("lib/msun: Allow building tests with WARNS=6") Reported by: Jenkins
* Don't add -Winline for WARNS=6Alex Richardson2021-03-222-2/+1
| | | | | | | | | | | | | | This warning is very rarely useful (inline is a hint and not mandatory). This flag results in many warnings being printed when compiling C++ code that uses the standard library with GCC. This flag was originally added in back in r94332 but the flag is a no-op in Clang ("This diagnostic flag exists for GCC compatibility, and has no effect in Clang"). Removing it should make the GCC build output slightly more readable. Reviewed By: jrtc27, imp Differential Revision: https://reviews.freebsd.org/D29235
* lib/msun/tests: Add more debug output to fenv_test.cAlex Richardson2021-03-222-2/+7
| | | | | Output a hex dump of the current fenv and the expected value to allow comparing them without having to resort to interactive use of GDB.
* lib/msun/tests: Skip fenv_test:masking if exceptions can't be trappedAlex Richardson2021-03-221-1/+21
| | | | | | | | | | | Some CPUs (e.g. AArch64 QEMU) cannot trap on floating point exceptions and therefore ignore the writes to the floating point control register inside feenableexcept(). If no exceptions are enabled after feenableexcept(FE_ALL_EXCEPT), we can assume that the CPU does not support exceptions and we can then skip the test. Reviewed By: dim Differential Revision: https://reviews.freebsd.org/D29095
* lib/msun: Allow building tests with WARNS=6Alex Richardson2021-03-221-1/+1
| | | | The only change needed is to mark a few variables as static.
* Improve test messages for msun testsAlex Richardson2021-03-2216-106/+102
| | | | | | | Also print the mismatched values when numbers compare not equal. Reviewed By: dim Differential Revision: https://reviews.freebsd.org/D29091
* Remove XFAILs from fmaxmin testAlex Richardson2021-03-221-19/+0
| | | | | | | | | These appears to have been resolved by compiling the test with -fno-builtin and/or using a newer compiler. PR: 208703 Reviewed By: ngie Differential Revision: https://reviews.freebsd.org/D28884
* Convert the msun tests to ATFAlex Richardson2021-03-2222-846/+845
| | | | | | | | This provides better error messages that just an assertion failure and also makes it easier to mark individual tests as XFAIL. It was also helpful when coming up with D28786 and D28787. Differential Revision: https://reviews.freebsd.org/D28798