FreeBSD/src 59409ef — sys/netpfil/pf if_pfsync.c

pfsync: account for second tickover in bulk updates

When one peer requests a bulk update it keeps track of when it sent this
request. The exporting peer includes 'endtime', indicating how long it
took to send the entire update along with its final message.

That allows the receiving peer to verify that the entire update was done
in response to its most recent request. However, due to different second
tickovers this calculation might be off by one.

Use milliseconds internally. This does not change the wire protocol,
'endtime' is still expressed in seconds. When the exporting peer
computes this value it will implicitly round down.

PR:             300824
Sponsored by:   Rubicon Communications, LLC ("Netgate")

(cherry picked from commit f3cb62f798070570db00b51138873474c31bbc6a)
DeltaFile
+9-8sys/netpfil/pf/if_pfsync.c
+9-81 files

FreeBSD/src 1b494ac — sys/netpfil/ipfw ip_dummynet.c

dummynet: Ignore DN_QHT_HASH when checking for an unchanged flowset

fsk_attach() sets DN_QHT_HASH in fs->fs.flags when the flowset or its
scheduler has a mask. Userland never sends that flag, so the bcmp() in
config_fs() never matches for such a flowset and re-applying the same
"queue N config ... mask ..." line takes the changed path, which
destroys all queues of the flowset and the packets in them. Firewall
front ends that re-run their dummynet config on every reload hit this.

Take the flag from the existing flowset before the comparison. If the
flowset did change, fsk_attach() computes the flag again.

PR:             298731
Reviewed by:    kp
Signed-off-by: Abdul Wasey <w453y.me at gmail.com>
Differential Revision:  https://reviews.freebsd.org/D61257
DeltaFile
+3-0sys/netpfil/ipfw/ip_dummynet.c
+3-01 files

FreeBSD/src e02b6be — sys/netpfil/ipfw ip_dummynet.c

dummynet: Allow AQM reconfiguration of flowsets with traffic

config_aqm() refused to configure CoDel/PIE on a flowset whose
scheduler had a hash table or an instance ("flowset busy"). The check
was there because queues that already exist were left without AQM
state after aqm_cleanup_deconfig_fs(). It had two bad effects:

- a scheduler with a mask always has siht allocated, so CoDel/PIE could
  never be configured on "pipe N config ... mask ... codel" or on a
  queue of a masked scheduler, even with no traffic at all;
- on the changed-parameters path of config_fs(), fsk_detach() has
  already removed the old AQM, so a refusal left the flowset with
  DN_IS_AQM set and aqmfp NULL. Changing the weight of a queue while
  its pipe carried traffic silently turned it into droptail.

The error never reached userland, only the kernel log.

Instead of refusing, init the AQM status of the queues that exist
after the new AQM is configured, which is what si_new() and q_new()

    [12 lines not shown]
DeltaFile
+76-24sys/netpfil/ipfw/ip_dummynet.c
+76-241 files

FreeBSD/src 9be24df — tests/sys/netpfil/common dummynet.sh

dummynet tests: Add CoDel/PIE masked and reconfiguration cases

aqm_masked configures CoDel and PIE on pipes with a mask and CoDel on
a queue of a masked WF2Q+ scheduler. aqm_reconfig changes the
parameters and the AQM of a pipe and of two queues (one masked) while
ping keeps an instance alive, and checks that the AQM is still there
and that traffic still passes afterwards.

PR:             298731
Reviewed by:    kp
Signed-off-by: Abdul Wasey <w453y.me at gmail.com>
Differential Revision:  https://reviews.freebsd.org/D61258
DeltaFile
+133-0tests/sys/netpfil/common/dummynet.sh
+133-01 files

FreeBSD/src 7ccc288 — lib/libpfctl libpfctl.c

libpfctl: remove pfctl_get_status()

It has been replaced by the pfctl_get_status_h() variant.

Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+0-101lib/libpfctl/libpfctl.c
+0-1011 files

FreeBSD/src cb67601 — lib/libpfctl libpfctl.c

libpfctl: remove unused pfctl_get_clear_rule()

All in-tree users already use the pfctl_get_clear_rule_h() variant.
This lets us remove a lot of nvlist-based code.

Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+0-228lib/libpfctl/libpfctl.c
+0-2281 files

FreeBSD/src c4f9e00 — share/man/man9 iflibdi.9, sys/net iflib.c

iflib: Cancel stale reset requests when a driver quiesces

A TX watchdog closes admission before the admin task runs. A driver
can then quiesce the datapath from its admin callback and rebuild its
resources. Acting on the earlier watchdog verdict after the callback
can restart a down interface or duplicate the driver's own restart.

Capture reset requests under the context lock before calling the
driver. A successful quiesce cancels both queued requests and those
captured for this pass. A fresh request after quiesce stays queued for
the next pass, which checks IFF_UP before a conditional restart.

Keep the watchdog event for reporting. Request a conditional restart
only while the timed-out datapath still has admission closed.

Check for detach while collecting reset requests. Only the device
selected for the detach failpoint needs the earlier check. Release the
context lock before freeing the taskqueue on failed attach so a late
admin task can acquire the lock, observe detach, and exit.

    [5 lines not shown]
DeltaFile
+27-22sys/net/iflib.c
+5-3share/man/man9/iflibdi.9
+32-252 files

FreeBSD/src 585334b — sys/dev/cxgbe/iw_cxgbe cm.c, sys/dev/wg if_wg.c

sockets: don't accept uio from kernel senders, only mbufs
DeltaFile
+4-5sys/rpc/svc_vc.c
+3-5sys/dev/cxgbe/iw_cxgbe/cm.c
+3-4sys/kern/uipc_socket.c
+2-3sys/sys/socketvar.h
+2-2sys/nfs/bootp_subr.c
+2-2sys/dev/wg/if_wg.c
+16-2111 files not shown
+28-3617 files

FreeBSD/src e2b5226 — sys/kern uipc_socket.c

sockets: refuse MSG_OOB on a datagram socket

The MSG_OOB is supported by TCP only and I wish we dropped this support.
The sosend_dgram() is now used by UDP only.  It could be used for a
different datagram protocol, but no way this protocol could want MSG_OOB.

Differential Revision:  https://reviews.freebsd.org/D62305
DeltaFile
+6-7sys/kern/uipc_socket.c
+6-71 files

FreeBSD/src a295171 — sys/kern uipc_socket.c, sys/nfs bootp_subr.c

bootp: provide mbuf to sosend() instead of uio

This is what kernel users of sockets are supposed to do.  The kernel BOOTP
client was the last one that didn't.

Differential Revision:  https://reviews.freebsd.org/D62413
DeltaFile
+9-13sys/nfs/bootp_subr.c
+2-4sys/kern/uipc_socket.c
+11-172 files

FreeBSD/src 574941c — sys/netinet in_pcb.c, sys/nfs bootp_subr.c

inpcb: in in_pcbladdr() make an exclusion for kernel BOOTP client

Allow use of unspecified source address in in_pcbladdr() for the kernel
BOOTP client.  It needs to send BOOTP/DHCP request with INADDR_ANY source.

We considered other options, but they all look too complex and intrusive.
This tiny hack hidden by #ifdef BOOTP, that is not included in the GENERIC
kernel, would be good enough to keep support for the legacy BOOTP boot.

Reviewed by:            markj
Differential Revision:  https://reviews.freebsd.org/D62412
Fixes:                  713264f6b8bc5f927dd52cf8ffcccfa397034fec
PR:                     278043
DeltaFile
+12-3sys/netinet/in_pcb.c
+2-1sys/nfs/bootp_subr.c
+14-42 files

FreeBSD/src 7d8b5bd — libexec/bootpd README Makefile

bootpd(8): add minimal RFC1542 support and improve multihoming

Support the broadcast flag from RFC1542.  With this flag a BOOTP client
requests the server to send initial reply as a broadcast, all-ones both on
the IP and on Ethernet layers.

The EDK2 Firmware for bhyve from the sysutils/edk2-bhyve sets the
broadcast flag and is not able to boot if server doesn't support it.  This
change makes edk2-bhyve with stock bootpd(8) bootable.

Improve multihoming.  With multiple interfaces in the system bootpd does a
bad job sending replies.  Set IP_RECVIF on the socket and upon receive
find the interface we received the packet and then its primary IP address
& broadcast.  Use the broadcast address later with  IP_ONESBCAST socket
option if client requested broadcast reply.  Use the primary IP address as
server address in case if sa= is missing in the bootptab(5).

Reviewed by:            imp
Differential Revision:  https://reviews.freebsd.org/D62411
DeltaFile
+109-53libexec/bootpd/bootpd.c
+0-142libexec/bootpd/getif.c
+0-72libexec/bootpd/trygetif.c
+0-3libexec/bootpd/getif.h
+0-2libexec/bootpd/README
+1-1libexec/bootpd/Makefile
+110-2731 files not shown
+111-2737 files

FreeBSD/src b42365b — sys/netgraph/bluetooth/socket ng_btsocket_l2cap.c

ng_btsocket_l2cap: stop using stale hdr pointer after m_pullup

The connectionless-channel pullup may reallocate.  hdr was from the
previous pullup.  Use m_pkthdr.len instead.

Differential Revision:  https://reviews.freebsd.org/D62430
DeltaFile
+1-1sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c
+1-11 files

FreeBSD/src d6108bd — usr.bin/top machine.h display.h

top: implement pid highlighting

Implement PID highlighting. This can be activated by pressing
'L' and entering a PID to highlight. Highlighting can be cleared
by entering '+' as a PID to highlight. This feature is inspired by
the OpenBSD top, which uses 'P' key for that. We have to use 'L'
because 'P' is already used for toggling per-CPU statistics.

Reviewed by:    kib
Obtained from:  OpenBSD (partially)
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D61090

(cherry picked from commit 3dcd4a2fd6b84fe962897f3c07e684ce166798a4)
DeltaFile
+47-11usr.bin/top/top.c
+40-4usr.bin/top/display.c
+8-1usr.bin/top/top.1
+4-1usr.bin/top/machine.c
+2-2usr.bin/top/machine.h
+2-2usr.bin/top/display.h
+103-212 files not shown
+105-228 files

FreeBSD/src f70e6aa — usr.bin/top top.1 top.c

top: allow filtering by command name

top(1) already supports interactive command filtering using
the '/' key. Support it also with a command line
argument '-g' / '--grep'.

Reviewed by:    kib
Obtained from:  OpenBSD
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D61160

(cherry picked from commit d668d96259d568877fa863095fc28bd6c323dd01)
DeltaFile
+12-2usr.bin/top/top.c
+9-1usr.bin/top/top.1
+21-32 files

FreeBSD/src 2832718 — sys/netgraph/netflow ng_netflow.c

ng_netflow: re-derive pointers after M_CHECK

M_CHECK calls m_pullup, which may reallocate.  Three pointers were stale:
evh in the VLAN path and ip in the IP-options path.

Reviewed by:            markj, glebius
Differential Revision:  https://reviews.freebsd.org/D62429
DeltaFile
+5-2sys/netgraph/netflow/ng_netflow.c
+5-21 files

FreeBSD/src 14de631 — usr.bin/top machine.h display.h

top: implement pid highlighting

Implement PID highlighting. This can be activated by pressing
'L' and entering a PID to highlight. Highlighting can be cleared
by entering '+' as a PID to highlight. This feature is inspired by
the OpenBSD top, which uses 'P' key for that. We have to use 'L'
because 'P' is already used for toggling per-CPU statistics.

Reviewed by:    kib
Obtained from:  OpenBSD (partially)
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D61090

(cherry picked from commit 3dcd4a2fd6b84fe962897f3c07e684ce166798a4)
DeltaFile
+47-11usr.bin/top/top.c
+40-4usr.bin/top/display.c
+8-1usr.bin/top/top.1
+4-1usr.bin/top/machine.c
+2-2usr.bin/top/machine.h
+2-2usr.bin/top/display.h
+103-212 files not shown
+105-228 files

FreeBSD/src 59d8933 — usr.bin/top top.1 top.c

top: allow filtering by command name

top(1) already supports interactive command filtering using
the '/' key. Support it also with a command line
argument '-g' / '--grep'.

Reviewed by:    kib
Obtained from:  OpenBSD
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D61160

(cherry picked from commit d668d96259d568877fa863095fc28bd6c323dd01)
DeltaFile
+12-2usr.bin/top/top.c
+9-1usr.bin/top/top.1
+21-32 files

FreeBSD/src 354fe37 — usr.sbin/pkg Makefile pkg.h, usr.sbin/pkg/tests pkg_test.sh

pkg: Add support for mldsa (ML-DSA-87) signatures

pkg(8) gained an "mldsa" signer backed by OpenSSL's ML-DSA-87
implementation.  Teach the bootstrap to verify it so that a repository
signed with it can be bootstrapped.

As in pkg(8), the signed message is the hex-encoded SHA-512 digest of
pkg.pkg, for both PUBKEY and FINGERPRINTS verification, and only
ML-DSA-87 keys are accepted.  The signer is only built when OpenSSL is
3.5 or later.

While here, report the actual signer type rather than "rsa" when the
signer for a fingerprint signature cannot be found, and document
SIGNATURE_TYPE=PUBKEY and PUBKEY in pkg(7).

Reviewed by:    kevans
MFC after:      1 week
Relnotes:       yes
Differential Revision:  https://reviews.freebsd.org/D62408
DeltaFile
+192-0usr.sbin/pkg/tests/pkg_test.sh
+172-0usr.sbin/pkg/mldsa.c
+14-1usr.sbin/pkg/pkg.c
+13-1usr.sbin/pkg/pkg.7
+5-0usr.sbin/pkg/pkg.h
+1-1usr.sbin/pkg/Makefile
+397-36 files

FreeBSD/src 94a83b0 — usr.sbin/pkg hash.h hash.c

pkg: Accept SHA-512 certificate fingerprints

Accept SHA-512 certificate fingerprints ("function: sha512") in the
trusted and revoked fingerprint directories, as pkg(8) does.  Trusted
and revoked fingerprints are each compared against the certificate
digest of their own type, so a revocation of either type applies.

Reviewed by:    kevans
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D62408
DeltaFile
+37-7usr.sbin/pkg/pkg.c
+15-0usr.sbin/pkg/hash.c
+2-0usr.sbin/pkg/hash.h
+54-73 files

FreeBSD/src bc74bf7 — usr.sbin/pkg rsa.c pkg.c

pkg: Fix signature length after the $PKGSIGN$ marker

parse_sigtype() only subtracted the length of "<type>$" from the
signature size, not the full "$PKGSIGN:<type>$" marker, so
read_pubkey() copied 9 bytes past the end of the signature buffer
into the signature.  The ECC signer happened to tolerate this because
its DER parser ignores trailing bytes, but a signer that checks the
signature length exactly will reject every typed pubkey signature.

Also search for the closing '$' with memchr() bounded by the buffer
length rather than relying on the buffer being NUL-terminated.

While here, drop an unneeded __DECONST: BIO_new_mem_buf() takes a
const pointer.

Reviewed by:    kevans
Fixes:          3d0a0dda3a7d ("pkg: finish adding the ECC signer...")
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D62407
DeltaFile
+3-2usr.sbin/pkg/pkg.c
+1-1usr.sbin/pkg/rsa.c
+4-32 files

FreeBSD/src 2bdde76 — sys/compat/linux linux_event.c

linux(4): accept EPOLLOUT on inotify, timerfd and epoll descriptors

On Linux, epoll_ctl() accepts any event mask on a pollable file; a
descriptor that can never become writable simply never reports
EPOLLOUT.  We turn EPOLLOUT into an EVFILT_WRITE knote, but inotify,
timerfd and kqueue descriptors only support EVFILT_READ, so the call
fails with EINVAL.

Go's runtime registers every non-blocking descriptor with
EPOLLIN|EPOLLOUT|EPOLLRDHUP|EPOLLET.  When that fails for an inotify
descriptor, fsnotify ends up reading it in a loop that only ever gets
EAGAIN.  With a Go CLI tool under the Linuxulator this kept about eight
cores busy per idle process and wrote megabytes of error logs per
second.  Because the read knote is added before the write knote fails,
the descriptor was also left half registered, and a later
EPOLL_CTL_ADD returned EEXIST.

Drop the write bits for these three descriptor types before building
the kevents, so the registration succeeds and only read readiness is

    [7 lines not shown]
DeltaFile
+14-0sys/compat/linux/linux_event.c
+14-01 files

FreeBSD/src 4e13bc5 — usr.sbin/bhyve uart_backend.c

bhyve: make UART TCP backend not disconnect on EAGAIN

Currently, uart_rxfifo_putchar() disconnects a TCP client when
ttywrite() returns -1. However, EAGAIN does not mean the client
has disconnected.

Thus, ignore EAGAIN and do not disconnect a client unnecessarily.
In this case the character is dropped, as the stdio and tty backends
already do.

Reviewed by:    aokblast
Reported by:    llm-postcr
Fixes:          1f903953fbf8 ("bhyve: Add raw tcp to uart backend")
MFC after:      3 days
MFC to:         stable/15
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D62404
DeltaFile
+4-2usr.sbin/bhyve/uart_backend.c
+4-21 files

FreeBSD/src 27a4387 — sys/amd64/vmm vmm.c, sys/arm64/vmm vmm.c

vmm: Use an rms lock to synchronize ioctls

Certain vmm ioctls, such as VM_RAISE_MSI, do not synchronize with
VM_REINIT.  This can lead to use-after-frees, as VM_REINIT will free and
reallocate various bits of VM state, such as per-vCPU vlapic structures.

Handle this with a per-VM read-mostly lock which synchronizes ioctl
handlers and VM_REINIT calls.  Handlers which freeze a vCPU do not need
additional synchronization and don't acquire the lock at all.

An alternate approach would be to change VM_REINIT to avoid freeing and
allocating new structures when possible.  This would fix the obvious
memory safety bugs, but the implementation is more complicated, and it
seems better to explicitly synchronize.

Reported by:    Myeonghun Pak
MFC after:      1 month
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D61044
DeltaFile
+18-1sys/dev/vmm/vmm_dev.c
+4-0sys/dev/vmm/vmm_vm.h
+3-0sys/riscv/vmm/vmm.c
+3-0sys/arm64/vmm/vmm.c
+3-0sys/amd64/vmm/vmm.c
+2-0sys/dev/vmm/vmm_dev.h
+33-16 files

FreeBSD/src 196fcf7 — sys/compat/linuxkpi/common/include/linux pci.h

LinuxKPI: pci: implement pci_clear_and_set_config_dword()

Implement pci_clear_and_set_config_dword() as a combination of
read and write config_dword.  Note while the read function returns
an error value its current implementation can never fail so we do
not have to deal with the error case.

This is needed by an rtw89 update.

MFC after:      3 days
Reviewed by:    dumbbell
Differential Revision: https://reviews.freebsd.org/D60687
DeltaFile
+12-0sys/compat/linuxkpi/common/include/linux/pci.h
+12-01 files

FreeBSD/src ccb94bc — sys/compat/linuxkpi/common/include/linux bitfield.h

LinuxKPI: add field_get() and FIELD_GET_SIGNED()

An updated rtw89 driver uses both so add them with the added
__FIELD_GET() not doing any extra checks.  We assume the Linux
counterpart will do that and drivers will fail them there, so
no need to add assertions here.

MFC after:      3 days
Reviwed by:     dumbbell
Differential Revision: https://reviews.freebsd.org/D60716
DeltaFile
+37-1sys/compat/linuxkpi/common/include/linux/bitfield.h
+37-11 files

FreeBSD/src c402edf — sys/compat/linuxkpi/common/src linux_firmware.c

LinuxKPI: firmware: ensure name stays valid

The name argument passed into request_firmware_nowait() may only be
valid locally in the calling function and could be out of scope by the
time the task runs;  make a copy to ensure it stays valid over the
callback.

MFC after:      3 days
Reviewed by:    dumbbell
Differential Revision: https://reviews.freebsd.org/D60630
DeltaFile
+8-1sys/compat/linuxkpi/common/src/linux_firmware.c
+8-11 files

FreeBSD/src a6a3bfe — sys/compat/linuxkpi/common/include/linux spinlock.h

LinuxKPI: add spinlock_bh guard support

We will likely have to add more DEFINE_LOCK_GUARD_1 cleanup.h
defintions for various lock types.  Add the one for spinlock_bh
as a wireless driver update needs it.

MFC after:      3 days
Reviewed by:    dumbbell
Differential Revision: https://reviews.freebsd.org/D60631
DeltaFile
+5-0sys/compat/linuxkpi/common/include/linux/spinlock.h
+5-01 files

FreeBSD/src e265686 — sys/compat/linuxkpi/common/include/linux cleanup.h

LinuxKPI: rework cleanup.h to use CLASS

After adding DEFINE_CLASS and CLASS in f2a2e02ae54b to cleanup.h
cleanup that file some from the original implementation:
- Rename CLEANUP_NAME to LKPI_CLASS_NAME to (a) match the CLASS
  implementation idea and (b) tell it is an internal macro and not
  a LinuxKPI one.
- consistently use LKPI_CLASS_NAME() rather than doing multiple ##.
- consistently use _constructor and _destructor instead of _create
  and _destroy.
- consistently use _name instead of _n and _type instead of _t; the
  latter helps a lot to keep the typedef _type LKPI_CLASS_NAME(_name, _t)
  apart.
- With this the former DECLARE now matches CLASS so remove the former
  in favour of the latter.
- With this DEFINE_GUARD() can now be implemented as a single
  LINUXKPI_]DEFINE_CLASS() call.
- In guard() and scoped_guard() start using __UNIQUE_ID() which was
  added in 8b05d84be9e28 rather than manually using ## __COUNTER__.

    [7 lines not shown]
DeltaFile
+55-75sys/compat/linuxkpi/common/include/linux/cleanup.h
+55-751 files

FreeBSD/src 1f74400 — sys/dev/virtio/network if_vtnet.c

vtnet_ctrl_announce_ack_cmd: Remove busdma

This function was added after busdma was added to vtnet, but there
were bugs in the busdma functionality and that got backed out.  The
busdma bits need to be stripped from vtnet_ctrl_announce_ack_cmd as
well.

Direct commit to releng/15.2.

PR:             301485
Reviewed by:    adrian
Approved by:    re (cperciva)
Differential Revision:  https://reviews.freebsd.org/D62436
DeltaFile
+5-22sys/dev/virtio/network/if_vtnet.c
+5-221 files