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
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
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
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
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]
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
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]
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]
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>
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
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
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
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
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
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
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
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
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
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.
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]
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
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