Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2019-10-03Cygwin: Fix signal handling issue introduced by PTY related change.Takashi Yano
- After commit 41864091014b63b0cb72ae98281fa53349b6ef77, there is a regression in signal handling reported in https://www.cygwin.com/ml/cygwin/2019-10/msg00010.html. This patch fixes the issue.
2019-09-27Document the last bug fixKen Brown
2019-09-26Cygwin: normalize_win32_path: improve error checkingKen Brown
If the source path starts with the Win32 long path prefix '\\?\' or the NT object directory prefix '\??\', require the prefix to be followed by 'UNC\' or '<drive letter>:\'. Otherwise return EINVAL. This fixes the assertion failure in symlink_info::check that was reported here: https://cygwin.com/ml/cygwin/2019-09/msg00228.html That assertion failure was caused by normalize_win32_path returning a path with no backslashes when the source path was '\\?\DRIVE'.
2019-09-26Cygwin: pty: Fix PTY so that cygwin setup shows help with -h option.Takashi Yano
- After commit 169d65a5774acc76ce3f3feeedcbae7405aa9b57, cygwin setup fails to show help message when -h option is specified, as reported in https://cygwin.com/ml/cygwin/2019-09/msg00248.html. This patch fixes the problem.
2019-09-25Add SIOCGIFDOWNREASON.kib
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
2019-09-25Add kernel-side support for in-kernel TLS.jhb
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
2019-09-25Rename IPPROTO 33 from SEP to DCCPthj
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
2019-09-25This commit updates rack to what is basicallyrrs
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
2019-09-25Add an external mbuf buffer type that holdsjhb
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
2019-09-25Convert all IPv4 and IPv6 multicast membershipshselasky
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
2019-09-25Extend mmap/mprotect API to specify the max pagebrooks
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
2019-09-25Some devices take undesired actions when RTS andshurd
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
2019-09-25Fix mismatch from r342379.pfg
2019-09-25gai_strerror() - Update string error messages according to RFC 3493.pfg
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
2019-09-25Document the last changeKen Brown
2019-09-25Cygwin: rmdir: fail if last component is a symlink, as on LinuxKen Brown
If the last component of the directory name is a symlink followed by a slash, rmdir now fails, following Linux but not POSIX, even if the symlink resolves to an existing empty directory. mkdir was similarly changed in 2009 in commit 52dba6a5c45e8d8ba1e237a15213311dc11d91fb. Modify a comment to clarify the purpose of that commit. Addresses https://cygwin.com/ml/cygwin/2019-09/msg00221.html.
2019-09-21Cygwin: remove old cruft from path_conv::checkKen Brown
Prior to commit b0717aae, path_conv::check had the following code: if (strncmp (path, "\\\\.\\", 4)) { /* Windows ignores trailing dots and spaces in the last path component, and ignores exactly one trailing dot in inner path components. */ char *tail = NULL; [...] if (!tail || tail == path) /* nothing */; else if (tail[-1] != '\\') { *tail = '\0'; [...] } Commit b0717aae0 intended to disable this code, but it inadvertently disabled only part of it. In particular, the declaration of the local tail variable was in the disabled code, but the following remained: if (!tail || tail == path) /* nothing */; else if (tail[-1] != '\\') { *tail = '\0'; [...] } [A later commit removed the disabled code.] The tail variable here points into a string different from path, causing that string to be truncated under some circumstances. See https://cygwin.com/ml/cygwin/2019-09/msg00001.html for more details. This commit fixes the problem by removing the leftover code that was intended to be removed in b0717aae.
2019-09-21Cygwin: Fix incorrect TTY for non-cygwin process.Takashi Yano
- After commit d4045fdbef60d8e7e0d11dfe38b048ea2cb8708b, the TTY displayed by ps command is incorrect if the process is non-cygwin process. This patch fixes this issue.
2019-09-21Cygwin: console: Make console input work in GDB and strace.Takashi Yano
- After commit 2232498c712acc97a38fdc297cbe53ba74d0ec2c, console input cause error in GDB or strace. This patch fixes this issue.
2019-09-20Cygwin: pty: Add missing guard when PTY is in the legacy mode.Takashi Yano
2019-09-20Cygwin: pty: Add charset conversion for console apps in legacy PTY.Takashi Yano
2019-09-20Cygwin: pty: Unify the charset conversion codes into a function.Takashi Yano
2019-09-20Cygwin: pty: Make GDB work again on pty.Takashi Yano
2019-09-20Cygwin: pty: Avoid potential segfault in PTY code when ppid = 1.Takashi Yano
2019-09-20Cygwin: console: Revive Win7 compatibility.Takashi Yano
- The commit fca4cda7a420d7b15ac217d008527e029d05758e broke Win7 compatibility. This patch fixes the issue.
2019-09-15Cygwin: document last changeKen Brown
2019-09-15winsup/cygwin/times.cc (times): follow Linux and allow for a NULL buf argumentAchim Gratz
Adresses the problem reported here: https://cygwin.com/ml/cygwin/2019-09/msg00141.html
2019-09-15Cygwin: pty: Use autoload feature for pseudo console system calls.Takashi Yano
- The autoload feature is used rather than GetModuleHandle(), GetProcAddress() for CreatePseudoConsole(), ResizePseudoConsole() and ClosePseudoConsole().
2019-09-15Cygwin: pty: Correct typos that do not fit the coding style.Takashi Yano
2019-09-15Cygwin: pty: Change the timing of clearing screen.Takashi Yano
- The code which clears screen is moved from reset_switch_to_pcon() to fixup_after_exec() because it seems not too early even at this timing.
2019-09-15Cygwin: pty: Use system NLS function instead of PTY's own one.Takashi Yano
- Since calling system __loadlocale() caused execution error, PTY used its own NLS function. The cause of the error has been found, the corresponding code has been rewritten using system function.
2019-09-15Cygwin: pty: Fix bad file descriptor error in some environment.Takashi Yano
- The bad file descriptor problem reported in: https://cygwin.com/ml/cygwin-patches/2019-q3/msg00104.html was recurring. Fixed again.
2019-09-14Cygwin: fix CPU_SET macro visibilityMark Geisert
The CPU_SET macros defined in Cygwin's include/sys/cpuset.h must not be visible in an application's namespace unless _GNU_SOURCE has been #defined. Internally this means wrapping them in #if __GNU_VISIBLE.
2019-09-14Cygwin: console: Fix read() in non-canonical mode.Takashi Yano
- In non-canonical mode, cygwin console returned only one character even if several keys are typed before read() called. This patch fixes this behaviour.
2019-09-14Cygwin: pty: Switch input and output pipes individually.Takashi Yano
- Previously, input and output pipes were switched together between the traditional pty and the pseudo console. However, for example, if stdin is redirected to another device, it is better to leave input pipe traditional pty side even for non-cygwin program. This patch realizes such behaviour.
2019-09-14Cygwin: pty: Prevent the helper process from exiting by Ctrl-C.Takashi Yano
2019-09-14Cygwin: pty: Fix screen alternation while pseudo console switching.Takashi Yano
- If screen alternated while pseudo console switching, it sometimes failed. This might happen when the output of the non-cygwin program is piped to less. This patch fixes this issue.
2019-09-14Cygwin: pty: Fix the behaviour of Ctrl-C in the pseudo console mode.Takashi Yano
- When the I/O pipe is switched to the pseudo console side, the behaviour of Ctrl-C was unstable. This rarely happens, however, for example, shell sometimes crashes by Ctrl-C in that situation. Furthermore, Ctrl-C was ignored if output of non-cygwin program is redirected to pipe. This patch fixes these issues.
2019-09-10libc/include/devctl.h: Add SOCKCLOSE per FACE Technical Standard, Edition 3.0Joel Sherrill
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
2019-09-06Cygwin: pty: Make SetConsoleCursorPosition() to be hooked.Takashi Yano
- Win32 API SetConsoleCursorPosition() injects ANSI escape sequence to pseudo console. Therefore, it should be added to the API list to be hooked.
2019-09-05Cygwin: pty: Make sure to show system error messagesTakashi Yano
- Forcibly attach to pseudo console in advance so that the error messages by system_printf() are displayed to screen reliably. This is needed when stdout is redirected to another pty. In this case, process has two ptys opened. However, process can attach to only one console. So it is necessary to change console attached.
2019-09-05Cygwin: pty: Fix potential state mismatch regarding pseudo console.Takashi Yano
- PTY with pseudo console support sitll has problem which potentially cause state mismatch between state variable and real console state. This patch fixes this issue.
2019-09-05Cygwin: pty: Fix select() with pseudo console support.Takashi Yano
- select() did not work correctly when both read and except are polled simultaneously for the same fd and the r/w pipe is switched to pseudo console side. This patch fixes this isseu.
2019-09-05Cygwin: pty: Disable clear screen on new pty if TERM=dumb or emacs*.Takashi Yano
- Pseudo console support introduced by commit 169d65a5774acc76ce3f3feeedcbae7405aa9b57 shows garbage ^[[H^[[J in some of emacs screens. These screens do not handle ANSI escape sequences. Therefore, clear screen is disabled on these screens.
2019-09-04Cygwin: pty: Add a workaround for ^C handling.Takashi Yano
- Pseudo console support introduced by commit 169d65a5774acc76ce3f3feeedcbae7405aa9b57 sometimes cause random crash or freeze by pressing ^C while cygwin and non-cygwin processes are executed simultaneously in the same pty. This patch is a workaround for this issue.
2019-09-04Cygwin: pty: Limit API hook to the program linked with the APIs.Takashi Yano
- API hook used for pseudo console support causes slow down. This patch limits API hook to only program which is linked with the corresponding APIs. Normal cygwin program is not linked with such APIs (such as WriteFile, etc...) directly, therefore, no slow down occurs. However, console access by cygwin.dll itself cannot switch the r/w pipe to pseudo console side. Therefore, the code to switch it forcely to pseudo console side is added to smallprint.cc and strace.cc.
2019-09-04Cygwin: pty: Fix state management for pseudo console support.Takashi Yano
- Pseudo console support introduced by commit 169d65a5774acc76ce3f3feeedcbae7405aa9b57 has some bugs which cause mismatch between state variables and real pseudo console state regarding console attaching and r/w pipe switching. This patch fixes this issue by redesigning the state management.
2019-09-04Cygwin: pty: Move function hook_api() into hookapi.cc.Takashi Yano
- PTY uses Win32 API hook for pseudo console suppot. The function hook_api() is used for this purpose and defined in fhandler_tty.cc previously. This patch moves it into hookapi.cc.
2019-09-04Cygwin: pty: Speed up a little hooked Win32 API for pseudo console.Takashi Yano
- Some Win32 APIs are hooked in pty code for pseudo console support. This causes slow down. This patch improves speed a little.
2019-09-04Cygwin: pty: Code cleanupTakashi Yano
- Cleanup the code which is commented out by #if 0 regarding pseudo console. - Remove #if 1 for experimental code which seems to be stable.