aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/sys
Commit message (Collapse)AuthorAgeFilesLines
* libc: stop trying to create __<syscall> symbolsBrooks Davis11 hours34-62/+0
| | | | | | | | | | | | | | | When we switched to an interposing table (commit 8495e8b1e9e1) for cancelation points we stopped having concrete implementations of __<syscall> and instead use __sys_<syscall> and __thr_<syscall>. These entries of the form: __weak_reference(__sys_<syscall>, __<syscall>); seem to be intended to preserve these symbols, but they have no effect as __sys_<syscall> isn't defined in the translation units in question. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D51668
* closefrom: always use close_range(2)Brooks Davis2025-06-061-9/+1
| | | | | | | | close_range(2) was added prior to 13.0. There is no need to support a new userspace on such an old kernel. Reviewed by: kevans, imp Differential Revision: https://reviews.freebsd.org/D50730
* libc: switch to __weak_symbol for fortified interpose stubsKyle Evans2024-07-165-10/+5
| | | | | | | | | | | GCC doesn't like `#pragma weak macro(foo)`, but that's fine; just slap a __weak_symbol on the definition to more reliably make it weak anyways. Reviewed by: kib (earlier version), markj Sponsored by: Klara, Inc. Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D45976
* include: ssp: fortify <sys/socket.h>Kyle Evans2024-07-133-3/+6
| | | | | | | | | | The entire recv*() implementation set is ripe for opportunities to validate, so do what we can with what we have. Reviewed by: markj Sponsored by: Klara, Inc. Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D45686
* include: ssp: fortify <sys/uio.h>Kyle Evans2024-07-131-1/+2
| | | | | | | | | | Check both the buffer size of the iov object itself, as well as that of each indidvidually io base. Reviewed by: markj Sponsored by: Klara, Inc. Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D45684
* include: ssp: fortify poll/ppoll from <poll.h>Kyle Evans2024-07-132-5/+8
| | | | | | | | | | For poll/ppoll we just need to bounds-check the poll array that we're about to write out to. Reviewed by: kib, markj (earlier version) Sponsored by: Klara, Inc. Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D45680
* Revert "lib{c,sys}: normalize export of openat, setcontext, and swapcontext"Brooks Davis2024-04-193-0/+3
| | | | | | | | | I put the symbols in the wrong file (should have been lib/libc/sys/Symbol.map), added a duplicate pdfork entry due to a botch rebase, and there seems to be a issue with gcc13/binutils not exposing the symbols so revert the whole thing while I debug. This reverts commit ee632fb9eb4a060a4087a7f5425bfe36e65cda61.
* lib{c,sys}: normalize export of openat, setcontext, and swapcontextBrooks Davis2024-04-173-3/+0
| | | | | | | | | List them in the symbol map rather than using the __sym_default to expose them. This will allow later improvements in the stub implementations in libc.so. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D44113
* libc: INTERPOS_SYS macro for interposed syscallsBrooks Davis2024-04-1646-117/+48
| | | | | | | | This macro makes uses the __sys_<foo>_t typedefs from libsys.h to greatly simplify calling functions in the interposing table. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D44389
* lib{c,sys}: return wrapped syscall APIs to libcBrooks Davis2024-03-1359-0/+2881
| | | | | | | | | | | | | These provide standard APIs, but are implemented using another system call (e.g., pipe implemented in terms of pipe2) or are interposed by the threading library to support cancelation. After discussion with kib (see D44111), I've concluded that it is better to keep most public interfaces in libc with as little as possible in libsys. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D44241
* libc: libc/sys/Makefile.inc -> libsys/Makefile.sysBrooks Davis2024-02-051-516/+0
| | | | | Reviewed by: kib, emaste, imp Pull Request: https://github.com/freebsd/freebsd-src/pull/908
* libsys: relocate implementations and manpagesBrooks Davis2024-02-05270-48667/+3
| | | | | | | | | Remove core system call implementations and documentation to lib/libsys and lib/libsys/<arch> from lib/libc/sys and lib/libc/<arch>/<sys>. Update paths to allow libc to find them in their new home. Reviewed by: kib, emaste, imp Pull Request: https://github.com/freebsd/freebsd-src/pull/908
* libc: split libc and syscall interposing (2/2)Brooks Davis2024-02-052-21/+0
| | | | | | | | Move the __libc_interposing implementation to libc/gen so it doesn't end up in libsys. Reviewed by: kib, emaste, imp Pull Request: https://github.com/freebsd/freebsd-src/pull/908
* libc: split libc and syscall interposing (1/2)Brooks Davis2024-02-0540-81/+61
| | | | | | | | | | | | | | System calls or their wrappers are now interposed by __libsys_interposing with purely libc entries remaining in __libc_interposing. Use __libsys_interposing_slot in libthr to update __libsys_interposing, but also make __libc_interposing_slot fall back to __libsys_interposing_slot so an out of date libc has a chance of working during updates. Reviewed by: kib, emaste, imp Pull Request: https://github.com/freebsd/freebsd-src/pull/908
* sctp: update manpagesLexi Winter2024-02-031-1/+5
| | | | | | | | | | | | | | Add missing documentation for sctp_sendv(3) and sctp_recvv(3). Add a note that sctp_send(3), sctp_sendx(3) and sctp_recvmsg(3) are deprecated by RFC 6458. Add a STANDARDS section to all functions specified in RFC 6458 to indicate their standards conformance. MFC after: 2 weeks Reviewed by: imp, bcr, kp, tuexen Pull Request: https://github.com/freebsd/freebsd-src/pull/965
* open(2): describe *at behavior for dirfd opened without O_SEARCHKonstantin Belousov2024-01-291-12/+24
| | | | | | | | | | and move the BUGS paragraph about dirfd permissions into STANDARDS section, noting that we provide POSIX-mandated implementation. Reviewed by: emaste, kevans Sponsored by: The FreeBSD Foundation MFC after: 3 days Differential revision: https://reviews.freebsd.org/D43652
* open: make non-POSIX errno value more apparentEd Maste2024-01-261-0/+5
| | | | | | | | | | | | | | | In the errno list, add an explicit note and reference to the note in the STANDARDS section. When O_NOFOLLOW is specified and the target is a symbolic link FreeBSD sets errno to a value different than that specified by POSIX. Commit 295159dfa3ed added a note to this effect, but I missed it when reading through the list of errno values. PR: 214633 Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D43618
* kcmp: Add a manual pageMark Johnston2024-01-242-0/+231
| | | | | | | Reviewed by: kib, emaste MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D43562
* Add kcmp(2) userspace bitsKonstantin Belousov2024-01-241-0/+4
| | | | | | | | | | | Unlike Linux, we do provide libc wrapper. All definitions and prototypes are available from <unistd.h> Tested by: manu Reviewed by: brooks, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D43518
* sigfastblock.2: Fix a typo in the manual pageGordon Bergling2024-01-201-1/+1
| | | | | | - s/successfull/successful/ MFC after: 3 days
* _umtx_op.2: Fix a typo in the manual pageGordon Bergling2024-01-201-1/+1
| | | | | | - s/interpeted/interpreted/ MFC after: 3 days
* libc: stop exposing __fcntl_compatBrooks Davis2024-01-131-1/+0
| | | | | | | | | | It was exposed (under FBSDprivate_1.0) for forward compatability in threading libraries in 2008 by commit cd7d66a21f1a. The last consumer was removed in 2015 by commit 8495e8b1e9e1. I missed this among the _ and __sys_ symbols in commit e2417a21a025. Reviewed by: imp, kib Differential Revision: https://reviews.freebsd.org/D43408
* libc: separate syscall and non-syscall symbolsBrooks Davis2024-01-111-8/+11
| | | | | | | | | | Put declerations of _ and __sys_ prefixed stubs at the top and everything else at the bottom. Sort the bottom list with sort(1). This paves the way to generate the syscall symbol list. Reviewed by: kib Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D43386
* Fix "version introduced" in numerous manual pagesTom Hukins2024-01-081-1/+1
| | | | | MFC after: 1 week Pull request: https://github.com/freebsd/freebsd-src/pull/853
* setfib.2: Consistently capitalize "FIB"Mark Johnston2024-01-031-4/+4
| | | | | MFC after: 1 week Sponsored by: Klara, Inc.
* copy_file_range.2: Clarify that only regular files workRick Macklem2023-12-291-5/+13
| | | | | | | | | | | | | | | | | | | | PR#273962 reported that copy_file_range(2) did not work on shared memory objects and returned EINVAL. Although the reporter felt this was incorrect, it is what the Linux copy_file_range(2) syscall does. Since there was no collective agreement that the FreeBSD semantics should be changed to no longer be Linux compatible, copy_file_range(2) still works on regular files only. This man page update clarifies that. If, someday, copy_file_range(2) is changed to support non-regular files, then the man page will need to be updated to reflect that. PR: 273962 Reviewed by: karels, pauamma_gundo.com (manpages) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D43227
* Remove _POSIX_PRIORITIZED_IO references from man pagesAlan Somers2023-12-183-28/+2
| | | | | | | | | | | | We don't support it, so there's no need to tell readers what would happen if we did. Also, don't remind the user that a certain field is ignored by aio_read. Mentioning every ignored field would make the man pages too verbose. MFC after: 1 week Sponsored by: Axcient Reviewed by: Pau Amma <pauamma@gundo.com> Differential Revision: https://reviews.freebsd.org/D42622
* libc: simplify MDASM/NOASM checksBrooks Davis2023-12-061-3/+1
| | | | | | | | Use boolean evaluation of :M matches and a single if statement. Reviewed by: imp, kib Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D42915
* Remove never implemented sbrk and sstk syscallsBrooks Davis2023-12-041-1/+0
| | | | | | | | | | | | | Both system calls were stubs returning EOPNOTSUPP and libc did not provide _ or __sys_ prefixed symbols. The actual implementation of sbrk(2) is on top of the undocumented break(2) system call. Technically this is a change in ABI, but no non-contrived program ever called these syscalls. Reviewed by: kib, emaste Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D42872
* sigaction.2: clarify that fork isn't async-signal-safe, but _Fork isAlan Somers2023-12-011-2/+2
| | | | | | | | | [skip ci] MFC after: 2 weeks Sponsored by: Axcient Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D42865
* jail: Don't allow jail_set(2) to resurrect dying jails.Jamie Gritton2023-11-301-2/+4
| | | | | | | | | | | | | | | | | | | | | Currently, a prison in "dying" state (removed but still holding resources) can be brought back to alive state via "jail -d", or the JAIL_DYING flag to jail_set(2). This seemed like a good idea at the time. Its main use was to improve support for specifying the jid when creating a jail, which also seemed like a good idea at the time. But resurrecting a jail that was partway through thr process of shutting down is trouble waiting to happen. This patch deprecates that flag, leaving it as a no-op for creating jails (but still useful for looking at dying jails). It sill allows creating a new jail with the same jid as a dying one, but will renumber the old one in that case. That's imperfect, but allows for current behavior. Reviewed by: bz Differential Revision: https://reviews.freebsd.org/D28150
* memfd_create: move implementation to libc/genBrooks Davis2023-11-282-94/+0
| | | | | | | | | | | | Due to memfd_create(3)'s construction of a path to pass to shm_open2(2), it has a much larger than typical dependency footprint for a system call wrapper (the list currently includes calloc, memset, sprintf, and strlen). As such, split it off into its own file under libc/gen to lighten libc/sys's dependency list. Reviewed by: kevans, imp, emaste Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D42709
* lib: Remove ancient SCCS tags.Warner Losh2023-11-27108-215/+0
| | | | | | | | Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script. Sponsored by: Netflix
* aio_read.2: correct the description of aio_bufAlan Somers2023-11-211-2/+2
| | | | | | | | | | | | Looks like a copypasta from aio_write.2. [skip ci] Reported by: Paul Floyd <pjfloyd@wanadoo.fr> MFC after: 1 week Sponsored by: Axcient Reviewed by: jilles (manpages) Differential Revision: https://reviews.freebsd.org/D42621
* libc: Teach libc about the BTI elf noteAndrew Turner2023-11-211-0/+7
| | | | | | | | | | Add the Branch Target Identification (BTI) note to libc assembly sources. As all obect files need the note for the library to have it we need to insert it in all asm files. Reviewed by: emaste, markj Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D42228
* libc: remove unused stub vdso timecounter implementationsBrooks Davis2023-11-151-45/+0
| | | | | | | | All supported architectures have shared page support so remove this unused stub. Reviewed by: imp, kib Differential Revision: https://reviews.freebsd.org/D42619
* libc: further centralize syscall symbolsBrooks Davis2023-11-151-0/+2
| | | | | | | | All architectures necessarily implement _exit(2) and vfork(2) so declare them in sys/Symbol.map. Reviewed by: imp, kib, emaste Differential Revision: https://reviews.freebsd.org/D42614
* libc: Remove empty comments in Symbol.mapBrooks Davis2023-11-151-3/+0
| | | | | | | These were left over from $FreeBSD$ removal. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D42612
* libc: Purge unneeded cdefs.hWarner Losh2023-11-0156-56/+0
| | | | | | | | | These sys/cdefs.h are not needed. Purge them. They are mostly left-over from the $FreeBSD$ removal. A few in libc are still required for macros that cdefs.h defines. Keep those. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D42385
* ino64: Remove 'forward compat' code for thisWarner Losh2023-10-3111-505/+7
| | | | | | | | | | | | | | | Forward compatibility code was added for running newer ino64 binaries on older kernels as a transition aide. Now that ino64 has been in the tree 6 years, this code is no longer useful and should have been removed long ago. Remove it now. Should be no user-visible changes at this point as all the 'upgrade' scenarios it was intended for are long since past. Also need to remove this stuff from rtld since the _foo versions no longer exist. Sponsored by: Netflix Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D42382
* clock_gettime: Minor clarificationWarner Losh2023-10-271-4/+6
| | | | | | | | | Add a note saying that the CLOCK_BOOTTIME is unrelated to FreeBSD's kern.boottime sysctl. Make a minor tweak to markup. Feedback from: pauammu Sponsored by: Netflix Differential Revsion: https://reviews.freebsd.org/D36037
* procctl.2: improve phrasing for ASLR disableBrooks Davis2023-10-261-3/+3
| | | | | | Reported by: jrtc27 Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D42364
* libc: Fix missing or misspelled MLINKS.Dag-Erling Smørgrav2023-10-182-1/+2
| | | | Differential Revision: https://reviews.freebsd.org/D42192
* ktrace.2: correct kern.ktrace.genio_size sysctl nameEd Maste2023-10-111-1/+1
| | | | | | | | | The man page had `kern.ktrace.geniosize` but the sysctl node contains an underscore. PR: 274274 Reported by: Ivan Rozhuk Sponsored by: The FreeBSD Foundation
* ptrace(2): Disabling: Describe influence of security.bsd.see_jail_procOlivier Certner2023-09-281-15/+21
| | | | | | | Reviewed by: mhorne, emaste, pauamma_gundo.com MFC after: 2 weeks Sponsored by: Kumacom SAS Differential Revision: https://reviews.freebsd.org/D41109
* Add paragraph about kern.mqueue sysctls and their defaults.Jens Schweikhardt2023-09-261-1/+13
|
* swapon.2: correct FreeBSD release that introduced swapoffEd Maste2023-09-181-1/+1
| | | | | It was introduced in 92da00bb245b, after 5.0 and beforen 5.1. Reported in https://github.com/ziglang/zig/issues/16590.
* getdirentries.2: Reference dir(5)Mateusz Piotrowski2023-09-051-1/+2
| | | | | | | As a note, parts of manual pages getdirentries(2) and dir(5) should probably be consolidated. MFC after: 3 days
* getdirentries.2: Improve readability of dirent membersMateusz Piotrowski2023-09-051-6/+6
| | | | MFC after: 3 days
* getdirentries.2: Reference directory(3)Mateusz Piotrowski2023-09-051-2/+3
| | | | MFC after: 3 days