aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/sys
Commit message (Collapse)AuthorAgeFilesLines
...
* divert: declare PF_DIVERT domain and stop abusing PF_INETGleb Smirnoff2022-08-301-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | The divert(4) is not a protocol of IPv4. It is a socket to intercept packets from ipfw(4) to userland and re-inject them back. It can divert and re-inject IPv4 and IPv6 packets today, but potentially it is not limited to these two protocols. The IPPROTO_DIVERT does not belong to known IP protocols, it doesn't even fit into u_char. I guess, the implementation of divert(4) was done the way it is done basically because it was easier to do it this way, back when protocols for sockets were intertwined with IP protocols and domains were statically compiled in. Moving divert(4) out of inetsw accomplished two important things: 1) IPDIVERT is getting much closer to be not dependent on INET. This will be finalized in following changes. 2) Now divert socket no longer aliases with raw IPv4 socket. Domain/proto selection code won't need a hack for SOCK_RAW and multiple entries in inetsw implementing different flavors of raw socket can merge into one without requirement of raw IPv4 being the last member of dom_protosw. Differential revision: https://reviews.freebsd.org/D36379
* socket(2): bring documentation up tp dateGleb Smirnoff2022-08-261-12/+10
| | | | | | | | | o Undocument sockets that are no longer supported, or never were. o Add AF_HYPERV. Note: PF_HYPERV isn't defined, no typo here. o Point at ip(4) and ip6(4) instead of unwelcoming "not described here". Reviewed by: gbe, markj Differential revision: https://reviews.freebsd.org/D36284
* libc: drop "All rights reserved" from Foundation copyrightsEd Maste2022-08-043-3/+0
| | | | | | | | | This has already been done for most files that have the Foundation as the only listed copyright holder. Do it now for files that list multiple copyright holders, but have the Foundation copyright in its own section. Sponsored by: The FreeBSD Foundation
* recv: bump manpage date after be1f485d7d6bebc53b05.Alexander V. Chernikov2022-08-021-1/+1
| | | | MFC after: 1 month
* sockets: add MSG_TRUNC flag handling for recvfrom()/recvmsg().Alexander V. Chernikov2022-07-301-0/+12
| | | | | | | | | | | | | | | | | | Implement Linux-variant of MSG_TRUNC input flag used in recv(), recvfrom() and recvmsg(). Posix defines MSG_TRUNC as an output flag, indicating packet/datagram truncation. Linux extended it a while (~15+ years) ago to act as input flag, resulting in returning the full packet size regarless of the input buffer size. It's a (relatively) popular pattern to do recvmsg( MSG_PEEK | MSG_TRUNC) to get the packet size, allocate the buffer and issue another call to fetch the packet. In particular, it's popular in userland netlink code, which is the primary driving factor of this change. This commit implements the MSG_TRUNC support for SOCK_DGRAM sockets (udp, unix and all soreceive_generic() users). PR: kern/176322 Reviewed by: pauamma(doc) Differential Revision: https://reviews.freebsd.org/D35909 MFC after: 1 month
* Remove "All Rights Reserved" from FreeBSD Foundation libc copyrightsEd Maste2022-07-2148-48/+0
| | | | | | | As per the updated FreeBSD copyright template. These were unambiguous cases where the Foundation was the only listed copyright holder. Sponsored by: The FreeBSD Foundation
* clock_gettime.2: Clarify CLOCK_*Mateusz Piotrowski2022-07-081-3/+12
| | | | | | | Clarify that CLOCK_* (e.g., CLOCK_REALTIME) do not necessarily default to CLOCK_*_FAST. PR: 259642
* clock_gettime.2: Add cross references and fix linter warningsMateusz Piotrowski2022-07-081-3/+7
| | | | MFC after: 3 days
* pselect(2): Document what a null pointer for the signalmask meansWarner Losh2022-07-021-2/+9
| | | | | | | | When pselect is passed a null pointer for the signal mask, the standard says it shall behave like select (except for the different timeout arg). Make a note of that here. Sponsored by: Netflix
* wait.2: Remove sys/types.h from the list of required headersMark Johnston2022-06-301-2/+1
| | | | | | | wait.h is self-contained. MFC after: 1 week Sponsored by: The FreeBSD Foundation
* unix: change error code for recvmsg() failed due to RLIMIT_NOFILEGleb Smirnoff2022-06-291-4/+15
| | | | | | | | | | | | | | | Instead of returning EMSGSIZE pass the error code from fdallocn() directly to userland. That would be EMFILE, which makes much more sense. This error code is not listed in the specification[1], but the specification doesn't cover such edge case at all. Meanwhile the specification lists EMSGSIZE as the error code for invalid value of msg_iovlen, and FreeBSD follows that, see sys_recmsg(). Differentiating these two cases will make a developer/admin life much easier when debugging. [1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/recvmsg.html Reviewed by: markj Differential revision: https://reviews.freebsd.org/D35640
* kevent.2: Add an xref to listen.2Mark Johnston2022-06-201-1/+1
| | | | | MFC after: 1 week Sponsored by: The FreeBSD Foundation
* utimensat(2): Remove description of compatibility codeSergey Kandaurov2022-06-121-13/+1
| | | | | | | | | | Commit e0e0323354c55335775e3a55b1af0f93967fb412 removed compat stubs for kernels that did not have futimens() and utimensat() system calls, but removed the documentation for them in the manual page only partially. Remove the rest of the documentation of the compatibility code. MFC after: 1 week
* kqueue: Fix kqueue(2) man page.Dmitry Chagin2022-05-141-5/+1
| | | | | | | | | Remove bogus BUGS note about timeout limit to 24 hours, that's not true since callouting project import. Reviewed by: mav Differential revision: https://reviews.freebsd.org/D35206 MFC after: 2 weeks
* Use Linux semantics for the thread affinity syscalls.Dmitry Chagin2022-05-111-7/+12
| | | | | | | | | | | | | | | | | | | Linux has more tolerant checks of the user supplied cpuset_t's. Minimum cpuset_t size that the Linux kernel permits in case of getaffinity() is the maximum CPU id, present in the system / NBBY, the maximum size is not limited. For setaffinity(), Linux does not limit the size of the user-provided cpuset_t, internally using only the meaningful part of the set, where the upper bound is the maximum CPU id, present in the system, no larger than the size of the kernel cpuset_t. Unlike FreeBSD, Linux ignores high bits if set in the setaffinity(), so clear it in the sched_setaffinity() and Linuxulator itself. Reviewed by: Pau Amma (man pages) In collaboration with: jhb Differential revision: https://reviews.freebsd.org/D34849 MFC after: 2 weeks
* libc: Add HISTORY sections to the manual pagesGordon Bergling2022-05-051-1/+18
| | | | | | | | | | There are some sections which could be improved and work to do so is on going. The work will be covered via 'X-MFC-WITH' commits. Obtained from: OpenBSD MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D34759
* Fix sigtimedwait manpage.Dmitry Chagin2022-04-211-2/+11
| | | | | | | | Historically, sigtimedwait() blocks indefinitely if timeout is NULL. Reviewed by: jilles, imp Differential Revision: https://reviews.freebsd.org/D34985 MFC after: 2 weeks
* Bump Dd in getdirentries.2 after c6487446.Dmitry Chagin2022-04-201-1/+1
| | | | MFC after: 1 week
* Mostly revert a5970a529c2d95271: Make files opened with O_PATH to not block ↵Konstantin Belousov2022-04-131-4/+1
| | | | | | | | | | | | non-forced unmount Problem is that open(O_PATH) on nullfs -o nocache is broken then, because there is no reference on the vnode after the open syscall exits. Reported and tested by: ambrisko Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week
* [patch][doc] Fix EXAMPLE in kqueue(2)Fernando Apesteguía2022-04-131-5/+7
| | | | | | | | | | | The error control was not properly implemented. "changelist" is const, hence event.flags is never changed by the syscall. PR: 196844 Reported by: eugen@ Reviewed by: PauAmma <pauamma@gundo.com> Approved by: eugen@ Fixes: 8c231786f01b9f8614e2fe5b47196db1caa7a772
* getdirentries: return ENOENT for unlinked but still open directory.Dmitry Chagin2022-04-111-0/+2
| | | | | | | | To be more compatible to IEEE Std 1003.1-2008 (“POSIX.1”). Reviewed by: mjg, Pau Amma (doc) Differential revision: https://reviews.freebsd.org/D34680 MFC after: 2 weeks
* chroot.2: Correct grammar errors.Greg Lehey2022-03-311-3/+3
| | | | | | No functional change. MFC after: 1 week
* fd: add close_range(..., CLOSE_RANGE_CLOEXEC)Mateusz Guzik2022-03-031-3/+7
| | | | | | | | For compatibility with Linux. MFC after: 3 days Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D34424
* libc binuptime(): use the right function to get the most significant bit indexKonstantin Belousov2022-02-081-2/+2
| | | | | | | Reported and tested by: Jaroslaw Pelczar <jarek@jpelczar.com> PR: 261781 Sponsored by: The FreeBSD Foundation MFC after: 1 week
* Add PT_GETREGSETAndrew Turner2022-01-271-1/+35
| | | | | | | | | | | | | | | | | | | This adds the PT_GETREGSET and PT_SETREGSET ptrace types. These can be used to access all the registers from a specified core dump note type. The NT_PRSTATUS and NT_FPREGSET notes are initially supported. Other machine-dependant types are expected to be added in the future. The ptrace addr points to a struct iovec pointing at memory to hold the registers along with its length. On success the length in the iovec is updated to tell userspace the actual length the kernel wrote or, if the base address is NULL, the length the kernel would have written. Because the data field is an int the arguments are backwards when compared to the Linux PTRACE_GETREGSET call. Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D19831
* execve: disallow argc == 0Kyle Evans2022-01-261-1/+4
| | | | | | | | | | | | | | | | | | | | The manpage has contained the following verbiage on the matter for just under 31 years: "At least one argument must be present in the array" Previous to this version, it had been prefaced with the weakening phrase "By convention." Carry through and document it the rest of the way. Allowing argc == 0 has been a source of security issues in the past, and it's hard to imagine a valid use-case for allowing it. Toss back EINVAL if we ended up not copying in any args for *execve(). The manpage change can be considered "Obtained from: OpenBSD" Reviewed by: emaste, kib, markj (all previous version) Differential Revision: https://reviews.freebsd.org/D34045
* Include the correct header for pdfork()'s prototype.John Baldwin2022-01-241-1/+1
| | | | | | | Reviewed by: kib, markj Obtained from: CheriBSD Sponsored by: The University of Cambridge, Google Inc. Differential Revision: https://reviews.freebsd.org/D33988
* ptrace(2): document policies affecting access to the facilityKonstantin Belousov2022-01-221-1/+50
| | | | | | | Reviewed by: emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D33986
* kqueue(2): Add note about format of the data for NOTE_EXITKonstantin Belousov2022-01-191-2/+4
| | | | | | | Noted by: Dave Baukus <daveb@spectralogic.com> PR: 261346 MFC after: 3 days Sponsored by: The FreeBSD Foundation
* Clarify the description of the EINTEGRITY error in intro(2).Kirk McKusick2021-12-291-1/+1
| | | | | | Requested by: pauamma_gundo.com Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D18765
* getfh: clarify that it is a privileged operationEd Maste2021-12-231-1/+4
| | | | | | | Reviewed by: kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33629
* Add idle priority scheduling privilege group to MAC/priorityFlorian Walpen2021-12-101-9/+9
| | | | | | | | | | | | | | | Add an idletime user group that allows non-root users to run processes with idle scheduling priority. Privileges are granted by a MAC policy in the mac_priority module. For this purpose, the kernel privilege PRIV_SCHED_IDPRIO was added to sys/priv.h (kernel module ABI change). Deprecate the system wide sysctl(8) knob security.bsd.unprivileged_idprio which lets any user run idle priority processes, regardless of context. While the knob is still working, it is marked as deprecated in the description and in the man pages. MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D33338
* Document new variant of swapoff(2)Konstantin Belousov2021-12-091-23/+3
| | | | | | | Reviewed by: brooks Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D33343
* swapoff: add one more variant of the syscallKonstantin Belousov2021-12-091-1/+1
| | | | | | | Requested and reviewed by: brooks Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D33343
* libc: get rid of NO_P1003_1B make variableBrooks Davis2021-12-071-8/+4
| | | | | | | | | | | There's no point in a knob to avoid installing a half dozen manpages. It's undocumented and unused in the tree. Online, the only metions I've found are the FreeBSD source tree, a commit in DragonFly BSD removing it, and some lists of build options for small systems where it's inevitably redundant due to an accompanying NO_MAN. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D33310
* libc: Add pdfork to the list of interposed system callsMark Johnston2021-12-061-0/+1
| | | | | | | | | Otherwise the asm stub is used and libthr interposition does not work. Reviewed by: kib Fixes: 21f749da82e7 ("libthr: wrap pdfork(2), same as fork(2).") MFC after: 1 week Sponsored by: The FreeBSD Foundation
* fcntl(2): be more precise about third arg typeKonstantin Belousov2021-12-061-2/+10
| | | | | | | | | Also use the term operation consistently, over the command. Reviewed by: emaste, jhb, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D33277
* fcntl(2): add F_KINFO operationKonstantin Belousov2021-12-061-2/+15
| | | | | | | | | | | that returns struct kinfo_file for the given file descriptor. Among other data, it also returns kf_path, if file op was able to restore file path. Reviewed by: jhb, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D33277
* swapoff(2): document extended syscall argumentsKonstantin Belousov2021-12-041-1/+37
| | | | | | | | Reviewed by: markj Discussed with: alc Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D33165
* MAC/priority module for realtime privilege groupFlorian Walpen2021-12-041-2/+7
| | | | | | | | | | | | This is a MAC policy module that grants scheduling privileges based on group membership. Users or processes in the group realtime (gid 47) are allowed to run threads and processes with realtime scheduling priority. For timing-sensitive, low-latency software like audio/jack, running with realtime priority helps to avoid stutter and gaps. PR: 239125 MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D33191
* Add sched_getcpu()Konstantin Belousov2021-11-101-0/+3
| | | | | | | | | for compatibility with Linux. Reviewed by: jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32901
* fexecve(2): allow O_PATH file descriptors opened without O_EXECKonstantin Belousov2021-11-031-3/+0
| | | | | | | | | | This improves compatibility with Linux. Noted by: Drew DeVault <sir@cmpwn.com> Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32821
* bpf: Fix the write filter for detached descriptorsMark Johnston2021-10-261-2/+2
| | | | | | | | | | | | A BPF descriptor only has an associated interface descriptor once it is attached to an interface, e.g., with BIOCSETIF. Avoid dereferencing a NULL pointer in filt_bpfwrite() if the BPF descriptor is not attached. Reviewed by: ae Reported by: syzbot+ae45d5166afe15a5a21d@syzkaller.appspotmail.com Fixes: ded77e0237a8 ("Allow the BPF to be select for write.") Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32561
* procctl: actually require debug privileges over targetKonstantin Belousov2021-10-191-0/+8
| | | | | | | | | | | for state control over TRACE, TRAPCAP, ASLR, PROTMAX, STACKGAP, NO_NEWPRIVS, and WXMAP. Reported by: emaste Reviewed by: emaste, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32513
* procctl(2): add consistent shortcut P_ID:0 as curprocKonstantin Belousov2021-10-191-0/+2
| | | | | | | | Reported by: bdrewery, emaste Reviewed by: emaste, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32513
* Allow the BPF to be select for write. This is needed for boost:asioHartmut Brandt2021-10-101-2/+7
| | | | | | which otherwise fails to handle BPFs. Reviewed by: ae Differential Revision: https://reviews.freebsd.org/D31967
* O_PATH: allow vfs_extattr syscallsGreg V2021-10-111-1/+6
| | | | | | | | | These calls do operate on vnodes only, not file contents. This is useful for e.g. the xdg-document-portal fuse filesystem. Reviewed by: kib, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D32438
* nanosleep.2: use appropriate macrosPiotr Pawel Stefaniak2021-10-111-1/+4
| | | | | Reported by: kib Fixes: bf8f6ffcb66a
* readlinkat(2): allow O_PATH fdKonstantin Belousov2021-10-091-2/+3
| | | | | | | | | PR: 258856 Reported by: ashish Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32390
* Mention kern.timecounter.alloweddeviation in nanosleep.1Piotr Pawel Stefaniak2021-10-081-1/+3
| | | | | PR: 224837 Reported by: Aleksander Derevianko