Various minor whitespace cleanupsAccumulated along the way.
kernel: Remove unnecessary casts for updated mbuf(9) functions
Minor cleanups to 'sruct domain' definitions
kernel - Add per-process capability-based restrictions* This new system allows userland to set capability restrictions which turns off numerous kernel features and root accesses. These restricti
kernel - Add per-process capability-based restrictions* This new system allows userland to set capability restrictions which turns off numerous kernel features and root accesses. These restrictions are inherited by sub-processes recursively. Once set, restrictions cannot be removed. Basic restrictions that mimic an unadorned jail can be enabled without creating a jail, but generally speaking real security also requires creating a chrooted filesystem topology, and a jail is still needed to really segregate processes from each other. If you do so, however, you can (for example) disable mount/umount and most global root-only features.* Add new system calls and a manual page for syscap_get(2) and syscap_set(2)* Add sys/caps.h* Add the "setcaps" userland utility and manual page.* Remove priv.9 and the priv_check infrastructure, replacing it with a newly designed caps infrastructure.* The intention is to add path restriction lists and similar features to improve jailess security in the near future, and to optimize the priv_check code.
show more ...
socket: introduce SO_RERROR to detect receive buffer overflowkernel receive buffers are initially of a limited size andgenerally the network protocols that use them don't careif a packet gets los
socket: introduce SO_RERROR to detect receive buffer overflowkernel receive buffers are initially of a limited size andgenerally the network protocols that use them don't careif a packet gets lost.However some users do care about lost messages even if notbaked into the protocol - such as consumers of route(4) totrack state.POSIX states that read(2) can return an error of ENOBUFS soreturn this error code when an overflow is detected.Guard this with socket option SO_RERROR so that existingapplications which do not care can carry on not caring bydefault.Taken-from: NetBSDReviewed-by: sephe
kernel - Remove PG_ZERO and zeroidle (page-zeroing) entirely* Remove the PG_ZERO flag and remove all page-zeroing optimizations, entirely. Aftering doing a substantial amount of testing, these
kernel - Remove PG_ZERO and zeroidle (page-zeroing) entirely* Remove the PG_ZERO flag and remove all page-zeroing optimizations, entirely. Aftering doing a substantial amount of testing, these optimizations, which existed all the way back to CSRG BSD, no longer provide any benefit on a modern system. - Pre-zeroing a page only takes 80ns on a modern cpu. vm_fault overhead in general is ~at least 1 microscond. - Pre-zeroing a page leads to a cold-cache case on-use, forcing the fault source (e.g. a userland program) to actually get the data from main memory in its likely immediate use of the faulted page, reducing performance. - Zeroing the page at fault-time is actually more optimal because it does not require any reading of dynamic ram and leaves the cache hot. - Multiple synth and build tests show that active idle-time zeroing of pages actually reduces performance somewhat and incidental allocations of already-zerod pages (from page-table tear-downs) do not affect performance in any meaningful way.* Remove bcopyi() and obbcopy() -> collapse into bcopy(). These other versions existed because bcopy() used to be specially-optimized and could not be used in all situations. That is no longer true.* Remove bcopy function pointer argument to m_devget(). It is no longer used. This function existed to help support ancient drivers which might have needed a special memory copy to read and write mapped data. It has long been supplanted by BUSDMA.
kernel: Use fhold() instead of increasing f_count manually
kernel: Use NULL for pointers.
kernel: Replace all usage of MALLOC()/FREE() with kmalloc()/kfree().
kernel - Fix netgraph MP race* Fix a netgraph MP race due to netgraph not acquiring required tokens when manipulating the socket's sockbuf structure.Reported-by: Francois Tigeot <ftigeot@wolfpo
kernel - Fix netgraph MP race* Fix a netgraph MP race due to netgraph not acquiring required tokens when manipulating the socket's sockbuf structure.Reported-by: Francois Tigeot <ftigeot@wolfpond.org>
kernel: Use NELEM() where we can.
network - Major netmsg retooling, part 1* Remove all the netmsg shims and make all pr_usrreqs and some proto->pr_* requests directly netmsg'd.* Fix issues with tcp implied connects and tcp6->tc
network - Major netmsg retooling, part 1* Remove all the netmsg shims and make all pr_usrreqs and some proto->pr_* requests directly netmsg'd.* Fix issues with tcp implied connects and tcp6->tcp4 fallbacks with implied connects.* Fix an issue with a stack-based udp netmsg (allocate it)* Consolidate struct ip6protosw and struct protosw into a single structure and normalize the API functions which differed between the two (primarily proto->pr_input()).* Remove protosw->pr_soport()* Replace varargs protocol *_input() functions (ongoing) with fixed arguments.
build - Fix netgraph* Some source files were missing newly required includes for their use of the mplock and socketvar2.h inlines.Reported-by: lentferj
network - MP socket free & abort interactions, so_state* Add so_refs and ref-count the socket structure to deal with MP races on sofree().* Ref the socket structure for all soabort() operations
network - MP socket free & abort interactions, so_state* Add so_refs and ref-count the socket structure to deal with MP races on sofree().* Ref the socket structure for all soabort() operations (they are usually asynchronous). The netmsg_pru_abort() handler will sofree() the ref after calling the protocol stack's abort function.* Use atomic ops to set and clear bits in so_state, because it is modified by both the fronttend and the backend.* Remove numerous critical sections that are no longer effective.* Protect the accept queues with so_rcv.ssb_token.* Protect after-the-fact calls to soisdisconnected() with a soreference() to avoid use-after-free cases.* Wrap unix domain, mroute, div, raw, and key sockets/protocols with their own private tokens.
kernel - Tear out socket polling* Remove existing (now legacy) code that implements socket polling, kq filters are now the "One True (and only) Way"* Implement a new socket_wait() that can be u
kernel - Tear out socket polling* Remove existing (now legacy) code that implements socket polling, kq filters are now the "One True (and only) Way"* Implement a new socket_wait() that can be used to wait for data to arrive on a single descriptor with an optional timeout.
modules: remove KMODDEPS, it is not used anymore
suser_* to priv_* conversion
Install pr_ctlport for the rest of the protocols.Reported-by: tomas@
Remove bogus checks after kmalloc(M_WAITOK) which never returns NULL.Reviewed-by: hasso
For kmalloc(), MALLOC() and contigmalloc(), use M_ZERO instead ofexplicitly bzero()ing.Reviewed-by: sephe
Catch up a bit with FreeBSD netgraph by replacing *LEN constants with*SIZ constants which already account space for trailing '\0's.Submitted-by: "Nuno Antunes" <nuno.antunes@gmail.com>Obtained fr
Catch up a bit with FreeBSD netgraph by replacing *LEN constants with*SIZ constants which already account space for trailing '\0's.Submitted-by: "Nuno Antunes" <nuno.antunes@gmail.com>Obtained from: FreeBSD (sorta).
Give the sockbuf structure its own header file and supporting source file.Move all sockbuf-specific functions from kern/uipc_socket2.c into the newkern/uipc_sockbuf.c and move all the sockbuf-speci
Give the sockbuf structure its own header file and supporting source file.Move all sockbuf-specific functions from kern/uipc_socket2.c into the newkern/uipc_sockbuf.c and move all the sockbuf-specific structures fromsys/socketvar.h to sys/sockbuf.h.Change the sockbuf structure to only contain those fields required toproperly management a chain of mbufs. Create a signalsockbuf structureto hold the remaining fields (e.g. selinfo, mbmax, etc).Change the so_rcv and so_snd structures in the struct socket froma sockbuf to a signalsockbuf.Remove the recently added sorecv_direct structure which was being usedto provide a direct mbuf path to consumers for socket I/O. Use the newlyrevamped sockbuf base structure instead. This gives mbuf consumersdirect access to the sockbuf API functions for use outside of a structsocket. This will also allow new API functions to be added to the sockbufinterface to ease the job of parsing data out of chained mbufs.
Convert all pr_usrreqs structure initializations to the .name = data format.
Further normalize the _XXX_H_ symbols used to conditionalize header fileinclusion.Use _MACHINE_BLAH_H_ for headers found in "/usr/src/sys/arch/<arch>/include".Most headers already did this, but s
Further normalize the _XXX_H_ symbols used to conditionalize header fileinclusion.Use _MACHINE_BLAH_H_ for headers found in "/usr/src/sys/arch/<arch>/include".Most headers already did this, but some did not.Use _ARCH_SUBDIR_BLAH_H_ for headers found in "/usr/src/sys/arch/<arch>/subdir"instead of _I386_SUBDIR_BLAH_H_.Change #include's made in architecture-specific directories to use<machine/blah.h> instead of "blah.h", allowing the included header filesto be overrdden by another architecture. For example, a virtual kernelarchitecture might include a header from arch/i386/include which thenincludes some other header in arch/i386/include. But really we want thatother header to also go via the arch/vkernel/include, so the header filesin arch/i386/include must use <machine/blah.h> instead of "blah.h" for mostof their sub-includes.Change most architecture-specific includes such as <i386/icu/icu.h> touse a generic path through the "arch" softlink, such as <arch/icu/icu.h>.Remove the temporary -I@/arch shim made in a recent commit, the <arch/...>mechanism replaces it.These changes allow us to implement heirarchical architectural overrides,primarily intended for virtual kernel support. A virtual kernel uses anarchitecture of 'vkernel' but must be able to access actual cpu-specificheader files such as those found in arch/i386. It does this using a"cpu" softlink. For example, someone including <machine/atomic.h> in avkernel build would hit the "arch/vkernel/include/atomic.h" header, and thisheader could then #include <cpu/atomic.h> to access the actual cpu'satomic.h file: "arch/i386/include/atomic.h".The ultimate effect is that an architecture can build on anotherarchitecture's header and source files.
File descriptor cleanup stage 2, remove the separate arrays for filepointers, fileflags, and allocation counts and replace the mess with asingle structural array. Also revamp the code that checks
File descriptor cleanup stage 2, remove the separate arrays for filepointers, fileflags, and allocation counts and replace the mess with asingle structural array. Also revamp the code that checks whether thefile descriptor array is built-in or allocated.Note that the removed malloc's were doing something weird, allocating'nf * OFILESIZE + 1' bytes instead of 'nf * OFILESIZE' bytes. I couldnot find any reason at all why it was doing that. It's gone now anyway.
12