DragonFlyBSD/src a6741f0sbin/hammer2 cmd_snapshot.c

sbin/hammer2/cmd_snapshot.c: Fix error handling

pfs.name is not valid when ioctl(HAMMER2IOC_PFS_GET) failed.
DeltaFile
+1-0sbin/hammer2/cmd_snapshot.c
+1-01 files

DragonFlyBSD/src 6cd7b65sbin/hammer2 main.c

sbin/hammer2: Fix usage()
DeltaFile
+1-1sbin/hammer2/main.c
+1-11 files

DragonFlyBSD/src 84646c2sys/netinet in_pcb.c, sys/netinet6 in6_src.c

kernel - Fix auto port assignment collision in network code

* When the SO_REUSEADDR or SO_REUSEPORT socket option is set on a
  socket undergoing automatic lport assignment, the auto network port
  assignment code in the kernel improperly ignores collisions against
  ports assigned to wildcard sockets and may assign the same port.  This
  causes later connect() calls to fail.

* Can cause gdb services to sometimes fail to connect.

* Fixed by ignoring the options for the purposes of finding an unused
  port.

Reported-by: Sergey Zigachev (servik)
DeltaFile
+10-0sys/netinet6/in6_src.c
+7-0sys/netinet/in_pcb.c
+17-02 files

DragonFlyBSD/src ccab79clibexec/rtld-elf rtld.c rtld.h, libexec/rtld-elf/x86_64 reloc.c

rtld - do not allow both dynamic DTV index and static TLS offset

* If we are allocating static offset for an object with dynamic index,
  return failure. In the opposite case, if dynamic index is requested for
  statically allocated TLS area, directly use the offset instead of
  setting the index.
  Taken from FreeBSD, commit 91880e07f605edb90339685bc934699a4344de3b.

* While there, fix dtv timing race between threads.

Co-authored-by: Matthew Dillon <dillon at apollo.backplane.com>
Reported-by: Stephane Russell <srussell at prodigeinfo.qc.ca>
DeltaFile
+21-5libexec/rtld-elf/rtld.c
+2-2libexec/rtld-elf/x86_64/reloc.c
+2-1libexec/rtld-elf/rtld.h
+1-1libexec/rtld-elf/map_object.c
+26-94 files

DragonFlyBSD/src 11bfc5asbin/ifconfig ifwg.c

ifconfig(8): Improve wg_aip_parse() to validate CIDR prefix length
DeltaFile
+5-3sbin/ifconfig/ifwg.c
+5-31 files

DragonFlyBSD/src d4d5b6bsbin/ifconfig ifwg.c

ifconfig(8): Fix IPv6 CIDR parsing error for wgaip (wg allowed-ip)

The inet_net_pton() is inherited from legacy ISC named code and uses a
legacy IPv6 CIDR format (e.g., 1:2:3:4/64), so it fails to parse some
now valid IPv6 CIDRs (e.g., 1:2:3:4::/64).  This was causing 'wgaip'
option to fail configure some IPv6 allowed-ips/networks.

Given that inet_net_pton() is not standard and behaves differently
across BSDs and Linux, it might be not really useful to fix/improve it
(e.g., by porting OpenBSD's version).  Instead, I chose to write
wg_aip_parse() to manually parse the CIDRs.

Reported-by: Michael Neumann (mneumann) on IRC
DeltaFile
+45-12sbin/ifconfig/ifwg.c
+45-121 files

DragonFlyBSD/src 996ed88sys/kern vfs_syscalls.c kern_sig.c, sys/sys proc.h

kernel - Improve umount -f operation

* Increase the process test/kill retry loop for umount -f from 10
  to 50 (from 2.5 seconds to 12.5 seconds) to give processes more
  time to exit after receiving a KILL signal.

* Make the tsleep() used for the retry delay unconditional to ensure a
  reasonable period of time is allowed to elapse.

* Release the mount structure lock during the 0.25 second tsleep()
  in the retry loop.  This allows processes to unstick during the
  umount -f retry loop.

* Add a P_MUSTKILL flag to the process structure, set if necessary
  during a umount -f.  Process core dumps (which are usually
  uninterruptable) will be aborted if this flag is found to be set.
  Further tests for this flag may be needed.

Reported-by: marino (via loki kernel crash)
DeltaFile
+15-5sys/kern/vfs_syscalls.c
+4-1sys/kern/kern_sig.c
+4-0sys/kern/imgact_elf.c
+1-1sys/sys/proc.h
+24-74 files

DragonFlyBSD/src c87a730sys/kern vfs_syscalls.c

kernel - Fix umount -f related panic

* Adjust umount -f (forced unmount) logic to kill processes which
  still hold references to the mount in question, due to being chrooted
  or jailed in the mount, their current directory being on the mount,
  or having any open file via the mount.

  To be frank, it is hard to find a nice way to rip a mount out from under
  processes as their behavior upon suddenly having file descriptors go bad
  is completely non-deterministic.  A forced unmount is not supposed to be
  kind to the system.  The best solution is to kill the processes.

* Fixes panics related to regular use of umount -f if the operation
  happens to race active operations by processes on the mount.

Reported-by: marino
DeltaFile
+83-7sys/kern/vfs_syscalls.c
+83-71 files

DragonFlyBSD/src b07befasys/kern vfs_syscalls.c kern_sig.c, sys/sys proc.h

kernel - Improve umount -f operation

* Increase the process test/kill retry loop for umount -f from 10
  to 50 (from 2.5 seconds to 12.5 seconds) to give processes more
  time to exit after receiving a KILL signal.

* Make the tsleep() used for the retry delay unconditional to ensure a
  reasonable period of time is allowed to elapse.

* Release the mount structure lock during the 0.25 second tsleep()
  in the retry loop.  This allows processes to unstick during the
  umount -f retry loop.

* Add a P_MUSTKILL flag to the process structure, set if necessary
  during a umount -f.  Process core dumps (which are usually
  uninterruptable) will be aborted if this flag is found to be set.
  Further tests for this flag may be needed.

Reported-by: marino (via loki kernel crash)
DeltaFile
+15-5sys/kern/vfs_syscalls.c
+4-1sys/kern/kern_sig.c
+4-0sys/kern/imgact_elf.c
+1-1sys/sys/proc.h
+24-74 files

DragonFlyBSD/src e436662sbin/fsck_hammer2 test.c

sbin/fsck_hammer2: Fix destination FILE* in print_media()

Also show comp/check in string format.
DeltaFile
+6-4sbin/fsck_hammer2/test.c
+6-41 files

DragonFlyBSD/src cc8e70bsys/kern vfs_vnops.c vfs_syscalls.c, sys/opencrypto cryptodev.c

kern - Make lseek(2) generic

* Extend fileops with fo_seek function allowing pluggable lseek(2)
  implementations. Part of preparation for linux DMA-BUF compat API.

* Move current vnode lseek implementation into vnode and devfs fileops.
  Code is exactly the same in both, note about duplication added.

* Set remaining fileops to badfo_seek.

Mentored-By: dillon
DeltaFile
+64-1sys/kern/vfs_vnops.c
+61-1sys/vfs/devfs/devfs_vnops.c
+1-51sys/kern/vfs_syscalls.c
+8-1sys/kern/kern_descrip.c
+6-0sys/sys/file2.h
+2-1sys/opencrypto/cryptodev.c
+142-555 files not shown
+152-5911 files

DragonFlyBSD/src c973322contrib/diffutils/lib vasnprintf.c regexec.c, contrib/diffutils/src diff3.c

world - Replace gnu diff, diff3, and sdiff with BSD versions

* Replace diff and diff3 with the OpenBSD diff and diff3,
  Replace sdiff with the FreeBSD sdiff,
  Remove the GNU diff, diff3, and sdiff

* Basic testing with dsynth bulk to ensure no significant compatibility
  disruptions.

Submitted-by: Tyler <tyler.clark at foxide.xyz>
DeltaFile
+0-5,621contrib/diffutils/lib/vasnprintf.c
+0-4,334contrib/diffutils/lib/regexec.c
+0-3,946contrib/diffutils/lib/regcomp.c
+0-1,789contrib/diffutils/src/diff3.c
+0-1,746contrib/diffutils/lib/regex_internal.c
+0-1,734gnu/usr.bin/diff/libdiffutils/config.h
+0-19,170257 files not shown
+5,328-66,284263 files

DragonFlyBSD/src 152bbefsbin/fsck_hammer2 test.c

sbin/fsck_hammer2: Remove unused voldata argument
DeltaFile
+68-103sbin/fsck_hammer2/test.c
+68-1031 files

DragonFlyBSD/src 167a410sbin/hammer2 cmd_debug.c

sbin/hammer2/cmd_debug.c: Refactor unreadable cmd_show()

0b7381572b131c74051832dc251604e7f77b5a54 added multi-volumes
support to cmd_show() (entry point of freemap,show,volhdr directives)
with minimum modification using goto, but the code has been not
so readable since then. Rewrite this entry point function.

The output is same except that "Volume %d header %d..."
by default (= when not showing volhdr or bref for all volumes)
appears before printing each volhdr or bref, rather than all
at once in the beginning.
DeltaFile
+67-72sbin/hammer2/cmd_debug.c
+67-721 files

DragonFlyBSD/src b87d88fsbin/hammer2 cmd_debug.c

sbin/hammer2/cmd_debug.c: Clear errno

otherwise affects next strtol(3) variant when no error.

strtol(3) says "If no conversion could be performed,
0 is returned and the global variable errno is set to EINVAL".
DeltaFile
+5-0sbin/hammer2/cmd_debug.c
+5-01 files

DragonFlyBSD/src 2c8c691sbin/fsck_hammer2 test.c, sbin/hammer2 cmd_debug.c print_inode.c

sys/vfs/hammer2: Change hammer2_inode_meta::target_type to unused84

No longer used or needed since
da0cdd33148ab3e3c227355de759c595c533841a in 2017.

target_type was only used for the initial hardlink design and
implementation, which is not how it works today.
DeltaFile
+0-2sbin/hammer2/cmd_debug.c
+1-1sys/vfs/hammer2/hammer2_disk.h
+0-1usr.sbin/makefs/hammer2.c
+0-1sbin/fsck_hammer2/test.c
+0-1sbin/hammer2/print_inode.c
+1-65 files

DragonFlyBSD/src 9443de1sys/vfs/hammer2 hammer2_disk.h

sys/vfs/hammer2: Remove obsolete comments for unused/reserved ondisk fields
DeltaFile
+5-5sys/vfs/hammer2/hammer2_disk.h
+5-51 files

DragonFlyBSD/src 1b4dc14libexec/rtld-elf/x86_64 reloc.c

rtld - Improve error reporting

* Prefix hex type values with 0x

* Include (%s) obj->path so the user has some idea which file is
  responsible for the error.

Requested-by: servik
DeltaFile
+4-4libexec/rtld-elf/x86_64/reloc.c
+4-41 files

DragonFlyBSD/src b4ddbe7usr.sbin/makefs/hammer2 hammer2_ondisk.c

usr.sbin/makefs/hammer2: Sync with recent userspace ondisk.c changes

8d1faa373c717ffa3d7dce83f48327742c966dad
c825a6c5bc23e72617bbb2bede9bfb99724bada0

usr.sbin/makefs/hammer2 has mostly same verifications in hammer2_ondisk.c.
DeltaFile
+24-12usr.sbin/makefs/hammer2/hammer2_ondisk.c
+24-121 files

DragonFlyBSD/src 831bf83sys/vfs/hammer2 hammer2_ondisk.c

sys/vfs/hammer2: Sync with recent userspace ondisk.c changes

8d1faa373c717ffa3d7dce83f48327742c966dad
c825a6c5bc23e72617bbb2bede9bfb99724bada0

sys/vfs/hammer2 has mostly same verifications in hammer2_ondisk.c.
DeltaFile
+24-12sys/vfs/hammer2/hammer2_ondisk.c
+24-121 files

DragonFlyBSD/src c825a6csbin/hammer2 ondisk.c

sbin/hammer2: Verify fstype UUID in hammer2_verify_volumes_common()

Its string form has to be HAMMER2_UUID_STRING.
Also move common volu_id check to hammer2_verify_volumes_common().
DeltaFile
+19-8sbin/hammer2/ondisk.c
+19-81 files

DragonFlyBSD/src 1a0f56esbin/hammer2 cmd_debug.c

sbin/hammer2/cmd_debug.c: Print volume id in "Volume header" message
DeltaFile
+4-3sbin/hammer2/cmd_debug.c
+4-31 files

DragonFlyBSD/src 8fbce03sbin/hammer2 cmd_debug.c

sbin/hammer2/cmd_debug.c: Don't use both XB and XiB in printf

These are the only ones print XiB with "XiB" in HAMMER2 commands.
DeltaFile
+9-9sbin/hammer2/cmd_debug.c
+9-91 files

DragonFlyBSD/src c4e275dlib/libfetch fetch.c

libfetch: don't include fragments in HTTP requests

Fragments are reserved for client-side processing, see
https://www.rfc-editor.org/rfc/rfc9110.html#section-7.1

Also, some servers don't like to receive HTTP requests with fragments.

```
$ fetch 'https://dropbox.com/a/b'
fetch: https://dropbox.com/a/b: Not Found

$ fetch 'https://dropbox.com/a/b#'
fetch: https://dropbox.com/a/b#: Bad Request
```

Taken-from: https://github.com/freebsd/freebsd-src/commit/1af7d5f389536a2f391153513d95d92ffdf360e4
DeltaFile
+4-1lib/libfetch/fetch.c
+4-11 files

DragonFlyBSD/src 8d1faa3sbin/hammer2 ondisk.c, sbin/newfs_hammer2 mkfs_hammer2.c

sbin/newfs_hammer2: Fail if input size is < alignment size

If aligned size becomes 0, it should fail with an error message
before hammer2_install_volume().
e.g. If a regular file av[0] is 4MiB, size becomes 0 after aligned.

Also add same sanity in hammer2_verify_volumes_common().
vol->size == 0 passes 8MiB or 1GiB alignment sanity.
DeltaFile
+2-1sbin/newfs_hammer2/mkfs_hammer2.c
+2-0sbin/hammer2/ondisk.c
+4-12 files

DragonFlyBSD/src 94803e4sbin/newfs_hammer2 mkfs_hammer2.c

sbin/newfs_hammer2: Remove redundant inode.meta.name_xxx zero clears

Remove obsolete code from b33a7e92438b9c9fc915e7c432666385051369db in 2012.

suproot has a name "SUPROOT" in inode itself if not in dirent,
and name_len is initialized with a proper length right after this.
DeltaFile
+0-3sbin/newfs_hammer2/mkfs_hammer2.c
+0-31 files

DragonFlyBSD/src 2b0cb81usr.bin/dsynth mount.c

dsynth - Make dummy /usr/packages directory for pkg compatibility

* For the chroot, make /usr/packages for pkg compatibility.  Certain
  pkg related temporary files are created there for reasons unknown.
DeltaFile
+6-0usr.bin/dsynth/mount.c
+6-01 files

DragonFlyBSD/src 5af8357lib/libc/sys utimes.2 Makefile.inc, sys/kern vfs_syscalls.c

futimesat() - Add futimesat() legacy system call

* Add legacy call for FreeBSD compatibility
DeltaFile
+31-0sys/kern/vfs_syscalls.c
+11-1lib/libc/sys/utimes.2
+6-0sys/sys/sysproto.h
+4-0sys/sys/time.h
+2-1lib/libc/sys/Makefile.inc
+3-0lib/libc/sys/Symbol.map
+57-27 files not shown
+67-513 files

DragonFlyBSD/src 83e7061sys/kern sys_generic.c, sys/net/tap if_tap.c

poll - Fix events == 0 handling for TAP and TUN, fix console spam

* BSD poll() supports events == 0 representing a "HUP ONLY" event.
  Most of our devices properly support this but TAP and TUN did not.

  Fix TAP and TUN to support this feature.  This fixes openvpn()
  when operating under heavier loads.

* Fix console spam on non-debug kprintf()s by rate-limiting any
  such spam if it occurs.  If a device doe snot support poll()'s
  HUP ONLY feature, the loop deregistration path will be hit and
  generate a kprintf().  We don't want console spam to stall the
  cpu.
DeltaFile
+18-10sys/kern/sys_generic.c
+6-4sys/net/tap/if_tap.c
+4-2sys/net/tun/if_tun.c
+28-163 files

DragonFlyBSD/src 7569b84share/man/man5 wg.conf.5

wg.conf.5: Fix a typo (in-inline comments are *not* allowed)
DeltaFile
+2-2share/man/man5/wg.conf.5
+2-21 files