tests/sigtramp_test: re-enable test on aarch64
This now passes on both aarch64 (since 6a936d939b88)
and amd64. It still fails on other architectures, so
keep the xfail.
PR: 289096
Sponsored by: The FreeBSD Foundation
pwd_altroot(): avoid creating new pwd structure if altroot does not change
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D60035
vfs: guard against altroot pointing to not a directory
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D60035
namei: disallow altroot for beneath lookups
Once namei_setup() has determined that the lookup is strictly relative,
set ni_rootdir to pwd_rdir and mark the lookup as already restarted,
which effectively disables restart on ENOENT.
This is done in namei_setup() and not in NDINIT(), because RBENEATH
might be set after NDINIT() by vn_open_cred() or inherited from
the dirfd in fgetvp_lookup(), and ISRESTARTED is cleared by
NDREINIT()/NDRESET().
Noted by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D60035
exec_new_vmspace(): drop altroot for native processes if setuid
Noted and reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D60035
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
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