boot0cfg: Also allow a file as a trailing argument
Modify the disk check to allow arbitrary files as the trailing argument
instead of requiring a live GEOM disk provider.
This enables modifying a boot0 binary file in-place before flashing it
to a disk via gpart bootcode, or using it directly as an argument to
mkimg's partition specification, as these tools cannot directly adjust
the parameters of the boot0 boot manager.
Reviewed by: imp, jhb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D57310
nanobsd: Restore boot0cfg functionality
The need for this step is fading, now is mostly used to allow the
selection of just the two code partitions in the boot0 boot manager,
instead of the default of allowing all four MBR slices (the other two
being cfg and data, which cannot boot).
Reviewed by: imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D57311
link_elf: Make phdrs first page check actually fatal
Otherwise we'll print an error but carry on regardless, presumably
destined to walk off the end of the mapping.
Reported by: thebugfixers at pm.me
MFC after: 1 week
ipsec: Fix a lock leak in ipsec_chkreplay()
Reported by: Chris Jarrett-Davies of the OpenAI Codex Security Team
Reviewed by: pouria, kp
Fixes: 0361f165f219 ("ipsec: replace SECASVAR mtx by rmlock")
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58521
kqueue: Associate marker knotes with a queue
Otherwise the assertion in KQ_FLUX_SLEEP_WMESG may fail.
kqueue_fork_copy() already handles this.
Fixes: 1f4b0ea4f3eb ("kqueue: Add a helper macro for sleeping on in-flux knotes")
Reported by: syzkaller
Reported by: kbowling
Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58516
authpf(8) read_config() should chop off trailing white space
if administrator mistakenly types into configuration file
anchor=authpf_test
where 'authpf_test' is followed by white space, the authpf(8)
is going to use anchor 'authpf_test ' instead of the 'authpf_test'
which is defined in pf.conf(5) as 'anchor authpf_test/*'
issue kindly reported and patch submitted by
Avinash Duduskar <avinash.duduskar (_at_) gmail (_dot_) com>
OK sashan@
PR: 296958
MFC after: 1 week
Obtained from: OpenBSD, sashan <sashan at openbsd.org>, 2d12a8e44d
[3 lines not shown]
authpf(8) read_config() should chop off trailing white space
if administrator mistakenly types into configuration file
anchor=authpf_test
where 'authpf_test' is followed by white space, the authpf(8)
is going to use anchor 'authpf_test ' instead of the 'authpf_test'
which is defined in pf.conf(5) as 'anchor authpf_test/*'
issue kindly reported and patch submitted by
Avinash Duduskar <avinash.duduskar (_at_) gmail (_dot_) com>
OK sashan@
PR: 296958
MFC after: 1 week
Obtained from: OpenBSD, sashan <sashan at openbsd.org>, 2d12a8e44d
[3 lines not shown]
statfs(2): allow to interrupt busying
There are probably more places which could benefit from allowing to
interrupt vfs_busy() calls at syscalls top level.
Requested by: Peter Eriksson <pen at lysator.liu.se>
Reviewed by: jah, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D58477
vfs_busy(): add MBF_PCATCH flag to allow interrupting the sleep
Reviewed by: jah, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D58477
mt76: mt7921: update man page
Adjust the man page to what other LinuxKPI wlan man pages say and look
like as it has been a while since I wrote it. The man page is not yet
hooked up to the build on purpose as the driver is not yet enabled in
the tree.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: ziaee (earlier version)
Differential Revision: https://reviews.freebsd.org/D58479
make-pkg-package.sh: Fix build for pkg 2.8.0
We used to pass CONFIGURE_ARGS to the make command which builds pkg,
but ports/ports-mgmt/pkg/Makefile has its own CONFIGURE_ARGS and the
version we were providing at the command line didn't contain the
--mandir setting which was added to the port with pkg 2.8.0. This
broke release builds.
Instead of passing --prefix=${LOCALBASE} via CONFIGURE_ARGS, pass
PREFIX=${LOCALBASE}; the port Makefile passes that value through to
its configure script. We also used to pass a --host parameter, but
that seems to have become unnecessary at some point in the past decade.
MFC after: 1 day
Sponsored by: Amazon
(cherry picked from commit 8d92f32ae011719b322b9943d01529cebef741f0)
dwatch: add nine diagnostic modules; grow errno, io, proc, sched
Grow the module collection to answer, each with a single command, the
first questions asked when diagnosing a sick system: why is my
application stalling, where is the kernel fighting over locks, what
file could it not find, why is this process getting EPERM, what killed
my process, will that fatal signal actually leave a core behind, what
was my process stuck on, where is my kernel memory going, who is
creating or entering jails, is the network slow because TCP is
resending, how long did my thread wait to run, and is the disk itself
slow. Every module keeps to the house style: invocation-name
overloading through hard links, predicate-only D with inline lookup
tables (no if-statements), and stable providers only (syscall, proc,
sched, io, dtmalloc, and the lockstat, vfs, priv, and mib SDT
providers), so the modules remain drop-in compatible with older
releases (the one documented exception is noted below). No kernel
changes: new and extended profiles under cddl/usr.sbin/dwatch/libexec
plus one libdtrace inline table (priv.d).
[129 lines not shown]
nvme: Add quirk for broken namespace-change log
Add a QUIRK_EMPTY_NAMESPACE_CHANGED_LOG quirk which indicates that the
nvme controller may not properly populate the namespace-changed log
page. If we receive a NVME_LOG_CHANGED_NAMESPACE page for a device
with this quirk and the page is empty, probe all of the namespaces
rather than none of them.
Reviewed by: imp
MFC after: 1 week
Sponsored by: Amazon
Differential Revision: https://reviews.freebsd.org/D58231
nvme: Add quirk for Amazon EBS NVMe Controller
This controller exhibits QUIRK_EMPTY_NAMESPACE_CHANGED_LOG behaviour.
A bug report has been filed with the vendor.
Reviewed by: imp
MFC after: 1 week
Sponsored by: Amazon
Differential Revision: https://reviews.freebsd.org/D58232
nda: Don't sleep with non-sleepable lock held
We reach ndaasync with the CAM device lock held, so we must pass
M_NOWAIT to disk_* rather than M_WAITOK.
Reviewed by: imp
Fixes: 628d7a3270b6 ("nda: AC_GETDEV_CHANGED calls media chanaged for sectorsize change")
MFC after: 1 week
Sponsored by: Amazon
Differential Revision: https://reviews.freebsd.org/D58230
tcp_hostcache: ensure expire and prune values stay consistent with each other
When configuring the expire timeout to something short, make sure that the
prune time runs at least at that interval. Similarly, when adjusting the
prune interval up, ensure the expire timeout reflect that expected minimum
time also. Finally, restart the callout timer so that the next pruning
happens after the new, expected interval.
Reviewed By: glebius
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D58424
tcp_hostcache: limit scope of struct hc_metrics_lite and rename with tcp_ prefix
Restrict the scope of the struct hc_metrics_lite to the kernel only.
Update the naming to align with other kernel structures and add a tcp_ prefix.
Reviewed by: glebius
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D58440
routing: Add tests for prefsrc route attribute
Add tests for both IPv4 and IPv6 routes with the prefsrc attribute.
Also test IPv4 routes over IPv6 nexthops and borrow their IPv4
addresses from the loopback interface.
Reviewed by: glebius
Differential Revision: https://reviews.freebsd.org/D58326
route(8): Add prefsrc option in netlink
Add prefsrc option that is frequently used on unnumbered interfaces
or L3 multi-homed network hosts.
This option uses RTA_PREFSRC.
Now you can add a static route by specifying the prefsrc option
with the loopback IP.
PR: 285422
Reviewed by: glebius
Differential Revision: https://reviews.freebsd.org/D58294
netlink: Add RTA_PREFSRC support
Add the ability to select source ip address of outgoing packets
even when the source ip address is configured on another interface.
Also add this new rtnetlink attribute to manual.
PR: 285422
Reviewed by: glebius, ziaee (manpages)
Tested by: ivy, Marek Zarychta <zarychtam at plan-b.pwste.edu.pl>
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D58294
nd6: Do not enter net_epoch under nd6_prelist_add
nd6_prefix_onlink will enter net_epoch when necessary.
Also, exit net_epoch earlier in nd6_prefix_onlink,
Because we acquired a reference to ifa, and we got our ifa
from the pr->ndpr_ifp, we don't need to stay under epoch.
While here, style it.
Reviewed by: markj, glebius
Discussed with: zlei
Differential Revision: https://reviews.freebsd.org/D56129
nd6: Set ip6 after m_pullup() in nd6_ra_input()
nd6_ra_input() reads the IPv6 header pointer ip6 before m_pullup(), then
uses that pointer afterwards to set nd_ra.
When m_pullup() relocates the chain it frees the original first mbuf and
returns a new one, leaving ip6 dangling; the subsequent access may be a
use-after-free read.
The fix writes ip6 from the returned mbuf after m_pullup() inside the
conditional if.
Reviewed by: pouria
Differential Revision: https://reviews.freebsd.org/D58229
tcp: improve handling of stopped timers
When a TCP timer is stopped, t_timers[] is set to SBT_MAX. Adding the
corresponding t_precisions[], if it is not zero, would result in
overflows in tcp_timer_next(). To avoid this, skip stopped timers.
The problem was identified while debugging uperf by Lukas Book and
an initial patch was provided by him. The committed patch was
suggested by glebius.
The problem can be observed by running netstat -nxptcp and looking for
negative timer values and by observing very long running timers in
some cases.
Reported by: Lukas Book <lkbook at outlook.de>
Reviewed by: glebius
Differential Revision: https://reviews.freebsd.org/D58484
kern_pdwait(): print the process pointer through pd
to avoid using uninitialized value in the KASSERT() statement on the first
iteration.
Also, do the assert under the proctree_lock, which is not critical but
satisfies the invariants.
Noted and reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D58505
proc_realparent(): assert that an orphaned child has real parent != parent
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D58504
pmc: enable the new pmc commands
This change hooks everything up to the pmc command and improves the
usage to document all functions. There are a couple older commands that
are currently broken that I have hidden from the usage, but left in the
code for those using it. I won't remove those until we have our
replacements upstreamed that depend on the AMD PMC multiplexing patches.
Sponsored by: Netflix
Reviewed by: adrian, imp
Differential Revision: https://reviews.freebsd.org/D57780
pmc: pmc info command
Prints the log header including machine, cpu and kernel details along
with what counters were selected.
Sponsored by: Netflix
Reviewed by: adrian, imp
Differential Revision: https://reviews.freebsd.org/D57778
pmc: pmc frontend stall analysis based on IBS
The frontend command uses AMD IBS frontend events to analyze the major
sources of frontend stalls. It displays a table breakind down the major
causes of front end stalls. This is a simple demonstration of the tools
as you can use the filtering tools to limit the analysis to a subset of
the samples including filtering by fetch latencies.
Sponsored by: Netflix
Reviewed by: adrian, imp
Differential Revision: https://reviews.freebsd.org/D57779
pmc: pmc record command
The record command is designed around the idea of predefined studies.
While you can still select individual counters, the predefined studies
are meant to enable the best hardware options for a given generation.
It implements all of the base studies that I have built so far.
Sponsored by: Netflix
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D57777