aboutsummaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* Remove MK_GSSAPILexi Winter17 hours1-3/+3
| | | | | | | | | | | | | | | For MIT Kerberos, MK_GSSAPI has no meaning: GSSAPI is a required part of Kerberos and is always built if MK_KERBEROS is enabled. Backport this behaviour to Heimdal so it works the same way. While here, change Heimdal's libcom_err and compile_et to be selected by MK_KERBEROS, not MK_KERBEROS_SUPPORT, since these are part of Kerberos and third-party users might need it even if Kerberos support is disabled in the base system. This means MK_KERBEROS_SUPPORT installs the same files with both MIT and Heimdal. Reviewed by: cy Differential Revision: https://reviews.freebsd.org/D51859
* libifconfig: Remove ifconfig_set_fib and ifconfig_sfp_id_is_qsfpMuhammad Saheed36 hours2-3/+0
| | | | | | | | | | | | | | | Remove the declaration of ifconfig_set_fib from libifconfig.h as it had no definition. ifconfig_sfp_id_is_qsfp is defined as a static header function in libifconfig_sfp.h and doesn't generate a symbol. Both have been removed from Symbol.map. Reviewed by: obiwac, mckusick (mentor) Approved by: obiwac, mckusick (mentor) Sponsored by: Google LLC (GSoC) Differential Revision: https://reviews.freebsd.org/D50666
* libc: preserve errno in gai_strerror()Konstantin Belousov38 hours1-0/+4
| | | | | | | | PR: 288931 Reviewed by: emaste, glebius Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D52010
* libc: some style in gai_strerror.cKonstantin Belousov38 hours1-4/+4
| | | | | | | Reviewed by: emaste, glebius Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D52010
* libc: mark ai_errlist as constKonstantin Belousov38 hours1-1/+1
| | | | | | | Reviewed by: emaste, glebius Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D52010
* libc: convert ai_errlist array to designated initializers syntaxKonstantin Belousov38 hours1-15/+15
| | | | | | | Reviewed by: emaste, glebius Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D52010
* pf: fix potential infinite loop adding/deleting addresses in tablesKristof Provost3 days1-12/+10
| | | | | | | | | | | | | | | The 'nadd' returned by these calls is the number of addresses actually added or deleted. It can differ from the number userspace sent to the kernel if the addresses are already present (or not present for the delete case). This meant that if all of the addresses were already handled the kernel would return zero, putting us in an infinite loop. Handle this, and extend the test case to provoke this scenario. Reported by: netchild@ Fixes: bad279e12deb ("pf: convert DIOCRDELADDRS to netlink") Fixes: 8b388995b8b2 ("pf: convert DIOCRADDADDRS to netlink") Sponsored by: Rubicon Communications, LLC ("Netgate")
* vfs: Introduce VN_ISDEV() macroDag-Erling Smørgrav4 days1-2/+1
| | | | | | | | | | | | | | We frequently need to check if a vnode refers to either a character or block special, so we might as well have a macro for it. We somewhat less frequently need to perform similar checks on things that aren't vnodes (usually a struct vattr *), so add VATTR_ISDEV() and a generic VTYPE_ISDEV() as well. Sponsored by: Klara, Inc. Sponsored by: NetApp, Inc. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D51947
* stat(2): Document the st_rdev fieldDag-Erling Smørgrav4 days1-1/+4
| | | | | | | | MFC after: 1 week Sponsored by: Klara, Inc. Sponsored by: NetApp, Inc. Reviewed by: bcr Differential Revision: https://reviews.freebsd.org/D51946
* getmntpoint: Don't compare st_rdev for non-devicesDag-Erling Smørgrav4 days1-0/+1
| | | | | | | | | | | If the mntfromname of a mountpoint is not a device (e.g. nullfs, tarfs, procfs) we shouldn't compare st_rdev, as any match will be spurious. MFC after: 1 week Sponsored by: Klara, Inc. Sponsored by: NetApp, Inc. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D51945
* jemalloc: don't error out on initializer warning in gccWarner Losh4 days1-0/+2
| | | | | | | | gcc doesn't like something about the initializer that comes with jemalloc. Since it's vendor code, make this warning not an error for -Werror purposes. Sponsored by: Netflix
* libc: Fix a typo in a source code commentGordon Bergling4 days1-1/+1
| | | | | | - s/aguments/arguments/ MFC after: 3 days
* sendmail: Move libmilter to its own packageLexi Winter5 days1-1/+1
| | | | | | | | | Many things other than sendmail itself use the milter API, for example mail/opendkim from ports. Putting the library in its own package means those applications don't need to depend on FreeBSD-sendmail. Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D51914
* jemalloc: Merge from jemalloc 5.3.0 vendor branchWarner Losh6 days8-128/+648
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This brings in a merge from jemalloc 5.3.0. It's almost fully scripted, except: Three conflicts resolved by hand: include/jemalloc/internal/test_hooks.h Use the new name src/extent.c Use the new code src/jemalloc.c Use the new code since je_realloc has moved The script is recorded in FREEBSD-upgrade. The old script did svn commands that were basically a rebase of our changes. This update has a series of diff reduction changes before this. Note: I'd planned on fixing the above three conflicts with commits, but ran out of time when I did this work in January. I got discouraged when jemalloc was EOL'd and didn't pick this back up. I did the above by hand to get this into FreeBSD 15.0 This work is a repeat of the work by Minsoo Choo who did all these changes and created a pull request. Given the importance of jemalloc, I audited these changes by redoing them in this series of commits (and with the script that was checked in). I did this to confince myself and anybody else in doubt that there was no supply chain attack. The diffs between this series of commits and Minsoo's work are minor (though the version skew makes adds some noise). Interested parties can independent audit each step, I hope. I've listed Minsoo as a co-author since without his pull request to test again, this wouldn't have been possible. Thanks to brooks@ for help with getting the jemalloc 3 ABI compat symbols right. Co-authored-by: Minsoo Choo <minsoochoo0122@proton.me> Pull Request: https://github.com/freebsd/freebsd-src/pull/1337 Sponsored by: Netflix
* Revert "Remove Secure RPC DES authentication"Lexi Winter6 days12-77/+1795
| | | | | | This reverts commit 7ac276298b72982189ac1a5b17461936dc00163e. Requested by: kib
* libc: Drop incorrect qsort optimizationDag-Erling Smørgrav6 days3-13/+114
| | | | | | | | | | | | | | | | As pointed out in the PR and the article linked below, the switch to insertion sort in the BSD qsort code is based on a misunderstanding of Knuth's TAOCP and is actually a pessimization. As demonstrated by the added test, it is trivially easy to construct pathological input which results in quadratic runtime. Without that misguided optimization, the same input runs in nearly linearithmic time. https://www.raygard.net/2022/02/26/Re-engineering-a-qsort-part-3 PR: 287089 MFC after: 1 week Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D51907
* sysent: regenerate after bumping setgroups/getgroupsKyle Evans6 days2-8/+8
|
* kern: fix setgroups(2) and getgroups(2) to match other platformsKyle Evans6 days4-27/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | On most other platforms observed, including OpenBSD, NetBSD, and Linux, these system calls have long since been converted to only touching the supplementary groups of the process. This poses both portability and security concerns in porting software to and from FreeBSD, as this subtle difference is a landmine waiting to happen. Bugs have been discovered even in FreeBSD-local sources, since this behavior is somewhat unintuitive (see, e.g., fix 48fd05999b0f for chroot(8)). Now that the egid is tracked outside of cr_groups in our ucred, convert the syscalls to deal with only supplementary groups. Some remaining stragglers in base that had baked in assumptions about these syscalls are fixed in the process to avoid heartburn in conversion. For relnotes: application developers should audit their use of both setgroups(2) and getgroups(2) for signs that they had assumed the previous FreeBSD behavior of using the first element for the egid. Any calls to setgroups() to clear groups that used a single array of the now or soon-to-be egid can be converted to setgroups(0, NULL) calls to clear the supplementary groups entirely on all FreeBSD versions. Co-authored-by: olce (but bugs are likely mine) Relnotes: yes (see last paragraph) Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D51648
* [libm] Avoid left shift of signed integer entitiesSteve Kargl7 days4-17/+36
| | | | | | | | | | | | | | | | | | | | | | | | Follow-up commit d180086e6eae by fixing the left shift of signed integer entities through the use of a helper function. Specific per file changes are: * lib/msun/src/e_fmodf.c: * lib/msun/src/s_remquof.c: . Eliminate now unused variable 'i'. . Sort declaration statement. . Use subnormal_ilogbf() to avoid left shift of signed integer. * lib/msun/src/math_private.h b/lib/msun/src/math_private.h: . Implement subnormal_ilogbf() to extract an exponent of a subnormal float. This avoids left shifts of signed integers. . Update nearby comment. * lib/msun/src/s_ilogbf.c . Fix declaration of the function statement in accordance with style(9). . Use subnormal_ilogbf() to avoid left shift of signed integer. PR: 288850 MFC after: 1 week
* libutil++: Move to the utilities packageMark Johnston7 days1-1/+0
| | | | | | | | | | | | | We should keep the clibs package as small as possible. Currently it contains some "extra" libraries, but this isn't a good argument for adding more stuff. Move it to the utilities package (the default for bsd.lib.mk consumers), since libutil++ is an INTERNALLIB and thus only installs man pages, so therefore doesn't need to be in FreeBSD-runtime. Requested by: kib Reviewed by: ivy, des Fixes: f4fd2aa07cde ("libutil++: Move to clibs") Differential Revision: https://reviews.freebsd.org/D51898
* pathconf.2: Add an entry for _PC_CLONE_BLKSIZERick Macklem8 days1-1/+7
| | | | | | | | | | | | | | | Commit 37b2cb5ecb0f added VFS support for cloning, including a new pathconf name to acquire the clone block size called _PC_CLONE_BLKSIZE. This patch documents this new name. This is a content change. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D51851 Fixes: 37b2cb5ecb0f ("vfs: Add support for file cloning to VOP_COPY_FILE_RANGE")
* kern: Allow O_CLOFORK to be passed to shm_open(2)Ricardo Branco9 days1-2/+3
| | | | | | | Signed-off-by: Ricardo Branco <rbranco@suse.de> Reviewed by: kib Pull Request: https://github.com/freebsd/freebsd-src/pull/1802
* libutil: Fix manlint failuresDag-Erling Smørgrav9 days5-9/+14
| | | | | | MFC after: 1 week Reviewed by: ziaee Differential Revision: https://reviews.freebsd.org/D51864
* libutil: Remove manual link for nonexistent functionDag-Erling Smørgrav9 days1-1/+0
| | | | | | | | | | | | I believe quota_statfs() was the original name of the function now called quota_check_path(). I must have forgotten to update the MLINK when I renamed it. MFC after: 1 week Fixes: 5666aadb3ddf ("Further extend the quotafile API.") Fixes: 22afc767869a ("libutil: Add missing MLINKs") Reviewed by: bcr Differential Revision: https://reviews.freebsd.org/D51863
* [libm] Fix undefined behavior of a left shifted of a signed integerSteve Kargl9 days4-44/+50
| | | | | | | | | | | | | | | | | | | | | The patch fixes a few instances of left shifts on signed integer entities. A 'static inline' helper function 'subnormal_ilogb()' has been added to math_private.h. This function is then used e_fmod.c, s_ilogb(), and s_remquo.c. The change in s_remquo.c has only been compile tested. The change to e_fmod.c has been test on over 3 billion pairs of subnormal numbers where testing included x > y and x < y pairs. The test compared the output from fmod() with the output from mpfr_fmod() from MPFR. There were no difference. The change to s_ilogb() has had limited testing where its output was compared against frexp(). In this testing, no differences in output were detected. PR: 288778 MFC after: 1 week
* Remove Secure RPC DES authenticationLexi Winter11 days12-1795/+77
| | | | | | | | | | | | | | | | | | | Following the earlier removal of keyserv, none of this functionality works since it requires keyserv. Remove the relevant symbols from libc's Symbol.map. Leave compatibility symbols for existing applications, but since the functions don't work without keyserv, stub them out to return an error. Remove some private symbols that were only used by keyserv; these don't get compatibility symbols. Remove the documentation for the old functions. Remove rpc.ypupdated since it requires DES authentication. Reviewed by: manu, des, emaste Differential Revision: https://reviews.freebsd.org/D50442
* libc/amd64: rewrite memrchr() scalar impl. to read the string from the backRobert Clausecker12 days1-38/+34
| | | | | | | | | | | A very simple implementation as I don't have the patience right now to write a full SWAR kernel. Should still do the trick if you wish to opt out of SSE for some reason. Reported by: Mikael Simonsson <m@mikaelsimonsson.com> Reviewed by: strajabot PR: 288321 MFC after: 1 month
* libc/amd64: rewrite memrchr() baseline impl. to read the string from the backRobert Clausecker12 days1-78/+74
| | | | | | | | | | This ensures O(1) behaviour if the character is a constant offset from the end of the string, regardless of how long the string is. Reported by: Mikael Simonsson <m@mikaelsimonsson.com> Reviewed by: benni PR: 288321 MFC after: 1 month
* Updates for ccosh[f] and csinh[f]Steve Kargl12 days4-28/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/msun/src/s_ccosh.c: . Update Copyright years. . sin() and cos() are needed at the same time, so use sincos() to compute values. This does argument reduction once instead of twice. . Replace '* 0.5' with '/ 2'. This reduces diff with s_ccoshf.c. . For (LDBL_MANT_DIG == 53), add weak references for ccoshl and ccosl. * lib/msun/src/s_ccoshf.c: . Update Copyright years. . sin() and cos() are needed at the same time, so use sincos() to compute values. This does argument reduction once instead of twice. . Replace '* 0.5F' with '/ 2'. This reduces diff with s_ccoshf.c. * lib/msun/src/s_csinh.c: . Update Copyright years. . sin() and cos() are needed at the same time, so use sincos() to compute values. This does argument reduction once instead of twice. . Replace '* 0.5' with '/ 2'. This reduces diff with s_csinhf.c. . For (LDBL_MANT_DIG == 53), add weak references for csinhl and csinl. * lib/msun/src/s_csinhf.c: . Update Copyright years. . sin() and cos() are needed at the same time, so use sincos() to compute values. This does argument reduction once instead of twice. . Replace '* 0.5F' with '/ 2'. This reduces diff with s_ccoshf.c. PR: 288740 MFC after: 1 week
* Remove unused variables in msun/bsdsrc/b_tgamma.cSteve Kargl12 days1-1/+1
| | | | | PR: 288736 MFC after: 3 days
* pam_ksu: Fix crash when no ticket is presentLexi Winter12 days1-27/+4
| | | | | | | | | | | | | | | | When building with MIT Kerberos, pam_ksu crashes if the user doesn't have a ticket because default_principal is never populated in get_su_principal(). Change the compatibility function to use krb5_build_principal_alloc_va instead, and make its interface compatible with the equivalent Heimdal function. Despite what the comment says, we do free the default principal later in get_su_principal() so this shouldn't cause any leaks. Reviewed by: des, philip, cy, jhb Differential Revision: https://reviews.freebsd.org/D51829
* stdio: Fix bug in integer-parsing FSMDag-Erling Smørgrav13 days4-6/+54
| | | | | | | | | | | If we encounter a zero in the havezero state, we should assume octal, just like we would if we encountered any other digit below 8. MFC after: 1 week PR: 288440 Fixes: d9dc1603d6e4 ("libc: Implement N2630.") Reviewed by: mandree Differential Revision: https://reviews.freebsd.org/D51832
* libregex: fix our mapping for \wKyle Evans13 days2-3/+4
| | | | | | | | | | A small oversight in our implementation of \w is that it's actually not strictly [[:alnum:]]. According to the GNU documentation, it's actually [[:alnum:]] + underscore. The fix is rather trivial: just add it to our set explicitly, and amend our test set to be sure that _ is actually included. PR: 287396
* amd64: assume the kernel supports RDFSBASE and RDGSBASEBrooks Davis13 days4-24/+4
| | | | | | | | | | | There is no need to support pre-12.0 (and thus pre-ino64) kernels in a 15.x libc. Continue to check if the CPU supports these features before using them and fall back as required. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D50732
* cap_fileargs.3: PolishFaraz Vahedi13 days1-88/+86
| | | | | | | | Extensively revised the manual page with clearer phrasing, better structure, and corrected grammar throughout. Also fixed typos and improved overall readability of the documentation. Signed-off-by: Faraz Vahedi <kfv@kfv.io>
* libutil++: Move to clibsLexi Winter13 days1-1/+1
| | | | | | | | | | | | | This library only installs manual pages, so putting it in its own package means we build a FreeBSD-libutil++-man package but not a base FreeBSD-libutil++ package. Without a base package, the man package can't be installed due to the missing dependency. We don't really need a separate package for a few manpages, so move it to clibs. Reviewed by: des Differential Revision: https://reviews.freebsd.org/D51756
* sysent: regen to mark _exit _NoreturnBrooks Davis13 days1-1/+1
|
* sysent: regen for _exit(2) normalizationBrooks Davis13 days2-3/+3
|
* syscalls: normalize _exit(2) declerationsBrooks Davis13 days1-1/+0
| | | | | | | | | | | | | | | | | | | exit(3) is implemented by the runtime and performs a number of shutdown actions before ultimately calling _exit(2) to terminate the program. We historically named the syscall table entry `exit` rather than `_exit`, but this requires special handling in libc/libsys to cause the `_exit` symbol to exist while implementing `exit` in libc. Declare the syscall as `_exit` and flow that through the system. Because syscall(SYS_exit, code) is fairly widely used, allow a configured extra line in syscall.h to define SYS_exit to SYS__exit. I've found no external uses of __sys_exit() so I've not bothered to create a compatability version of this private symbol. Reviewed by: imp, kib, emaste Differential Revision: https://reviews.freebsd.org/D51672
* libutil++: Appease GCC -Wshadow warnings in constructorsJohn Baldwin14 days1-2/+2
| | | | | | Fixes: 937e92b5f7cc ("libutil++: Add freebsd::fd_up class to manage file descriptors") Fixes: 7be913e00d79 ("libutil++: Add freebsd::pidfile wrapper class around struct pidfh") Sponsored by: Chelsio Communications
* gssapi,krb5: Replace libgssapi with the MIT versionCy Schubert14 days2-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | lib/libgssapi is based on Heimdal. As on Linux systems, the MIT libgssapi_krb5 replaces it. With both gssapi libraries and header files installed results in broken buildworld (gssd) and ports that will not build without modifications to support the MIT gssapi in an alternate location. 73ed0c7992fd removed the MIT GSSAPI headers from /usr/include. Apps using MIT KRB5 gssapi functions and structures will fail to build without this patch. This patch includes a temporary patch to usr.sbin/gssd to allow it to build with this patch. rmacklem@ has a patch for this and for kgssapi that uses this patch to resolve kgssapi issues for NFS with Kerberos. This patch is an updated version of D51661 to allow it to build following additional patchs to the tree. This should have been implmented with 7e35117eb07f. Fixes: 7e35117eb07f, 73ed0c7992fd Differential Revision: https://reviews.freebsd.org/D51661
* libc: Fix style nits in flushlbuf regression testDag-Erling Smørgrav14 days1-5/+5
| | | | Sponsored by: Klara, Inc.
* libutil: Fix 32-bit buildDag-Erling Smørgrav2025-08-071-0/+4
| | | | | | | In the expand_generic test case for expand_number(), leave out size_t if it's not 64 bits wide. Fixes: ab1c6874e500
* libutil: Fix login_setcryptfmt()Dag-Erling Smørgrav2025-08-061-0/+8
| | | | | | | | | | | Our dummy crypt_set_format() needs to be exported, otherwise it will be resolved at link time instead of load time, preventing the real crypt_set_format() in libcrypt from replacing it when present. PR: 288677 Fixes: 0c381b7f0570 Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D51746
* libutil: Backward compatibility for expand_number()Dag-Erling Smørgrav2025-08-065-10/+181
| | | | | | | | | | Reimplement expand_number() in terms of expand_unsigned(), which takes a pointer to uint64_t like expand_number() did before. Provide a macro that picks the correct version based on the type of the argument. Fixes: 2e0caa7c7e14 Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D51723
* libnvmf: Fix header to work with C++John Baldwin2025-08-061-0/+4
| | | | | Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D51727
* libusb: implement libusb_get_platform_descriptorShengYi Hung2025-08-063-1/+78
| | | | | | | | | This adds a function introduced in libusb 1.0.27 to parse platform-specific USB descriptors, enabling access to vendor- or OS-specific information. Approved by: lwhsu (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D51242
* libusb: Add missing misc class in LIBUSB_CLASSShengYi Hung2025-08-061-0/+1
| | | | | | | | Reviewed by: emaste Approved by: markj (mentor), lwhsu (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D51738
* libusb: implement libusb_wrap_sys_deviceShengYi Hung2025-08-063-0/+16
| | | | | | | | | | | | | | | | The libusb_wrap_sys_device function can wrap an opened fd from the system into a libusb handler. However, in FreeBSD's libusb implementation, a USB device contains two fds: one for control transfers and another for normal (bulk, interrupt, isochronous) transfers. This design makes it impossible for FreeBSD to implement this function without exposing a different structure in libusb.h to provide two fds. Therefore, we return LIBUSB_ERROR_NOT_SUPPORTED to maintain API compatibility. Approved by: makrj (mentor), lwhsu (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D51739
* libusb: implement libusb_pollfds_handle_timeoutsShengYi Hung2025-08-063-0/+15
| | | | | | | | | | | | This function tells applications who maintain the pollfds themselves if they should handle the timeout for each xfer themselves. In FreeBSD, the timeout for each xfer is handled by kernel and doesn't need a special timer to do so. Therefore, we return 1 to indicate that it is handled by libusb internally. Approved by: lwhsu (mentor), markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D51742