aboutsummaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* tzcode: Add test case for setugid programsDag-Erling Smørgrav4 hours2-12/+45
| | | | | Fixes: a6b19979bf13 ("tzcode: Fix TZ for non-setugid programs") Differential Revision: https://reviews.freebsd.org/D52124
* libnvmf: Fix a typo in a source code commentGordon Bergling7 hours1-1/+1
| | | | | | - s/tranfers/transfers/ MFC after: 3 days
* libelftc: Move to toolchain packageLexi Winter3 days1-0/+1
| | | | | | | | This is where the rest of ElfToolchain lives now. Note that this library only installs manpages. Reported by: des Differential Revision: https://reviews.freebsd.org/D51899
* Remove redundant PACKAGE for INTERNALLIB librariesLexi Winter3 days11-11/+0
| | | | | | | | | These libraries don't install anything, so they shouldn't have a PACKAGE setting. This avoids surprising behaviour in future if e.g. manpages are added to an internal library. Reported by: des Differential Revision: https://reviews.freebsd.org/D51901
* packages: Improve handling of -lib packagesLexi Winter3 days1-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For some packages (OpenSSL, Kerberos) we want to ship runtime libraries in a separate package, e.g. openssl and openssl-lib. Currently this is done using PACKAGE=openssl-lib, but that creates packages with strange names like openssl-lib-lib32. Instead, add a new LIB_PACKAGE option to bsd.lib.mk that causes runtime libraries to be placed in a new -lib subpackage. This significantly improves the set of packages we create; for example, OpenSSL goes from: FreeBSD-openssl FreeBSD-openssl-dbg FreeBSD-openssl-lib FreeBSD-openssl-lib-dbg FreeBSD-openssl-lib-dbg-lib32 FreeBSD-openssl-lib-dev FreeBSD-openssl-lib-dev-lib32 FreeBSD-openssl-lib-lib32 FreeBSD-openssl-lib-man FreeBSD-openssl-man to: FreeBSD-openssl FreeBSD-openssl-dbg FreeBSD-openssl-dbg-lib32 FreeBSD-openssl-dev FreeBSD-openssl-dev-lib32 FreeBSD-openssl-lib FreeBSD-openssl-lib32 FreeBSD-openssl-man While here, move /usr/bin/krb5-config and /usr/bin/compile_et into the kerberos-dev package. Reviewed by: des Differential Revision: https://reviews.freebsd.org/D51925
* copy_file_range.2: Document the COPY_FILE_RANGE_CLONE flagRick Macklem3 days1-4/+31
| | | | | | | | | | | | | | Commit 37b2cb5ecb0f added support for the COPY_FILE_RANGE_CLONE flags argument to copy_file_range(2). This patch documents this flags argument. This is a content change. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D51938 Fixes: 37b2cb5ecb0f ("vfs: Add support for file cloning to VOP_COPY_FILE_RANGE")
* tzcode: Fix TZ for non-setugid programsDag-Erling Smørgrav3 days1-19/+42
| | | | | | | | | | | The previous commit had the desired effect for setugid programs, but broke TZ for everyone else. I didn't notice because my test cases swap out /etc/localtime instead of setting TZ, so add a test case that sets TZ. Fixes: b6ea2513f776 ("tzcode: Limit TZ for setugid programs") Reviewed by: cy Differential Revision: https://reviews.freebsd.org/D52108
* Remove MK_GSSAPILexi Winter5 days1-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 Saheed6 days2-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 Belousov6 days1-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 Belousov6 days1-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 Belousov6 days1-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 Belousov6 days1-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 Provost7 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ørgrav8 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ørgrav8 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ørgrav8 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 Losh8 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 Bergling8 days1-1/+1
| | | | | | - s/aguments/arguments/ MFC after: 3 days
* sendmail: Move libmilter to its own packageLexi Winter9 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 Losh10 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 Winter10 days12-77/+1795
| | | | | | This reverts commit 7ac276298b72982189ac1a5b17461936dc00163e. Requested by: kib
* libc: Drop incorrect qsort optimizationDag-Erling Smørgrav10 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 Evans10 days2-8/+8
|
* kern: fix setgroups(2) and getgroups(2) to match other platformsKyle Evans10 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 Kargl11 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 Johnston11 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 Macklem12 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 Branco13 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ørgrav13 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ørgrav13 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 Kargl13 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 Winter2025-08-1012-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 Clausecker2025-08-091-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 Clausecker2025-08-091-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 Kargl2025-08-094-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 Kargl2025-08-091-1/+1
| | | | | PR: 288736 MFC after: 3 days
* pam_ksu: Fix crash when no ticket is presentLexi Winter2025-08-091-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ørgrav2025-08-084-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 Evans2025-08-082-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 Davis2025-08-084-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 Vahedi2025-08-081-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 Winter2025-08-081-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 Davis2025-08-081-1/+1
|
* sysent: regen for _exit(2) normalizationBrooks Davis2025-08-082-3/+3
|
* syscalls: normalize _exit(2) declerationsBrooks Davis2025-08-081-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 Baldwin2025-08-071-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 Schubert2025-08-072-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ørgrav2025-08-071-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