DragonFlyBSD/src 7a91466 — sys/kern kern_dmsg.c

kdmsg: protect connection-state publication and ownership

Autoinitiate can create a connection transaction after the writer has
stopped. The state can survive into the next connection, where replacing
conn_state loses its held reference. An old close callback can also drop
the replacement state's reference instead of its own.

Hold msglk across creation, publication and queuing, and do not initiate
a connection once EXITNOACC is set. Use a locked allocator helper for
this call path so the allocator does not need recursive lock acquisition.

Release the previous conn_state reference before replacing it. On DELETE,
clear and release the slot only when it still points to the callback's
state, independently of whether a closing reply is needed.

Dropping the previous conn_state reference is now only needed when two
autoinitiates race on a live connection; otherwise the old transaction is
cleaned up through the state tree.

Bug: https://bugs.dragonflybsd.org/issues/3435
DeltaFile
+48-16sys/kern/kern_dmsg.c
+48-161 files

DragonFlyBSD/src 4668419 — sys/bus/u4b/net if_axge.c

axge(4): reject register reads for other PHY addresses

The adapter has one PHY at sc_phyno. It can answer reads at other
addresses with the same PHY data, so MII probing finds it 32 times.

Return zero for other addresses before locking or sending a USB request.
This matches the existing write callback and the axe driver pattern.

This is a driver-local fix rather than an import of the broader FreeBSD
MII framework change (see their commit
a55fb8a458d67348d723bc947914873f25b947de)

Reported-by: mneumann
Bug: https://bugs.dragonflybsd.org/issues/3405
DeltaFile
+3-0sys/bus/u4b/net/if_axge.c
+3-01 files

DragonFlyBSD/src 4973045 — sys/dev/netif/iwm if_iwm.c

iwm(4): reset and rescan after a fatal firmware error

On a firmware error (SW_ERR) the driver calls ieee80211_restart_all().
That does not bring the link back on a 9260: after the reset the VAP
is still in RUN, and with manual roaming (wpa_supplicant)
ieee80211_start_all() does not scan again, so Wi-Fi stays down until
the interface is brought down and up.

Do a full iwm_stop()/iwm_init() from the task queue instead, serialised
with IWM_FLAG_BUSY like iwm_init_task(), then move each VAP to SCAN so
that wpa_supplicant reassociates.

See commit df45c061928f in OpenBSD.

Bug: https://bugs.dragonflybsd.org/issues/3453
DeltaFile
+32-1sys/dev/netif/iwm/if_iwm.c
+32-11 files

DragonFlyBSD/src 5b1a42b — sys/dev/netif/iwm if_iwm.c

iwm(4): mask closed_rb_num to the RX ring size

The 9000-series firmware can report a closed_rb_num at or beyond the
ring size (9000 step A0 wrap-around).  iwm_notif_intr() compares it
against the local consumer index, which is always below the ring size,
so the two would never become equal; the loop would cycle through stale
ring entries and the write-pointer update would use a bogus index.

See commits 5eae443eb5e2 in Linux and 3287dca4fa10 in OpenBSD.

Bug: https://bugs.dragonflybsd.org/issues/3449
DeltaFile
+1-0sys/dev/netif/iwm/if_iwm.c
+1-01 files

DragonFlyBSD/src 540ec29 — sys/dev/netif/iwm if_iwm.c

iwm(4): allow 36-bit DMA for the RX/TX data buffers

The RX and TX data buffer DMA tags were limited to
BUS_SPACE_MAXADDR_32BIT.  With more than 4 GB of RAM every frame is
then bounced through busdma, and under load the bounce zone can be
exhausted, dropping RX replenishments and TX frames.

iwlwifi uses 36-bit DMA for non-gen2 devices (7000/8000/9000; only
gen2 uses 64-bit).  The hardware can represent such addresses: the
9000-series MQ RX free descriptor stores a full 64-bit address and
the legacy RX descriptor stores addr >> 8, while the TX TFD carries
the address bits [35:32] in the hi_n_len field.  The descriptor,
status, firmware, keep-warm, ICT and scheduler allocations keep their
32-bit limit because the registers that point at them are narrower.

See tfd.addr_size in iwlwifi gen1_2/trans.c in Linux.

Bug: https://bugs.dragonflybsd.org/issues/3448
DeltaFile
+2-2sys/dev/netif/iwm/if_iwm.c
+2-21 files

DragonFlyBSD/src 7d62593 — sys/dev/netif/iwm if_iwm.c

iwm(4): Replenish the RX ring before modifying the mbuf

iwm_rx_mpdu_mq() changed m_data and m_len of the RX ring mbuf before
calling iwm_rx_addbuf().  When the replenishment failed, for example
with ENOMEM from exhausted busdma bounce pages, it returned with the
modified mbuf still in the ring.  The next frame received into that
slot was then parsed 56 bytes too far in: payload was taken for
notifications, bogus command completions drained the command queue,
and the "ring->queued is empty?" assertion in iwm_cmd_done() fired.

Replenish first, as iwm_rx_rx_mpdu() already does.

See commits 96eaecf93d9f in DragonFly and 0acc104f88cc in OpenBSD.

Bug: https://bugs.dragonflybsd.org/issues/3447
DeltaFile
+7-7sys/dev/netif/iwm/if_iwm.c
+7-71 files

DragonFlyBSD/src 91ba172 — sys/dev/drm/include/linux pci.h

drm: implement pci_set_dma_mask() and pci_set_consistent_dma_mask()

The two compat functions returned -EIO unconditionally since their
introduction in 2014 (9ca0d65ea7), so every drm driver that asks for a
DMA mask at attach time fails: i915's gen8_gmch_probe() logs
"Can't set DMA mask/consistent mask (-5)" on every boot, and
radeon/amdgpu silently downgrade their DMA limit to 32 bits.

No mask was ever recorded or enforced: this compat layer maps DMA
addresses 1:1 to physical addresses, and dma_alloc_coherent() keeps all
consistent allocations below 4GB.  Honor a requested mask when it
covers the installed memory (ptoa(Maxmem)); refuse only what cannot
actually work, so drivers still see an honest error on machines whose
memory exceeds their GPU's addressing limit.

Bug: https://bugs.dragonflybsd.org/issues/3455
DeltaFile
+9-2sys/dev/drm/include/linux/pci.h
+9-21 files

DragonFlyBSD/src 9129387 — bin/cat cat.1 cat.c

cat(1): Remove UNIX domain socket support in favor of nc(1)

This feature was inherited from FreeBSD and added by Matthew Dillon in
2001, before nc(1) was ported from OpenBSD in 2005.  Now remove this
feature in favor of nc(1), which also handles such scenarios better.

Bug: https://bugs.dragonflybsd.org/issues/2933
DeltaFile
+0-68bin/cat/cat.c
+1-13bin/cat/cat.1
+1-812 files

DragonFlyBSD/src e200cac — . Makefile.inc1

Makefile.inc1: Improve handling of default and alternative compilers

This makes it much easier for adding another alternative compiler and
switching the default compiler in the future.
DeltaFile
+60-72Makefile.inc1
+60-721 files

DragonFlyBSD/src eda315c — . Makefile.inc1

Makefile.inc1: Minor cleanups
DeltaFile
+13-21Makefile.inc1
+13-211 files

DragonFlyBSD/src 85c411a — share/mk sys.mk

Switch the default compiler from gcc80 to gcc120 (2)

Missed the WORLD_ALTCOMPILER update in the previous default compiler
switch commit f832cd76a838d30fcf0743178ef47129113ff095.  That caused the
nrelease failure in the package building phase (see below), because it
still uses CCVER=gcc80 but gcc80 was unavailable due to
WORLD_ALTCOMPILER not being updated.

```
===>  Configuring for pkg-2.2.0
No installed jimsh or tclsh, building local bootstrap jimsh0
Host System...x86_64-unknown-dragonfly6.5
Build System...x86_64-unknown-dragonfly6.5
C compiler... cc -pipe -Wno-error -I/usr/include/priv -O2 -fno-strict-aliasing
C++ compiler... c++  -pipe -Wno-error -I/usr/include/priv -O2 -fno-strict-aliasing
Build C compiler...cc
Checking for stdlib.h...not found
Error: Compiler does not work. See config.log
Try: 'configure --help' for options

    [6 lines not shown]
DeltaFile
+1-1share/mk/sys.mk
+1-11 files

DragonFlyBSD/src b51aa7c — usr.bin/dsynth pkglist.c

dsynth - Apply the "debug" directive to ports-mgmt/pkg

The debug directive was not being applied to ports-mgmt/pkg,
so we couldn't retain the mounts for debugging purposes when
explicitly building that target.

Adjust the (s4) string to recognize multiple flags, since fixing
this requires two flags to be passed in.

Reported-by: aly
DeltaFile
+6-3usr.bin/dsynth/pkglist.c
+6-31 files

DragonFlyBSD/src 873069b — gnu/usr.bin Makefile.cco, gnu/usr.bin/cc120 Makefile.langs

cc80,cc120: Clean up IS_PRIMARY determination
DeltaFile
+4-5gnu/usr.bin/cc80/support-libs/liblto_plugin/Makefile
+3-1gnu/usr.bin/Makefile.cco
+0-2gnu/usr.bin/cc80/Makefile.langs
+0-2gnu/usr.bin/cc120/Makefile.langs
+1-1gnu/usr.bin/cc120/support-libs/liblto_plugin/Makefile
+8-115 files

DragonFlyBSD/src ee6780c — libexec/customcc cc.sh

customcc: Save a 'basename' command invocation
DeltaFile
+1-1libexec/customcc/cc.sh
+1-11 files

DragonFlyBSD/src f832cd7 — . Makefile.inc1, gnu/lib Makefile

Switch the default compiler from gcc80 to gcc120
DeltaFile
+15-16Makefile.inc1
+8-5libexec/customcc/cc.sh
+6-6gnu/usr.bin/Makefile
+3-5gnu/usr.bin/Makefile.cco
+4-4gnu/lib/Makefile
+3-3share/man/man5/make.conf.5
+39-394 files not shown
+44-4410 files

DragonFlyBSD/src cac1cf0 — sys/dev/drm linux_dma-buf.c

drm: Improve dmabuf_close() and dma_buf_fd()

* Reset fp fields before releasing the dmabuf.
* Support O_CLOEXEC in dma_buf_fd().

Obtained-from: https://apollo.backplane.com/DFlyMisc/drm98.patch
Suggested-by: servik
DeltaFile
+6-9sys/dev/drm/linux_dma-buf.c
+6-91 files

DragonFlyBSD/src 293eef3 — etc Makefile

etc/Makefile: Remove obsolete "usr/share/initrd/sbin"
DeltaFile
+1-1etc/Makefile
+1-11 files

DragonFlyBSD/src 4585723 — share/mk bsd.sys.mk

bsd.sys.mk: Clean up a bit

* Remove the obsolete check for "_gccver >= 49" because gcc47 has been
  removed.
* Remove the duplicate "CWARNFLAGS += -Werror" inside WFORMAT condition.
  This is a minor behavior change, but I think it makes more sense for
  FORMAT_AUDIT to control the -Wformat warnings without adding -Werror.
DeltaFile
+1-8share/mk/bsd.sys.mk
+1-81 files

DragonFlyBSD/src 7a8fdfb — share/mk bsd.sys.mk

bsd.sys.mk: Enable -Werror for gcc120 (GCC 12.5)
DeltaFile
+2-2share/mk/bsd.sys.mk
+2-21 files

DragonFlyBSD/src c8eb5f6 — contrib/tre README.DRAGONFLY, contrib/tre/lib tre-match-backtrack.c

contrib/tre: Fix a use-after-free bug and a memory leak bug

The 'tags', 'pmatch' and 'states_seen' are interior pointers into a
single 'buf' allocation, so calling xfree() on each of them was a
use-after-free bug.

While there, there was another memory leak bug in handling 'buf'
allocation failure, where the previously allocated 'mem' was not freed
before return.

Fix both bugs by using 'goto error_exit' for proper memory free.

The use-after-free bug was caught by the '-Wuse-after-free' warnings
from GCC 12.5, e.g.,
```
In file included from /usr/src/lib/libc/../../contrib/tre/lib/tre-match-backtrack.c:78:
/usr/src/lib/libc/../../contrib/tre/lib/tre-match-backtrack.c: In function 'tre_tnfa_run_backtrack':
/usr/src/lib/libc/../../contrib/tre/lib/xmalloc.h:69:20: warning: pointer 'tmp_buf' used after 'free' [-Wuse-after-free]
   69 | #define xfree(ptr) free(ptr)

    [19 lines not shown]
DeltaFile
+8-17contrib/tre/lib/tre-match-backtrack.c
+3-0contrib/tre/README.DRAGONFLY
+11-172 files

DragonFlyBSD/src b492328 — usr.bin/pctrack pctrack.c

pctrack(8): explain unresolved tracking symbols

Add the DEBUG_PCTRACK hint for unresolved tracking entries. Keep table
errors and missing ncpus separate, and include the library error.

Bug: https://bugs.dragonflybsd.org/issues/3347
Bug: https://bugs.dragonflybsd.org/issues/3444
DeltaFile
+8-2usr.bin/pctrack/pctrack.c
+8-21 files

DragonFlyBSD/src 919846a — sbin/ccdconfig ccdconfig.c

ccdconfig(8): report kvm errors before closing the handle

Read the error while the handle is still valid.

Bug: https://bugs.dragonflybsd.org/issues/3444
DeltaFile
+2-2sbin/ccdconfig/ccdconfig.c
+2-21 files

DragonFlyBSD/src 9f9d82b — usr.bin/ipcs ipcs.c, usr.bin/netstat if.c main.c

Check required kvm(3) symbols before reading

Check required symbols in dconschat, ipcs, netstat and legacy pstat TTY
paths. Keep optional IPC subsystems usable. Check IPC reads and
allocations before using their data.

Use buffered IPC errors and report short reads explicitly instead of
relying on an error buffer that may not describe the incomplete read.

Bug: https://bugs.dragonflybsd.org/issues/3444
DeltaFile
+51-16usr.bin/ipcs/ipcs.c
+12-2usr.bin/netstat/main.c
+4-0usr.sbin/pstat/pstat.c
+4-0usr.bin/netstat/if.c
+1-1usr.sbin/dconschat/dconschat.c
+72-195 files

DragonFlyBSD/src 0458d53 — lib/libkvm kvm_file.c kvm_nlist.3

libkvm(3): clear failed lookups and report lookup errors

Clear requested symbol results before lookup. Keep the live failure
count and continue looking up later entries. Report lookup errors
without relying on the last errno, and preserve table errors in internal
callers.

Bug: https://bugs.dragonflybsd.org/issues/3444
DeltaFile
+35-14lib/libkvm/kvm.c
+14-6lib/libkvm/kvm_proc.c
+12-5lib/libkvm/kvm_getloadavg.c
+13-2lib/libkvm/kvm_nlist.3
+6-3lib/libkvm/kvm_file.c
+80-305 files

DragonFlyBSD/src d573aa0 — sys/kern subr_diskslice.c

kern: avoid reading a disk label while dumping

Checking an unlabelled dump slice can trigger a disk-label read through
normal buffered I/O. During a crash dump, that read can wait indefinitely
before the dump writer reaches its polled I/O path.

Skip the label read while dumping and use the slice bounds already held
in memory, keeping the normal label probe outside the dump path.

Bug: https://bugs.dragonflybsd.org/issues/3441
DeltaFile
+3-1sys/kern/subr_diskslice.c
+3-11 files

DragonFlyBSD/src 7cc2aa3 — sys/netinet6 nd6.c

nd6: keep foreign-CPU neighbors off the timer and purge list

Route requests create neighbor entries on each network CPU, but timers
and purge run on CPU 0. Purging a foreign-CPU entry deletes the matching
local route and can follow its freed neighbor entry. Link only CPU 0
entries into the list and unlink only linked entries; keep other CPUs
route-local neighbor data.

Bug: https://bugs.dragonflybsd.org/issues/3439
DeltaFile
+11-7sys/netinet6/nd6.c
+11-71 files

DragonFlyBSD/src 9524753 — share/man/man5 pf.conf.5

pf.conf.5: describe IPv6 fragment filtering without reassembly

IPv6 fragments are filtered as the Fragment header protocol, not blocked
unconditionally. State that port/type rules cannot pass them and that a
broad pass rule does not enforce those restrictions.

Bug: https://bugs.dragonflybsd.org/issues/3438
DeltaFile
+10-3share/man/man5/pf.conf.5
+10-31 files

DragonFlyBSD/src cebb74e — sys/net/pf pf_norm.c

pf: fix IPv6 fragment length checks

ip6_plen excludes the IPv6 header, but off includes it. Check packet and
fragment-header bounds, use matching length units, and reject misaligned
non-final fragments. Include pre-fragment extension headers in the
reassembled payload limit.

Bug: https://bugs.dragonflybsd.org/issues/3437
DeltaFile
+8-2sys/net/pf/pf_norm.c
+8-21 files

DragonFlyBSD/src 3300033 — usr.sbin/ndp ndp.c

ndp(8): avoid deleting covering routes and report socket errors

RTM_GET can return a covering route for an absent neighbor. Require the
requested address and an NDP route before deletion. Return failure for
routing-socket write, read and reply errors, and pass deletion failure
to the exit status.

Bug: https://bugs.dragonflybsd.org/issues/3436
DeltaFile
+46-29usr.sbin/ndp/ndp.c
+46-291 files

DragonFlyBSD/src f61fa2f — lib/libssh Makefile, usr.bin/ssh Makefile

libssh: Enable OpenBSD compat for <sys/queue.h>

This removes the two TAILQ_FOREACH_SAFE redefinition in libssh and
usr.bin/ssh.
DeltaFile
+4-3lib/libssh/Makefile
+0-2usr.bin/ssh/Makefile
+4-52 files