Commit Graph

301212 Commits

Author SHA1 Message Date
John Baldwin 0d0d6378ad Remove stale reference to EXTRA_ARCHES_arm
Fixes:		7818c2d37c ("armv6: Remove support for building armv6")
2025-07-14 11:02:15 -04:00
John Baldwin 072f54bf9f arch.7: Move i386, powerpc, and powerpcspe to the discontinued arch list
Other tables retain entries about these architectures since those
details are still relevant for lib32 environments.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D51195
2025-07-14 11:01:30 -04:00
John Baldwin 4a3fb7547e powerpc: Disconnect 32-bit powerpc from make universe
World and kernels for 32-bit powerpc can still be built using the
buildworld and buildkernel targets.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D51194
2025-07-14 11:01:09 -04:00
John Baldwin 7442cdca51 i386: Unhook all kernel configs from make universe
This effectively makes i386 a world-only target in make universe.

Reviewed by:	bz, imp
Differential Revision:	https://reviews.freebsd.org/D51193
2025-07-14 11:00:10 -04:00
Mark Johnston 1cc020eba6 ncurses: Provide reproducible paths
Avoid hard-coding the value of SRCTOP in generated files.  Use /usr/src
as the canonical srcdir.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D50955
2025-07-14 14:45:57 +00:00
Mateusz Piotrowski 193f2289fc d.7: Document the DTrace scripting language
Reviewed by:	bcr, christos, ziaee
Event:		Berlin Hackathon 202507
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D51268
2025-07-14 15:01:51 +02:00
Mateusz Piotrowski a487606afd dtrace_dtrace.4: Document the DTrace dtrace provider
Reviewed by:	bcr, christos
Event:		Berlin Hackathon 202507
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D51267
2025-07-14 14:17:04 +02:00
Tom Jones 4d718f57c5 xhci pci: Add some amd xhci controller device ids
Reviewed by: aokblast
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D51259
2025-07-14 09:03:45 +01:00
Alan Cox b87aa79153 amd64 pmap: simplify recent changes to pmap_enter_pde()
When pmap_enter_pde() removes an existing 2MB page mapping within the
kernel address space, do not remap the kernel page table page since it
will shortly be unmapped.  Simply zero it.

Eliminate an unnecessary conditional refcount decrement on what must be
a kernel page table page.  (We only utilize this refcount on user-space
page table pages.)

Convert an assertion from a panic to a KASSERT.

Reviewed by:	kib, markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D51235
2025-07-13 19:23:49 -05:00
Christos Margiolis 697bf0f416 fortune: Fix typo in dmesgd.nycbug.org example
No functional change, but commit for correctness nonetheless.

MFC after:	1 day
Differential Revision:	https://reviews.freebsd.org/D51293
2025-07-14 00:25:58 +03:00
Mark Johnston 9f67180733 msdosfs: Fix handling of eofflag in VOP_READDIR
We also need to set it when an end-of-directory marker is reached.

Reported by:	vishwin
Reviewed by:	kib
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D51290
2025-07-13 18:24:36 +00:00
Mark Johnston da89500adb rc_subr_test: Bump some sleep timeouts
The test verifies that the rc framework will OOM-protect a process
spawned by rc.  It just wraps a 5-second /bin/sleep invocation as part
of this test.

The rc framework uses procctl to set the OOM-protect bit after the
process has started, i.e., it uses procctl -p.  So, with a 5 second
timeout, it's possible for the process to exit before procctl actually
runs, if the system is heavily loaded.  (I see this failure occasionally
with KMSAN configured and many tests running in parallel.)

Bump the timeout to reduce the risk of this happening.  The timeout
value is arbitrary since the test will stop the rc process, i.e., we
don't have to wait for 60 seconds to elapse before the test passes.

MFC after:	1 week
2025-07-13 18:24:36 +00:00
Timothy Pearson 8efa35fea3 libc/powerpc64: Fix swapcontext(3)
On PowerPC platforms a valid link to the Table of Contents (TOC) is
required for PLT lookups to function.  This TOC pointer is stored in
a dedicated register, and is used along with the stack pointer by both
C prologue and PLT lookup code.

When calling swapcontext() with uc_link != NULL, a PLT lookup to
setcontext(3) is attempted from within the _ctx_done context.  The
exiting process has usually trashed both r1 and r2 at this point,
leading to a crash within the PLT lookup before setcontext(2) is
reached to restore the linked context.

Save and restore r2 as in a regular function.  This ensures the
subsequent PLT lookup to setcontext(3) succeeds.

Signed-off-by: Timothy Pearson <tpearson@raptorengineering.com>

MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1759
2025-07-13 14:00:56 -04:00
Timothy Pearson 077e30e61d powerpc: Fix multiple issues with FP/VSX save/restore
Multiple issues existed within the powerpc FP/VSX save/restore functionality,
leading to register corruption and loss of register contents in specific
scenarios involving high signal load and use of both floating point and VSX
instructions.

Issue #1

On little endian systems the PCB used the wrong location for the shadowed
FP register within the larger VSX register.  This appears to have been an
attempt to correct issue #2 without understanding how the vector load/store
instructions actually operate.

Issue #2

On little endian systems, the VSX state save/restore routines swapped 32-bit
words within the 64-bit aliased double word for the associated floating point
register.  This was due to the use of a word-oriented load/store vs. doubleword
oriented load/store.

Issue #3

The FPU was turned off in the PCB but not in hardware, leading to a potential
race condition if the same thread was scheduled immediately after sigreturn.

The triggering codebase for this is Go, which makes heavy use of signals and
and generates an unusual mix of floating point and VSX assembler.  As a result,
when combined with th powerpc lazy FPU restore, a condition was repeatedly hit
whereby the thread was interrupted in FP+VSX mode, then restored in FP only
mode, thus reliably triggering the issues above.

Also clean up the associated asm() style issue flagged by GitHub Actions.

Signed-off-by: Timothy Pearson <tpearson@raptorengineering.com>

MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1756
2025-07-13 14:00:56 -04:00
Timothy Pearson 645bb3efc3 powerpc: Reserve correct scratch region size below stack
According to the ELF ABI v2, two scratch regions are reserved below the stack
pointer, one 288 byte general region and one 224 byte compiler region.

FreeBSD only reserved the 288 byte region.  Follow the ELV v2 ABI and reserve
the full 512 byte region as specified.

Signed-off-by: Timothy Pearson <tpearson@raptorengineering.com>

MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1756
2025-07-13 14:00:56 -04:00
Alan Cox 2cfd6342ac arm64 pmap: do not panic when unable to insert PTP into trie
When pmap_enter_l2() needs to destroy an existing kernel superpage
mapping, do not remove the saved page table page (PTP) from the pm_root
trie and remap it into the page table.  Instead, simply zero it.  Then,
later the PTP does not need to be unmapped and reinserted into the trie.

If the kernel region is not mapped by a superpage, then try to insert
the PTP into the pm_root trie before clearing the PTEs.  If the PTP
insertion fails, then we can return failure with the old mappings still
in place.

Convert an assertion from a panic to a KASSERT.

Reviewed by:	kib, markj (an earlier version)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D51220
2025-07-13 11:55:47 -05:00
Mateusz Piotrowski 10d336114d tracing(7): Add hwt(4)
Also, reference tracing(7) from hwt(4).

Reviewed by:	bnovkov
Event:		Berlin Hackathon 202507
Differential Revision:	https://reviews.freebsd.org/D51276
2025-07-13 17:32:48 +02:00
Kajetan Staszkiewicz 2b2ac1aa9a pf tests: Fix rdr pass test to really use 'pass … rdr-to' syntax
Reviewed by:	kp
Event:		Berlin Hackathon 202507
Sponsored by:	InnoGames GmbH
2025-07-13 16:48:01 +02:00
Kajetan Staszkiewicz 04dcbb4434 pf: Prevent infinite looping over tables in round-robin pools
In FreeBSD each redirection pool (struct pf_kpool) consists of multiple
hosts (struct pf_addr_wrap). In OpenBSD that is not the case, and a
round-robin pool having a table as a host loops infinitely only over
that single table.

In FreeBSD once all addresses from a table are returned the pool must
iterate to the next host. Add a custom flag to have pfr_pool_get() break
its loop once it reaches the last index. Use this flag in round-robin
pools. When changing pool's host set index to 0 to always start
iterating each table from beginning.

Reviewed by:  kp
Approved by:  kp
Sponsored by: InnoGames GmbH
Differential Revision:    https://reviews.freebsd.org/D50779
2025-07-13 15:11:21 +02:00
Kajetan Staszkiewicz c46bf1e3c9 pf tests: Add jail configuration for route_to and ipv6-nexthop tests
Maybe it could later replace previous IPv4 and IPv6 jail configurations.

Reviewed by:  kp
Approved by:  kp
Sponsored by: InnoGames GmbH
Differential Revision:    https://reviews.freebsd.org/D50764
2025-07-13 15:11:18 +02:00
Robert Clausecker 804f961c5c share/termcap: add xterm-ghostty entry
As generated by ghostty during the build with some copy-editing.

Submitted by:	Tim Culverhouse <tim@timculverhouse.com>
PR:		287642
Event:		Berlin Hackathon 202507
MFC after:	1 week
2025-07-13 14:23:48 +02:00
Robert Clausecker b98b82a8bf share/termcap: ti703 does not actually support tabs
This is a mistake I made when I originally wrote this entry.

Event:		Berlin Hackathon 202507
MFC after:	1 week
2025-07-13 14:23:48 +02:00
Kajetan Staszkiewicz cbd06dd2af pf: Fix error handling when pf_map_addr() fails
When pf_map_addr() fails, for example for a NAT pool, we expect packet will
not be forwarded. The error returned by pf_map_addr() has been ignored in
pf_map_addr_sn(), though, causing packets being forwarded without NAT
applied. Catch the error, return the error to caller, let the caller handle
error counters for route-to pools just like it does for NAT pools. Add
tests for NAT and route-to rules.

Improve logging by not hardcoding function name and use __func__
instead.

Reviewed by:  kp
Approved by:  kp
Sponsored by: InnoGames GmbH
Differential Revision:    https://reviews.freebsd.org/D50763
2025-07-13 13:48:39 +02:00
Dirk Engling 5031da2059 bluetooth-config: Fix command line parsing
This addresses the problems encountered when parsing options in bluetooth-config.

- the optional parameters were not properly shifted after consumption
- the command line parameter count was checked before getopts and not after

Reported by:	sjg
Approved by:	kp
MFC after:	7 days
Event:	Berlin Hackathon 202507
Differential Revision:	<https://reviews.freebsd.org/D51281>
2025-07-13 11:25:24 +02:00
Lukas Engelhardt 76856ead44 netstat.1: Add common example to list listening sockets
While here, wrap to 80 characters.

Approved by:	ziaee
Differential Revision:	https://reviews.freebsd.org/D51280
2025-07-13 08:07:00 +00:00
Olivier Certner 1e78a6a6d8 vm_domainset: Print correct function in KASSERT()/panic()
Some messages in vm_domainset_iter_next() would wrongly refer to
vm_domainset_iter_first().  While here, ensure that all assertion/panic
messages use '__func__' to avoid this discrepancy in the future if code
is moved/copy-pasted again.

Reviewed by:    markj, alc, kib
MFC after:      10 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D51248
2025-07-13 16:15:22 +09:00
Olivier Certner 9d1f3ce79d pmap: Degrade pmap_page_set_attr*() into a no-op on same attribute
For 32-bit arm, move the no-op test that was already in place at start
of the function so that it stays first even if the '#if 0' block around
the call to sf_buf_invalidate_cache() is uncommented at some point (if
ever).

Reviewed by:    jeffpc_josefsipek.net, kib
MFC after:      10 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D51253
2025-07-13 16:13:25 +09:00
Olivier Certner 986edb19a4 LinuxKPI: Have kvzalloc() rely on kvmalloc(), not kmalloc()
Since commit 19df0c5abc ("LinuxKPI: make __kmalloc() play by the
rules"), kmalloc() systematically allocates contiguous physical memory,
as it should.  However, kvzalloc() was left defined in terms of
kmalloc(), which makes it allocate contiguous physical memory too.  This
is a too stringent restriction, as kvzalloc() is supposed to be a simple
page-zeroing wrapper around kvmalloc().

According to Linux's documentation ("memory-allocation.rst"), kvmalloc()
first tries to allocate contiguous memory, falling back to
non-contiguous one if that fails.  Thus, callers are already supposed to
deal with the possibility of non-contiguous memory being returned.

Reviewed by:    bz
Fixes:          19df0c5abc ("LinuxKPI: make __kmalloc() play by the rules")
MFC after:      10 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D51247
2025-07-13 15:46:49 +09:00
Olivier Certner 4ca9190251 LinuxKPI: alloc_pages(): Don't reclaim on __GFP_NORETRY
Pass VM_ALLOC_NORECLAIM to vm_page_alloc_noobj_contig() so that it
avoids reclaiming (currently, calling vm_reserv_reclaim_contig()).

According to Linux's documentation, __GFP_NORETRY should not cause any
"disruptive reclaim".  alloc_pages() is called a lot from the amdgpu DRM
driver via ttm_pool_alloc(), which tries to allocate pages of the
highest order first and fallback to lower order pages (as allocating
contiguous physical pages is in fact not a requirement).  This process
relies on failing fast, as requested by __GFP_NORETRY.  See also related
commit 718d1928f8 ("LinuxKPI: make linux_alloc_pages() honor
__GFP_NORETRY").

Reviewed by:    jeffpc_josefsipek.net, bz
MFC after:      10 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D51246
2025-07-13 15:41:19 +09:00
Konstantin Belousov bf4d2a45b9 kern_descrip.c: further limit expression in Static_assert() to newer clang
Reported by:	vexeduxr
Sponsored by:	The FreeBSD Foundation
2025-07-13 04:24:14 +03:00
Andrew Gallatin 78bdaa57cf lagg: Fix if_hw_tsomax_update() not being called
In a mixed lagg, its likely that ifcaps or hwassist may not
match between members.  If this is true, the logical OR will
be short-circuited and if_hw_tsomax_update() will not be called.

Fix this by calling it inside the body of the if as well

Sponsored by: Netflix
MFC after: 2 weeks
2025-07-12 18:35:29 -04:00
Konstantin Belousov fb84b9f400 kern_descrip.c: only allow complex expression in Static_assert() for clang
gcc cannot compute the assert expression, which is formally not required
by a C standard.

Reported and reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
2025-07-12 20:56:13 +03:00
Kristof Provost f5dba67334 pf tests: fix anchor:nat test
Don't assume that the epair we created is epair0.

Event:	Berlin 2025 Hackathon
2025-07-12 18:29:27 +02:00
Mateusz Piotrowski 5d5258653b rc.subr: Fix a typo in check_jail()'s description
MFC after:	3 days
Event:		Berlin Hackathon 202507
2025-07-12 18:23:03 +02:00
Mateusz Piotrowski 46f18ecf8d rc: Use check_jail to check values of security.jail MIBs
PR:		282404
Reviewed by:	markj, netchild
Approved by:	markj (mentor)
MFC after:	2 weeks
Event:		Berlin Hackathon 202507
Differential Revision:	https://reviews.freebsd.org/D47329
2025-07-12 18:20:32 +02:00
Mateusz Piotrowski 47ffc24fbb tracing.7: Aproposify
By adding "FreeBSD" to Nd we make tracing(7) discoverable
when running `apropos freebsd`.

Reported by:	ziaee
Event:		Berlin Hackathon 202507
2025-07-12 18:02:00 +02:00
Kajetan Staszkiewicz 16a9f31b8a pf: Don't access sk and nk before they are allocated
The NAT addresses are chosen during ruleset parsing. The new afto code stores
post-nat addresses in nsaddr. The old nat code (also used for new nat-to rules)
creates state keys and stores addresses in them.

Ensure proper way of accessing the NAT addresses in case sticky-address
is used for af-to rules.

Reviewed by:	kp
Approved by:	kp
Sponsored by:	InnoGames GmbH
Differential Revision:	https://reviews.freebsd.org/D50768
2025-07-12 16:27:46 +02:00
Brad Davis 0430faacb6 gstat(8): Fix typo in example to filter the results
Reported by:	rpokala
Fixes:	5652050565 - gstat.8: Add an example of how  to filter the results
2025-07-12 08:23:48 -06:00
Kajetan Staszkiewicz dedb4d3597 pf: Don't return src node and hash from pf_map_addr_sn
The function pf_map_addr_sn() already returns naddr and nkif, there is
no need to return the source node too, it is redundant.
2025-07-12 16:15:10 +02:00
Kristof Provost 3e827cbaa3 ipfilter: fix LINT-NOINET6 build
Event:		Berlin 2025 Hackathon
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2025-07-12 15:04:16 +02:00
Kristof Provost 7c5cc952ff pf: Use the table on root always if current table is not active.
ok sashan

Obtained from:	OpenBSD, yasuoka <yasuoka@openbsd.org>, 26b6297991
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2025-07-12 11:57:52 +02:00
Kristof Provost 116eabaa0b pf: when calculating the ruleset's checksum, skip automatic table names.
the checksum is exclusively used for pfsync to verify rulesets are identical
on all nodes. the automatic table names are random and have a near zero
chance to match. found at a customer in zurich
ok sashan kn

Obtained from:	OpenBSD, henning <henning@openbsd.org>, 7f1a6fd2a8
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2025-07-12 11:57:52 +02:00
Kristof Provost 9f21a946d0 pf: rename PF_OPT_TABLE_PREFIX to PF_OPTIMIZER_TABLE_PFX
Move it to pf.h.
OPT is misleading and usually refers to command line arguments to pfctl

ok sashan kn

Obtained from:	OpenBSD, henning <henning@openbsd.org>, 9c6ad19ba4
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2025-07-12 11:57:52 +02:00
Kristof Provost a4b7e54000 pfctl.8: Mention hostid and checksum
Complete the description of "-s info -v" such that grepping for them
in the manual pager yields something.

Feedback jmc
OK sashan

Obtained from:	OpenBSD, kn <kn@openbsd.org>, 0f5c867d7c
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2025-07-12 11:57:52 +02:00
Kristof Provost 8bced62600 pf: Fix pfr_kentry_byaddr() to be used for a rule in an anchor
It couldn't find an entry if its table is attached a table on the root. This
fixes the problem "route-to <TABLE> least-states" doesn't work.
The problem is found by IIJ.

OK sashan

Obtained from:	OpenBSD, yasuoka <yasuoka@openbsd.org>, a7d8badaea
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2025-07-12 11:57:51 +02:00
Kristof Provost 3030d29571 pfctl: restore '.' at the end of these errors
The sys/netpfil/pf/table:reset_nonzero test expects them, and we're better off
not modifying errors without good reason.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2025-07-12 11:57:51 +02:00
Kristof Provost a9706d78bd pfctl: replace TAILQ concatenation loop with TAILQ_CONCAT
OK kn@, sashan@, florian@

Obtained from:	OpenBSD, bket <bket@openbsd.org>, c8d5c2349e
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2025-07-12 11:57:51 +02:00
Kristof Provost 1ae17b65b6 pf.conf.5: should clearly state range match operator ':' does not work for uid/gid.
OK @kn, OK @sthen

Obtained from:	OpenBSD, sashan <sashan@openbsd.org>, 4521e23a38
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2025-07-12 11:57:51 +02:00
Kristof Provost c87390026a pfctl: Fail on missing anchor
There is no reason to continue on anchor specific paths if the given
anchor does not exist.

OK sashan

Obtained from:	OpenBSD, kn <kn@openbsd.org>, ad846651a1
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2025-07-12 11:57:50 +02:00
Kristof Provost 004062345b pfctl: Do the actual pfr_strerror() to pf_strerror() rename
Missed in previous

Obtained from:	OpenBSD, kn <kn@openbsd.org>, c802a0d9d6
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2025-07-12 11:57:50 +02:00