summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2 dayslibc: drop NO_FP_LIBC supportXin LI
NO_FP_LIBC was added in 2004 to save space by disabling FP support in *printf()/*scanf(). The size benefit is negligible on modern systems and conflicts with assumptions made by current base utilities. Remove the option and always build libc with floating-point support. Reported by: Oskar Holmlund <eovholmlund at gmail com> MFC after: 2 weeks
3 daystdestroy: don't visit one-child node twiceDoug Moore
Change tdestroy() to immediately free a node with no right child as soon as it is encountered. Currently, such nodes are visited twice before deletion. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D54699
3 daysexterr: Regenerate exterr_cat_filenames.hMark Johnston
3 dayslib/virtual_oss: don't (over)link to libsamplerateBrooks Davis
These plugins require samplerate.h due to virtual_oss's int.h including it, but don't use any symbols directly so don't link to the library. Centralize adding the include path. Reviewed by: christos Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D54705
3 daysvirtual_oss: build system tidyingBrooks Davis
general: - find libsamplerate's headers in the temporary sysroot instead of digging in the source tree. - use LIBADD where possible lib/virtual_oss: - centralize SHLIBDIR define - centralize include path for internal headers - don't try to find libsamplerate directly in .OBJDIR No functional changes. Reviewed by: christos Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D54704
3 daysvirtual_oss: build commands/libs in parallelBrooks Davis
Reviewed by: christos Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D54703
3 daysvirtual_oss: remove needless .include in intermediate MakefileBrooks Davis
It doesn't define anything we use. Reviewed by: christos Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D54702
3 dayslibjail: extend struct handlers to included MAC labelsKyle Evans
MAC label handling is a little special; to avoid being too disruptive, we allocate a `mac_t *` here for the value so that we can mac_prepare() or mac_from_text() into. As a result, we need: - A custom free() handler to avoid leaking the *jp_value - A custom jailparam_get() handler to mac_prepare() the mac_t and populate the iove properly, so that the kernel doesn't have to do something funky like copyin, dereference, copyin again. - A custom jailparam_set() handler to similarly populate the iovec properly. Reviewed by: jamie Differential Revision: https://reviews.freebsd.org/D53960
3 dayslibjail: start refactoring struct ioctl supportKyle Evans
Instead of ad-hoc comparisons against the struct type in a few places, start to abstract out an interface for dealing with struct types. For now, this just means that we have some special jailparam_import and jailparam_export handling for the ip addr types, but in the next commit we'll extend it further to support MAC labels. Reviewed by: jamie Differential Revision: https://reviews.freebsd.org/D53959
4 daysvirtual_oss: Take MK_CUSE into accountChristos Margiolis
Reported by: brooks Fixes: f74f891581bc ("src.opts: Introduce MK_SOUND") Sponsored by: The FreeBSD Foundation MFC after: 4 days Reviewed by: brooks, emaste Differential Revision: https://reviews.freebsd.org/D54708
4 dayslibc/stdlib: Port strtonumx() from IllumosHans Rosenfeld
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
4 daysncurses: fix cross build on MacOSBaptiste Daroussin
5 daysswab: Correctly treat the data as misalignedJohn Baldwin
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
5 dayslibexecinfo: tests: Expect failure on aarch64Jose Luis Duran
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
5 daysncurses: merge update to ncurses 6.6Baptiste Daroussin
6.6 is ABI compatible with 6.5 (tested with abidiff) Remove html documentation to ease updates MFC After: 1 month
5 dayspf: configurable action on limiter exceededKristof Provost
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")
5 dayspf: convert state limiter interface to netlinkKristof Provost
This is a new feature with new ioctl calls, so we can safely remove them right now. Sponsored by: Rubicon Communications, LLC ("Netgate")
5 dayspf: introduce source and state limitersKristof Provost
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")
6 dayslibc/aarch64: Use MOPS implementations of memcpy/memmove/memset where availbleSarah Walker
Reviewed by: andrew Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D54560
6 dayslibc/csu: Pass HWCAP flags to ifunc resolver functionsSarah Walker
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
6 dayscsu: Remove unused constantJohn Baldwin
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
7 daysbuild: Remove duplicate SUBDIR entriesMark Johnston
Fixes: f74f891581bc ("src.opts: Introduce MK_SOUND")
7 dayssrc.opts: Introduce MK_SOUNDChristos Margiolis
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
7 daysRemove all code under __SPE__Minsoo Choo
Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me> Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1957
10 dayslogin.conf.5: Remove mention of login copyright settingSimon Wollwage
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
10 daysgetopt(3): be more explicit about :: extensionSimon Wollwage
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
10 dayslib: remove powerpcspeMinsoo Choo
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)
10 dayslibpmc: Import AMD Zen 5 PMU events.Ali Mashtizadeh
Sponsored by: Netflix Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1954
13 daysmips: remove mips leftoversMinsoo Choo
Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me> Pull-request: https://github.com/freebsd/freebsd-src/pull/1909
13 daysmanuals: Correct some sysctl markupAlexander Ziaee
This enables additional searching the manual by sysctl variable. This syntax is standardized in style.mdoc(5). Reported by: bapt MFC after: 3 days
13 dayslib/libbl[ao]cklist: Use LIB_PACKAGELexi Winter
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
13 dayslibypclnt: Move to yp packageLexi Winter
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
13 dayszstd: Move to a new zstd packageLexi Winter
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
2026-01-04libc/amd64: fix stpncpy.S againRobert Clausecker
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
2026-01-03libgeom: Fix 32-bit gcc buildDag-Erling Smørgrav
MFC after: 1 week Fixes: 27894e20f140 ("libgeom: Fix segfault in 32-on-64 case")
2026-01-03libgeom: Improve type safety of xml2tree codeDag-Erling Smørgrav
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
2026-01-03libgeom: Clean up xml2tree codeDag-Erling Smørgrav
MFC after: 1 week Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D54453
2026-01-03libgeom: Fix segfault in 32-on-64 caseDag-Erling Smørgrav
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
2025-12-30pf: convert DIOCRCLRASTATS to netlinkKristof Provost
Sponsored by: Rubicon Communications, LLC ("Netgate")
2025-12-30pf: move DIOCRCLRASTATS into libpfctlKristof Provost
Sponsored by: Rubicon Communications, LLC ("Netgate")
2025-12-29ioctl.2: Mention EACCESFelix Johnson
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
2025-12-29tdestroy(3): add testsKonstantin Belousov
Reviewed by: alc, emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D54365
2025-12-29tdestroy(3) man pageKonstantin Belousov
Reviewed by: alc, emaste, ziaee Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D54365
2025-12-29libc: add glibc-compatible tdestroy(3)Konstantin Belousov
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
2025-12-29libc/stdlib/Makefile: one line for each source file nameKonstantin Belousov
Reviewed by: alc, emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D54365
2025-12-29geom_part: Fix format string issuesDag-Erling Smørgrav
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
2025-12-29man pages: provide some description for extended errorsKonstantin Belousov
, 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
2025-12-29exterr: in verbose mode, print the source file nameKonstantin Belousov
Reviewed by: emaste, mckusick Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D54380
2025-12-29Add automatically generated file libc/gen/exterr_cat_filenames.hKonstantin Belousov
MFC after: 1 week
2025-12-29exterror: Add EXTERROR_VERBOSE env variable to control verbosityKonstantin Belousov
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