Mark Johnsons Claude code found a duplicate call to rack_check_reorder_ack() in rack.c
Mark's Claude code properly points out an interesting bug case where if a new block is
created from a sack aka
rsm |--------|
sackblk |--------->
Then when the new block is created rack_check_reorder_ack() is called and then called again when
the block is actually ack'ed. Proper thing is to *not* in this case call the function and only call
it at the processing to ACK. You leave the hookery side however since that is just transfering
the existing block pointers.
Differential Revision:https://reviews.freebsd.org/D61159
kern: Remove unreachable compat_freebsd8 FEATURE
COMPAT_FREEBSD8 does not exist as a kernel option, so this is dead code.
No functional change intended.
Fixes: e256f71389fb ("kernel: add missed FEATUREs compat_freebsd 8-14")
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Reviewed by: kib
Pull-Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/80
(cherry picked from commit 9da2c05a748fd17757638e1a9e78215cdb8b80d0)
arm64 pmap: demote L3C pages in pmap_clear_modify()
When pmap_clear_modify() demotes a dirty L2 block mapping, it write
protects the L3 entry that maps "m", so that a subsequent write access
may repromote. However, since fd6cb031f577, the L3 entries created by
pmap_demote_l2_locked() may have ATTR_CONTIGUOUS set, and
pmap_clear_modify() was write protecting one L3 entry within an L3C page
while leaving the page's other L3 entries writeable with ATTR_CONTIGUOUS
still set. A TLB entry that a processor creates from any of those other
L3 entries may translate "m"'s virtual address and permit writes to "m"
without a fault. To fix this issue, as in pmap_remove_write(), demote
the L3C page before write protecting the L3 entry.
(cherry picked from commit 6d7960628f825f1eec0959d6000a79ca8a4ae927)
pci: restore resizable BAR sizes in pci_cfg_restore()
After a device reset, resizable BARs return to their default sizes.
Restore them to the sizes they had prior to reset.
Reviewed by: imp, adrian
Differential Revision: https://reviews.freebsd.org/D61110
Approved by: adrian (mentor)
Signed-off-by: Nick Price <nprice at FreeBSD.org>
ppp: bound Predictor-1 decompression output
Pred1Input() decompressed CCP data into a MAX_MRU+2 mbuf with no limit
on the output, so a peer could expand a short compressed frame (up to
8:1) past the buffer and overflow adjacent heap. An input length below
4 also drove decompress() with a negative length.
Reject out-of-range input lengths and stop decompression at the
destination buffer size.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D61011
Approved by: adrian (mentor)
Signed-off-by: Nick Price <nprice at FreeBSD.org>
ppp: drop config packets whose options overrun the packet
fsm_readopt() advanced the decode cursor by the option length without
checking it against the end of the packet. A crafted LCP/CCP/IPCP
option could then make the Config-Reject/Nak echo copy past the
received packet into adjacent heap, disclosing heap bytes to the peer
before authentication.
Check the option framing once in fsm_Input() and drop the packet before
decoding per RFC1661
Reviewed by: adrian, markj
Differential Revision: https://reviews.freebsd.org/D61008
Approved by: adrian (mentor)
Signed-off-by: Nick Price <nprice at FreeBSD.org>
linux: do not truncate the listxattr() size
listxattr() sized its buffer with min(), which truncates the 64-bit
size to 32 bits, so a size of 2^32 + k allocated k bytes while the
copy-out guard used the full size. The walk then read record lengths
past the buffer and copied kernel heap out to the caller, and could
panic the kernel. Any user can reach it through a user.* attribute on
a file it owns.
Use MIN(), and fail with EIO if a record runs past the data returned.
Reviewed by: adrian, markj
Approved by: adrian (mentor)
Differential Revision: https://reviews.freebsd.org/D61006
Signed-off-by: Nick Price <nprice at FreeBSD.org>
xdr: Limit xdr_wrapstring
The previous commit (re)introduced the possibility that a malicious or
corrupt message can cause the receiver to allocate a very large amount
of memory before realizing that the message is much shorter than
claimed. Revert the change to xdr_wrapstring() to avoid this.
Fixes: d2018cedb414 ("xdr: Fix xdr_string")
Reported by: bjk@
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D60898
iSCSI: Fast and per-session timeouts
Support per-session configurable ping (SCSI NOP) and login timeouts
similar to what is supported in the Linux iSCSI initiator configuration file.
Reduce iscsi timer granularity to 0.1 sec.
For backwards compatibility, when all timers are selected on integer numbers,
all status messages are unchanged. If the higher granularity is used, the
log messages include sub-second granularity.
The sysctl(3) interface has changed from pure int to string, in order to
support fractional seconds in a human-readable, dotted notation.
Reviewed By: #netapp, #manpages, jhb, pauamma_chezdork.com, siderop1_netapp.com
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D32540
asmc: move the sysctl registration loops next to their tables
asmc_attach() and asmc_init() had 4 description tables inline,
several hundred lines from the tables they index. Wrapped each loop in a
function defined after its table.
No functional change.
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D61293
asmc: make the raw key debug state unconditional
The ASMC_DEBUG block was in mid-struct, so struct asmc_softc had a different
layout in translation units that missed opt_asmc.h.
No functional change.
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D61292
asmc: move the backlight control level into the softc
light_control was a file-scope static shared by resume, the light.control
sysctl and the backlight method. Per-device state belongs in the softc.
No functional change.
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D61291
asmc: scan every sensor range through one helper
asmc_detect_sensors hand-rolled the temperature and light scans as copies
of asmc_scan_sensor_range(). Give the helper a match predicate and route
all five ranges through it.
No functional change.
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D61289
asmc: table-drive the system state and board identity sysctls
The dev.asmc.n.system subtree was seven copies of "probe the key, then
register", and the auto_poweron/sil pair in asmc_init two more. Drive both
from tables.
No functional change.
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D61288
asmc: collapse the SMS axis and light sensor sysctl handlers
asmc_mb_sysctl_sms_{x,y,z} differed only in which SMS key they read, and
asmc_mbp_sysctl_light_{left,right} only in which light key. One handler
each, selecting from a table through arg2.
No functional change.
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D61287
asmc: collapse the per-fan speed sysctl handlers
The five fan speed handlers differed only in which key they read and
whether they wrote back. Select the key from a table through arg2, the way
asmc_sensor_sysctl() already packs a type and an index, and keep one
handler. A second table drives the seven registration calls.
No functional change,
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D61286
asmc: share the getinfo and getbyindex PIO transactions
asmc_key_getinfo() and asmc_key_dump_by_index() both ran the command 0x13
transaction, the latter after a command 0x12. Put each behind a helper that
assumes the caller holds sc_mtx, and fold the shared response decode into
asmc_keyinfo_decode().
The index bytes are now derived inside the helper, so they are recomputed
per retry. Same value all the time.
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D61285
asmc: rebuild asmc_key_dump on the by-index helper
asmc_key_dump() branched on the backend, but asmc_key_dump_by_index()
already dispatches on it, so the PIO arm open-coded a transaction it could
have called. Keep one printer for both.
Output is unchanged. The PIO arm checked asmc_key_read()'s return value
instead of printing a zeroed buffer; the merged printer keeps that. Its
retry exhaustion message is gone, which asmc_dumpall() cannot observe.
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D61284