summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Document the last changeKen Brown2019-09-241-0/+3
|
* Cygwin: rmdir: fail if last component is a symlink, as on LinuxKen Brown2019-09-241-4/+25
| | | | | | | | | | | | 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.
* Cygwin: remove old cruft from path_conv::checkKen Brown2019-09-211-13/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Cygwin: Fix incorrect TTY for non-cygwin process.Takashi Yano2019-09-202-5/+2
| | | | | | - After commit d4045fdbef60d8e7e0d11dfe38b048ea2cb8708b, the TTY displayed by ps command is incorrect if the process is non-cygwin process. This patch fixes this issue.
* Cygwin: console: Make console input work in GDB and strace.Takashi Yano2019-09-201-1/+1
| | | | | - After commit 2232498c712acc97a38fdc297cbe53ba74d0ec2c, console input cause error in GDB or strace. This patch fixes this issue.
* Cygwin: pty: Add missing guard when PTY is in the legacy mode.Takashi Yano2019-09-201-1/+4
|
* Cygwin: pty: Add charset conversion for console apps in legacy PTY.Takashi Yano2019-09-201-0/+7
|
* Cygwin: pty: Unify the charset conversion codes into a function.Takashi Yano2019-09-201-81/+49
|
* Cygwin: pty: Make GDB work again on pty.Takashi Yano2019-09-201-0/+35
|
* Cygwin: pty: Avoid potential segfault in PTY code when ppid = 1.Takashi Yano2019-09-201-2/+9
|
* Cygwin: console: Revive Win7 compatibility.Takashi Yano2019-09-193-7/+6
| | | | | - The commit fca4cda7a420d7b15ac217d008527e029d05758e broke Win7 compatibility. This patch fixes the issue.
* Cygwin: document last changeKen Brown2019-09-152-0/+7
|
* winsup/cygwin/times.cc (times): follow Linux and allow for a NULL buf argumentAchim Gratz2019-09-151-6/+11
| | | | | | Adresses the problem reported here: https://cygwin.com/ml/cygwin/2019-09/msg00141.html
* Cygwin: pty: Use autoload feature for pseudo console system calls.Takashi Yano2019-09-152-23/+16
| | | | | | - The autoload feature is used rather than GetModuleHandle(), GetProcAddress() for CreatePseudoConsole(), ResizePseudoConsole() and ClosePseudoConsole().
* Cygwin: pty: Correct typos that do not fit the coding style.Takashi Yano2019-09-151-13/+13
|
* Cygwin: pty: Change the timing of clearing screen.Takashi Yano2019-09-151-13/+13
| | | | | | - 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.
* Cygwin: pty: Use system NLS function instead of PTY's own one.Takashi Yano2019-09-154-397/+107
| | | | | | | - 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.
* Cygwin: pty: Fix bad file descriptor error in some environment.Takashi Yano2019-09-151-2/+0
| | | | | | - The bad file descriptor problem reported in: https://cygwin.com/ml/cygwin-patches/2019-q3/msg00104.html was recurring. Fixed again.
* Cygwin: fix CPU_SET macro visibilityMark Geisert2019-09-141-0/+3
| | | | | | 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.
* Cygwin: console: Fix read() in non-canonical mode.Takashi Yano2019-09-141-291/+315
| | | | | | - In non-canonical mode, cygwin console returned only one character even if several keys are typed before read() called. This patch fixes this behaviour.
* Cygwin: pty: Switch input and output pipes individually.Takashi Yano2019-09-148-101/+173
| | | | | | | | - 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.
* Cygwin: pty: Prevent the helper process from exiting by Ctrl-C.Takashi Yano2019-09-141-0/+1
|
* Cygwin: pty: Fix screen alternation while pseudo console switching.Takashi Yano2019-09-141-8/+14
| | | | | | - 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.
* Cygwin: pty: Fix the behaviour of Ctrl-C in the pseudo console mode.Takashi Yano2019-09-144-42/+50
| | | | | | | | - 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.
* 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
* Cygwin: pty: Make SetConsoleCursorPosition() to be hooked.Takashi Yano2019-09-061-0/+9
| | | | | | - Win32 API SetConsoleCursorPosition() injects ANSI escape sequence to pseudo console. Therefore, it should be added to the API list to be hooked.
* Cygwin: pty: Make sure to show system error messagesTakashi Yano2019-09-051-6/+49
| | | | | | | | - 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.
* Cygwin: pty: Fix potential state mismatch regarding pseudo console.Takashi Yano2019-09-051-2/+7
| | | | | | - 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.
* Cygwin: pty: Fix select() with pseudo console support.Takashi Yano2019-09-054-15/+207
| | | | | | - 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.
* Cygwin: pty: Disable clear screen on new pty if TERM=dumb or emacs*.Takashi Yano2019-09-053-5/+16
| | | | | | | - 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.
* Cygwin: pty: Add a workaround for ^C handling.Takashi Yano2019-09-042-1/+6
| | | | | | | | - 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.
* Cygwin: pty: Limit API hook to the program linked with the APIs.Takashi Yano2019-09-044-71/+66
| | | | | | | | | | | - 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.
* Cygwin: pty: Fix state management for pseudo console support.Takashi Yano2019-09-046-254/+289
| | | | | | | | - 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.
* Cygwin: pty: Move function hook_api() into hookapi.cc.Takashi Yano2019-09-043-44/+35
| | | | | | - 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.
* Cygwin: pty: Speed up a little hooked Win32 API for pseudo console.Takashi Yano2019-09-041-1/+3
| | | | | - Some Win32 APIs are hooked in pty code for pseudo console support. This causes slow down. This patch improves speed a little.
* Cygwin: pty: Code cleanupTakashi Yano2019-09-041-28/+0
| | | | | | - Cleanup the code which is commented out by #if 0 regarding pseudo console. - Remove #if 1 for experimental code which seems to be stable.
* Adjust nios2 and m68k semihosting for sys/stat.h changes.Sandra Loosemore2019-09-044-12/+12
| | | | | | | | | | | Commit 72ff9acad2ab54e80a19ddaec0106065c817e3f6 caused st_atime, st_ctime, and st_mtime to be defined as macros. This collided with use of these identifiers as field names in struct gdb_stat (which represents the GDB RSP encoding of struct stat) in libgloss semihosting support for nios2 and m68k. This patch renames the affected fields of struct gdb_stat. Signed-off-by: Sandra Loosemore <sandra@codesourcery.com>
* Cygwin: sys/wait.h: Add _wait prototype to avoid compiler warningCorinna Vinschen2019-09-031-0/+4
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* 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.
* Cygwin: add W10 pseudo console support to release notesCorinna Vinschen2019-08-292-6/+18
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: pty: add pseudo console support.Takashi Yano2019-08-2912-55/+2016
| | | | | | | - Support pseudo console in PTY. Pseudo console is a new feature in Windows 10 1809, which provides console APIs on virtual terminal. With this patch, native console applications can work in PTYs such as mintty, ssh, gnu screen or tmux.
* Cygwin: get_posix_access: avoid negative subscriptKen Brown2019-08-261-4/+4
| | | | Don't refer to lacl[pos] unless we know that pos >= 0.
* Fix regression in visium caused by sys/stat.h changeJeff Law2019-08-202-6/+6
|