DragonFlyBSD/src e8a6211sys/conf kern.post.mk newvers.sh

kernel: Refactor newvers.sh script

* Require and directly use 'KERN_IDENT' from the environment.  This
  avoids the 'make -V KERN_IDENT' command and thus fix the following
  warning from bmake since the last upgrade to 20260619:
  ```
  make[3]: warning: Invalid internal option "-J" in "/usr/obj/usr/src/sys/ALY"; see the manual page
  ```

* Leverage the new tools/gencopyright.sh script to generate the
  copyright header.

* Simplify the awk command that extracts '__DragonFly_version' from
  <sys/param.h> (referred to FreeBSD).

* Clean up code and styles.
DeltaFile
+51-52sys/conf/newvers.sh
+2-1sys/conf/kern.post.mk
+53-532 files

DragonFlyBSD/src 18323e1include Makefile, tools gencopyright.sh

include: Rewrite generation of <osreldate.h>

* Add the new tools/gencopyright.sh script to generate the copyright
  header.  Prefer the copyright year extracted from top-level COPYRIGHT,
  similar to FreeBSD's.

* Directly extract the __DragonFly_version from <sys/param.h> as RELDATE
  instead of calling newvers.sh.  As a result, no need to clean up the
  extra-generated files: version, vers.c and vers.txt.

By the way, this also avoids a few bmake warnings appeared after the
recent bmake upgrade (to 20260619):
```
make[2]: warning: Invalid internal option "-J" in "/usr/src"; see the manual page
make[2]: warning: Invalid internal option "-J" in "/usr/src"; see the manual page
make[2]: warning: Invalid internal option "-J" in "/usr/src"; see the manual page
make[5]: warning: Invalid internal option "-J" in "/usr/obj/usr/src/world_x86_64/usr/src/include"; see the manual page
make[2]: warning: Invalid internal option "-J" in "/usr/src"; see the manual page
make[2]: warning: Invalid internal option "-J" in "/usr/src"; see the manual page

    [4 lines not shown]
DeltaFile
+26-0tools/gencopyright.sh
+12-12include/Makefile
+38-122 files

DragonFlyBSD/src f56704fshare/man/man9 kprintf.9

kprintf.9: Document the return value of ksnprintf()/kvsnprintf()
DeltaFile
+15-4share/man/man9/kprintf.9
+15-41 files

DragonFlyBSD/src 6303926sys/netinet6 icmp6.c nd6.c

kernel: Change ip6_sprintf() not to use static buffers

Now the caller must pass a buffer of size at least INET6_ADDRSTRLEN.

Derived-from: FreeBSD (commit 1d54aa3ba94f4d9883b0746ce45123d5b5be773b)
DeltaFile
+73-41sys/netinet6/ip6_mroute.c
+52-31sys/netinet6/nd6_rtr.c
+29-28sys/netinet6/in6.c
+36-21sys/netinet6/nd6_nbr.c
+32-18sys/netinet6/nd6.c
+23-10sys/netinet6/icmp6.c
+245-14912 files not shown
+307-19218 files

DragonFlyBSD/src fdf5103sys/kern kern_jail.c

jail: Fix potential buffer overflow in sysctl_jail_list()

sysctl_jail_list() allocates a buffer of size = count*1024, and then
uses ksnprintf() to format the jail information and advance the write
position. However, ksnprintf() returns the would-be length (i.e., the
number of bytes would be written if the buffer is big enough). So a jail
that has a very long path and/or many IPs would overflow the allocated
buffer.

Fix the bug by correctly handling the return value of ksnprintf().

GitHub-PR: #45
Reported-by: Nathan Sapwell (jewbird)
DeltaFile
+6-6sys/kern/kern_jail.c
+6-61 files

DragonFlyBSD/src 9257500sys/kern kern_jail.c

jail: Clean up sysctl_jail_list()

No functional changes.
DeltaFile
+23-31sys/kern/kern_jail.c
+23-311 files

DragonFlyBSD/src 23fad20sys/conf files, sys/dev/apple/fw Makefile

Fix LINT64 build (add smc_thermal.c).

While here, break too long lines in apple_{fw,ir,smc}'s Makefiles.
DeltaFile
+3-2sys/dev/apple/ir/Makefile
+3-1sys/dev/apple/smc/Makefile
+3-1sys/dev/apple/fw/Makefile
+1-0sys/conf/files
+10-44 files

DragonFlyBSD/src 896ad35share/man/man5 make.conf.5, sys/conf bsd.kern.mk

kernel: Add WARNS_AUDIT for the kernel.

Analogous to world. If specified, any warning options that we normally
disable in buildkernel using -Wno-* will be active.

While here, move -Wold-style-declaration from CFLAGS to CWARNFLAGS.
DeltaFile
+11-4sys/conf/bsd.kern.mk
+2-5share/man/man5/make.conf.5
+13-92 files

DragonFlyBSD/src b5eed50share/mk bsd.sys.mk, sys/conf bsd.kern.mk

Add -Wno-address-of-packed-member to both world and kernel builds.

Following FreeBSD in doing so.

Discussed-with: aly
DeltaFile
+3-0sys/conf/bsd.kern.mk
+3-0share/mk/bsd.sys.mk
+6-02 files

DragonFlyBSD/src 29f2402sys/conf bsd.kern.mk

bsd.kern.mk: Add an easier way to check GCC's version.

Like we have in bsd.sys.mk for world.
DeltaFile
+5-0sys/conf/bsd.kern.mk
+5-01 files

DragonFlyBSD/src d0c37f9sys/sys caps.h

<sys/caps.h>: Include <sys/types.h> for size_t.
DeltaFile
+2-0sys/sys/caps.h
+2-01 files

DragonFlyBSD/src 4f301d2lib/libc/sys syscap_get.2

syscap_get.2: Fix prototype.
DeltaFile
+1-1lib/libc/sys/syscap_get.2
+1-11 files

DragonFlyBSD/src d8b4bdfsys/kern subr_diskmbr.c subr_diskslice.c

kernel: Clean up subr_diskmbr.c and subr_diskslice.c

No functional changes.
DeltaFile
+77-82sys/kern/subr_diskslice.c
+8-14sys/kern/subr_diskmbr.c
+85-962 files

DragonFlyBSD/src 2b3ac52initrd/oinit oinit.c pathnames.h

initrd/oinit: Fold pathnames.h into oinit.c

Meanwhile, remove unused _PATH_RUNDOWN define.
DeltaFile
+0-39initrd/oinit/pathnames.h
+2-1initrd/oinit/oinit.c
+2-402 files

DragonFlyBSD/src 8eea1a0etc/rc.d routed route6d

rc.d: Clean up routed and route6d scripts

* Remove obsolete comments.
* Replace 'eval' with assignment to 'command_args' variable.
DeltaFile
+2-7etc/rc.d/route6d
+2-6etc/rc.d/routed
+4-132 files

DragonFlyBSD/src d0e023aetc/rc.d devfs

rc.d: Skip 'devfs' in jails

Obtained-from: FreeBSD
DeltaFile
+1-0etc/rc.d/devfs
+1-01 files

DragonFlyBSD/src 75a978dshare/man/man4 netintro.4

netintro.4: Fix whitespace and indentation for 'struct sockaddr'
DeltaFile
+3-3share/man/man4/netintro.4
+3-31 files

DragonFlyBSD/src 4fb785dlib/libtcplay safe_mem.c, sbin/cryptdisks safe_mem.c

libtcplay,cryptdisks: Fix GCC 12's -Wmaybe-uninitialized false positive

This reverts commit b77d373551e67a9ce62d8063b8dd7bafd6f9e360 and
correctly fix/silence the GCC 12's -Wmaybe-uninitialized warning, which
is actually a false positive.

GCC's rationale is: the memory 'mem' refers to was not initialized and
may be used in mlock(). The 'mem' parameter is passed as 'const void *',
so mlock() is impossible to initialize the memory.

Discussed-with: swildner
See-also: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118588#c1
DeltaFile
+6-10sbin/cryptdisks/safe_mem.c
+6-10lib/libtcplay/safe_mem.c
+12-202 files

DragonFlyBSD/src 38407b1usr.sbin/jail jail.8

jail.8: Document jail.defaults.vfs_mount_* MIB entries
DeltaFile
+25-1usr.sbin/jail/jail.8
+25-11 files

DragonFlyBSD/src f7d736asys/conf kern.pre.mk

kern.pre.mk: Style cleanups
DeltaFile
+7-5sys/conf/kern.pre.mk
+7-51 files

DragonFlyBSD/src 0688f9fsys/vm device_pager.c

vm: Clean up cdev_pager_allocate() a bit

* Introduce 'pindex' variable to clean up the code.
* Add KASSERT() to ensure the object type matches (obtained from FreeBSD)
DeltaFile
+7-4sys/vm/device_pager.c
+7-41 files

DragonFlyBSD/src 3afd77dshare/man/man7 vkernel.7

vkernel.7: Fix markup in FILES section
DeltaFile
+1-2share/man/man7/vkernel.7
+1-21 files

DragonFlyBSD/src 86716f0sys/vm device_pager.c

vm: Remove duplicate reference in cdev_pager_allocate()

The code was updated in 2013 [1] to bring in various changes from
FreeBSD, but left this duplicate reference.  Remove the erroneous
vm_object_reference_locked() call.

[1] kernel: Port new device_pager interface from FreeBSD
    commit f2c2051ee473577d22178d55f782ceebbd88d58f

GitHub-PR: #49
Credit: LI Leding
DeltaFile
+0-4sys/vm/device_pager.c
+0-41 files

DragonFlyBSD/src f47a9aesys/platform/vkernel64/conf Makefile ldscript.x86_64

vkernel64: Remove unused linker script
DeltaFile
+0-194sys/platform/vkernel64/conf/ldscript.x86_64
+3-0sys/platform/vkernel64/conf/Makefile
+3-1942 files

DragonFlyBSD/src 2e3d5fesys/net/wg if_wg.c

wg: Destroy newly created peers on failure

Previously, a newly created peer was not destroyed even if there were
errors in configuring it, e.g., invalid AllowedIPs.  The rationale was
that the user could correct the error by issuing another 'ifconfig'
command with the fixed arguments.

Now destroy the new peer if an error occurs, making a complex 'ifconfig'
command that adds a peer atomic.  This matches the behavior of FreeBSD.

As part of this change, refactor wg_ioctl_set() by extracting
wg_ioctl_set_peer() to handle a single peer, and add  'const' qualifiers
where appropriate.
DeltaFile
+92-73sys/net/wg/if_wg.c
+92-731 files

DragonFlyBSD/src 4a85e64sys/kern kern_mib.c

kernel: Disable build-ID for vkernel(7) and fix build

Vkernel(7) doesn't use a linker script, so it's not easy to define
__build_id_{start,end} for it.

A solution would be to locate the ELF in memory, parse and walk the
program headers to find the ".note.gnu.build-id" section.

Reported-by: Michael Neumann
DeltaFile
+9-0sys/kern/kern_mib.c
+9-01 files

DragonFlyBSD/src d4a2200sys/conf kern.pre.mk, sys/platform/vkernel64/conf Makefile

kern.pre.mk: Update ELDFLAGS and thus clean up vkernel64/Makefile
DeltaFile
+4-12sys/platform/vkernel64/conf/Makefile
+8-8sys/conf/kern.pre.mk
+12-202 files

DragonFlyBSD/src 44d8901sys/net/wg if_wg.c

wg: Merge the code of handling SIOC[SG]WG ioctls

This cleans up the caps_priv_check() code.
DeltaFile
+9-9sys/net/wg/if_wg.c
+9-91 files

DragonFlyBSD/src 70b4e2bsys/net/wg if_wg.c

wg: Return ENETUNREACH when transmitting to a non-existent peer

Do the same thing as FreeBSD and OpenBSD.

Obtained-from: FreeBSD (https://reviews.freebsd.org/D44582)
DeltaFile
+1-5sys/net/wg/if_wg.c
+1-51 files

DragonFlyBSD/src 8adc752sys/net/wg if_wg.c

wg: Do not expose peer information to jail
DeltaFile
+10-4sys/net/wg/if_wg.c
+10-41 files