aboutsummaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* | libc/stdlib: Port strtonumx() from IllumosHans Rosenfeld2026-01-154-23/+80
| | | | | | | | | | | | | | | | | | | | | | Add strtonumx(), a companion to strtonum(3) that preserves its safety and error-reporting semantics while allowing the caller to specify a conversion base, similar to the strtol(3) family of functions. Reviewed by: emaste, kib, ziaee Obtained from: https://www.illumos.org/issues/15365 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D54270
* | ncurses: fix cross build on MacOSBaptiste Daroussin2026-01-151-1/+0
| |
* | swab: Correctly treat the data as misalignedJohn Baldwin2026-01-141-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The __aligned attribute in the previous version applied to the location of the pointers, not the data the pointers pointed to. While this could be fixed by applying the attribute to a local typedef of uint16_t, just using memcpy() for the unaligned access is simpler and ISO C. This fixes the build on CHERI architectures which do not support misaligned pointers and were thus failing with: lib/libc/string/swab.c:12:18: error: alignment (1) of 'const uint16_t *' (aka 'const unsigned short *') is less than the required capability alignment (16) [-Werror,-Wcheri-capability-misuse] 12 | const uint16_t *f __aligned(1) = from; | Co-authored by: Jessica Clarke <jrtc27@FreeBSD.org> Fixes: 02ebbc781f08 ("swab: Fix implementation to support overlapping copies") Sponsored by: AFRL, DARPA Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D54399
* | libexecinfo: tests: Expect failure on aarch64Jose Luis Duran2026-01-141-0/+8
| | | | | | | | | | | | | | | | | | Add a guard that expects a failure of the test on aarch64. Reviewed by: emaste Fixes: df1ea5887326 ("tests: Test libexecinfo backtrace call througth signal trampoline") MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D54675
* | ncurses: merge update to ncurses 6.6Baptiste Daroussin2026-01-142-22/+24
| | | | | | | | | | | | | | 6.6 is ABI compatible with 6.5 (tested with abidiff) Remove html documentation to ease updates MFC After: 1 month
* | pf: configurable action on limiter exceededKristof Provost2026-01-142-6/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change extends pf(4) limiters so administrator can specify action the rule executes when limit is reached. By default when limit is reached the limiter overrides action specified by rule to no-match. If administrator wants to block packet instead then rule with limiter should be changed to: pass in from any to any state limiter test (block) OK dlg@ Obtained from: OpenBSD, sashan <sashan@openbsd.org>, 04394254d9 Sponsored by: Rubicon Communications, LLC ("Netgate")
* | pf: convert state limiter interface to netlinkKristof Provost2026-01-142-0/+413
| | | | | | | | | | | | | | This is a new feature with new ioctl calls, so we can safely remove them right now. Sponsored by: Rubicon Communications, LLC ("Netgate")
* | pf: introduce source and state limitersKristof Provost2026-01-142-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | both source and state limiters can provide constraints on the number of states that a set of rules can create, and optionally the rate at which they are created. state limiters have a single limit, but source limiters apply limits against a source address (or network). the source address entries are dynamically created and destroyed, and are also limited. this started out because i was struggling to understand the source and state tracking options in pf.conf, and looking at the code made it worse. it looked like some functionality was missing, and the code also did some things that surprised me. taking a step back from it, even it if did work, what is described doesn't work well outside very simple environments. the functionality i'm talking about is most of the stuff in the Stateful Tracking Options section of pf.conf(4). some of the problems are illustrated one of the simplest options: the "max number" option that limits the number of states that a rule is allowed to create: - wiring limits up to rules is a problem because when you load a new ruleset the limit is reset, allowing more states to be created than you intended. - a single "rule" in pf.conf can expand to multiple rules in the kernel thanks to things like macro expansion for multiple ports. "max 1000" on a line in pf.conf could end up being many times that in effect. - when a state limit on a rule is reached, the packet is dropped. this makes it difficult to do other things with the packet, such a redirect it to a tarpit or another server that replies with an outage notices or such. a state limiter solves these problems. the example from the pf.conf.5 change demonstrates this: An example use case for a state limiter is to restrict the number of connections allowed to a service that is accessible via multiple protocols, e.g. a DNS server that can be accessed by both TCP and UDP on port 53, DNS-over-TLS on TCP port 853, and DNS-over-HTTPS on TCP port 443 can be limited to 1000 concurrent connections: state limiter "dns-server" id 1 limit 1000 pass in proto { tcp udp } to port domain state limiter "dns-server" pass in proto tcp to port { 853 443 } state limiter "dns-server" a single limit across all these protocols can't be implemented with per rule state limits, and any limits that were applied are reset if the ruleset is reloaded. the existing source-track implementation appears to be incomplete, i could only see code for "source-track global", but not "source-track rule". source-track global is too heavy and unweildy a hammer, and source-track rule would suffer the same issues around rule lifetimes and expansions that the "max number" state tracking config above has. a slightly expanded example from the pf.conf.5 change for source limiters: An example use for a source limiter is the mitigation of denial of service caused by the exhaustion of firewall resources by network or port scans from outside the network. The states created by any one scanner from any one source address can be limited to avoid impacting other sources. Below, up to 10000 IPv4 hosts and IPv6 /64 networks from the external network are each limited to a maximum of 1000 connections, and are rate limited to creating 100 states over a 10 second interval: source limiter "internet" id 1 entries 10000 \ limit 1000 rate 100/10 \ inet6 mask 64 block in on egress pass in quick on egress source limiter "internet" pass in on egress proto tcp probability 20% rdr-to $tarpit the extra bit is if the source limiter doesn't have "space" for the state, the rule doesn't match and you can fall through to tarpitting 20% of the tcp connections for fun. i've been using this in anger in production for over 3 years now. sashan@ has been poking me along (slowly) to get it in a good enough shape for the tree for a long time. it's been one of those years. bluhm@ says this doesnt break the regress tests. ok sashan@ Obtained from: OpenBSD, dlg <dlg@openbsd.org>, 8463cae72e Sponsored by: Rubicon Communications, LLC ("Netgate")
* | libc/aarch64: Use MOPS implementations of memcpy/memmove/memset where availbleSarah Walker2026-01-136-6/+139
| | | | | | | | | | | | Reviewed by: andrew Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D54560
* | libc/csu: Pass HWCAP flags to ifunc resolver functionsSarah Walker2026-01-131-3/+28
| | | | | | | | | | | | | | | | | | | | Function arguments are based on Section 9.4.1 "GNU C Library IFUNC interface" from "System V ABI for the Arm 64-bit Architecture (AArch64)", 2025Q1. (https://github.com/ARM-software/abi-aa/releases/download/2025Q1/sysvabi64.pdf) Reviewed by: andrew Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D54599
* | csu: Remove unused constantJohn Baldwin2026-01-131-2/+0
| | | | | | | | | | | | | | | | | | | | | | This is no longer used after commit 99282790b7d01ec3c4072621d46a0d7302517ad4 moved ELF notes from C to assembly. Reviewed by: kib Fixes: 99282790b7d0 ("Remove the sed hack for ABI tag notes.") Sponsored by: AFRL, DARPA Differential Revision: https://reviews.freebsd.org/D54506
* | build: Remove duplicate SUBDIR entriesMark Johnston2026-01-121-1/+0
| | | | | | | | Fixes: f74f891581bc ("src.opts: Introduce MK_SOUND")
* | src.opts: Introduce MK_SOUNDChristos Margiolis2026-01-121-1/+2
| | | | | | | | | | | | | | | | PR: 291853 Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: zarychtam_plan-b.pwste.edu.pl, markj Differential Revision: https://reviews.freebsd.org/D54456
* | Remove all code under __SPE__Minsoo Choo2026-01-122-57/+0
| | | | | | | | | | | | Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me> Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1957
* | login.conf.5: Remove mention of login copyright settingSimon Wollwage2026-01-091-2/+1
| | | | | | | | | | | | | | | | PR: 291649 Fixes: 905571c03119 ("Remove copyright strings printed at login time via login(1) or sshd(8).") Signed-off-by: Simon Wollwage rootnode+freebsd@wollwage.com Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1926
* | getopt(3): be more explicit about :: extensionSimon Wollwage2026-01-091-15/+34
| | | | | | | | | | | | | | | | | | | | | | | | Make it possible to search for literal two colons (::) and actually find something. Make the "x"/"x:"/"x::" examples more explicit and more visibile. Signed-off-by: Simon Wollwage <rootnode+freebsd@wollwage.com> Obtained from: NetBSD, nbuwe <uwe@stderr.spb.ru>, 856d5b6 PR: 291374 Reviewed by: imp, jlduran Pull Request: https://github.com/freebsd/freebsd-src/pull/1923
* | lib: remove powerpcspeMinsoo Choo2026-01-0918-1249/+0
| | | | | | | | | | | | | | Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me> Reviewed by: emaste Pull Request: https://github.com/freebsd/freebsd-src/pull/1914 (cherry picked from commit 907cf3e4378f9d114af41d05a59ef4a075d3efb0)
* | libpmc: Import AMD Zen 5 PMU events.Ali Mashtizadeh2026-01-0913-0/+4518
| | | | | | | | | | | | | | Sponsored by: Netflix Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1954
* | mips: remove mips leftoversMinsoo Choo2026-01-062-117/+0
| | | | | | | | | | Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me> Pull-request: https://github.com/freebsd/freebsd-src/pull/1909
* | manuals: Correct some sysctl markupAlexander Ziaee2026-01-062-8/+8
| | | | | | | | | | | | | | | | This enables additional searching the manual by sysctl variable. This syntax is standardized in style.mdoc(5). Reported by: bapt MFC after: 3 days
* | lib/libbl[ao]cklist: Use LIB_PACKAGELexi Winter2026-01-062-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This avoids e.g. utilities or ssh depending on the full blocklist package just because they link against libblocklist. This change moves files between packages so, until we have a proper policy on how to handle this in release/stable branches, it should not be MFC'd. MFC after: never Reviewed by: bapt Sponsored by: https://www.patreon.com/bsdivy Differential Revision: https://reviews.freebsd.org/D53605
* | libypclnt: Move to yp packageLexi Winter2026-01-061-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was previously in runtime, because pam_unix uses it and we don't want to pull in the entire yp package as a dependency of runtime. However, we can now use LIB_PACKAGE here to create a yp-lib package to contain the library, which is a much more reasonable dependency. Since libypclnt clearly belongs in the yp package, move it there. This change moves files between packages so, until we have a proper policy on how to handle this in release/stable branches, it should not be MFC'd. MFC after: never Reviewed by: bapt Sponsored by: https://www.patreon.com/bsdivy Differential Revision: https://reviews.freebsd.org/D53600
* | zstd: Move to a new zstd packageLexi Winter2026-01-061-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Zstd is a discrete, self-contained system component. To match how we package zlib, bzip2 and xz, move it to its own package, with a separate lib package. Add the new package to the minimal set, since this is a core component that users expect to be installed. This change adds a new package to the system so, until we have a proper policy on how to handle this in release/stable branches, it should not be MFC'd. MFC after: never Reviewed by: bapt Sponsored by: https://www.patreon.com/bsdivy Differential Revision: https://reviews.freebsd.org/D53603
* | libc/amd64: fix stpncpy.S againRobert Clausecker2026-01-041-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous fix introduced a regression on machines without the BMI1 instruction set extension. The TZCNT instruction used in this function behaves different on old machines when the source operand is zero, but the code was originally designed to never trigger this case. The bug fix caused this case to be possible, leading to a regression on sufficiently old hardware. Fix the code by messing with things such that the source operand is never zero. PR: 291720 Fixes: 66eb78377bf109af1d9e25626bf254b4369436ec Tested by: cy Approved by: markj (mentor) Differential Revision: https://reviews.freebsd.org/D54303
* | libgeom: Fix 32-bit gcc buildDag-Erling Smørgrav2026-01-031-2/+5
| | | | | | | | | | MFC after: 1 week Fixes: 27894e20f140 ("libgeom: Fix segfault in 32-on-64 case")
* | libgeom: Improve type safety of xml2tree codeDag-Erling Smørgrav2026-01-031-10/+44
| | | | | | | | | | | | | | | | | | | | When resolving references, assert that the type of the object we find is what we expect. This will help prevent memory corruption if two objects of different types somehow end up with the same identifier. MFC after: 1 week Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D54454
* | libgeom: Clean up xml2tree codeDag-Erling Smørgrav2026-01-032-50/+52
| | | | | | | | | | | | MFC after: 1 week Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D54453
* | libgeom: Fix segfault in 32-on-64 caseDag-Erling Smørgrav2026-01-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | We were using strtoul() to parse object identifiers, which are kernel pointers. This works fine as long as the kernel and userland match, but in a 32-bit libgeom on a 64-bit kernel this will return ULONG_MAX for all objects, resulting in memory corruption when we later pick the wrong object while resolving consumer-producer references. MFC after: 1 week PR: 292127 Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D54452
* | pf: convert DIOCRCLRASTATS to netlinkKristof Provost2025-12-301-18/+60
| | | | | | | | Sponsored by: Rubicon Communications, LLC ("Netgate")
* | pf: move DIOCRCLRASTATS into libpfctlKristof Provost2025-12-302-0/+27
| | | | | | | | Sponsored by: Rubicon Communications, LLC ("Netgate")
* | ioctl.2: Mention EACCESFelix Johnson2025-12-291-1/+4
| | | | | | | | | | | | | | | | | | | | ioctls can fail with EACCES, see sys/kern/tty.c PR: 239504 MFC after: 3 days Reviewed by: ziaee Reported by: Brennan Vincent <brennan@umanwizard.com> Differential Revision: https://reviews.freebsd.org/D49072
* | tdestroy(3): add testsKonstantin Belousov2025-12-291-0/+65
| | | | | | | | | | | | | | Reviewed by: alc, emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D54365
* | tdestroy(3) man pageKonstantin Belousov2025-12-292-3/+25
| | | | | | | | | | | | | | Reviewed by: alc, emaste, ziaee Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D54365
* | libc: add glibc-compatible tdestroy(3)Konstantin Belousov2025-12-293-0/+70
| | | | | | | | | | | | | | | | | | | | | | The function clears the whole tree. Relnotes: yes Reviewed by: alc, emaste Discussed with: dougm Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D54365
* | libc/stdlib/Makefile: one line for each source file nameKonstantin Belousov2025-12-291-13/+69
| | | | | | | | | | | | | | Reviewed by: alc, emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D54365
* | geom_part: Fix format string issuesDag-Erling Smørgrav2025-12-291-29/+40
| | | | | | | | | | | | | | | | | | This fixes a segfault on i386 and armv7 and numerous style violations. PR: 292008 Fixes: 4f809ffec69c ("gpart: add libxo support for "show" subcommand + man page updates") Reviewed by: js Differential Revision: https://reviews.freebsd.org/D54393
* | man pages: provide some description for extended errorsKonstantin Belousov2025-12-291-0/+16
| | | | | | | | | | | | | | | | | | , related functions, and the EXTERROR_VERBOSE environment variable. Reviewed by: emaste, mckusick Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D54380
* | exterr: in verbose mode, print the source file nameKonstantin Belousov2025-12-291-4/+17
| | | | | | | | | | | | | | Reviewed by: emaste, mckusick Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D54380
* | Add automatically generated file libc/gen/exterr_cat_filenames.hKonstantin Belousov2025-12-291-0/+17
| | | | | | | | MFC after: 1 week
* | exterror: Add EXTERROR_VERBOSE env variable to control verbosityKonstantin Belousov2025-12-291-5/+48
| | | | | | | | | | | | | | | | | | | | | | | | If the variable is set and the process is not suid, __uexterr_format(), used by err(3), prints errno/category/source line/pX always, not only when there is no kernel message provided. Requested by: mckusick Reviewed by: emaste, mckusick Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D54380
* | exterror: add support for the format specifiers in the extended error msgKonstantin Belousov2025-12-291-1/+2
| | | | | | | | | | | | | | | | | | | | Note that we trust kernel code to only request the printout of integer types, and use the 'j' modifier always. Reviewed by: emaste, mckusick Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D54380
* | libc/gen/err.c: remove 'extended error' herald from extended error outputKonstantin Belousov2025-12-291-1/+1
| | | | | | | | | | | | | | Reviewed by: emaste, mckusick Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D54380
* | bsd.sys.mk: add NO_WCHARACTER_CONVERSION and use it for googletestDimitry Andric2025-12-281-0/+3
| | | | | | | | | | This silences warnings about benign implicit character conversions in googletest's gtest-printers.h.
* | cuse(3): annotate cuse_init() to suppress thread safety analysisDimitry Andric2025-12-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This avoids warnings from clang 21, similar to: /usr/src/lib/libcuse/cuse_lib.c:111:14: error: writing variable 'h_cuse' requires holding mutex 'm_cuse' exclusively [-Werror,-Wthread-safety-analysis] 111 | TAILQ_INIT(&h_cuse); | ^ /usr/src/lib/libcuse/cuse_lib.c:111:14: error: writing variable 'h_cuse' requires holding mutex 'm_cuse' exclusively [-Werror,-Wthread-safety-analysis] /usr/src/lib/libcuse/cuse_lib.c:112:14: error: writing variable 'h_cuse_entered' requires holding mutex 'm_cuse' exclusively [-Werror,-Wthread-safety-analysis] 112 | TAILQ_INIT(&h_cuse_entered); | ^ /usr/src/lib/libcuse/cuse_lib.c:112:14: error: writing variable 'h_cuse_entered' requires holding mutex 'm_cuse' exclusively [-Werror,-Wthread-safety-analysis] MFC after: 3 days
* | src.conf: Add WITH_LLVM_LINK_STATIC_LIBRARIES build knobDimitry Andric2025-12-233-10/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In commit 2e47f35be5dc libllvm, libclang and liblldb were converted into private shared libraries. This allowed clang, lld, lldb, and other llvm tools to be linked against these shared libraries, which makes them smaller and avoids duplication. However, this also comes at the cost of some performance, since the dynamic libraries are quite large, and contain lots of long symbols (mangled C++ identifiers). Add a WITH_LLVM_LINK_STATIC_LIBRARIES build knob that can be used to go back to the previous behavior: libllvm, libclang and liblldb are built as internal static libraries, i.e. only available during buildworld, and fully linked into the various executables such as clang, lld, etc. PR: 287447 Reviewed by: emaste MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D50956
* | MFV 762f11d98d5cd57ebbe85c36e9e86a557a91fe4e: xz 5.8.2.Xin LI2025-12-231-3/+9
| | | | | | | | MFC after: 7 days
* | Remove debug crutch I accidentally left inDimitry Andric2025-12-221-1/+0
| | | | | | | | | | Fixes: cf1eaaf41cef MFC after: 1 week
* | Reduce number of external symbols in libllvm, libclang and liblldbDimitry Andric2025-12-222-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In commit 2e47f35be5dc libllvm, libclang and liblldb were converted into private shared libraries. This allowed clang, lld, lldb, and other llvm tools to be linked against these shared libraries, which makes them smaller and avoids duplication. However, upstream builds the shared libraries using several visibility options, which reduces the number of external symbols, and makes the libraries a bit smaller. On my test machine: * libprivatellvm.so goes from 75643 to 34706 symbols (~54% reduction) * libprivateclang.so goes from 53250 to 33531 symbols (~37% reduction) * libprivatelldb.so goes from 27242 to 18798 symbols (~31% reduction) Note: to get the full benefit, a clean build is required. Incremental builds should still work, but I didn't want to force a full rebuild on everybody. MFC after: 1 week
* | libpfctl: export a get states variant that takes a pfctl_handleKristof Provost2025-12-212-11/+12
| | | | | | | | Sponsored by: Rubicon Communications, LLC ("Netgate")
* | librt/mq_getfd_np.3: Initial manual pageRick Parrish2025-12-182-0/+59
| | | | | | | | | | | | | | | | | | | | The mq_getfd_np function appeared in FreeBSD 11 with no documentation. This function dereferences the mqd_t as a pointer to an int. Relnotes: yes MFC after: 3 days Reviewed by: kib (previous), markj, ziaee Differential Revision: https://reviews.freebsd.org/D43947