libsysdecode: Avoid non-portable \> word end boundary in mktables
Whilst we bootstrap our own sed when building on non-FreeBSD, it uses
the system regex(3) implementation, and so inherits its extensions, not
our own. Our implementation and glibc's both include this extension to
POSIX, but macOS's does not, and so even with our bootstrap sed we
cannot use the \> extension when built and run on macOS.
Unfortunately, there is no alternative form we can use; whilst macOS
implements [[:>:]] as an extension that provides this same feature, and
so do we, the regex(3) implementation in glibc does not, and the only
alternative glibc offers is \b, which neither us nor macOS implement.
We could make the form used conditional on the OS, but that starts to
get messy once other Linux libcs enter the picture, which in theory we
somewhat support.
Rewrite both uses to avoid the need for \>. For gen_table, use a pattern
to match the identifier that is precisely the (non-extended) C99
[23 lines not shown]
nuageinit: Fix typo, whitespace, and lua style in new test
Fixes: e82b8378de19 ("nuageinit: Also add -n to pw usermod and pw groupshow")
Sponsored by: The FreeBSD Foundation
dns/encrypted-dns-server: Update 0.9.21 => 0.9.22
Changelog:
https://github.com/DNSCrypt/encrypted-dns-server/compare/0.9.21...0.9.22
While here:
- Remove patch that fixes build without METRICS as it upstreamed.
- Set ETCDIR to ${PREFIX}/etc/encrypted-dns so it matches the
chroot() path in the shipped sample configuration.
- Create pkg-message.
PR: 300945
MFH: 2026Q4
lindebugfs: Do not expose a node before its private data is set
pfs_create_file(), pfs_create_dir() and pfs_create_link() link the new node
into its parent and return, and only then do the debugfs_create_*()
functions set pn_data. Between the two, the node can already be found by a
lookup but pn_data is NULL, so a concurrent stat(2) or read(2) calls
debugfs_attr(), debugfs_fill() or debugfs_fill_data() which dereference it:
a driver creating debugfs entries while lindebugfs is mounted can panic
whoever is looking at the tree at that moment. The window is only a few
instructions wide, which made it hard to hit; with a delay added on purpose
it panics at once in debugfs_attr() called from stat(2).
Changing pfs_create_*() to take the data would change the pseudofs API and
ABI. Use the visibility callback instead: pseudofs checks it before
creating a vnode for a node and before getattr, read and write, so a
node whose pn_data is not set yet is reported as not visible and lookups
return ENOENT. The data is published with a release store and read with an
acquire load, so whoever sees the pointer sees the initialized dentry_meta.
debugfs_lookup() now also returns NULL for such a node.
[4 lines not shown]
dwc: Limit the DMA of the QoS core to the address width of the hardware
The QoS core is used with the 64 bits descriptor address scheme, TDES1
and the *DLAR_HI registers holding the upper 32 bits. This only works
when the core was synthesized with a wider than 32 bits address bus. The
RK3568 GMAC for example has a 32 bits DMA: DMASBMR.EAME cannot be set and
the *DLAR_HI registers read back as zero. The DMA tags allowed any
address, so on systems with memory above 4GB the descriptor rings and the
mbufs could be allocated there and the core fetched descriptors and data
from the truncated addresses. Nothing could be sent or received.
Read the address width from the ADDR64 field of the MAC hardware feature 1
register, like Linux does, and limit the DMA tags to it. Memory that
cannot be reached is bounced by busdma.
Tested on a Quartz64 Model A with 8GB of RAM and on a NanoPi R5S.
Reviewed by: br
Differential Revision: https://reviews.freebsd.org/D61018
dwc: rockchip: Do not enable the same clock twice
Some Rockchip SoCs reference the same clock from several clock-names
properties. On the RK3568 both mac_clk_tx and clk_mac_speed reference
the same clock: SCLK_GMAC0_RX_TX on GMAC0 and SCLK_GMAC1_RX_TX on
GMAC1. So if_dwc_rk_init_clocks() enables that clock twice through two
different handles.
The clk framework then considers that the clock has more than one
consumer and refuses the rate change done by rk3568_set_speed() with
EBUSY, as the clock is not glitch-free.
Only enable clk_mac_speed if it is not the same clock as mac_clk_tx.
Reviewed by: oh
Differential Revision: https://reviews.freebsd.org/D61016
dwc: Program the DMA burst length of the QoS core
dma4_init() set the 8xPBL mode bit but never wrote the programmable burst
lengths, which stay at the reset value of one beat, so the DMA engines issue
very short bursts. The TX and RX burst lengths are already parsed from the
device tree (snps,pbl, snps,txpbl, snps,rxpbl, default 8) for the older
core, use them here too.
Reviewed by: br
Differential Revision: https://reviews.freebsd.org/D60920
dwc: Do not report a negative number of output errors with the QoS core
The good and the total transmitted packet counters are not read atomically,
so the difference can be negative when a packet completes between the two
reads. It was added to the error counter as a huge unsigned value. Only
add it when the total is larger.
Differential Revision: https://reviews.freebsd.org/D60919
dwc: Configure the AXI request limits and mixed burst of the QoS core
dma4_init() wrote the system bus mode register with only the burst length
and enhanced address bits, which left the maximum number of outstanding AXI
requests at its reset value of one and did not honour mixed burst. The
receive DMA could not keep up and dropped frames in the FIFO while the CPU
was mostly idle.
Parse the snps,axi-config node of the device tree (the maximum number of
outstanding read and write requests) with the other snps properties, and
program the limits, the hardware fields hold the limit minus one. Set the
mixed burst bit when snps,mixed-burst is present, as the eqos driver does.
Differential Revision: https://reviews.freebsd.org/D60918
dwc: rockchip: Add support for the RK3568 GMAC
The RK3568 GMAC is a DesignWare Ethernet QoS core (version 5.x), which dwc
supports since 9006a6ad1b30. Add the SoC specific code:
- Select the GMAC0 or GMAC1 GRF registers from the device address, set the
PHY interface and the RX/TX clock delays.
- Switch the RGMII speed clock according to the media (the device tree only
selects the gigabit one).
- Compute the MDIO clock range from the main clock, the CSR clock of this
core.
- Set DWC_HAS_GMAC5 so that the QoS backend is used.
eqos also matches this device, probe with a higher priority until it is
removed.
Differential Revision: https://reviews.freebsd.org/D60917
dwc: Use the MAC address from the device tree
The bootloader usually sets the Ethernet address of the device in the
device tree (mac-address or local-mac-address), but the driver only used the
address read from the hardware, or a random one if there is none.
Use fdt_ether_get_addr() right before attaching the interface, so the address
from the device tree is preferred and the one from the hardware (or generated)
remains the fallback.
Differential Revision: https://reviews.freebsd.org/D60916
clk: Do not print errors when testing a frequency
clk_set_freq() with CLK_SET_DRYRUN is used to check if a clock can
provide a frequency, for example when a mux looks for a suitable parent.
Several candidates are expected to fail, so only report an error for
real requests, or when bootverbose is set.
Differential Revision: https://reviews.freebsd.org/D61020
rk3568_cru: Allow the GMAC RGMII speed clock to reparent
The RGMII speed mux selects between the 125MHz GMAC clock and fixed
dividers of it that provide the 25MHz (100M) and 2.5MHz (10M) clocks.
Without RK_CLK_MUX_REPARENT the mux does not try its parents and the
rate request is forwarded to clk_gmac0 (and above), where it fails with
EBUSY because that clock is enabled by more than one consumer.
Mark both RGMII speed muxes as reparenting so that the rate is achieved
by selecting the appropriate fixed divider.
Reviewed by: oh
Differential Revision: https://reviews.freebsd.org/D61019
nuageinit: Also add -n to pw usermod and pw groupshow
Commit 7e11a18e74ba ("nuageinit: Use -n with pw usershow") fixed a bug
wtih `pw usershow` and numeric user names. Fix the smae issue with
`pw usermod` and `pw groupshow`.
Reported by: llm-postcr
Reviewed by: bapt
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D61761
nuageinit: Add test for user named "0"
Commit 7e11a18e74ba ("nuageinit: Use -n with pw usershow") fixed a bug
with numeric user names. For a user named "0" we would previously look
up and return information for uid 0 (root) instead.
Add a test for this. Confirmed that the new test fails without
7e11a18e74ba.
Reviewed by: bapt
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D61759
stdio: Fix error case for positional %wN / %wfN
In the case were N was not a valid bit width, we were taking the wrong
error path.
Fixes: 5e809bf1c93f ("stdio: Fix positional %wN / %wfN conversion")
(cherry picked from commit 0bf5d86620d047b4551d7414bf8011a328264b3d)
stdio: Fix positional %F conversion
When a format uses positional arguments, __find_arguments() walks it
first to learn the type of every argument, and lists the floating
point conversions as A a E e f G g. F is missing, so a double that
is only referred to through %F never gets a type, its slot in the
argument table stays unset, and the conversion reads whatever is
there:
printf("[%1$F]\n", -INFINITY); [0.000000]
printf("[%1$F]\n", 1.5); [0.000000]
printf("[%F]\n", 1.5); [1.500000]
With a width taken from another argument, "%1$*2$F", vsnprintf(3)
returned lengths like 2103024 for a ten character result; abseil's
str_format test allocates that much and was killed for it on
FreeBSD. The same format with %1$f, or with any other conversion of
the same argument, works because those give it a type.
[9 lines not shown]
clang: Fix warnings in ARM GCS ACLE header
Including <arm_acle.h> in C code compiled with -Wstrict-prototypes
results in warnings (or errors if -Werror is in effect) due to missing
parameter lists for __gcspr() and __gcspopm().
Submitted upstream as PR#242286.
MFC after: 1 week
Reported by: Pete French <pete at twisted.org.uk>
Reviewed by: dim
Differential Revision: https://reviews.freebsd.org/D61503
(cherry picked from commit 74d72b3491e810068313e49629c3b8fe46f29318)
libgeom: Open the control device read-write
Try to open the control device read-write first, and fall back to
read-only if that fails and the error is EACCES. This prepares us for a
future in which GEOM requires write access to execute verbs that modify
the configuration.
MFC after: 1 week
Event: EuroBSDCon 2026 DevSummit
Reviewed by: imp, markj, emaste
Differential Revision: https://reviews.freebsd.org/D59592
(cherry picked from commit 1e9e198b7f064322687746d26b283c3fcbad4579)
geom: Check file flags before handling control request
Pass fflag down to g_ctl_req() and:
* Refuse all requests unless fflag has the FREAD bit set
* Refuse all but getxml unless fflag also has the FWRITE bit set
This should allow us to restore read access to /dev/geom.ctl for group
operator; they will then be able to run `gpart list` or `gpart backup`
but not commands that actually modify the table.
For backward compatibility, we set the FWRITE bit if it is not already
set and the calling thread has the PRIV_GEOM privilege, which is
automatically granted to a jailed or unjailed superuser. This should
cover the case of older binaries (which open /dev/geom.ctl read-only)
running as root on a newer kernel. Since we intend to merge this to
stable/15, the compatibility code is conditional on COMPAT_FREEBSD14.
[6 lines not shown]
stdio: Fix error case for positional %wN / %wfN
In the case were N was not a valid bit width, we were taking the wrong
error path.
Fixes: 5e809bf1c93f ("stdio: Fix positional %wN / %wfN conversion")
(cherry picked from commit 0bf5d86620d047b4551d7414bf8011a328264b3d)
clang: Fix warnings in ARM GCS ACLE header
Including <arm_acle.h> in C code compiled with -Wstrict-prototypes
results in warnings (or errors if -Werror is in effect) due to missing
parameter lists for __gcspr() and __gcspopm().
Submitted upstream as PR#242286.
MFC after: 1 week
Reported by: Pete French <pete at twisted.org.uk>
Reviewed by: dim
Differential Revision: https://reviews.freebsd.org/D61503
(cherry picked from commit 74d72b3491e810068313e49629c3b8fe46f29318)
stdio: Fix positional %F conversion
When a format uses positional arguments, __find_arguments() walks it
first to learn the type of every argument, and lists the floating
point conversions as A a E e f G g. F is missing, so a double that
is only referred to through %F never gets a type, its slot in the
argument table stays unset, and the conversion reads whatever is
there:
printf("[%1$F]\n", -INFINITY); [0.000000]
printf("[%1$F]\n", 1.5); [0.000000]
printf("[%F]\n", 1.5); [1.500000]
With a width taken from another argument, "%1$*2$F", vsnprintf(3)
returned lengths like 2103024 for a ten character result; abseil's
str_format test allocates that much and was killed for it on
FreeBSD. The same format with %1$f, or with any other conversion of
the same argument, works because those give it a type.
[9 lines not shown]