DragonFlyBSD/src 6c3ded9sys/dev/disk/nata ata-all.h

disk/nata: Fix panic caused by 'callouts: malloc limit exceeded'

Call callout_terminate() in ata_free_request() to fix the leak.

There was a callout leak before and could easily cause the following
panic:

        panic: callouts: malloc limit exceeded
        cpuid = 1
        Trace beginning at frame 0xfffff8005cd9d2a8
        _kmalloc() at _kmalloc+0xb09 0xffffffff80658519
        _kmalloc() at _kmalloc+0xb09 0xffffffff80658519
        callout_reset() at callout_reset+0x13f 0xffffffff80687adf
        ata_begin_transaction() at ata_begin_transaction+0x1a7 0xffffffff8032bf47
        ata_start() at ata_start+0x190 0xffffffff80330140
        ata_queue_request() at ata_queue_request+0x100 0xffffffff80330390
        Debugger("panic")

Reported-by: daftaupe (and others before)

    [2 lines not shown]
DeltaFile
+1-0sys/dev/disk/nata/ata-all.h
+1-01 files

DragonFlyBSD/src 5b449c9sys/vfs/isofs/cd9660 cd9660_rrip.c

cd9660: Recognize IEEE_1282 and IEEE_P1282 as RockRidge identifiers

This allows us to read the ISO images created by makefs(8) utility,
which uses "IEEE_P1282" as the RockRidge extension identifier.

Note that this doesn't mean we actually fully support those specs, which
include the multiple ER/ES entries, sparse files and the file serial
number field in PX entries.

Obtained-from: NetBSD
DeltaFile
+10-3sys/vfs/isofs/cd9660/cd9660_rrip.c
+10-31 files

DragonFlyBSD/src 74da20fsys/vfs/isofs/cd9660 cd9660_rrip.c

cd9660 - Fix bp corruption and excess bp refs

* Fix improper bp reuse without deref / cleanup.  In DFly, this improper
  use case could also corrupt the previous buffer content with incorrect
  data.

* Refactor code logic to make everytyhing more readable.

Taken-From: FreeBSD PR 272856 and fa3cf6cdc68cb6d6f2c440f2653258d68eae1015
Requested-by: aly
DeltaFile
+53-21sys/vfs/isofs/cd9660/cd9660_rrip.c
+53-211 files

DragonFlyBSD/src 174cf1cetc/rc.d wg

rc.d/wg: Update wg_load_config() to reduce code duplication
DeltaFile
+6-12etc/rc.d/wg
+6-121 files

DragonFlyBSD/src ebf24f4etc/rc.d wg, share/man/man5 wg.conf.5

rc.d/wg: Warn if config file does not have mode 0400 or 0600

Help protect from leaking private keys in the config files.
The wg.conf.5 man page has bee updated accordingly.

Later I'll convert this warning to an error.
DeltaFile
+7-1share/man/man5/wg.conf.5
+5-0etc/rc.d/wg
+12-12 files

DragonFlyBSD/src 9e15d34sys/dev/disk/nata ata-all.h

disk/nata: Fix panic caused by 'callouts: malloc limit exceeded'

Call callout_terminate() in ata_free_request() to fix the leak.

There was a callout leak before and could easily cause the following
panic:

        panic: callouts: malloc limit exceeded
        cpuid = 1
        Trace beginning at frame 0xfffff8005cd9d2a8
        _kmalloc() at _kmalloc+0xb09 0xffffffff80658519
        _kmalloc() at _kmalloc+0xb09 0xffffffff80658519
        callout_reset() at callout_reset+0x13f 0xffffffff80687adf
        ata_begin_transaction() at ata_begin_transaction+0x1a7 0xffffffff8032bf47
        ata_start() at ata_start+0x190 0xffffffff80330140
        ata_queue_request() at ata_queue_request+0x100 0xffffffff80330390
        Debugger("panic")

Reported-by: daftaupe (and others before)

    [2 lines not shown]
DeltaFile
+1-0sys/dev/disk/nata/ata-all.h
+1-01 files

DragonFlyBSD/src 3526d77sys/net rtsock.c

route(4): Ensure RTA_NETMASK has a valid length and family

When adding a route to the radix tree only the data part of the
sockaddr is preserved. Trailing zeros are also removed which
results in zero length netmask for the default route.
So when we pull the route from the kernel via a route(4) message,
the netmask sockaddr has an invalid family and for the default
route, an invalid length as well.

You can see the effect of this by ensuring a default route is
present and then issuing the command `route -n flush`
which results in an error.

The simple fix is this: when we place the netmask in a route(4)
message and we have a destination address (ie it's a route)
then we can fix the family (it will be either 0x00 or 0xff) and
the length (it will be 0 for the default route).
DeltaFile
+29-2sys/net/rtsock.c
+29-21 files

DragonFlyBSD/src 57b363enrelease Makefile

nrelease: Migrate from cdrtools/mkisofs to makefs(8) for ISO creation

With the recently updated kernel cd9660 and userland makefs(8), we're
able to replace the mkisofs (from port sysutils/cdrtools) with the
in-base makefs(8) utility.

The new ISO has been tested for:
- both legacy BIOS and UEFI boot okay
- installation ok and the installed system worked
DeltaFile
+10-16nrelease/Makefile
+10-161 files

DragonFlyBSD/src 4e41573nrelease Makefile

nrelease: Fix volume label to comply with cd9660 spec

The iso/cd9660 spec says the volume identifier/label can have a maximum
length of 32 characters, and must contain only A-Z, 0-9 and _, so we
have to fix the label portion of git version string to meet the
requirement.

Although the old label format is accepted by mkisofs, it will be
rejected by makefs(8).  So this change helps we migrate to the latter.
DeltaFile
+6-3nrelease/Makefile
+6-31 files

DragonFlyBSD/src 7086154nrelease Makefile

nrelease: Remove legacy code that used vn(4) to create ESP image

We're now using makefs(8) to create the ESP image.
DeltaFile
+2-15nrelease/Makefile
+2-151 files

DragonFlyBSD/src 6634454sys/vfs/isofs/cd9660 cd9660_rrip.c

cd9660: Recognize IEEE_1282 and IEEE_P1282 as RockRidge identifiers

This allows us to read the ISO images created by makefs(8) utility,
which uses "IEEE_P1282" as the RockRidge extension identifier.

Note that this doesn't mean we actually fully support those specs, which
include the multiple ER/ES entries, sparse files and the file serial
number field in PX entries.

Obtained-from: NetBSD
DeltaFile
+10-3sys/vfs/isofs/cd9660/cd9660_rrip.c
+10-31 files

DragonFlyBSD/src 49a42dfusr.sbin/makefs Makefile ffs.c, usr.sbin/makefs/hammer2 hammer2_compat.h

makefs(8): Fix several warnings and tweak Makefile

ffs.c: In function 'ffs_write_file':
ffs.c:944:9: warning: missing initializer for field 'v_type' of 'struct m_vnode' [-Wmissing-field-initializers]
  struct m_vnode vp = { fsopts, NULL };
         ^~~~~~~
In file included from ffs/ffs_extern.h:38,
                 from ffs.c:106:
/usr/src/usr.sbin/makefs/ffs/buf.h:57:13: note: 'v_type' declared here
  enum vtype v_type; /* DragonFly */

In file included from hammer2.h:41,
                 from hammer2.c:59:
hammer2/hammer2.h: In function 'hammer2_knote':
hammer2/hammer2.h:2098:51: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
   KNOTE(&vp->v_pollinfo.vpi_kqinfo.ki_note, flags);
                                                   ^
...
DeltaFile
+6-3usr.sbin/makefs/Makefile
+3-3usr.sbin/makefs/ffs.c
+1-1usr.sbin/makefs/hammer2/hammer2_compat.h
+10-73 files

DragonFlyBSD/src 631c0f0sys/vfs/isofs/cd9660 cd9660_node.c

cd9660: Use S_I* flags instead of VREAD/VEXEC flags for readability

Obtained-from: FreeBSD (commit 464119c4228fcc800e936f58447a277914929115)
DeltaFile
+7-7sys/vfs/isofs/cd9660/cd9660_node.c
+7-71 files

DragonFlyBSD/src 4834b23usr.sbin/makefs cd9660.c cd9660.h, usr.sbin/makefs/cd9660 cd9660_debug.c cd9660_archimedes.c

makefs(8): Sync cd9660 function with FreeBSD

The major changes are (in chronological order):

* makefs: connect cd9660 El Torito EFI boot image system type

* Fix -Wpointer-sign warnings in makefs and mkimg

* makefs: correct iso9660 Rock Ridge TF timestamps

  The bit definitions for the TF_* timestamp bits (TF_MODIFY, etc.) were
  incorrect, and timestamps were written in the wrong order.

  See RRIP 4.1.6 Description of the "TF" System Use Entry for details.

  PR:           203531
  Reported by:  Thomas Schmitt <scdbackup at gmx.net>
  Reviewed by:  jrtc27, kevans
  Sponsored by: The FreeBSD Foundation

    [158 lines not shown]
DeltaFile
+59-110usr.sbin/makefs/cd9660.c
+53-88usr.sbin/makefs/cd9660/cd9660_debug.c
+0-125usr.sbin/makefs/cd9660/cd9660_archimedes.c
+11-42usr.sbin/makefs/cd9660.h
+0-52usr.sbin/makefs/cd9660/cd9660_archimedes.h
+30-20usr.sbin/makefs/cd9660/cd9660_eltorito.c
+153-4378 files not shown
+225-50614 files

DragonFlyBSD/src 023dad5sys/vfs/isofs/cd9660 cd9660_node.c

cd9660: Explicitly treat the timezone byte as a signed value

Otherwise, timezone information for time zones west of GMT gets
discarded.

Obtained-from: FreeBSD (PR kern/128934, commit 5c423e0640bcad0eb90d9c968658347228bc2818)
DeltaFile
+1-1sys/vfs/isofs/cd9660/cd9660_node.c
+1-11 files

DragonFlyBSD/src 0c760dbsys/vfs/isofs/cd9660 cd9660_rrip.c

cd9660: Fix ISO_SUSP_CFLAG_ROOT handling in RockRidge

When encountering a ISO_SUSP_CFLAG_ROOT element in Rock Ridge processing,
this actually means there's a double slash recorded in the symbolic
link's path name.  We used to start over from / then, which caused link
targets like "../../bsdi.1.0/include//pathnames.h" to be interpreted as
/pathnahes.h.  This is both contradictionary to our conventional slash
interpretation, as well as potentially dangerous.

The right thing to do is (obviously) to just ignore that element.

Obtained-from: FreeBSD (commit f7d5a5328faa1cb0b6ad60860e8f46d748507c88)
DeltaFile
+2-4sys/vfs/isofs/cd9660/cd9660_rrip.c
+2-41 files

DragonFlyBSD/src cbea5b4usr.sbin/makefs makefs.8

makefs.8: Mention hammer2(8) in SEE ALSO
DeltaFile
+1-0usr.sbin/makefs/makefs.8
+1-01 files

DragonFlyBSD/src f7f15e8sys/vfs/isofs/cd9660 cd9660_mount.h iso_rrip.h

cd9660: Add inclusion guards for headers
DeltaFile
+7-0sys/vfs/isofs/cd9660/cd9660_mount.h
+6-0sys/vfs/isofs/cd9660/iso_rrip.h
+5-0sys/vfs/isofs/cd9660/iso.h
+5-0sys/vfs/isofs/cd9660/cd9660_rrip.h
+5-0sys/vfs/isofs/cd9660/cd9660_node.h
+28-05 files

DragonFlyBSD/src c9588casys/vfs/isofs/cd9660 cd9660_rrip.c

cd9660 - Fix bp corruption and excess bp refs

* Fix improper bp reuse without deref / cleanup.  In DFly, this improper
  use case could also corrupt the previous buffer content with incorrect
  data.

* Refactor code logic to make everytyhing more readable.

Taken-From: FreeBSD PR 272856 and fa3cf6cdc68cb6d6f2c440f2653258d68eae1015
Requested-by: aly
DeltaFile
+53-21sys/vfs/isofs/cd9660/cd9660_rrip.c
+53-211 files

DragonFlyBSD/src e45bcd8stand/boot/common load_elf.c module.c

stand/boot: Tweak the load message to print the file's rootpath

Meanwhile, fix a style chore.
DeltaFile
+2-3stand/boot/common/load_elf.c
+2-1stand/boot/common/module.c
+4-42 files

DragonFlyBSD/src e6595d9stand/boot/common rel_open.c

stand/boot: Fix rel_rootpath() to avoid duplicate "/boot" prefix

When the /boot is on the root filesystem instead of being a separate
filesystem (e.g., the ISO/IMG installation media), the loader was
setting DirBase to be "/boot/<kernelname>", which already had the
"/boot" prefix.  And then rel_rootpath() would return
"/boot/boot/kernel/kernel" for the default kernel (i.e., name "kernel"
and boot file "kernel").

In that case, loadfile() would set "kernelname=/boot/boot/kernel/kernel"
and derive "exported_module_path=/boot/boot/kernel;/boot/modules.local".
Then boot() would move "exported_module_path" to "module_path", which
finally be the value of "kern.module_path" sysctl.  As a result,
kldload(8) would fail to load a module without specifying its full path.

This patch fixes the above issue.

Suggested-by: swildner
DeltaFile
+18-8stand/boot/common/rel_open.c
+18-81 files

DragonFlyBSD/src 60ff65bsbin/route route.c

route(8): Minor tweaks and style cleanups
DeltaFile
+14-10sbin/route/route.c
+14-101 files

DragonFlyBSD/src 4f3252asbin/mount_cd9660 mount_cd9660.c

mount_cd9660(8): Improve the parsing of file/dir masks
DeltaFile
+7-10sbin/mount_cd9660/mount_cd9660.c
+7-101 files

DragonFlyBSD/src 183e6fcsys/vfs/isofs/cd9660 cd9660_mount.h

cd9660: Minor style cleanup and comment tweaks
DeltaFile
+3-3sys/vfs/isofs/cd9660/cd9660_mount.h
+3-31 files

DragonFlyBSD/src b06fcdcsbin/mount_cd9660 mount_cd9660.8 mount_cd9660.c

mount_cd9660(8): Simplify the settings of file/dir mode masks

Meanwhile, update the man page to clarify the default values of uid, gid,
and file/dir modes. (obtained from FreeBSD)

See also: https://reviews.freebsd.org/D47357
DeltaFile
+17-22sbin/mount_cd9660/mount_cd9660.8
+6-30sbin/mount_cd9660/mount_cd9660.c
+23-522 files

DragonFlyBSD/src 2b103f9sbin/route route.c

route(8): Tweak the hex print format for unknown addresses

Change the old format like "(family) xx xx xx ..." to
"(family)xx.xx.xx..." so it looks better in the monitor output.

Referred to OpenBSD.
DeltaFile
+2-1sbin/route/route.c
+2-11 files

DragonFlyBSD/src b5d7cb4sbin/route route.c

route(8): Fix routename() for AF_LINK addresses with sdl_index

The link_ntoa() function is able to handle such link addresses with zero
lengths but only 'sdl_index', so route(8) would print an empty string
for some RTA_GATEWAY and RTA_IFP sockaddrs in the monitor output.

Fix routename() to correctly print such addresses by copying the code
from netstat(1).
DeltaFile
+23-1sbin/route/route.c
+23-11 files

DragonFlyBSD/src 1f68b02sys/vfs/isofs/cd9660 cd9660_vfsops.c

cd9660: Fix file/dir mode masks to support setuid/setgid/sticky bits

The old code only allowed max mode to be 777, which caused the special
permissions (i.e., setuid/setgid/sticky) were lost in the filesystem.
That would cause a system installed from ISO to malfunction.

Fix the file/dir mode masks to ALLPERMS by default.

The ISOFSMNT_MODEMASK option is kept for backward compatible with the
old mount_cd9660(8) utility. (It will also be updated.)

See also: https://reviews.freebsd.org/D47357
DeltaFile
+6-5sys/vfs/isofs/cd9660/cd9660_vfsops.c
+6-51 files

DragonFlyBSD/src ab75f1dnrelease Makefile

nrelease: Let vnconfig(8) auto determine/create the vn device
DeltaFile
+2-6nrelease/Makefile
+2-61 files

DragonFlyBSD/src ccc073fnrelease Makefile

nrelease: Unconfigure vn(4) and clean up after creating efiboot.img
DeltaFile
+3-4nrelease/Makefile
+3-41 files