summaryrefslogtreecommitdiffstats
path: root/newlib
Commit message (Collapse)AuthorAgeFilesLines
* libm: switch sf_log1p from double error routines to floatKeith Packard2019-12-022-4/+2
| | | | | | | | | sf_log1p was using __math_divzero and __math_invalid, which drag in a pile of double-precision code. Switch to using the single-precision variants. This also required making those available in __OBSOLETE_MATH mode. Signed-off-by: Keith Packard <keithp@keithp.com>
* newlib/libc/include/sys/features.h: update __STDC_ISO_10646__Brian Inglis2019-11-261-3/+7
| | | | | | | newlib wide char conversion functions were updated to Unicode 11 on 2019-01-12 update standard symbol __STDC_ISO_10646__ to Unicode 11 release date 2018-06-05 for Cygwin
* newlib: fix fseek optimization with SEEK_CURBastien Bouclet2019-11-182-50/+12
| | | | | | | The call to fflush was invalidating the read buffer, preventing relative seeks to positions that would have been inside the read buffer from being optimized. The call to srefill would then re-read mostly the same data that was initially in the read buffer.
* Stash reent marker in upper bits of s1 on AMD GCNKwok Cheung Yeung2019-11-081-10/+10
| | | | | | | s[0:3] contain a descriptor used to set up the initial value of the stack, but only the lower 48 bits of s[0:1] are currently used. The reent marker is currently set in s3, but by stashing it in the upper 16 bits of s[0:1] instead, s3 can be freed up for other purposes.
* Move timeval macros to <sys/time.h>Sebastian Huber2019-11-042-32/+31
| | | | | In FreeBSD, NetBSD, and OpenBSD these macros are defined in <sys/time.h>.
* Synchronize <sys/time.h> with FreeBSDSebastian Huber2019-11-041-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | This change is based on the FreeBSD commit: Author: asomers <asomers@FreeBSD.org> Date: Mon Jul 30 15:46:40 2018 +0000 Make timespecadd(3) and friends public The timespecadd(3) family of macros were imported from NetBSD back in r35029. However, they were initially guarded by #ifdef _KERNEL. In the meantime, we have grown at least 28 syscalls that use timespecs in some way, leading many programs both inside and outside of the base system to redefine those macros. It's better just to make the definitions public. Our kernel currently defines two-argument versions of timespecadd and timespecsub. NetBSD, OpenBSD, and FreeDesktop.org's libbsd, however, define three-argument versions. Solaris also defines a three-argument version, but only in its kernel. This revision changes our definition to match the common three-argument version. Bump _FreeBSD_version due to the breaking KPI change. Discussed with: cem, jilles, ian, bde Differential Revision: https://reviews.freebsd.org/D14725
* Synchronize <sys/_timespec.h> with FreeBSDSebastian Huber2019-11-041-2/+4
|
* Fix sbttons for values > 2simp2019-11-041-2/+9
| | | | | | | Add test against negative times. Add code to cope with larger values properly. Discussed with: bde@ (quite some time ago, for an earlier version)
* PRU: Align libmath to PRU ABIDimitar Dimitrov2019-10-3118-2/+6719
| | | | | | | | The TI proprietary toolchain uses nonstandard names for some math library functions. In order to achieve ABI compatibility between GNU and TI toolchains, add support for the TI function names. Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
* Fix some generated filesJeff Johnston2019-10-314-16/+16
|
* Initial PRU port for libgloss and newlibDimitar Dimitrov2019-10-3111-3/+6320
| | | | Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
* riscv/sys/fenv.h: Add missing extern for fe_dfl_env_pJoel Sherrill2019-10-091-0/+2
|
* Add patch from Joel Sherrill for i386 and x86_64 fenv supportJeff Johnston2019-10-0837-9/+16544
|
* Allow verifying _REENT_CHECK macros memory allocationJeff Johnston2019-10-076-5/+54
| | | | | | | | | | - change sys/reent.h to replace _REENT_CHECK_DEBUG with _REENT_CHECK_VERIFY which when set asserts that any memory allocated is non-NULL and calls __assert_func directly - add new --enable-newlib-reent-check-verify configure option - add support for configure.host to specify default for newlib_reent_check_verify - add _REENT_CHECK_VERIFY macro support to acconfig.h and newlib.hin
* Optimize epilogue sequence for architectures with POP interworking.Christos Gentsos2019-10-072-0/+12
| | | | | ARMv5 and above supports arm/thumb interworking using POP, so we can improve the exit sequence in this case.
* Prevent NULL ptr accesses due to Balloc out of memoryJeff Johnston2019-10-043-12/+20
| | | | | | | - add new eBalloc macro to mprec.h which calls Balloc and aborts if Balloc fails due to out of memory - change mprec.c functions that use Balloc without checking to use eBalloc instead - fix dtoa.c to use eBalloc
* Add SIOCGIFDOWNREASON.kib2019-09-252-2/+14
| | | | | | | | | | | | | | | | The ioctl(2) is intended to provide more details about the cause of the down for the link. Eventually we might define a comprehensive list of codes for the situations. But interface also allows the driver to provide free-form null-terminated ASCII string to provide arbitrary non-formalized information. Sample implementation exists for mlx5(4), where the string is fetched from firmware controlling the port. Reviewed by: hselasky, rrs Sponsored by: Mellanox Technologies MFC after: 1 week Differential revision: https://reviews.freebsd.org/D21527
* Add kernel-side support for in-kernel TLS.jhb2019-09-252-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | KTLS adds support for in-kernel framing and encryption of Transport Layer Security (1.0-1.2) data on TCP sockets. KTLS only supports offload of TLS for transmitted data. Key negotation must still be performed in userland. Once completed, transmit session keys for a connection are provided to the kernel via a new TCP_TXTLS_ENABLE socket option. All subsequent data transmitted on the socket is placed into TLS frames and encrypted using the supplied keys. Any data written to a KTLS-enabled socket via write(2), aio_write(2), or sendfile(2) is assumed to be application data and is encoded in TLS frames with an application data type. Individual records can be sent with a custom type (e.g. handshake messages) via sendmsg(2) with a new control message (TLS_SET_RECORD_TYPE) specifying the record type. At present, rekeying is not supported though the in-kernel framework should support rekeying. KTLS makes use of the recently added unmapped mbufs to store TLS frames in the socket buffer. Each TLS frame is described by a single ext_pgs mbuf. The ext_pgs structure contains the header of the TLS record (and trailer for encrypted records) as well as references to the associated TLS session. KTLS supports two primary methods of encrypting TLS frames: software TLS and ifnet TLS. Software TLS marks mbufs holding socket data as not ready via M_NOTREADY similar to sendfile(2) when TLS framing information is added to an unmapped mbuf in ktls_frame(). ktls_enqueue() is then called to schedule TLS frames for encryption. In the case of sendfile_iodone() calls ktls_enqueue() instead of pru_ready() leaving the mbufs marked M_NOTREADY until encryption is completed. For other writes (vn_sendfile when pages are available, write(2), etc.), the PRUS_NOTREADY is set when invoking pru_send() along with invoking ktls_enqueue(). A pool of worker threads (the "KTLS" kernel process) encrypts TLS frames queued via ktls_enqueue(). Each TLS frame is temporarily mapped using the direct map and passed to a software encryption backend to perform the actual encryption. (Note: The use of PHYS_TO_DMAP could be replaced with sf_bufs if someone wished to make this work on architectures without a direct map.) KTLS supports pluggable software encryption backends. Internally, Netflix uses proprietary pure-software backends. This commit includes a simple backend in a new ktls_ocf.ko module that uses the kernel's OpenCrypto framework to provide AES-GCM encryption of TLS frames. As a result, software TLS is now a bit of a misnomer as it can make use of hardware crypto accelerators. Once software encryption has finished, the TLS frame mbufs are marked ready via pru_ready(). At this point, the encrypted data appears as regular payload to the TCP stack stored in unmapped mbufs. ifnet TLS permits a NIC to offload the TLS encryption and TCP segmentation. In this mode, a new send tag type (IF_SND_TAG_TYPE_TLS) is allocated on the interface a socket is routed over and associated with a TLS session. TLS records for a TLS session using ifnet TLS are not marked M_NOTREADY but are passed down the stack unencrypted. The ip_output_send() and ip6_output_send() helper functions that apply send tags to outbound IP packets verify that the send tag of the TLS record matches the outbound interface. If so, the packet is tagged with the TLS send tag and sent to the interface. The NIC device driver must recognize packets with the TLS send tag and schedule them for TLS encryption and TCP segmentation. If the the outbound interface does not match the interface in the TLS send tag, the packet is dropped. In addition, a task is scheduled to refresh the TLS send tag for the TLS session. If a new TLS send tag cannot be allocated, the connection is dropped. If a new TLS send tag is allocated, however, subsequent packets will be tagged with the correct TLS send tag. (This latter case has been tested by configuring both ports of a Chelsio T6 in a lagg and failing over from one port to another. As the connections migrated to the new port, new TLS send tags were allocated for the new port and connections resumed without being dropped.) ifnet TLS can be enabled and disabled on supported network interfaces via new '[-]txtls[46]' options to ifconfig(8). ifnet TLS is supported across both vlan devices and lagg interfaces using failover, lacp with flowid enabled, or lacp with flowid enabled. Applications may request the current KTLS mode of a connection via a new TCP_TXTLS_MODE socket option. They can also use this socket option to toggle between software and ifnet TLS modes. In addition, a testing tool is available in tools/tools/switch_tls. This is modeled on tcpdrop and uses similar syntax. However, instead of dropping connections, -s is used to force KTLS connections to switch to software TLS and -i is used to switch to ifnet TLS. Various sysctls and counters are available under the kern.ipc.tls sysctl node. The kern.ipc.tls.enable node must be set to true to enable KTLS (it is off by default). The use of unmapped mbufs must also be enabled via kern.ipc.mb_use_ext_pgs to enable KTLS. KTLS is enabled via the KERN_TLS kernel option. This patch is the culmination of years of work by several folks including Scott Long and Randall Stewart for the original design and implementation; Drew Gallatin for several optimizations including the use of ext_pgs mbufs, the M_NOTREADY mechanism for TLS records awaiting software encryption, and pluggable software crypto backends; and John Baldwin for modifications to support hardware TLS offload. Reviewed by: gallatin, hselasky, rrs Obtained from: Netflix Sponsored by: Netflix, Chelsio Communications Differential Revision: https://reviews.freebsd.org/D21277
* Rename IPPROTO 33 from SEP to DCCPthj2019-09-251-2/+2
| | | | | | | | | | | | | | | | | | | | IPPROTO 33 is DCCP in the IANA Registry: https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml IPPROTO_SEP was added about 20 years ago in r33804. The entries were added straight from RFC1700, without regard to whether they were used. The reference in RFC1700 for SEP is '[JC120] <mystery contact>', this is an indication that the protocol number was probably in use in a private network. As RFC1700 is no longer the authoritative list of internet numbers and that IANA assinged 33 to DCCP in RFC4340, change the header to the actual authoritative source. Reviewed by: Richard Scheffenegger, bz Approved by: bz (mentor) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D21178
* This commit updates rack to what is basicallyrrs2019-09-251-7/+20
| | | | | | | | | | | being used at NF as well as sets in some of the groundwork for committing BBR. The hpts system is updated as well as some other needed utilities for the entrance of BBR. This is actually part 1 of 3 more needed commits which will finally complete with BBRv1 being added as a new tcp stack. Sponsored by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D20834
* Add an external mbuf buffer type that holdsjhb2019-09-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | multiple unmapped pages. Unmapped mbufs allow sendfile to carry multiple pages of data in a single mbuf, without mapping those pages. It is a requirement for Netflix's in-kernel TLS, and provides a 5-10% CPU savings on heavy web serving workloads when used by sendfile, due to effectively compressing socket buffers by an order of magnitude, and hence reducing cache misses. For this new external mbuf buffer type (EXT_PGS), the ext_buf pointer now points to a struct mbuf_ext_pgs structure instead of a data buffer. This structure contains an array of physical addresses (this reduces cache misses compared to an earlier version that stored an array of vm_page_t pointers). It also stores additional fields needed for in-kernel TLS such as the TLS header and trailer data that are currently unused. To more easily detect these mbufs, the M_NOMAP flag is set in m_flags in addition to M_EXT. Various functions like m_copydata() have been updated to safely access packet contents (using uiomove_fromphys()), to make things like BPF safe. NIC drivers advertise support for unmapped mbufs on transmit via a new IFCAP_NOMAP capability. This capability can be toggled via the new 'nomap' and '-nomap' ifconfig(8) commands. For NIC drivers that only transmit packet contents via DMA and use bus_dma, adding the capability to if_capabilities and if_capenable should be all that is required. If a NIC does not support unmapped mbufs, they are converted to a chain of mapped mbufs (using sf_bufs to provide the mapping) in ip_output or ip6_output. If an unmapped mbuf requires software checksums, it is also converted to a chain of mapped mbufs before computing the checksum. Submitted by: gallatin (earlier version) Reviewed by: gallatin, hselasky, rrs Discussed with: ae, kp (firewalls) Relnotes: yes Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D20616
* Convert all IPv4 and IPv6 multicast membershipshselasky2019-09-252-10/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | into using a STAILQ instead of a linear array. The multicast memberships for the inpcb structure are protected by a non-sleepable lock, INP_WLOCK(), which needs to be dropped when calling the underlying possibly sleeping if_ioctl() method. When using a linear array to keep track of multicast memberships, the computed memory location of the multicast filter may suddenly change, due to concurrent insertion or removal of elements in the linear array. This in turn leads to various invalid memory access issues and kernel panics. To avoid this problem, put all multicast memberships on a STAILQ based list. Then the memory location of the IPv4 and IPv6 multicast filters become fixed during their lifetime and use after free and memory leak issues are easier to track, for example by: vmstat -m | grep multi All list manipulation has been factored into inline functions including some macros, to easily allow for a future hash-list implementation, if needed. This patch has been tested by pho@ . Differential Revision: https://reviews.freebsd.org/D20080 Reviewed by: markj @ MFC after: 1 week Sponsored by: Mellanox Technologies
* Extend mmap/mprotect API to specify the max pagebrooks2019-09-251-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | protections. A new macro PROT_MAX() alters a protection value so it can be OR'd with a regular protection value to specify the maximum permissions. If present, these flags specify the maximum permissions. While these flags are non-portable, they can be used in portable code with simple ifdefs to expand PROT_MAX() to 0. This change allows (e.g.) a region that must be writable during run-time linking or JIT code generation to be made permanently read+execute after writes are complete. This complements W^X protections allowing more precise control by the programmer. This change alters mprotect argument checking and returns an error when unhandled protection flags are set. This differs from POSIX (in that POSIX only specifies an error), but is the documented behavior on Linux and more closely matches historical mmap behavior. In addition to explicit setting of the maximum permissions, an experimental sysctl vm.imply_prot_max causes mmap to assume that the initial permissions requested should be the maximum when the sysctl is set to 1. PROT_NONE mappings are excluded from this for compatibility with rtld and other consumers that use such mappings to reserve address space before mapping contents into part of the reservation. A final version this is expected to provide per-binary and per-process opt-in/out options and this sysctl will go away in its current form. As such it is undocumented. Reviewed by: emaste, kib (prior version), markj Additional suggestions from: alc Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D18880
* Some devices take undesired actions when RTS andshurd2019-09-251-1/+2
| | | | | | | | | | | | DTR are asserted. Some development boards for example will reset on DTR, and some radio interfaces will transmit on RTS. This patch allows "stty -f /dev/ttyu9.init -rtsdtr" to prevent RTS and DTR from being asserted on open(), allowing these devices to be used without problems. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D20031
* Fix mismatch from r342379.pfg2019-09-251-2/+2
|
* gai_strerror() - Update string error messages according to RFC 3493.pfg2019-09-251-9/+9
| | | | | | | | | | | | | | | | Error messages in gai_strerror(3) vary largely among OSs. For new software we largely replaced the obsoleted EAI_NONAME and with EAI_NODATA but we never updated the corresponding message to better match the intended use. We also have references to ai_flags and ai_family which are not very descriptive for non-developer end users. Bring new new error messages based on informational RFC 3493, which has obsoleted RFC 2553, and make them consistent among the header adn manpage. MFC after: 1 month Differentical Revision: D18630
* libc/include/devctl.h: Add SOCKCLOSE per FACE Technical Standard, Edition 3.0Joel Sherrill2019-09-101-5/+24
| | | | | | The FACE Technical Standard, Edition 3.0 and later require the definition of the subcommand SOCKCLOSE in <devctl.h>. Reference: https://www.opengroup.org/face
* fe_dfl_env.c: Fix typo in commentJoel Sherrill2019-09-031-1/+1
|
* riscv/include/fenv.h: Use shared fenv.h.Joel Sherrill2019-09-031-42/+0
| | | | libc/include/fenv.h was a direct copy of this file.
* Revert previous change to sys/stat.h and fix cris libglossJeff Johnston2019-08-191-9/+0
| | | | | | - revert previous fix which altered sys/stat.h - fix libgloss/cris/gensyscalls to undef st_atime, st_mtime, and st_ctime macros which cannot be used with new_stat structure
* Fix regression in cris-elf caused by sys/stat.h changeJeff Johnston2019-08-191-2/+11
|
* stat.h: use POSIX-required timefields throughoutCorinna Vinschen2019-08-161-16/+6
| | | | | | ...except in certain SysV R4 cases for backward compat. This is probably not required anymore, but it doesn't hurt to keep it in.
* fenv: Include documentation in generated .info fileJoel Sherrill2019-08-155-2/+49
|
* memmem.c and strstr.c: do not require -std=c99Giacomo Tesio2019-08-142-5/+10
|
* fenv: Update makedocbook for eae68bfcJon Turney2019-08-131-1/+3
| | | | | | | | | Teach makedocbook how to handle some new things seen in the makedoc markup since eae68bfc: - 'link with' lines appearing in SYNOPSIS sections Also, don't raise a NoneType exception when there's something we don't know how to handle in a SYNOPSIS section, just exit.
* fenv: Fix typo-ed variable name in documentationJon Turney2019-08-131-1/+1
|
* fenv: Fix mangled makedoc markupJon Turney2019-08-134-8/+8
| | | | | | See makedoc.c:657: Variables are marked up as '<[foo]>'. Code is marked up as '<<foo>>'.
* fenv: fe_dfl_env.c doesn't contain any documentationJon Turney2019-08-132-2/+2
| | | | | fe_dfl_env.c doesn't contain any documentation, so drop it from makedoc processing.
* sched.h: Declare affinity functions only on targets supporting themCorinna Vinschen2019-08-121-0/+6
|
* Regenerated files from fenv.h additionJoel Sherrill2019-08-093-7/+636
|
* Add default implementation of fenv.h and all methodsJoel Sherrill2019-08-0917-5/+997
| | | | | | | | | | The default implementation of the fenv.h methods return -EOPNOTSUP. Some of these have implementations appropriate for soft-float. The intention of the new fenv.h is that it be portable and that architectures provide their own implementation of sys/fenv.h.
* Miscellaneous Makefile.in regeneratedJoel Sherrill2019-08-094-46/+33
|
* Align libgloss/arm and libc/sys/arm sources: miscellaneous fixesAlexander Fedotov2019-08-052-17/+35
| | | | | 1. Trim trailing spaces 2. Align comments, function declarations and definitions
* Align libgloss/arm and libc/sys/arm sources: Lite exit supportAlexander Fedotov2019-08-051-0/+16
| | | | | | | Applied changes from commit 2404223: * arm/crt0.S (_mainCRTStartup): Weak reference to atexit and _fini when lite exit is enabled.
* Align libgloss/arm and libc/sys/arm sources: HeapInfo and __heap_limitAlexander Fedotov2019-08-052-2/+14
| | | | | | | | | | | Applied changes from commit 8d98f95: * arm/crt0.S: Initialise __heap_limit when ARM_RDI_MONITOR is defined. * arm/syscalls.c: define __heap_limit global symbol. * arm/syscalls.c (_sbrk): Honour __heap_limit. Applied changes from commit 8d98f95: Fixed semihosting for ARM when heapinfo not provided by debugger
* Align libgloss/arm and libc/sys/arm sources: Fix GetCmdLine semihosting ↵Alexander Fedotov2019-08-051-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | directives Applied changes from the commit 9b11672: When simulating arm code, the target program startup code (crt0) uses semihosting invocations to get the command line from the simulator. The simulator returns the command line and its size into the area passed in parameter. (ARM 32-bit specifications : http://infocenter.arm.com/help/topic/com.arm.doc.dui0058d/DUI0058.pdf chapter "5.4.19 SYS_GET_CMDLINE"). The memory area pointed by the semihosting register argument is located in .text section (usually not writtable (RX)). If we run this code on a simulator that respects this rights properties (qemu user-mode for instance), the command line will not be written to the .text program memory, in particular the length of the string. The program runs with an empty command line. This problem hasn't been seen earlier probably because qemu user-mode is not so much used, but this can happen with another simulator that refuse to write in a read-only segment. With this modification, the command line can be correctly passed to the target program. Changes: - newlib/libc/sys/arm/crt0.S : Arguments passed to the AngelSWI_Reason_GetCmdLine semihosting invocation are placed into .data section instead of .text
* RISC-V: Fix header guard for sys/fenv.hKito Cheng2019-08-021-3/+3
|
* common/math_errf.c: Enable compilation of __math_oflowfJoel Sherrill2019-07-261-2/+3
| | | | | This resolved linking errors when using methods such as expm1().
* hash.c: #include <reent.h>Ken Brown2019-07-261-0/+1
| | | | | | This is needed for the prototypes of _stat64 and _fstat64 on Cygwin. Fixes: commit 279805b2 "hash functions: use reentrant stat functions".
* [arm] remove libc/sys/arm/sys/param.hRichard Earnshaw2019-07-261-25/+0
| | | | | | | The Arm sys/param.h does not define anything differently to the generic sys/param.h, but fails to define some things that that file provides. There does not appear to be any reason to keep this version and we should revert to using the common version.