aboutsummaryrefslogtreecommitdiff
path: root/sys/sys
Commit message (Collapse)AuthorAgeFilesLines
* Remove SV_CAPSICUMKonstantin Belousov40 hours1-1/+1
| | | | | | | | It was only needed for cloudabi Reviewed by: emaste Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D31923
* Drop cloudabiKonstantin Belousov40 hours1-1/+0
| | | | | | | | | | | | | According to https://github.com/NuxiNL/cloudlibc: CloudABI is no longer being maintained. It was an awesome experiment, but it never got enough traction to be sustainable. There is no reason to keep it in FreeBSD. Approved by: ed (private mail) Reviewed by: emaste Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D31923
* Revert "cpuset(9): Add CPU_FOREACH_IS(SET|CLR) and modify consumers to use it"Mark Johnston43 hours1-2/+0
| | | | | | | | | This reverts commit 9068f6ea697b1b28ad1326a4c7a9ba86f08b985e. The underlying macro needs to be reworked to avoid problems with control flow statements. Reported by: rlibby
* cpuset(9): Add CPU_FOREACH_IS(SET|CLR) and modify consumers to use itMark Johnston45 hours1-0/+2
| | | | | | | | | | | This implementation is faster and doesn't modify the cpuset, so it lets us avoid some unnecessary copying as well. No functional change intended. Reviewed by: cem, kib, jhb MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32029
* bitset(9): Introduce BIT_FOREACH_ISSET and BIT_FOREACH_ISCLRMark Johnston45 hours1-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | These allow one to non-destructively iterate over the set or clear bits in a bitset. The motivation is that we have several code fragments which iterate over a CPU set like this: while ((cpu = CPU_FFS(&cpus)) != 0) { cpu--; CPU_CLR(cpu, &cpus); <do something>; } This is slow since CPU_FFS begins the search at the beginning of the bitset each time. On amd64 and arm64, CPU sets have size 256, so there are four limbs in the bitset and we do a lot of unnecessary scanning. A second problem is that this is destructive, so code which needs to preserve the original set has to make a copy. In particular, we have quite a few functions which take a cpuset_t parameter by value, meaning that each call has to copy the 32 byte cpuset_t. The new macros address both problems. Reviewed by: cem, kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32028
* endian.h: Use the __bswap* versionsWarner Losh2 days1-12/+12
| | | | | | | | | | Make it possible to have all these macros work without bswap* being defined. bswap* is part of the application namespace and applications are free to redefine those functions. Reviewed by: emaste,jhb,markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31964
* device: add device_get_property and device_has_propertyBartlomiej Grzesik3 days1-0/+2
| | | | | | | | | | | Generialize bus specific property accessors. Those functions allow driver code to access device specific information. Currently there is only support for FDT and ACPI buses. Reviewed by: manu, mw Sponsored by: Semihalf Differential revision: https://reviews.freebsd.org/D31597
* Add ELF macros found in the aaelf64 specAndrew Turner3 days1-0/+9
| | | | | | | | | | | | | The arm64 aaelf64 spec [0] has DT_AARCH64_ that could be used with dynamic linking. It also adds GNU_PROPERTY_AARCH64_FEATURE_1_AND used to tell the kernel which CPU features the binary is compatible with, but does not require to execute correctly. Add these values so the kernel and elf tools can make use of them. [0] https://github.com/ARM-software/abi-aa/blob/2021Q1/aaelf64/aaelf64.rst Sponsored by: The FreeBSD Foundation
* socket: Synchronize soshutdown() with listen(2) and AIOMark Johnston6 days1-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To handle shutdown(SHUT_RD) we flush the receive buffer of the socket. This may involve searching for control messages of type SCM_RIGHTS, since we need to close the file references. Closing arbitrary files with socket buffer locks held is undesirable, mainly due to lock ordering issues, so we instead make a copy of the socket buffer and operate on that without any locks. Fields in the original buffer are cleared. This behaviour clobbered the AIO job queue associated with a receive buffer. It could also cause us to leak a KTLS session reference. Reorder socket buffer fields to address this. An alternate solution would be to remove the hack in sorflush(), but this is not quite feasible (yet). In particular, though sorflush() flags the sockbuf with SBS_CANTRCVMORE, it is possible for more data to be queued - the flag just prevents userspace from reading more data. I suspect we should fix this; SBS_CANTRCVMORE represents a terminal state and protocols can likely just drop any data destined for such a buffer. Many of them already do, but in some cases the check is racy, and some KPI churn will be needed to fix everything. This approach is more straightforward for now. Reported by: syzbot+104d8ee3430361cb2795@syzkaller.appspotmail.com Reported by: syzbot+5bd2e7d05f84a59d0d1b@syzkaller.appspotmail.com Reviewed by: jhb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31976
* ktls: Fix error/mode confusion in TCP_*TLS_MODE getsockopt handlersMark Johnston6 days1-2/+2
| | | | | | | | | | | | | ktls_get_(rx|tx)_mode() can return an errno value or a TLS mode, so errors are effectively hidden. Fix this by using a separate output parameter. Convert to the new socket buffer locking macros while here. Note that the socket buffer lock is not needed to synchronize the SOLISTENING check here, we can rely on the PCB lock. Reviewed by: jhb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31977
* buffer pager: allow get_blksize method to return errorKonstantin Belousov6 days1-1/+1
| | | | | | | Reported and reviewed by: asomers Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31998
* procctl(2): Add PROC_WXMAP_CTL/STATUSKonstantin Belousov6 days2-0/+8
| | | | | | | | | | | It allows to override kern.elf{32,64}.allow_wx on per-process basis. In particular, it makes it possible to run binaries without PT_GNU_STACK and without elfctl note while allow_wx = 0. Reviewed by: brooks, emaste, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31779
* Remove PT_GET_SC_ARGS_ALLKonstantin Belousov7 days1-4/+0
| | | | | | | | | | | | | | Reimplement bdf0f24bb16d556a5b by checking for the caller' ABI in the implementation of PT_GET_SC_ARGS, and copying out everything if it is Linuxolator. Also fix a minor information leak: if PT_GET_SC_ARGS_ALL is done on the thread reused after other process, it allows to read some number of that thread last syscall arguments. Clear td_sa.args in thread_alloc(). Reviewed by: jhb Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D31968
* Only define sanitizer wrappers for unsized bus space operations once.John Baldwin8 days1-3/+6
| | | | | | | | | Previously, this was defining duplicate definitions for each size. This fixes a redundant definition warning from GCC. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D31966
* Only define sanitizer wrappers for atomic fences once.John Baldwin8 days1-3/+6
| | | | | | | | | Previously, this was defining duplicate definitions for each type. This fixes a redundat definition warning from GCC. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D31965
* linux: implement PTRACE_GET_SYSCALL_INFOEdward Tomasz Napierala9 days1-0/+4
| | | | | | | | | This is one of the pieces required to make modern (ie Focal) strace(1) work. Reviewed By: jhb (earlier version) Sponsored by: EPSRC Differential Revision: https://reviews.freebsd.org/D28212
* Add a switch structure for send tags.John Baldwin9 days1-2/+5
| | | | | | | | | | | | | | | | | | | | | Move the type and function pointers for operations on existing send tags (modify, query, next, free) out of 'struct ifnet' and into a new 'struct if_snd_tag_sw'. A pointer to this structure is added to the generic part of send tags and is initialized by m_snd_tag_init() (which now accepts a switch structure as a new argument in place of the type). Previously, device driver ifnet methods switched on the type to call type-specific functions. Now, those type-specific functions are saved in the switch structure and invoked directly. In addition, this more gracefully permits multiple implementations of the same tag within a driver. In particular, NIC TLS for future Chelsio adapters will use a different implementation than the existing NIC TLS support for T6 adapters. Reviewed by: gallatin, hselasky, kib (older version) Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D31572
* socket: De-duplicate SBLOCKWAIT() definitionsMark Johnston9 days1-0/+2
| | | | | MFC after: 1 week Sponsored by: The FreeBSD Foundation
* md: Add MD_MUSTDEALLOC supportKa Ho Ng12 days1-0/+1
| | | | | | | | | | | This adds an option to detect if hole-punching is implemented by the underlying file system. If this flag is set, and if the underlying file system does not support hole-punching, md(4) fails BIO_DELETE requests with EOPNOTSUPP. Sponsored by: The FreeBSD Foundation Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D31883
* socket: Add macros to lock socket buffers using socket referencesMark Johnston13 days2-4/+33
| | | | | | | | | | | | | | | | | | | | | Since commit c67f3b8b78e50c6df7c057d6cf108e4d6b4312d0 the sockbuf mutexes belong to the containing socket. Sockbufs contain a pointer to a mutex, which by default is initialized to the corresponding mutexes in the socket. The SOCKBUF_LOCK() etc. macros operate on this pointer. However, the pointer is clobbered by listen(2) so it's not safe to use them unless one is sure that the socket is not a listening socket. This change introduces a new set of macros which lock socket buffers through the socket. This is a bit cheaper since it removes the pointer indirection, and allows one to safely lock socket buffers and then check for a listening socket. For MFC, these macros should be reimplemented in terms of the existing socket buffer layout. Reviewed by: tuexen, gallatin, jhb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31900
* VOP_COPY_FILE_RANGE: Add a COPY_FILE_RANGE_TIMEO1SEC flagRick Macklem2021-09-081-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Although it is not specified in the RFCs, the concept that the NFSv4 server should reply to an RPC request within a reasonable time is accepted practice within the NFSv4 community. Without this patch, the NFSv4.2 server attempts to reply to a Copy operation within 1second by limiting the copy to vfs.nfs.maxcopyrange bytes (default 10Mbytes). This is crude at best, given the large variation in I/O subsystem performance. This patch adds a kernel only flag COPY_FILE_RANGE_TIMEO1SEC that the NFSv4.2 can specify, which tells VOP_COPY_FILE_RANGE() to return after approximately 1 second with a partial result and implements this in vn_generic_copy_file_range(), used by vop_stdcopyfilerange(). Modifying the NFSv4.2 server to set this flag will be done in a separate patch. Also under consideration is exposing the COPY_FILE_RANGE_TIMEO1SEC to userland for use on the FreeBSD copy_file_range(2) syscall. MFC after: 2 weeks Reviewed by: khng Differential Revision: https://reviews.freebsd.org/D31829
* Bump __FreeBSD_version for the recent socket KPI changesMark Johnston2021-09-071-1/+1
| | | | Sponsored by: The FreeBSD Foundation
* socket: Properly interlock when transitioning to a listening socketMark Johnston2021-09-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, most protocols implement pru_listen with something like the following: SOCK_LOCK(so); error = solisten_proto_check(so); if (error) { SOCK_UNLOCK(so); return (error); } solisten_proto(so); SOCK_UNLOCK(so); solisten_proto_check() fails if the socket is connected or connecting. However, the socket lock is not used during I/O, so this pattern is racy. The change modifies solisten_proto_check() to additionally acquire socket buffer locks, and the calling thread holds them until solisten_proto() or solisten_proto_abort() is called. Now that the socket buffer locks are preserved across a listen(2), this change allows socket I/O paths to properly interlock with listen(2). This fixes a large number of syzbot reports, only one is listed below and the rest will be dup'ed to it. Reported by: syzbot+9fece8a63c0e27273821@syzkaller.appspotmail.com Reviewed by: tuexen, gallatin MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31659
* socket: Move sockbuf mutexes into the owning socketMark Johnston2021-09-072-8/+18
| | | | | | | | | | | | | | | | | | | | | | This is necessary to provide proper interlocking with listen(2), which destroys the socket buffers. Otherwise, code must lock the socket itself and check SOLISTENING(so), but most I/O paths do not otherwise need to acquire the socket lock, so the extra overhead needed to check a rare error case is undesirable. listen(2) calls are relatively rare. Thus, the strategy is to have it acquire all socket buffer locks when transitioning to a listening socket. To do this safely, these locks must be stable, and not destroyed during listen(2) as they are today. So, move them out of the sockbuf and into the owning socket. For the sockbuf mutexes, keep a pointer to the mutex in the sockbuf itself, for now. This can be removed by replacing SOCKBUF_LOCK() etc. with macros which operate on the socket itself, as was done for the sockbuf I/O locks. Reviewed by: tuexen, gallatin MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31658
* socket: Rename sb(un)lock() and interlock with listen(2)Mark Johnston2021-09-072-4/+12
| | | | | | | | | | | | | | | | | | | | | | In preparation for moving sockbuf locks into the containing socket, provide alternative macros for the sockbuf I/O locks: SOCK_IO_SEND_(UN)LOCK() and SOCK_IO_RECV_(UN)LOCK(). These operate on a socket rather than a socket buffer. Note that these locks are used only to prevent concurrent readers and writters from interleaving I/O. When locking for I/O, return an error if the socket is a listening socket. Currently the check is racy since the sockbuf sx locks are destroyed during the transition to a listening socket, but that will no longer be true after some follow-up changes. Modify a few places to check for errors from sblock()/SOCK_IO_(SEND|RECV)_LOCK() where they were not before. In particular, add checks to sendfile() and sorflush(). Reviewed by: tuexen, gallatin MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31657
* socket: Reorder socket and sockbuf fields to eliminate some paddingMark Johnston2021-09-072-4/+4
| | | | | | | | | | | | | | | | | | This is in preparation for moving sockbuf locks into the owning socket, in order to provide proper interlocking for listen(2). In particular, listening sockets do not use the socket buffers and repurpose that space in struct socket for their own purposes. Moving the locks out of the socket buffers and into the socket proper makes it possible to safely lock socket buffers and test for a listening socket before deciding how to proceed. Reordering these fields saves some space and helps ensure that UMA will provide the same space efficiency for sockets as before. No functional change intended. Reviewed by: tuexen, gallatin Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31656
* cdefs.h: Remove redundant #ifdefsWarner Losh2021-09-071-4/+0
| | | | | | | Remove redunant #ifdef __GNUC__ inside an #if defined(__GNUC__) block. They are nops. Sponsored by: Netflix
* kqueue: drain kqueue taskqueue if syscall tickled itKonstantin Belousov2021-09-062-1/+2
| | | | | | | | | | | | | | Otherwise return from the syscall and next syscall, which could be kevent(2) on the kqueue that should be notified, races with the kqueue taskqueue thread, and potentially misses the wakeup. This is reliably visible when kevent(2) only peeks into events using zeroed timeout. PR: 258310 Reported by: arichardson, Jan Kokemüller <jan.kokemueller@gmail.com> Reviewed by: arichardson, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31858
* Re-implement virtual console (constty).Alexander Motin2021-09-041-2/+2
| | | | | | | | | | | | | | Protect conscallout with tty lock instead of Giant. In addition to Giant removal it also closes race on console unset. Introduce additional lock to protect against concurrent console sets. Remove consbuf free on console unset as unsafe, making impossible to change buffer size after first allocation. Instead increase default buffer size from 8KB to 64KB and processing rate from 5Hz to 10-15Hz to make the output more smooth. MFC after: 1 month
* ktls: Support asynchronous dispatch of AEAD ciphers.John Baldwin2021-08-301-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | KTLS OCF support was originally targeted at software backends that used host CPU cycles to encrypt TLS records. As a result, each KTLS worker thread queued a single TLS record at a time and waited for it to be encrypted before processing another TLS record. This works well for software backends but limits throughput on OCF drivers for coprocessors that support asynchronous operation such as qat(4) or ccr(4). This change uses an alternate function (ktls_encrypt_async) when encrypt TLS records via a coprocessor. This function queues TLS records for encryption and returns. It defers the work done after a TLS record has been encrypted (such as marking the mbufs ready) to a callback invoked asynchronously by the coprocessor driver when a record has been encrypted. - Add a struct ktls_ocf_state that holds the per-request state stored on the stack for synchronous requests. Asynchronous requests malloc this structure while synchronous requests continue to allocate this structure on the stack. - Add a ktls_encrypt_async() variant of ktls_encrypt() which does not perform request completion after dispatching a request to OCF. Instead, the ktls_ocf backends invoke ktls_encrypt_cb() when a TLS record request completes for an asynchronous request. - Flag AEAD software TLS sessions as async if the backend driver selected by OCF is an async driver. - Pull code to create and dispatch an OCF request out of ktls_encrypt() into a new ktls_encrypt_one() function used by both ktls_encrypt() and ktls_encrypt_async(). - Pull code to "finish" the VM page shuffling for a file-backed TLS record into a helper function ktls_finish_noanon() used by both ktls_encrypt() and ktls_encrypt_cb(). Reviewed by: markj Tested on: ccr(4) (jhb), qat(4) (markj) Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31665
* Create sys/reg.h for the common code previously in machine/reg.hAndrew Turner2021-08-301-0/+68
| | | | | | | | | | Move the common kernel function signatures from machine/reg.h to a new sys/reg.h. This is in preperation for adding PT_GETREGSET to ptrace(2). Reviewed by: imp, markj Sponsored by: DARPA, AFRL (original work) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D19830
* vfs_default: Change vop_stddeallocate() from static to globalRick Macklem2021-08-281-0/+1
| | | | | | | | | | A future commit to the NFS client uses vop_stddeallocate() for cases where the NFS server does not support a Deallocate operation. Change vop_stddeallocate() from static to global so that it can be called by the NFS client. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D31640
* libc/posix1e: Add acl_extended_file_np() function.Gleb Popov2021-08-271-2/+5
| | | | | | Reviewed by: kib, debdrup, gbe Approved by: kib Differential Revision: https://reviews.freebsd.org/D28255
* libc/posix1e: Add acl_equiv_mode_np() function.Gleb Popov2021-08-271-0/+1
| | | | | | Reviewed by: kib, debdrup, gbe Approved by: kib Differential Revision: https://reviews.freebsd.org/D28255
* libc/posix1e: Add acl_cmp_np() function.Gleb Popov2021-08-271-0/+1
| | | | | | Reviewed by: kib, debdrup, gbe Approved by: kib Differential Revision: https://reviews.freebsd.org/D28255
* libc/posix1e: Add acl_from_mode_np() function.Gleb Popov2021-08-271-1/+2
| | | | | | Reviewed by: kib, debdrup, gbe Approved by: kib Differential Revision: https://reviews.freebsd.org/D28255
* param: Bump __FreeBSD_version to 1400032Ka Ho Ng2021-08-251-1/+1
| | | | | | | | Commit 9e202d036dd6 introduces incompatible changes to fspacectl(2), vn_deallocate(9) and VOP_DEALLOCATE(9)'s rmsr.r_offset/*offset return value. Sponsored by: The FreeBSD Foundation
* Remove bcopy declarationMateusz Guzik2021-08-241-1/+0
| | | | | | | The kernel was migrated to memmove in ba96f37758412151 ("Use __builtin for various mem* and b* (e.g. bzero) routines."). Sponsored by: Rubicon Communications, LLC ("Netgate")
* param: Bump __FreeBSD_version to 1400031Ka Ho Ng2021-08-241-1/+1
| | | | | | | | | Commit 1eaa36523cb9 introduces backward compatible changes to fspacectl(2), vn_deallocate(9) and VOP_DEALLOCATE(9). rmsr.r_offset and *offset is updated to contain meaningful value upon returning from the call. Sponsored by: The FreeBSD Foundation
* Remove bzero declarationMateusz Guzik2021-08-232-2/+1
| | | | | | | | | | The kernel was migrated to memset in ba96f37758412151 ("Use __builtin for various mem* and b* (e.g. bzero) routines.") and there are no remaining architectures using the file. malloc is augmented to prevent KMSAN from breaking. Sponsored by: Rubicon Communications, LLC ("Netgate")
* Remove libkern/bcmp.cMateusz Guzik2021-08-231-1/+0
| | | | | | | | The kernel was migrated to memcmp in ba96f37758412151 ("Use __builtin for various mem* and b* (e.g. bzero) routines.") and there are no remaining architectures using the file. Sponsored by: Rubicon Communications, LLC ("Netgate")
* lio_listio(2): Allow LIO_READV and LIO_WRITEV.Thomas Munro2021-08-221-1/+3
| | | | | | | | | | | | | Allow multiple vector IOs to be started with one system call. aio_readv() and aio_writev() already used these opcodes under the covers. This commit makes them available to user space. Being non-standard extensions, they're only visible if __BSD_VISIBLE is defined, like the functions. Reviewed by: asomers, kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D31627
* VFS: add retry limit and delay for failed recursive unmountsJason A. Harmening2021-08-201-0/+1
| | | | | | | | | | | | | | | | | | | | | A forcible unmount attempt may fail due to a transient condition, but it may also fail due to some issue in the filesystem implementation that will indefinitely prevent successful unmount. In such a case, the retry logic in the recursive unmount facility will cause the deferred unmount taskqueue to execute constantly. Avoid this scenario by imposing a retry limit, with a default value of 10, beyond which the recursive unmount facility will emit a log message and give up. Additionally, introduce a grace period, with a default value of 1s, between successive unmount retries on the same mount. Create a new sysctl node, vfs.deferred_unmount, to export the total number of failed recursive unmount attempts since boot, and to allow the retry limit and retry grace period to be tuned. Reviewed by: kib (earlier revision), mkusick Differential Revision: https://reviews.freebsd.org/D31450
* Introduce m_get3()Kristof Provost2021-08-181-0/+1
| | | | | | | | | | Introduce m_get3() which is similar to m_get2(), but can allocate up to MJUM16BYTES bytes (m_get2() can only allocate up to MJUMPAGESIZE). This simplifies the bpf improvement in f13da24715. Suggested by: glebius Differential Revision: https://reviews.freebsd.org/D31455
* uipc: create dedicated lists for fast and slow timeout callbacksMateusz Guzik2021-08-171-0/+4
| | | | | | | | | | This avoids having to walk all possible protocols only to check if they have one (vast majority does not). Original patch by kevans@. Reviewed by: kevans Sponsored by: Rubicon Communications, LLC ("Netgate")
* mount.h: improve a comment about flagsPiotr Pawel Stefaniak2021-08-171-3/+1
| | | | | | The comment only specifies MNT_ROOTFS - which is set by the kernel when mounting its root file system. So it's not clear if any other flags are not quite right and for what reason.
* bitstring(3): Add bitstring traversal macros.Vladimir Kondratyev2021-08-161-0/+16
| | | | | | | | | | | | | | | | The macro bit_foreach() traverses all set bits in the bitstring in the forward direction, assigning each location in turn to variable. The macro bit_foreach_at() traverses all set bits in the bitstring in the forward direction at or after the zero-based bit index, assigning each location in turn to variable. The bit_foreach_unset() and bit_foreach_unset_at() macros which traverses unset bits are implemented for completeness. Reviewed by: asomers, dougm MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31469
* domain: make it safer to add domains post-domainfinalizeKyle Evans2021-08-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | I can see two concerns for adding domains after domainfinalize: 1.) The slow/fast callouts have already been setup. 2.) Userland could create a socket while we're in the middle of initialization. We can address #1 fairly easily by tracking whether the domain's been initialized for at least the default vnet. There are still some concerns about the callbacks being invoked while a vnet is in the process of being created/destroyed, but this is a pre-existing issue that the callbacks must coordinate anyways. We should also address #2, but technically this has been an issue anyways because we don't assert on post-domainfinalize additions; we don't seem to hit it in practice. Future work can fix that up to make sure we don't find partially constructed domains, but care must be taken to make sure that at least, e.g., the usages of pffindproto in ip_input.c can still find them. Differential Revision: https://reviews.freebsd.org/D25459
* domain: give domains a chance to probe for availabilityKyle Evans2021-08-161-0/+5
| | | | | | | | | | | | | | | | | | This gives any given domain a chance to indicate that it's not actually supported on the current system. If dom_probe isn't supplied, we assume the domain is universally applicable as most of them are. Keeping fully-initialized and registered domains around that physically can't work on a large majority of FreeBSD deployments is sub-optimal and leads to errors that aren't consistent with the reality of why the socket can't be created (e.g. ESOCKTNOSUPPORT) because such scenario has to be caught upon pru_attach, at which point kicking back the more-appropriate EAFNOSUPPORT would seem weird. The initial consumer of this will be hvsock, which is only available on HyperV guests. Reviewed by: cem (earlier version), bcr (manpages) Differential Revision: https://reviews.freebsd.org/D25062
* pci: Add an ioctl to perform I/O to BARsMark Johnston2021-08-141-0/+12
| | | | | | | | | | | This is useful for bhyve, which otherwise has to use /dev/io to handle accesses to I/O port BARs when PCI passthrough is in use. Reviewed by: imp, kib Discussed with: jhb MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31307