DragonFlyBSD/src c7a8214 — etc/defaults rc.conf, share/man/man5 rc.conf.5

rc.conf: Enable dntpd service by default

Following my previous commit 5e4ae0baf5d3cb622cc44f4854b4df46d5193877
that enabled dntpd service via the installer, this commit takes another
method to also enable dntpd by default.

While there, correct the default value of 'syslogd_enable' in rc.conf(5)
man page as well.

Suggested-by: swildner
DeltaFile
+13-7share/man/man5/rc.conf.5
+1-1etc/defaults/rc.conf
+14-82 files

DragonFlyBSD/src a876e25 — sys/vfs/ufs ufs_vnops.c

ufs: release fdvp on rename errors after the source checks

A rename that fails after the source directory's reference is taken,
for example ENOTEMPTY or EACCES, returns through bad:/out: labels
without releasing fdvp, so the filesystem stays busy.  FreeBSD releases
fdvp before those paths; DragonFly's VFS conversion removed that release
but did not add it to the error paths.

Fix the issue by correctly releasing fdvp in the 'out:' label.

Bug: https://bugs.dragonflybsd.org/issues/3457
DeltaFile
+1-0sys/vfs/ufs/ufs_vnops.c
+1-01 files

DragonFlyBSD/src 4ec0bc1 — sys/vfs/ext2fs ext2_vnops.c

ext2fs: release fdvp on rename errors after the source checks

A rename that fails after the source directory's reference is taken,
for example ENOTEMPTY or EACCES, returns through bad:/out: labels
without releasing fdvp, so the filesystem stays busy. FreeBSD releases
fdvp before those paths; DragonFly's VFS conversion removed that release
but did not add it to the error paths.

Fix the issue by correctly releasing fdvp in the 'out:' label.

Bug: https://bugs.dragonflybsd.org/issues/3457
DeltaFile
+1-0sys/vfs/ext2fs/ext2_vnops.c
+1-01 files

DragonFlyBSD/src 18702bc — sys/vfs/ext2fs ext2_vfsops.c

ext2fs: sync the device vnode before writing the clean flag on unmount

An inode freed by rmdir is deactivated during vflush(), after
ext2_unmount()'s VFS_SYNC(), so its inode-bitmap update is only queued
with bdwrite() and nothing writes it out.  e2fsck -fn then reports the
inode still allocated and the group's free-inode count wrong.

After vflush(), do what ffs_flushfiles() does: lock the device vnode,
VOP_FSYNC() it with MNT_WAIT and return the error, before the group
descriptors and the clean flag are written.  Test e2fs_ronly rather
than MNT_RDONLY, which sys_mount() sets before a downgrade.

This fixes unmount and forced unmount.  A read-write to read-only
downgrade is not covered: the rmdir'd inode is not freed on that path
at all (pre-existing).

Reproducer: mount rw, mkdir d; rmdir d; sync; umount; e2fsck -fn.

Bug: https://bugs.dragonflybsd.org/issues/3458
DeltaFile
+10-0sys/vfs/ext2fs/ext2_vfsops.c
+10-01 files

DragonFlyBSD/src fc7d23c — sys/vfs/ext2fs ext2_vnops.c

ext2fs: pass dirbuf itself and the whole block to vn_rdwr in ext2_rename

ext2_rename() allocates a filesystem-block-sized buffer in dirbuf and
uses vn_rdwr() to read and rewrite the target directory's first block,
but passes (caddr_t)&dirbuf, the address of the pointer variable, and
only sizeof(struct dirtemplate) (24) bytes.  vn_rdwr() therefore writes
the directory data over the pointer and 16 bytes of adjacent stack, and
the following dirbuf->dotdot_type read uses directory bytes as a pointer
address.  The kernel takes a general protection fault in ext2_rename:

  Fatal trap 9: general protection fault while in kernel mode
  instruction pointer = 0x8:...8280e6b3  (ext2_rename+0x943)

A partial block is also wrong on checksummed filesystems:
ext2_dirent_csum_set() looks for the dirent tail at e2fs_bsize - 12,
which is zeroed memory outside the 24 bytes that were read, so the
directory checksum is left unchanged while the new ".." entry is
written.


    [9 lines not shown]
DeltaFile
+4-4sys/vfs/ext2fs/ext2_vnops.c
+4-41 files

DragonFlyBSD/src afaef3c — sys/vfs/ext2fs ext2_vfsops.c

ext2fs: do not synthesize a generation number on inode lookup

ext2_vget() replaced an on-disk generation number of 0 with a random
value.  On ext4 with metadata_csum the generation number is part of the
inode, directory entry and extent block checksums, so the in-memory
change makes every directory block checksum fail and reads return EIO.

FreeBSD removed this in 43ce40e891e1 ("ext2fs: cleanup generation
number management"); ext2fs already generates a non-zero value at
inode allocation time.

Bug: https://bugs.dragonflybsd.org/issues/3451
DeltaFile
+0-9sys/vfs/ext2fs/ext2_vfsops.c
+0-91 files

DragonFlyBSD/src 91bbce8 — sys/vfs/ext2fs ext2_vfsops.c

ext2fs: refuse read-write mounts of extent filesystems

The extent reader cannot write: with EXT2F_INCOMPAT_EXTENTS set a
read-write mount lets inode and directory updates through and only then
fails the data blocks with EINVAL, leaving the filesystem inconsistent
(e2fsck reports a file with a size but no blocks).

Refuse the read-write mount with the same warning style as the other
unsupported-feature checks.  Read-only mounts are unaffected and can
still be reloaded; upgrading such a mount to read-write is refused.

ext2_reload() asked ext2_check_sb_compat() with a hard-coded "not
read-only", so a read-only reload of an extent filesystem failed with
EIO once this check existed.  Pass the mount's read-only state.

The check keys on the filesystem feature bit, so an ext3 filesystem
converted with tune2fs -O extents is refused for read-write mounts too,
although it mounted read-write before this change.


    [6 lines not shown]
DeltaFile
+9-1sys/vfs/ext2fs/ext2_vfsops.c
+9-11 files

DragonFlyBSD/src 3f67cba — sys/vfs/ext2fs ext2_extern.h ext2_bmap.c

ext2fs: read ext4 extent-mapped inodes

DragonFly's ext2fs advertises EXT2F_INCOMPAT_EXTENTS, but the extent
lookup path is stubbed out: ext4_bmapext() and ext4_ext_find_extent()
both return EINVAL.  mkfs.ext4 creates every inode extent-mapped by
default, so a read-only mount of a Linux ext4 filesystem succeeds
(statfs reads only the superblock) but every directory lookup and
readdir fails with EINVAL.

Port the read-only extent tree walk and the extent bmap from FreeBSD
main (d7d237ce731f), following FreeBSD's extent read path
(d7511a40a749, b394cd1e28f1, 5679656e09fb).  The extent write path
(allocation, truncation and removal) remains unimplemented.

The path array is sized EXT4_EXT_DEPTH_MAX + 1: FreeBSD accepts
eh_depth == EXT4_EXT_DEPTH_MAX but allocates only EXT4_EXT_DEPTH_MAX
entries and indexes the last one, one past the end.

Validation and unwritten-extent handling belong to the same reader:

    [22 lines not shown]
DeltaFile
+398-26sys/vfs/ext2fs/ext2_extents.c
+71-2sys/vfs/ext2fs/ext2_bmap.c
+1-1sys/vfs/ext2fs/ext2_extern.h
+470-293 files

DragonFlyBSD/src 3f77050 — sys/vfs/ext2fs ext2_alloc.c ext2_vfsops.c

ext2fs: sync FreeBSD changes except large sectorsize disks support

Patches synced in from FreeBSD:

- ext2fs: 'struct ufid': Re-order fields and unpack
- ext2fs: Fix the size of struct ufid and add a static assert
- Do not panic in case of corrupted directory
- Add root directory entry check.
- Fix block bitmap end position computation
- Fix vop_readdir's ncookies handling in UFS and EXT2.

GitHub-PR: https://github.com/DragonFlyBSD/DragonFlyBSD/pull/31
Signed-off-by: Yusuf <yusisamerican at gmail.com>
DeltaFile
+13-10sys/vfs/ext2fs/ext2_lookup.c
+9-0sys/vfs/ext2fs/ext2_vnops.c
+4-4sys/vfs/ext2fs/inode.h
+1-1sys/vfs/ext2fs/ext2_alloc.c
+2-0sys/vfs/ext2fs/ext2_vfsops.c
+29-155 files

DragonFlyBSD/src 4e13863 — sys/vm vm_map.h vm_mmap.c

vm: make normal MAP_FIXED replacement atomic

vm_mmap() removes an existing mapping before looking up the new object
and inserting its mapping.  If the thread blocks in between, its LWKT
tokens are released and another mmap() can claim the vacated range.
The fixed mapping then fails with KERN_NO_SPACE.

Add vm_map_replace() for normal MAP_FIXED mappings.  Wait for entries
in transition before deleting any part of the range, then delete and
insert under the same map lock.  Acquire the new object's shared token
after deletion, since deleting an old mapping of the same object may
require its token exclusively.

Don't touch UKSMAP, virtual page table and internal stack mappings;
they keep separate removal and insertion.

Bug: https://bugs.dragonflybsd.org/issues/3442
DeltaFile
+54-0sys/vm/vm_map.c
+19-8sys/vm/vm_mmap.c
+2-0sys/vm/vm_map.h
+75-83 files

DragonFlyBSD/src dbb9212 — gnu/lib/gcc120 Makefile, gnu/lib/gcc120/libatomic Makefile auto-config.h

gcc120: Build and install libatomic

While there, fix a outdated comment in gcc120/Makefile and add missing
LIBGOMP to bsd.libnames.mk.
DeltaFile
+299-0gnu/lib/gcc120/libatomic/auto-config.h
+62-0gnu/lib/gcc120/libatomic/Makefile
+3-1gnu/lib/gcc120/Makefile
+2-0share/mk/bsd.libnames.mk
+366-14 files

DragonFlyBSD/src 5f33676 — contrib/gcc-12 README.DELETED

contrib/gcc-12: Update README.DELETED
DeltaFile
+22-1contrib/gcc-12/README.DELETED
+22-11 files

DragonFlyBSD/src ec111a0 — contrib/gcc-12/libatomic cas_n.c exch_n.c, contrib/gcc-12/libatomic/config/x86 host-config.h

Merge branch 'vendor/GCC120'

Add back libatomic.
DeltaFile
+295-0contrib/gcc-12/libatomic/libatomic_i.h
+200-0contrib/gcc-12/libatomic/fop_n.c
+144-0contrib/gcc-12/libatomic/gexch.c
+142-0contrib/gcc-12/libatomic/config/x86/host-config.h
+128-0contrib/gcc-12/libatomic/exch_n.c
+124-0contrib/gcc-12/libatomic/cas_n.c
+1,033-021 files not shown
+2,486-027 files

DragonFlyBSD/src b98568b — contrib/gcc-12/libatomic cas_n.c exch_n.c, contrib/gcc-12/libatomic/config/x86 host-config.h

vendor/GCC120: Add back libatomic
DeltaFile
+295-0contrib/gcc-12/libatomic/libatomic_i.h
+200-0contrib/gcc-12/libatomic/fop_n.c
+144-0contrib/gcc-12/libatomic/gexch.c
+142-0contrib/gcc-12/libatomic/config/x86/host-config.h
+128-0contrib/gcc-12/libatomic/exch_n.c
+124-0contrib/gcc-12/libatomic/cas_n.c
+1,033-021 files not shown
+2,486-027 files

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