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
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
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
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
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
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
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
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
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
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
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
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
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
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>
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
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
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
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
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
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
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
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")
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")
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")
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")
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")
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")