Commit graph

24833 commits

Author SHA1 Message Date
Brooks Davis d9d2e3ab7c sysent: regen comments 2024-10-01 18:46:40 +01:00
Kyle Evans c02bc0aa0b libmd: re-apply masking of _Transform names
Visibility can get complicated when, e.g., ifuncs are involved.  In
particular, SHA256/SHA512 on aarch64 use ifuncs for their _Transform
implementations, which then exposes global symbols of the same name that
break things trying to statically link both libcrypto and libmd.

Revert this part of the _Transform removal to fix the pkg-static build
on aarch64.

Fixes:	81de655acd ("libmd: stop exporting Transform() symbols")
2024-09-30 14:59:31 -05:00
Kyle Evans 0ffebeb08a libmd: quickly switch exported symbols to FBSD_1.8 before anyone notices
This sat in my tree for years, and we've since cut another release
branch.  Oops. =\
2024-09-29 23:42:53 -05:00
Kyle Evans 5190e6341c libmd: stop exporting _version symbols
These are reportedly likely to be specific to SSLeay's implementation
and likely not needed here.  At the very least they shouldn't be used
by consumers, so let's kick them out now while we're already prepared
for a libmd soversion bump.

Requested by:	delphij, fuz
2024-09-29 22:35:23 -05:00
Kyle Evans 442e0975ee Consolidate md4 implementations written in C
We currently have one in libmd and another in the kernel that's almost
completely identical.  Standardize on the kernel version.

PR:		280784 (exp-run)
2024-09-29 22:34:21 -05:00
Kyle Evans 81de655acd libmd: stop exporting Transform() symbols
They're not documented in libmd and we don't have any consumers.  It's
problematic to keep them exported, as we don't currently export their
implementations. Make them all private.

PR:		280784 (exp-run)
Reviewed by:	fuz
Differential Revision:	https://reviews.freebsd.org/D34503
2024-09-29 22:34:20 -05:00
Kyle Evans fd3ced1507 libmd: export and document *Fd/*FdChunk interfaces
PR:		280784 (exp-run)
Fixes: de13c2427d ("libmd: introduce functions that operate on an fd")
Reviewed by:	manpages (bcr), fuz
Differential Revision:	https://reviews.freebsd.org/D34502
2024-09-29 22:34:20 -05:00
Kyle Evans 01112a1711 libmd: tests: raise WARNS to the default
The drivers just had a small issue, passing a literal string as
non-const.  Fix it and lift WARNS.

PR:		280784 (exp-run)
Reviewed by:	delphij, emaste
Differential Revision:	https://reviews.freebsd.org/D34501
2024-09-29 22:34:20 -05:00
Kyle Evans e0c51286dd libmd: split tests out into the test infrastructure
Make us a little less reliant on individuals running the tests, we'll
start running them as part of CI.

PR:		280784 (exp-run)
Reviewed by:	delphij
Differential Revision:	https://reviews.freebsd.org/D34500
2024-09-29 22:34:19 -05:00
Kyle Evans e25527f75f libmd: symbol versioning
The primary benefit sought is exporting _libmd_* symbols in a private
namespace, and avoiding export of some other implementation details that
are shared amongst TUs.

PR:		280784 (exp-run)
Reviewed by:	fuz
Differential Revision:	https://reviews.freebsd.org/D34499
2024-09-29 22:34:19 -05:00
Kyle Evans d61f4b481f libmd: stop exporting _block symbols
These are needed across compilation units so we can keep the _libmd_
prefixing bits (though I suspect we're not likely to collide), but we
don't need to be exporting the unprefixed versions of these; it's an
implementation detail.

PR:		280784 (exp-run)
Reviewed by:	delphij, fuz
Differential Revision:	https://reviews.freebsd.org/D34498
2024-09-29 22:34:18 -05:00
Kyle Evans e7a629c851 libmd, kern, stand: consolidate md5 implementations (NFC)
Reduce the number of md5c.c between the three of these from two to one
by just reaching into the kernel build for both userland builds.  The
precedent for this already exists for sha2 in both cases.

_libmd_ symbol privatization bits have been moved to sys/md5.h and
md5.h remains to #include <sys/md5.h> for compatibility.

This stops exporting MD5Pad() in the process because the kernel stopped
exporting it in 502a35d60f.  soversion is bumped accordingly.

This also renames the libc version of stack_protector.c; it previously
only worked by coincidence because .PATH ordering worked out such that
we got the right one, but this is not the case anymore.  Remove the
landmine.

PR:		280784 (exp-run)
Reviewed by:	allanjude, delphij
Differential Revision:	https://reviews.freebsd.org/D34497
2024-09-29 22:34:18 -05:00
Enji Cooper c284f45dc7 lib/libexpat: update build config for 2.6.3
MFC after:	1 week
MFC with:	ffd294a1f4
Differential Revision:	https://reviews.freebsd.org/D46830
2024-09-28 07:23:32 -07:00
Brooks Davis 1235d276b7 lib{c,sys}: stop exposing errno symbol
Officially since C11 (and in reality FreeBSD since 3.0 with commit
1b46cb523d) errno has been defined to be a macro.  Rename the symbol
to __libsys_errno and move it to FBSDprivate_1.0 and confine it entierly
to libsys for use by libthr.  Add a FBSD_1.0 compat symbol for existing
binaries that were incorrectly linked to the errno symbol during
libc.so.7's lifetime.

This deliberately breaks linking software that directly links to errno.
Such software is broken and will fail in surprising ways if it becomes
threaded (e.g., if it triggers loading of a pam or nss module that
uses threads.)

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D46780
2024-09-27 20:27:46 +01:00
Konstantin Belousov 6126f4ea64 libprocstat: add procstat_getrlimitusage()
Reviewed by:	markj, olce
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D46747
2024-09-27 18:02:29 +03:00
Konstantin Belousov 927f379180 Regen 2024-09-27 18:02:23 +03:00
Konstantin Belousov 9b29fc89ae Userspace enablement for getrlimitusage(2)
Reviewed by:	markj, olce
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D46747
2024-09-27 18:02:09 +03:00
Kajetan Staszkiewicz 7fe42038b2 pf: fix max-src-conn when rules are added via netlink
Reviewed by:	kp
Differential Revision:	https://reviews.freebsd.org/D46797
2024-09-27 14:29:20 +02:00
Konstantin Belousov eade2001aa jemalloc: set LG_VADDR to 64 on amd64
and allow to revert it back to 48 with WITHOUT_JEMALLOC_LG_VADDR_WIDE build
option.

Reviewed by:	andrew, emaste
Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D46686
2024-09-27 01:54:25 +03:00
Dag-Erling Smørgrav d2c2d5f494 stdio: Disable USE_XPRINTF envar.
As xprintf has not kept up with our standard printf(3) implementation,
it is becoming increasingly dangerous to continue to allow it to take
over if USE_XPRINTF is defined.  Remove that code, while still allowing
applications which know about xprintf to select it.

Reviewed by:	phk
Differential Revision:	https://reviews.freebsd.org/D46765
2024-09-25 19:14:55 +02:00
Ka Ho Ng 1d910b5f88 dirdeps: update Makefile.depend for toolchain
Sponsored by:	Juniper Networks, Inc.
2024-09-24 01:24:45 +00:00
Ka Ho Ng 306113630d libthr: add libsys for dirdeps build
Sponsored by:	Juniper Networks, Inc.
2024-09-24 01:24:36 +00:00
Dimitry Andric f97c7fdc59 Bump lld LINKER_FREEBSD_VERSION for reproducibility fix
The upstream fix to make lld output for our EFI loaders reproducible
again was committed in 54521a2ff9. Bump lld's LINKER_FREEBSD_VERSION
to be able to check this in the EFI loader Makefile.

MFC after:	3 days
2024-09-22 19:12:38 +02:00
Kristof Provost 93e96359c9 libpfctl: ensure we return useful error codes
Return errno rather than -1 on error. This allows pfctl to report much
more useful errors.

Reported by:	Alexander Leidinger <Alexander@Leidinger.net>
MFC after:	1 week
2024-09-22 00:55:46 +02:00
Faraz Vahedi f144058b40 Refactor error handling in lseek operations
1. Subtraction was performed on the current position
   regardless of the success of the lseek operation.
   In the event of an error, this resulted in the
   current position being erroneously set to -2,
   which bypassed the intended error handling
   mechanism. The proposed change performs error
   checking immediately following the lseek operation,
   prior to any modification of the current position.
   This ensures that a failed lseek operation will
   correctly trigger the appropriate error handling.

2. The error checking logic was based on the assumption
   that lseek would return `offset - 1` upon failure.
   However, this is not consistent with the behaviour of
   lseek as specified in the POSIX standard, which
   stipulates that lseek shall return -1 in case of
   an error. The code has been updated to reflect this
   standard, improving reliability and compliance.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1392
2024-09-21 05:25:15 -06:00
Faraz Vahedi c3c06f94f0 Remove unused includes, migrate to stdint.h for uintXX_t types.
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1392
2024-09-21 05:25:15 -06:00
John F. Carr a55640536a Install xo_emit_f.3
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1406
2024-09-21 05:25:15 -06:00
Graham Percival 2878d99dfc manuals: Misc macro typos
These were reported by `mandoc -T lint` as
    ERROR: skipping unknown macro
When these pages were rendered with `man`, the "unknown macro" meant
that the entire line was omitted from the output.

Obvious typos in:
lib/libsys/swapon.2
lib/libsys/procctl.2
share/man/man9/firmware.9

lib/libcasper/services/cap_net/cap_net.3: 'mode' describes a function
    argument.

lib/libsys/statfs.2: there's no .Tm command ("trademark?"), and
    .Tn ("tradename") is deprecated, so remove the macro entirely.

usr.sbin/mfiutil/mfiutil.8: man was interpreting '/dev/' as a macro
    (which it didn't recognize).

share/man/man4/qat.4: same issue as above, but with '0'.  In this case,
    given the context of the previous line, rewriting as "Value '0'"
    seemed more appropriate.

usr.sbin/mlx5tool/mlx5tool.8: typo in .Xr

Signed-off-by:	Graham Percival <gperciva@tarsnap.com>
Sponsored by:	Tarsnap Backup Inc.
Reviewed by:	concussious, imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1417
2024-09-21 05:25:15 -06:00
Dag-Erling Smørgrav 74f1007fcc printf(): Save errno earlier.
The manual page says %m is replaced with “the string representation of
the error code stored in the errno variable at the beginning of the
call”.  However, we don't actually save `errno` until fairly late in
`__vfprintf()`.  Make sure it is saved before we do anything that
might perturb `errno`.

MFC after:	1 week
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D46718
2024-09-20 18:30:39 +02:00
Graham Percival 650056363b manuals: Fix errors in .2 pages
These were reported by `mandoc -T lint ...` as errors.

fhlink.2, fhreadlink.2: remove unneeded block closing.

getfh.2, procctl.2: add necessary block closing.

ptrace.2: -width only takes one argument.

swapon.2: <sys/vmparam.h> and <vm/swap_pager.h> weren't being displayed,
    because .It is for a list item whereas .In is for included files.
    Also, we want a blank line between <sys/ > headers and the other
    one.

Signed-off-by:	Graham Percival <gperciva@tarsnap.com>
PR:		281597
Reviewed by:	mhorne
Sponsored by:	Tarsnap Backup Inc.
2024-09-20 11:37:02 -03:00
Konstantin Belousov a4c04958f5 libutil: support RLIMIT_PIPEBUF
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D46619
2024-09-20 09:46:06 +03:00
Konstantin Belousov 54a8d1fbbf getrlimit(2): document RLIMIT_PIPEBUF
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D46619
2024-09-20 09:46:06 +03:00
Stephen J. Kiernan 567d9fe8ad csu: add include path to CFLAGS to be able to find libsys.h
In order to ensure we get the correct libsys.h, we need to add
lib/libsys to the includes search path.
2024-09-19 15:36:38 -04:00
Stephen J. Kiernan c644d3d896 libsys: Add dependencies for dirdeps build 2024-09-18 13:03:42 -04:00
Dag-Erling Smørgrav abed32f91d realpath(3): Minor style issues.
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D46695
2024-09-18 18:29:55 +02:00
Kristof Provost 2339ead638 pf: allow filtering on the receive interface
add support to pf for filtering a packet by the interface it was received
on. use the received-on IFNAME filter option on a pf.conf rule to restrict
which packet the interface had to be received on. eg:

  pass out on em0 from $foo to $bar received-on fxp0

ive been running this in production for a week now. i find it particularly
usefull with interface groups.

no objections, and a few "i like"s from henning, claudio, deraadt, mpf

Obtained from:	OpenBSD, dlg <dlg@openbsd.org>, 95b4320893
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D46577
2024-09-16 13:47:07 +02:00
Konstantin Belousov 3a2a5d6060 getrlimit(2): document RLIMIT_UMTXP
Reviewed by:	olce
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D46619
2024-09-15 09:30:00 +03:00
Robert Clausecker 61ed5748e4 lib/libc/tests/string: improve memccpy "bounds" unit test
The purpose of the "bounds" test is to check that the function does not
overread the array bounds.  The old unit test, copied from the strlcpy()
one, always ensured that we see the character c memccpy() is looking for
in the source array before the array ends.  While this is correct for
strlcpy(), memccpy()'s specification does not guarantee that c is
present within the given size limit.

The updated test handles this case better, ensuring that the source
array ends early if c is not supposed to be present.

Reported by:	getz
Approved by:	emaste
See also:	D46052
Event:		GSoC 2024
Differential Revision:	https://reviews.freebsd.org/D46051
2024-09-14 20:42:19 +02:00
Joseph Mingrone ecb75be376
libpcap: Add changes missed in update to 1.10.5
Fixes:		afdbf109c6 (libpcap: Update to 1.10.5)
Sponsored by:	The FreeBSD Foundation
2024-09-14 14:35:58 -03:00
Brooks Davis 5b92737502 kcmp(2): fix whitespace in symbol list
Fixes:		211bdd601e Add kcmp(2) userspace bits
2024-09-12 12:35:04 +01:00
Baptiste Daroussin 7899f917b1 flua: move modules source into the main source directory
Follow the path of what is done with bsnmp, build the modules along
with the main binary, this allows to build the modules at a moment
where all needed libraries are already built and available in the
linker path instead of having to declare all the libraries which a
flua module will be linked to in _prebuild_libs.

Discused with:	markj
Reviewed by:	markj, jrtc27, kevans, imp
Accepted by:	kevans, imp
Differential Revision:	https://reviews.freebsd.org/D46610
2024-09-12 09:03:44 +02:00
Mark Johnston a86678a3d6 Remove a ktrace.out which snuck into an earlier commit
Fixes:	b76961e3a2 ("kdump: Print splice structures")
2024-09-10 17:52:43 +00:00
Mark Johnston b76961e3a2 kdump: Print splice structures
MFC after:	3 months
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
2024-09-10 16:52:01 +00:00
Mark Johnston a1da7dc1cd socket: Implement SO_SPLICE
This is a feature which allows one to splice two TCP sockets together
such that data which arrives on one socket is automatically pushed into
the send buffer of the spliced socket.  This can be used to make TCP
proxying more efficient as it eliminates the need to copy data into and
out of userspace.

The interface is copied from OpenBSD, and this implementation aims to be
compatible.  Splicing is enabled by setting the SO_SPLICE socket option.
When spliced, data that arrives on the receive buffer is automatically
forwarded to the other socket.  In particular, splicing is a
unidirectional operation; to splice a socket pair in both directions,
SO_SPLICE needs to be applied to both sockets.  More concretely, when
setting the option one passes the following struct:

    struct splice {
	    int fd;
	    off_t max;
	    struct timveval idle;
    };

where "fd" refers to the socket to which the first socket is to be
spliced, and two setsockopt(SO_SPLICE) calls are required to set up a
bi-directional splice.

select(), poll() and kevent() do not return when data arrives in the
receive buffer of a spliced socket, as such data is expected to be
removed automatically once space is available in the corresponding send
buffer.  Userspace can perform I/O on spliced sockets, but it will be
unpredictably interleaved with splice I/O.

A splice can be configured to unsplice once a certain number of bytes
have been transmitted, or after a given time period.  Once unspliced,
the socket behaves normally from userspace's perspective.  The number of
bytes transmitted via the splice can be retrieved using
getsockopt(SO_SPLICE); this works after unsplicing as well, up until the
socket is closed or spliced again.  Userspace can also manually trigger
unsplicing by splicing to -1.

Splicing work is handled by dedicated threads, similar to KTLS.  A
worker thread is assigned at splice creation time.  At some point it
would be nice to have a direct dispatch mode, wherein the thread which
places data into a receive buffer is also responsible for pushing it
into the sink, but this requires tighter integration with the protocol
stack in order to avoid reentrancy problems.

Currently, sowakeup() and related functions will signal the worker
thread assigned to a spliced socket.  so_splice_xfer() does the hard
work of moving data between socket buffers.

Co-authored by:	gallatin
Reviewed by:	brooks (interface bits)
MFC after:	3 months
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D46411
2024-09-10 16:51:37 +00:00
Martin Matuska e2df9bb441 zfs: merge openzfs/zfs@b10992582
Notable upstream pull request merges:
 #15892 -multiple Fast Dedup: Introduce the FDT on-disk format and feature flag
 #15893 -multiple Fast Dedup: “flat” DDT entry format
 #15895 -multiple Fast Dedup: FDT-log feature
 #16239 6be8bf555 zpool: Provide GUID to zpool-reguid(8) with -g
 #16277 -multiple Fast Dedup: prune unique entries
 #16316 5807de90a Fix null ptr deref when renaming a zvol with snaps and snapdev=visible
 #16343 77a797a38 Enable L2 cache of all (MRU+MFU) metadata but MFU data only
 #16446 83f359245 FreeBSD: fix build without kernel option MAC
 #16449 963e6c9f3 Fix incorrect error report on vdev attach/replace
 #16505 b10992582 spa_prop_get: require caller to supply output nvlist

Obtained from:	OpenZFS
OpenZFS commit:	b109925820
2024-09-09 18:13:02 +02:00
Jose Luis Duran 3f0efe0543 libefivar: Fix AcpiEx print logic
Add logic that checks if the code doesn't overflow
ACPI_EXTENDED_HID_DEVICE_PATH node when searching for optional
strings. If the string is not provided in the device path node
default value of "\0" is used.

Upstream PR:	https://bugzilla.tianocore.org/show_bug.cgi?id=4555
Obtained from:	96ed60dfd7

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1388
2024-09-06 12:34:33 -06:00
Jose Luis Duran 9cb98ab7ce getaddrinfo.{1,3}: Cross-reference ip6addrctl(8)
Reviewed by: imp, glebius
Pull Request: https://github.com/freebsd/freebsd-src/pull/1375
2024-09-06 12:34:32 -06:00
Baptiste Daroussin 39667ed7ad flua: hook libfreebsd to the build 2024-09-06 17:52:08 +02:00
Baptiste Daroussin df1323e023 lua_ucl: make sure flua gets build after libucl 2024-09-06 17:50:04 +02:00
Baptiste Daroussin 705583b76f freebsd.sys.linker: rename source file
Suggested by:	markj
2024-09-06 17:35:28 +02:00