UPDATING: note login-name validation in pw(8)/pwd_mkdb(8)
An existing master.passwd with a login name containing a now-disallowed
charater will make pwd_mkdb(8) fail until the name is fixed, which blocks
passwd(1), chpass(1) and pw(8). Warn users to audit their accounts
befroe updating.
Reviewed by: bcr
Differential Revision: https://reviews.freebsd.org/D61507
sched_ule: Fix rare deadlock on stealing a migrated lock-blocked thread
Thread stealing ultimately happens in tdq_move() which, while holding
the locks of the source and destination runqueues, has to wait for the
stolen thread to be lock-unblocked. If it is indeed lock-blocked, the
corresponding sched_switch_migrate() needs to re-acquire the lock of the
runqueue of the CPU it is running on before being able to lock-unblock
it. This amounts to adding a "hidden" and variable additional
lock-ordering dependency between the 'struct tdq' locks held by
tdq_move() and that of an arbitray third 'struct tdq', possibly
violating the ordering established by tdq_lock_pair(). In that case,
other steals occurring in parallel and involving the same queues can
deadlock the scheduler.
Fix that by having sched_switch_migrate() hold its current CPU's
runqueue's lock in addition to the remote CPU's before the migrated
thread can appear on the remote runqueue, so that it does not have to
re-acquire the former, removing the "hidden" lock-ordering dependency.
[127 lines not shown]
sched_ule: tdq_move(): INVARIANTS: Remove a superfluous assertion
That the lock of the stolen thread is the same as the source runqueue is
already checked by sched_rem().
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
proc.h: Order thread_lock*() functions more logically
Also matches the implementation order in 'kern_mutex.c'.
No functional change.
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
sched_ule: sched_rem(): Use THREAD_LOCKPTR_ASSERT() instead of MPASS()
This gives a better message.
While here, add some empty lines to make INVARIANTS-only statements
stand out for better readability.
No functional change.
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
sched_ule: tdq_add(): INVARIANTS: Add check, fix name in assertion strings
Change the assertion on the to-add thread's lock so that it also fails
if the thread's lock is not that of the 'tdq' (the checks that it is
lock-unblocked and locked remain).
It is tempting to add another check that the thread's 'ts_cpu'
corresponds to the passed runqueue (in other words, that it has been set
correctly), but that requires to add a call to thread_lock_block_wait()
which should not be present in non-debug code, and that may prevent some
races from happening on INVARIANTS, so I gave up on it.
Fix the function name in assertion strings, as sched_add() is not the
only (direct or indirect) caller of tdq_add().
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
sched_ule: Document fields of 'struct runq_steal_pred_data'
While here, re-order them to have inputs before outputs.
No functional change.
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
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.
[4 lines not shown]
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
acpi_pci_link: Ignore tunables with negative values
IRQ values are unsigned and negative values do not make sense. The
invalid IRQ value (255) is already ignored, so ignoring other invalid
values is consistent with that behavior.
Reported by: cperciva
acpi_pci_link: Handle IRQ values > 255
Some systems use a stub PCI link device for hardwired interrupts
instead of static _PRT entries. These link devices can use an IRQ >
255. The current driver was designed to handle PCI link devices on
x86 used for legacy INTx IRQs which were < 255. These changes handle
larger IRQ values while making a few tradeoffs.
- Expand most IRQ fields from 8 bits to 32-bits. The BIOS IRQ
(read from the PCIR_INTLINE config register which is an 8-bit register)
remains 8 bits.
- Add a wrapper API for managing interrupt weights and avoid tracking
weights for IRQs > 255 and instead report a constant weight of 0 for
IRQs > 255.
PR: 300476
Reported by: Aviv Bakal <avivb at amazon.com>
Tested by: cperciva
tests: Add test for vn_io_fault1 bug
This bug was fixed in b487aca48535, but I did not have a regression
test ready for it at the time.
The test allocates a large buffer, faults part of it in and leaves the
rest unmapped, then tries to read a 3 GiB file into it. If the bug is
present, the read succeeds, but the return value exceeds the requested
amount by exactly one page less than the amount that was prefaulted.
PR: 298159
MFC after: 1 week
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D61475
(cherry picked from commit ba02bbbe86aeca0c95c8e7d12c1be357ebb3ddeb)
tests: Improve vn_io_fault1 test
[21 lines not shown]
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.
[7 lines not shown]
netmap: Handle TX buffers larger than MCLBYTES
The generic netmap TX pool always allocates standard clusters
(zone_clust), even though the buffer size may be larger.
INVARIANTS kernels panic in nm_os_get_mbuf() on first transmit through a
non-native NIC (e.g. re or epair) using netmap with jumbo frames
configured. Release kernels silently truncate frames in
nm_os_generic_xmit_frame().
Implement cluster zone selection based on the requested size. Catch
oversized requests in nm_os_catch_tx() and return EINVAL. Add a KASSERT
before the truncation fallback in xmit. Make nm_os_get_mbuf() take a
uint32_t size, matching the type of the value passed to it.
Tested using epair, pkt-gen, and tcpdump on release (15.1) and
INVARIANTS (main) kernels at buffer sizes 2048/4096/9216/16384.
Reviewed by: vmaffione, kevans, markj
[2 lines not shown]
libifconfig: Fix SFP table generators for Lua 5.5
This fixes Lua 5.5 compat in the .c template, where the first loop
variable '_' becomes const in Lua 5.5. Use select() to discard inside
the loop instead.
While here, fix a mismatched variable name in the corresponding header
template.
Reported by: Austin Horstman <khaneliman12 at gmail.com>
Reviewed by: kevans
Approved by: kevans (mentor)
Closes: https://github.com/freebsd/freebsd-src/pull/2473
Differential Revision: https://reviews.freebsd.org/D61455
liblua: Accept + and e in io.popen mode
Our popen(3) accepts more than the historical "r" and "w" types. Define
the appropriate macro to provide a custom mode check accepting all valid
pipe types.
Reviewed by: kevans
Approved by: kevans (mentor)
Differential Revision: https://reviews.freebsd.org/D61175
lua: Prune unused luaconf.h copies
Both stand and lib use luaconf.h from contrib and make local
customizations in their respective luaconf.local.h files since
8c784bb8cf36.
Reviewed by: kevans, imp
Approved by: kevans (mentor)
Fixes: 8c784bb8cf36 ("lua: Update to 5.4.4")
MFC after: 3 days
MFC to: stable/14, stable/15
Differential Revision: https://reviews.freebsd.org/D61456
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
ixgbe: Classify missed packets only as input drops
Missed packets should be counted as drops, not as both drops
and errors. Errors should be reserved for things like link level
crc errors.
Reviewed by: kbowling
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D61523
powerpc: fix the VSCR save and restore on little endian
VSCR was saved and restored through stvewx/lvewx at byte 12 of a
16 byte slot. Which element those instructions move at a given address
depends on the byte order, so on little-endian kernels they touched VR
bits 0-31 instead of the 96-127 where mfvscr/mtvscr keep VSCR: every
context switch and signal reset VSCR to 0, losing NJ and SAT.
Replicate the word into all four elements first so that the element
choice no longer matters.
VSCR[NJ] set with mtvscr read back as 0 after a usleep on a
little-endian kernel; it is preserved now.
Reviewed by: adrian, jhibbits
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D61525