Commit Graph

294335 Commits

Author SHA1 Message Date
Dag-Erling Smørgrav 4e859e67dd libdiff: Implement diff coloring.
This patch got accidentally left out when libdiff was imported.  The
rest of the code (command-line option etc.) was present, just not the
part that actually prints ANSI color codes.

Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D46873
2024-10-02 17:55:06 +02:00
Cy Schubert fe55d62ab9 Revert "stdio.h: don't expose rsize_t unless __EXT1_VISIBLE"
This change has caused a number of port build failures. Let's
revert this for now and request an exp-run.

This reverts commit b35f0aa495.
2024-10-02 08:51:56 -07:00
Kajetan Staszkiewicz 6bbef79355 pf: Remove struct pf_pdesc->nat_rule
The variable struct pd->nat_rule is set only during rule evaluation, that
is only for the first packet of a connection. Use struct pf_kstate->nat_rule
instead.

Reviewed by:	kp
Differential Revision:	https://reviews.freebsd.org/D46867
2024-10-02 12:05:08 +02:00
Kristof Provost c17a0f62da pf tests: use unique pid files for inetd processes
Ensure that we don't conflict with other inetd processes running in other jails
by setting an explicit pid file (rather than relying on the default /var/run/
inetd.pid). This could lead to failure to start inetd, which in turn could cause
test failures.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-10-02 12:03:19 +02:00
Takanori Watanabe f5a04b16b1 acpidump: add 's' option to parse dsdt and ssdt's separately. In some machine, they may not be parsed if they are concatinated into one image.
Reviewed by:           kib
MFC after:              1 week
Differential Revision:  https://reviews.freebsd.org/D46796
2024-10-02 15:36:41 +09:00
Brooks Davis d9d2e3ab7c sysent: regen comments 2024-10-01 18:46:40 +01:00
Brooks Davis 0d490c6a44 sysent: make header comments more consistent
An upcoming refactor appends do-not-merge comments to all headers
centrally to do the same to reduce the final diff.  Headers also start
with a comment line (for /*) and end with a blank line.
2024-10-01 18:44:03 +01:00
Brooks Davis 13227efc5b sysent: regen removing comment alignment 2024-10-01 17:10:08 +01:00
agge3 e668866c82 sysent: Remove comment aligning
Comment aligning was inconsistent and required a ton of book-keeping.
Replaced comment aligning with a simple, single tab out.

Pull Request:	https://github.com/freebsd/freebsd-src/pull/1441
Signed-off-by: agge3 <sterspark@gmail.com>
2024-10-01 17:08:41 +01:00
Michael Tuexen 2eacb0841c tcp: small cleanup
No functional change intended.

Reviewed by:		cc, glebius, markj, rscheff
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D46850
2024-10-01 17:34:35 +02:00
Zhenlei Huang 7643141e93 if_enc(4): Make enc_add_hhooks() void
As for the consumer `enc_add_hhooks()`, `hhook_add_hook()` will never
fail for the given parameters. Meanwhile, to build the module if_enc(4),
at least option INET or INET6 is required, so no need for the error
EPFNOSUPPORT.

No functional change intended.

Reviewed by:	ae
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D46770
2024-10-01 23:28:37 +08:00
Zhenlei Huang 89937323bd khelp: Sprinkle const qualifiers where appropriate
No functional change intended.

MFC after:	1 week
2024-10-01 23:28:37 +08:00
Zhenlei Huang 941f8aceac hhook: Sprinkle const qualifiers where appropriate
No functional change intended.

MFC after:	1 week
2024-10-01 23:28:37 +08:00
Olivier Cochard 215fd38e29 ctl: skip the test if ctladm is missing (WITHOUT_ISCSI)
Reviewed by:	asomers
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D46853
2024-10-01 15:59:47 +02:00
Konstantin Belousov 6dcffb980f hyperv: call smp_targeted_tlb_shootdown_native() with pin
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2024-10-01 14:45:23 +03:00
Konstantin Belousov c2fe7156e9 amd64/mp_machdep.c: style
Wrap long lines.
Remove redundand declaration.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2024-10-01 14:32:19 +03:00
Kristof Provost 1b745d8b23 pf: move normalisation into pf_setup_pdesc()
This simplifies the code slightly, and brings us closer to the OpenBSD code.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D46707
2024-10-01 09:55:14 +02:00
Kristof Provost 288bec2b2b pf: fold pf_test_fragment() into pf_test_rule()
Reduces code and fixes a bunch of bugs with fragment handling not being in sync
with the rest of the ruleset.

Much feedback from mpf, bluhm & markus
Thanks to Tony Sarendal for help with testing

ok bluhm; various previous versions ok henning, claudio, mpf, markus

Note that while this changes the order of src addr/src port/dst addr/dst port
skips this doesn't actually affect the kernel/userspace ABI. The kernel always
recalculates skip steps. As a result we have to fix one of the pfctl parser
tests. Note that this is an order change that does not affect what packets are
acceppted or dropped.

Obtained from:	OpenBSD, mcbride <mcbride@openbsd.org>, 04c69899a7
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D46705
2024-10-01 09:55:13 +02:00
Graham Percival b35f0aa495 stdio.h: don't expose rsize_t unless __EXT1_VISIBLE
PR:		281768
Fixes:		c13559d31e
MFC after:	1 week
2024-09-30 20:07:43 -07:00
Rick Macklem eb345e05ac nfsd: Fix close handling when vfs.nfsd.enable_locallocks=1
nfsrv_freeopen() was being called after the mutex
lock was released, making it possible for other
kernel threads to change the lists while nfsrv_freeopen()
took the nfsstateid out of the lists.

This patch moves the code around
"if (nfsrv_freeopen(stp, vp, 1 p) == 0) {"
into nfsrv_freeopen(), so that it can remove the nfsstateid
structure from all lists before unlocking the mutex.
This should avoid any race between CLOSE and other nfsd threads
updating the NFSv4 state.

The patch does not affect semantics when vfs.nfsd.enable_locallocks=0.

PR:	280978
Tested by:	Matthew L. Dailey <matthew.l.dailey@dartmouth.edu>
MFC after:	1 week
2024-09-30 15:49:57 -07:00
Kyle Evans c4564a47c1 ObsoleteFiles: fix the libmd.so version bump order
This changeset started two years ago, but the entry was not tweaked upon
final commit to reflect reality.

Fixes:	e7a629c851 ("libmd, kern, stand: consolidate md5 [...]")
2024-09-30 14:59:37 -05: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
Tatsuki Makino 4fa4693dcd btx: Align the PXE prompt with other options
To fit within in the same space, drop the newline before the PXE
prompt to make room for the additional space character.

PR:		281494
2024-09-30 15:41:42 -04:00
Gleb Smirnoff 57671d5ccc tcp: further cleanup old options
They all were experimental and some comments refer to internal Netflix
versions.  There is not reason to leak that into the header. Style unused
options so that they have the available value aligned with really used
values.

Reviewed by:	tuexen
Differential Revision:	https://reviews.freebsd.org/D46779
2024-09-30 12:11:37 -07:00
Michael Tuexen 01eb635d12 tcp: improve mbuf handling when processing SYN segments
When the sysctl-variable net.inet.ip.accept_sourceroute is non-zero,
an mbuf would be leaked when processing a SYN-segment containing an
IPv4 strict or loose source routing option, when the on-stack
syncache entry is used or there is an error related to processing
TCP MD5 options.
Fix this by freeing the mbuf whenever an error occurred or the
on-stack syncache entry is used.

Reviewed by:		markj, rscheff
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D46839
2024-09-30 20:00:04 +02:00
Michael Tuexen a2e4f45480 tcp: whitespace cleanup
No functional change intended.

Reported by:	markj
MFC after:	1 week
Sponsored by:	Netflix, Inc.
2024-09-30 19:53:57 +02:00
Ed Maste 030c387f5d tzsetup: correct timezone symlink target
In chroot mode tzsetup prepended the chroot path to the symlink target,
which is not correct.  Use the same path for the symlink regardless of
chroot mode.

PR:		281332
Reported by:	scf, Herbert J. Skuhra
Reviewed by:	olce
Fixes: 5e16809c95 ("tzsetup: symlink /etc/localtime instead of co...")
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D46725
2024-09-30 10:22:34 -04:00
Andrew Turner 90cd9c203e buf_ring: Use atomic accesses for head/tail values
Use explicit atomic load/store operations for all producer and consumer
head and tail accesses. This allows us to remove the volatile
annotation from these variables.

Reviewed by:	alc, imp, kib, markj
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D46380
2024-09-30 12:04:24 +00:00
Andrew Turner 8e95079e17 buf_ring: Add a threaded test
Add a threaded test for buf_ring.h used to help find issues with it on
architectures with a weak memory order.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D46158
2024-09-30 12:04:24 +00:00
Andrew Turner e189296153 tests: Add buf_ring overflow checks
Check enqueue works correctly when the offsets overflow

Reviewed by:	imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D46156
2024-09-30 12:04:24 +00:00
Andrew Turner a707b81ccb tests: Add a buf_ring test
Add a simple test for sys/buf_ring.h. This enqueues and dequeues items
in the buf_ring to ensure the simple operations are correct.

There are no checks for multiple threads operating on buf_ring_enqueue
or buf_ring_dequeue_mc as they can be probabilistic and depend on the
architecture memory model.

Reviewed by:	markj
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D46147
2024-09-30 12:04:23 +00:00
Andrew Turner 33f2cf4ad4 arm64: Switch to ACPI by default
When the FreeBSD/arm64 port was created we only supported FDT. We now
also support ACPI, and have for many years. When this support was
added we kept FDT as the default.

There are some setups where both ACPI tables and a FDT DTB are passed
into the kernel. In most of these cases the DTB is only used to pass
in minimal information.

To handle the cases where both are passed in prefer ACPI over FDT.

Reviewed by:	bz, imp, emaste
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D46750
2024-09-30 12:04:23 +00:00
Andrew Turner 205c1007be arm64: Enable SVE in userspace
Report when SVE is present and allow it to be used by calling
sve_restore_state on an SVE exception from userspace.

Reviewed by:	kib
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D43310
2024-09-30 12:04:23 +00:00
Andrew Turner fe5ed2496e arm64: Don't trap SVE to EL2
As with floating point instructions don't trap SVE instructions to the
hypervisor. This lets us handle then in the kernel.

Reviewed by:	imp (earlier version)
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D43303
2024-09-30 12:04:23 +00:00
Andrew Turner aab6006894 arm64: Support SVE in ptrace and core dumps
Add the NT_ARM_SVE note type and use it to access the SVE registers
from ptrace. This allows userspace to modify the full SVE register
values.

Try to follow the Linux semantics to allow debuggers to use this with
minimal changes.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D43309
2024-09-30 12:04:23 +00:00
Andrew Turner 87a58d931d arm64: Add an SVE sysarch
To allow for user space to read the SVE vector length add a sysarch
handler to return the value to userspace.

Reviewed by:	imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D43308
2024-09-30 12:04:23 +00:00
Andrew Turner e45132e978 arm64: Add the SVE registers to the signal frame
Use the new extended register support in the arm64 signal frame to
handle the SVE registers.

As these registers alias the VFP registers we use the floating point
register values to restore the lower bits of the SVE registers. This
is to support software that doesn't understand SVE to continue working.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D43307
2024-09-30 12:04:23 +00:00
Andrew Turner 332c426328 arm64: Initial SVE support
Add initial kernel support for SVE. This detects if SVE is present on
all CPUs, and if so allows for the use of SVE in the future.

As the SVE registers are a superset of the VFP registers we don't need
to restore the VFP registers when SVE is enabled.

Ths interface to enable SVE is provided, but not used until SVE is
supported in signals and with ptrace.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D43306
2024-09-30 12:04:23 +00:00
Pierre Pronchery 8934002959 bhyve: avoid buffer overflow in pci_vtcon_control_send
The program copies an input buffer to an output buffer without verifying
that the size of the input buffer is less than the size of the output
buffer, leading to a buffer overflow.

Inside the function pci_vtcon_control_send, the length of the iov buffer
is not validated before copy of the payload.

Reported by:    Synacktiv
Reviewed by:	markj
Security:       HYP-19
Sponsored by:   The Alpha-Omega Project
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D46105
2024-09-30 08:01:28 -04:00
Kajetan Staszkiewicz 8e3d252901 pf: Split pf_map_addr()
Split pf_map_addr() into 2 functions:
- pf_map_addr() handles just the address mapping algorithms, it is used
  in pf_route() and pf_route6() in case of stateless route-to, where
  source nodes would never be created
- pf_map_addr_sn() handles source nodes and calls pf_map_addr() for
  address mapping algorightms, it is used everywhere else, like NAT
  rules, which are always stateful

Reviewed by:	kp
Differential Revision:	https://reviews.freebsd.org/D46776
2024-09-30 11:16:24 +02:00
Kajetan Staszkiewicz 3ec4fbdd98 pf tests: Add test for max-src-states
Reviewed by:	kp
Differential Revision:	https://reviews.freebsd.org/D46840
2024-09-30 09:48:40 +02:00
Kyle Evans aad507854e Fix the cross-build after recent commits
- Provide a sys/md4.h in the cross-build environment to fix bootstrap
    of libmd.
- flua now exposes WTRAPPED which isn't incredibly common- make it
    conditional, we probably won't be using it in any bootstrap context
    any time soon.

Fixes:	442e0975ee ("Consolidate md4 implementations written in C")
Fixes:	c2caf3b331 ("flua: posix: add more useful functions [...]")
2024-09-30 00:08:49 -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 c2caf3b331 flua: lposix: add more useful functions for general purpose scripts
unistd:
- _exit
- close
- fork
- getpid
- pipe
- read
- write

libgen:
- basename, dirname

stdlib:
- realpath

These are sufficient for a number of real world scenarios.  In our first
application of them, we use the libgen+stdlib additions to grab the
script dir based on argv[0].  The unistd assortment is then used to
outsource a bunch of work to forks and report back to the main process.

Reviewed by:	emaste, imp
Differential Revision:	https://reviews.freebsd.org/D39083
2024-09-29 22:52:20 -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