DragonFlyBSD/src c76ea56 — sbin/mount mount.c

mount(8): Detect known filesystem types in raw GPT partitions

mount(8) previously only guessed the filesystem from the disklabel
fstype.  DIOCGPART already puts the GPT partition type UUID in
partinfo.fstype_uuid, but mount(8) never looked at it.  A raw GPT
partition has fstype 0, so mount(8) would warn and fall back to ufs.

Update checkdisklabel() to look the fstype_uuid up in a table of known
GPT partition types (EFI -> msdos, the DragonFly/FreeBSD native types ->
ufs/hammer/hammer2) if the disklabel fstype does not map.  Unknown GPT
partition types keep the old warning and ufs fallback.

Bug: #3401
DeltaFile
+43-12sbin/mount/mount.c
+43-121 files

DragonFlyBSD/src ffd4b44 — stand/boot/efi/loader Makefile, stand/boot/efi/loader/arch/x86_64 ldscript.x86_64

efi/loader: Improve the linker script and LDFLAGS

* Remove the stale comment of `.hash`, which is empty under the default
  `--hash-style=gnu`.  The image base is also pinned by
  `. = 0; ImageBase = .`.

* Fold the remaining linker-generated PLT sections (`.plt.*` and `.iplt`)
  into `.text` so the `objcopy -j .text` can never drop them.

* Add `-Wl,-z,defs` to fail the link if there are unresolved symbols,
  instead of generating PLT entries for them.

* Add `-Wl,--no-eh-frame-hdr` to skip generating the `.eh_frame_hdr`
  section because it's never copied into the final `loader.efi`
  executable.  What's worse, the generation sidesteps a bug in
  bintuils/bfd that produced the misleading overlapping FDEs error, as
  observed in the previous commit.

Assisted-by: DeepSeek-v4.1-flash (with Pi Coding Agent)
DeltaFile
+6-0stand/boot/efi/loader/Makefile
+2-2stand/boot/efi/loader/arch/x86_64/ldscript.x86_64
+8-22 files

DragonFlyBSD/src 34c6dca — stand/boot/efi/loader Makefile

efi/loader: Fix libstand.a order in LDADD

When I tried to use `strtok()` in `boot/dloader`, the `stand/efi/loader`
would fail the linking with an obscure error:

```
cc -pipe -O1   -fno-stack-protector -fPIC -I/usr/src/stand/boot/efi/loader/../../../contrib/edk2/MdePkg/Include -I/usr/src/stand/boot/efi/loader/../../../contrib/edk2/MdePkg/Include/X64 -I/usr/src/stand/boot/efi/loader/../../../contrib/edk2/MdeModulePkg/Include -I/usr/src/stand/boot/efi/loader -I/usr/src/stand/boot/efi/loader/arch/x86_64 -I/usr/src/stand/boot/efi/loader/../include -I/usr/src/stand/boot/efi/loader/../../../../sys/contrib/dev/acpica/source/include -I/usr/src/stand/boot/efi/loader/../../../../sys -I/usr/src/stand/boot/efi/loader/../../pc32/libi386 -I/usr/src/stand/boot/efi/loader/../../dloader -I/usr/src/stand/boot/efi/loader/../../../lib -DNO_PCI -DEFI -I/usr/src/stand/boot/efi/loader/../../common -O -D_STANDALONE -ffreestanding -Wformat -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float -fshort-wchar -mno-red-zone -mno-aes   -std=gnu11 -Wmissing-include-dirs -Wsystem-headers -Wall -Wformat-security -Winit-self -Wextra -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wold-style-definition  -Wno-pointer-sign -Wno-maybe-uninitialized -Wno-unused-parameter -Wno-format-overflow -Wno-format-truncation -Wno-stringop-truncation -Wno-stringop-overflow -Wno-address-of-packed-member -Wno-unused-but-set-variable -Wno-unused-but-set-parameter -Wno-unused-value -Wno-implicit-fallthrough  -Wl,-znocombreloc -Wl,-T/usr/src/stand/boot/efi/loader/arch/x86_64/ldscript.x86_64 -Wl,-Bsymbolic -shared -nostdlib -o loader.sym autoload.o bootinfo.o conf.o copy.o devicename.o efi_main.o i386_module.o main.o self_reloc.o smbios.o vers.o amd64_tramp.o start.o framebuffer.o elf64_freebsd.o nullconsole.o comconsole.o bcache.o boot.o commands.o console.o devopen.o interp_backslash.o interp_parse.o ls.o misc.o module.o panic.o rel_open.o load_elf32.o load_elf32_obj.o reloc_elf32.o load_elf64.o load_elf64_obj.o reloc_elf64.o do_dloader.o /usr/obj/usr/src/world_x86_64/usr/src/stand/boot/efi/loader/../libefi/libefi.a /usr/obj/usr/src/world_x86_64/usr/src/stand/boot/efi/loader/../../../lib/libstand.a /usr/obj/usr/src/world_x86_64/usr/src/stand/boot/efi/loader/../../dloader/libdloader.a
/usr/obj/usr/src/ctools_x86_64_x86_64/usr/libexec/binutils234/elf/ld.bfd: .eh_frame_hdr refers to overlapping FDEs
/usr/obj/usr/src/ctools_x86_64_x86_64/usr/libexec/binutils234/elf/ld.bfd: final link failed: bad value
collect2: error: ld returned 1 exit status
```

Reproducing the failing link with `ld.bfd --no-eh-frame-hdr` and dumping
`.eh_frame` showed:

```
00000018  00000014  FDE cie=0  pc=0x6000..0x600e   <- efi_autoload (autoload.o)
00000030  00000024  FDE cie=0  pc=0x6000..0x6020   <- PLT .eh_frame
00000058  00000050  FDE cie=0  pc=0x600e..0x63ab   <- bi_copymodules (bootinfo.o)

    [27 lines not shown]
DeltaFile
+2-2stand/boot/efi/loader/Makefile
+2-21 files

DragonFlyBSD/src 1cb32eb — sbin/mount mount.c

mount(8): Detect known filesystem types in raw GPT partitions

mount(8) previously only guessed the filesystem from the disklabel
fstype.  DIOCGPART already puts the GPT partition type UUID in
partinfo.fstype_uuid, but mount(8) never looked at it.  A raw GPT
partition has fstype 0, so mount(8) would warn and fall back to ufs.

Update checkdisklabel() to look the fstype_uuid up in a table of known
GPT partition types (EFI -> msdos, the DragonFly/FreeBSD native types ->
ufs/hammer/hammer2) if the disklabel fstype does not map.  Unknown GPT
partition types keep the old warning and ufs fallback.

Bug: #3401
DeltaFile
+43-12sbin/mount/mount.c
+43-121 files

DragonFlyBSD/src c689f9e — stand/boot/dloader Makefile, stand/boot/efi Makefile.inc

stand: Sync FPU-related CFLAGS with sys/platform/pc64/conf/kern.mk
DeltaFile
+4-4stand/boot/efi/Makefile.inc
+2-3stand/boot/dloader/Makefile
+2-1stand/lib/Makefile
+2-1stand/boot/pc32/Makefile.inc
+10-94 files

DragonFlyBSD/src 66bf176 — stand/boot/efi/boot1 Makefile

efi/boot1: Apply the same LDFLAGS update as efi/loader
DeltaFile
+3-0stand/boot/efi/boot1/Makefile
+3-01 files

DragonFlyBSD/src cc88f3f — stand/boot/efi/loader Makefile, stand/boot/efi/loader/arch/x86_64 ldscript.x86_64

efi/loader: Improve the linker script and LDFLAGS

* Remove the stale comment of `.hash`, which is empty under the default
  `--hash-style=gnu`.  The image base is also pinned by
  `. = 0; ImageBase = .`.

* Fold the remaining linker-generated PLT sections (`.plt.*` and `.iplt`)
  into `.text` so the `objcopy -j .text` can never drop them.

* Add `-Wl,-z,defs` to fail the link if there are unresolved symbols,
  instead of generating PLT entries for them.

* Add `-Wl,--no-eh-frame-hdr` to skip generating the `.eh_frame_hdr`
  section because it's never copied into the final `loader.efi`
  executable.  What's worse, the generation sidesteps a bug in
  bintuils/bfd that produced the misleading overlapping FDEs error, as
  observed in the previous commit.

Assisted-by: DeepSeek-v4.1-flash (with Pi Coding Agent)
DeltaFile
+6-0stand/boot/efi/loader/Makefile
+2-2stand/boot/efi/loader/arch/x86_64/ldscript.x86_64
+8-22 files

DragonFlyBSD/src 20f3853 — stand/boot/efi/loader Makefile

efi/loader: Fix libstand.a order in LDADD

When I tried to use `strtok()` in `boot/dloader`, the `stand/efi/loader`
would fail the linking with an obscure error:

```
cc -pipe -O1   -fno-stack-protector -fPIC -I/usr/src/stand/boot/efi/loader/../../../contrib/edk2/MdePkg/Include -I/usr/src/stand/boot/efi/loader/../../../contrib/edk2/MdePkg/Include/X64 -I/usr/src/stand/boot/efi/loader/../../../contrib/edk2/MdeModulePkg/Include -I/usr/src/stand/boot/efi/loader -I/usr/src/stand/boot/efi/loader/arch/x86_64 -I/usr/src/stand/boot/efi/loader/../include -I/usr/src/stand/boot/efi/loader/../../../../sys/contrib/dev/acpica/source/include -I/usr/src/stand/boot/efi/loader/../../../../sys -I/usr/src/stand/boot/efi/loader/../../pc32/libi386 -I/usr/src/stand/boot/efi/loader/../../dloader -I/usr/src/stand/boot/efi/loader/../../../lib -DNO_PCI -DEFI -I/usr/src/stand/boot/efi/loader/../../common -O -D_STANDALONE -ffreestanding -Wformat -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float -fshort-wchar -mno-red-zone -mno-aes   -std=gnu11 -Wmissing-include-dirs -Wsystem-headers -Wall -Wformat-security -Winit-self -Wextra -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wold-style-definition  -Wno-pointer-sign -Wno-maybe-uninitialized -Wno-unused-parameter -Wno-format-overflow -Wno-format-truncation -Wno-stringop-truncation -Wno-stringop-overflow -Wno-address-of-packed-member -Wno-unused-but-set-variable -Wno-unused-but-set-parameter -Wno-unused-value -Wno-implicit-fallthrough  -Wl,-znocombreloc -Wl,-T/usr/src/stand/boot/efi/loader/arch/x86_64/ldscript.x86_64 -Wl,-Bsymbolic -shared -nostdlib -o loader.sym autoload.o bootinfo.o conf.o copy.o devicename.o efi_main.o i386_module.o main.o self_reloc.o smbios.o vers.o amd64_tramp.o start.o framebuffer.o elf64_freebsd.o nullconsole.o comconsole.o bcache.o boot.o commands.o console.o devopen.o interp_backslash.o interp_parse.o ls.o misc.o module.o panic.o rel_open.o load_elf32.o load_elf32_obj.o reloc_elf32.o load_elf64.o load_elf64_obj.o reloc_elf64.o do_dloader.o /usr/obj/usr/src/world_x86_64/usr/src/stand/boot/efi/loader/../libefi/libefi.a /usr/obj/usr/src/world_x86_64/usr/src/stand/boot/efi/loader/../../../lib/libstand.a /usr/obj/usr/src/world_x86_64/usr/src/stand/boot/efi/loader/../../dloader/libdloader.a
/usr/obj/usr/src/ctools_x86_64_x86_64/usr/libexec/binutils234/elf/ld.bfd: .eh_frame_hdr refers to overlapping FDEs
/usr/obj/usr/src/ctools_x86_64_x86_64/usr/libexec/binutils234/elf/ld.bfd: final link failed: bad value
collect2: error: ld returned 1 exit status
```

Reproducing the failing link with `ld.bfd --no-eh-frame-hdr` and dumping
`.eh_frame` showed:

```
00000018  00000014  FDE cie=0  pc=0x6000..0x600e   <- efi_autoload (autoload.o)
00000030  00000024  FDE cie=0  pc=0x6000..0x6020   <- PLT .eh_frame
00000058  00000050  FDE cie=0  pc=0x600e..0x63ab   <- bi_copymodules (bootinfo.o)

    [27 lines not shown]
DeltaFile
+2-2stand/boot/efi/loader/Makefile
+2-21 files

DragonFlyBSD/src e13f232 — sys/kern kern_memio.c

kern: Fix mmioctl() to return ENOTTY for unknown devices

The default case for unknown devices handles /dev/null and previously
returned ENODEV for tcsetattr/tcgetattr/tc* requests, which should be
ENOTTY as specified by POSIX (as well as documented in the man pages).

Fix the bug by correcting mmioctl() to return ENOTTY in the default
case.

Patch-by: jpikin, sigttou (David Bidner)
Bug: https://bugs.dragonflybsd.org/issues/3252
DeltaFile
+1-1sys/kern/kern_memio.c
+1-11 files

DragonFlyBSD/src 673727e — stand/boot/efi/loader/arch/x86_64 elf64_freebsd.c

loader: Allocate the EFI trampoline as executable memory

The trampoline contains code, but EfiLoaderData allocations may be mapped
non-executable. Allocate its page as EfiLoaderCode.

Adapted from Ed Maste's FreeBSD commit:
https://github.com/freebsd/freebsd-src/commit/2b1df6149e8a2d50a09d13c64d1574dad91e10b1
FreeBSD review: https://reviews.freebsd.org/D58383

Bug: https://bugs.dragonflybsd.org/issues/3427
DeltaFile
+1-1stand/boot/efi/loader/arch/x86_64/elf64_freebsd.c
+1-11 files

DragonFlyBSD/src 1f371a2 — usr.bin/w w.c

w(1) - Do not warn about non-existent tty lines

ttystat() called warn() when stat("/dev/<line>") failed, so X11 sessions
(ut_line like ":16") printed a spurious
"w: /dev/:16: No such file or directory".

Return NULL silently unless the line is an existing character device.
Matches FreeBSD (see commits 21632754d652d20a4618cac0b52ebe7d8e790865,
d0d0355e4dd9fa060443d3f1b1a223118ff68827).

Fixes #3298
DeltaFile
+3-5usr.bin/w/w.c
+3-51 files

DragonFlyBSD/src a8c6b03 — stand/boot/efi/loader/arch/x86_64 elf64_freebsd.c amd64_tramp.S

loader: Clear CR0.WP during EFI kernel relocation

Firmware on an HP ProDesk 600 G4 leaves relocation destination pages
read-only. efi_copy_finish() faults at 0x1001000 with page-fault error
code 3 (supervisor write, protection violation) while CR0.WP is set.

Save CR0 and clear WP around the relocation copy after ExitBootServices,
with interrupts disabled. Restore CR0 before entering the kernel. Reject
active CET before leaving boot services, since it prevents clearing WP.

Bug: https://bugs.dragonflybsd.org/issues/3427
DeltaFile
+11-0stand/boot/efi/loader/arch/x86_64/amd64_tramp.S
+8-0stand/boot/efi/loader/arch/x86_64/elf64_freebsd.c
+19-02 files

DragonFlyBSD/src 48147b0 — usr.bin/w w.c

w(1) - Do not warn about non-existent tty lines

ttystat() called warn() when stat("/dev/<line>") failed, so X11 sessions
(ut_line like ":16") printed a spurious
"w: /dev/:16: No such file or directory".

Return NULL silently unless the line is an existing character device.
Matches FreeBSD (see commits 21632754d652d20a4618cac0b52ebe7d8e790865,
d0d0355e4dd9fa060443d3f1b1a223118ff68827).

Fixes #3298
DeltaFile
+3-5usr.bin/w/w.c
+3-51 files

DragonFlyBSD/src 4ac0f97 — stand/boot/efi/loader/arch/x86_64 elf64_freebsd.c amd64_tramp.S

loader: Clear CR0.WP during EFI kernel relocation

Firmware on an HP ProDesk 600 G4 leaves relocation destination pages
read-only. efi_copy_finish() faults at 0x1001000 with page-fault error
code 3 (supervisor write, protection violation) while CR0.WP is set.

Save CR0 and clear WP around the relocation copy after ExitBootServices,
with interrupts disabled. Restore CR0 before entering the kernel. Reject
active CET before leaving boot services, since it prevents clearing WP.

Bug: https://bugs.dragonflybsd.org/issues/3427
DeltaFile
+11-0stand/boot/efi/loader/arch/x86_64/amd64_tramp.S
+8-0stand/boot/efi/loader/arch/x86_64/elf64_freebsd.c
+19-02 files

DragonFlyBSD/src c82594c — stand/boot/efi/loader/arch/x86_64 elf64_freebsd.c

loader: Allocate the EFI trampoline as executable memory

The trampoline contains code, but EfiLoaderData allocations may be mapped
non-executable. Allocate its page as EfiLoaderCode.

Adapted from Ed Maste's FreeBSD commit:
https://github.com/freebsd/freebsd-src/commit/2b1df6149e8a2d50a09d13c64d1574dad91e10b1
FreeBSD review: https://reviews.freebsd.org/D58383

Bug: https://bugs.dragonflybsd.org/issues/3427
DeltaFile
+1-1stand/boot/efi/loader/arch/x86_64/elf64_freebsd.c
+1-11 files

DragonFlyBSD/src 106617d — sys/kern kern_memio.c

kern: Fix mmioctl() to return ENOTTY for unknown devices

The default case for unknown devices handles /dev/null and previously
returned ENODEV for tcsetattr/tcgetattr/tc* requests, which should be
ENOTTY as specified by POSIX (as well as documented in the man pages).

Fix the bug by correcting mmioctl() to return ENOTTY in the default
case.

Patch-by: jpikin, sigttou (David Bidner)
Bug: https://bugs.dragonflybsd.org/issues/3252
DeltaFile
+1-1sys/kern/kern_memio.c
+1-11 files

DragonFlyBSD/src 2052d4f — contrib/flex README.DRAGONFLY, contrib/flex/src misc.c

contrib/flex: Guard against int overflow in sko_push().

sko_sz is an int; doubling it unchecked could overflow and produce a
huge size_t for realloc(). Bail out if it would overflow.

It's sad that the upstream project hasn't had a new release since 2017,
so we decided to directly patch the contributed source.

Bug: #3426
DeltaFile
+6-2contrib/flex/src/misc.c
+3-0contrib/flex/README.DRAGONFLY
+9-22 files

DragonFlyBSD/src d1f4fb9 — contrib/flex README.DRAGONFLY, contrib/flex/src misc.c

contrib/flex: Guard against int overflow in sko_push().

sko_sz is an int; doubling it unchecked could overflow and produce a
huge size_t for realloc(). Bail out if it would overflow.

It's sad that the upstream project hasn't had a new release since 2017,
so we decided to directly patch the contributed source.

Bug: #3426
DeltaFile
+6-2contrib/flex/src/misc.c
+3-0contrib/flex/README.DRAGONFLY
+9-22 files

DragonFlyBSD/src 9ee24a3 — lib/libc/locale utf8.c

libc: reject a negative wchar_t in the UTF-8 encoder

_UTF8_wcrtomb() and _UTF8_wcrtombin() pick the four byte form with
"wc <= 0x10ffff".  wchar_t is signed, so every negative value passes
that test and is encoded from its low bits: wcrtomb() of (wchar_t)-1
returns 4 and writes ff bf bf bf, and printf("%lc", -1) prints those
bytes instead of failing with EILSEQ as it does for 0x110000.

Add "wc >= 0 &&" to both tests, as FreeBSD's utf8.c has.

GitHub-PR: https://github.com/DragonFlyBSD/DragonFlyBSD/pull/57
FreeBSD: https://github.com/freebsd/freebsd-src/commit/8bb93485fb51aac423ec000aa292815cf50bb02c
DeltaFile
+2-2lib/libc/locale/utf8.c
+2-21 files

DragonFlyBSD/src 37e8817 — lib/libc/stdio printf-pos.c

libc: type a positional %F argument in __find_arguments()

When a format uses positional arguments, __find_arguments() walks it
first to learn the type of every argument, and lists the floating
point conversions as a A e E f g G.  F is missing, so a double that
is only referred to through %F never gets a type, its slot in the
argument table stays unset, and the conversion reads whatever is
there:

    printf("[%1$F]\n", -INFINITY);   [0.000000]
    printf("[%1$F]\n", 1.5);         [0.000000]
    printf("[%F]\n", 1.5);           [1.500000]

The same format with %1$f, or with any other conversion of the same
argument, works because those give it a type.  abseil's str_format
test compares against the C library and caught it.

Add F next to f in both __find_arguments() and __find_warguments().

GitHub-PR: https://github.com/DragonFlyBSD/DragonFlyBSD/pull/56
DeltaFile
+2-0lib/libc/stdio/printf-pos.c
+2-01 files

DragonFlyBSD/src a1c2f7b — sbin/gpt expand.c

gpt(8): Fix "expand" command to update 'hdr_lba_end'

Update the usuable LBA by fixing the 'hdr_lba_end' after expanding.
Otherwise, the extended partition may extend beyond the usuable LBA.

Bugs: #3276, #3423
DeltaFile
+2-0sbin/gpt/expand.c
+2-01 files

DragonFlyBSD/src 1f2ddc2 — lib/libc/locale utf8.c

libc: reject a negative wchar_t in the UTF-8 encoder

_UTF8_wcrtomb() and _UTF8_wcrtombin() pick the four byte form with
"wc <= 0x10ffff".  wchar_t is signed, so every negative value passes
that test and is encoded from its low bits: wcrtomb() of (wchar_t)-1
returns 4 and writes ff bf bf bf, and printf("%lc", -1) prints those
bytes instead of failing with EILSEQ as it does for 0x110000.

Add "wc >= 0 &&" to both tests, as FreeBSD's utf8.c has.

GitHub-PR: https://github.com/DragonFlyBSD/DragonFlyBSD/pull/57
FreeBSD: https://github.com/freebsd/freebsd-src/commit/8bb93485fb51aac423ec000aa292815cf50bb02c
DeltaFile
+2-2lib/libc/locale/utf8.c
+2-21 files

DragonFlyBSD/src 79869cc — lib/libc/stdio printf-pos.c

libc: type a positional %F argument in __find_arguments()

When a format uses positional arguments, __find_arguments() walks it
first to learn the type of every argument, and lists the floating
point conversions as a A e E f g G.  F is missing, so a double that
is only referred to through %F never gets a type, its slot in the
argument table stays unset, and the conversion reads whatever is
there:

    printf("[%1$F]\n", -INFINITY);   [0.000000]
    printf("[%1$F]\n", 1.5);         [0.000000]
    printf("[%F]\n", 1.5);           [1.500000]

The same format with %1$f, or with any other conversion of the same
argument, works because those give it a type.  abseil's str_format
test compares against the C library and caught it.

Add F next to f in both __find_arguments() and __find_warguments().

GitHub-PR: https://github.com/DragonFlyBSD/DragonFlyBSD/pull/56
DeltaFile
+2-0lib/libc/stdio/printf-pos.c
+2-01 files

DragonFlyBSD/src 4120737 — sbin/gpt gpt.8

gpt.8: Remove the obsolete BUGS section

On the other hand, they are not really bugs.

OK by swildner.
DeltaFile
+1-18sbin/gpt/gpt.8
+1-181 files

DragonFlyBSD/src eadc493 — sbin/gpt expand.c gpt.8

gpt(8): Add '-n' to "expand" to not auto extend the last partition

Add the '-n' option to the "expand" command to not auto extend the last
partition, so only the GPT itself is expanded.

Rewrite the "expand" command description in the man page to read more
clear and fluent.

Bug: #3276
DeltaFile
+16-9sbin/gpt/gpt.8
+11-6sbin/gpt/expand.c
+27-152 files

DragonFlyBSD/src f6a1090 — sbin/gpt expand.c

gpt(8): Fix two bugs in "expand" command

* Commit f4b4c056f1 introduced a regression to the "expand" command that
  the existing secondary GPT header and table were not relocated to the
  new end of the expanded disk, leaving the primary GPT header pointing
  at a non-existent secondary GPT. A second run would then creates it.

  Fix the regression by always setting the 'map_start' of the existing
  secondary GPT header and table to correctly relocate them.

  It's actually a hack to directly modify the 'map_start' field instead
  of deleting the map entry and then readding it, because there is no
  map_delete(). However, this is okay because we don't call map_add()
  afterwards.

* Update the usuable LBA by fixing the 'hdr_lba_end' after expanding.
  This fixes the warning revealed by the previous commit.

Bugs: #3422, #3423
DeltaFile
+24-3sbin/gpt/expand.c
+24-31 files

DragonFlyBSD/src fb80821 — sbin/gpt gpt.c

gpt(8): Add warnings about invalid partition LBA range

* Check the partition LBA range against the disk's usuable LBA range and
  warn the invalid LBA ranges.  This helps catch errors in GPT header
  (e.g., the hdr_lba_end) and table.

* Add a verbose message printing the disk's usuable LBA range.

* Don't hide the CRC errors behind the verbose flag.

Bugs: #3276, #3423
DeltaFile
+32-18sbin/gpt/gpt.c
+32-181 files

DragonFlyBSD/src 961f58e — bin/cpdup hcproto.c

cpdup: Don't pass an uninitialized pointer to getgroups(0, ...).

getmygroups() passed *gidlist to the size-only getgroups() query
before it was initialized. The list argument is ignored when the
size is 0, so pass NULL instead.

Bug: #3425
DeltaFile
+1-1bin/cpdup/hcproto.c
+1-11 files

DragonFlyBSD/src ad06c25 — lib/libevtr evtr.c

libevtr: Fix off-by-one in string namespace indexing.

evtr_dump_string() indexed evtr->strings[ns] although the array is
sized EVTR_NS_MAX - 1. The namespace IDs are EVTR_NS_PATH=1,
EVTR_NS_FUNC=2 and EVTR_NS_DSTR=3, so ns == 3 runs one past the array
and aliases the following union member (fmts): the dynamic-string
namespace and the format-string table then share a hashtable, and the
table allocated for that slot by evtr_open_write() leaks.

The read side already uses maps[ns - 1], so make the write side
consistent and only allocate/free the EVTR_NS_MAX - 1 entries.

Also reject ns == 0 in evtr_load_string(); the old check let it
through and maps[ns - 1] would read before the array on corrupt input.

Bug: #3424
DeltaFile
+5-5lib/libevtr/evtr.c
+5-51 files

DragonFlyBSD/src 62b6028 — lib/libc/gdtoa glue.c _ldtoa.c

libc: Sync gdtoa code with FreeBSD

* Fix bug: prevent incorrect %a/%La rounding at full precision
  Pull Request: https://github.com/freebsd/freebsd-src/pull/1837

* Minor code/style tweaks.
DeltaFile
+3-4lib/libc/gdtoa/machdep_ldisx.c
+4-3lib/libc/gdtoa/_hldtoa.c
+4-3lib/libc/gdtoa/_hdtoa.c
+3-2lib/libc/gdtoa/_ldtoa.c
+0-2lib/libc/gdtoa/glue.c
+14-145 files