DragonFlyBSD/src e1b2548 — lib/libnvmm libnvmm_x86.c

libnvmm: Improve the page walker

* Implement A/D bit setting.
* Inject #PFs on non-present pages when emulating MMIOs. This is needed
  for guests like Windows 2000 that aggressively page out memory that
  they then use in MMIO operations.
* Fix the '64bit walk - present' test that failed in the previous
  commit.

Obtained-from: NVMM Reference Implementation
DeltaFile
+410-187lib/libnvmm/libnvmm_x86.c
+410-1871 files

DragonFlyBSD/src 6f52ef5 — lib/libnvmm libnvmm.3 libnvmm_x86.c, test/testcases/libnvmm h_os.h h_mem_assist.c

libnvmm: Improve the correctness of page table walks

* Fix 32bit PAE: the top-level pdir doesn't have NX.
* Fix 32bit non-PAE: PTE_PS is ignored if CR4.PSE=0.
* Stop the walks early on if a required permission is not met.
* Take CR0.WP and EFER.NXE into account when evaluating permissions.
* Enforce SMEP/SMAP protections.
* Document the semantics of nvmm_gva_to_gpa() more clearly.
* Add unit-tests.

Note that the '64bit walk - present' test is failing, which will be
fixed in a later commit.

Obtained-from: NVMM Reference Implementation
DeltaFile
+139-91lib/libnvmm/libnvmm_x86.c
+119-6test/testcases/libnvmm/h_mem_assist.c
+10-4lib/libnvmm/libnvmm.3
+3-0test/testcases/libnvmm/h_os.h
+271-1014 files

DragonFlyBSD/src 6cda333 — test/testcases/libnvmm h_mem_assist.c

testcases/libnvmm: Fully reset the VCPU after each test

Otherwise if a fault is pending it gets injected in the next test.

Obtained-from: NVMM Reference Implementation
DeltaFile
+18-6test/testcases/libnvmm/h_mem_assist.c
+18-61 files

DragonFlyBSD/src eb95b47 — test/testcases/libnvmm h_misc.c h_io_assist.c

testcases/libnvmm: Don't depend on <machine/segments.h>

Obtained-from: NVMM Reference Implementation
DeltaFile
+14-14test/testcases/libnvmm/h_mem_assist.c
+13-2test/testcases/libnvmm/h_os.h
+7-7test/testcases/libnvmm/h_misc.c
+7-7test/testcases/libnvmm/h_io_assist.c
+41-304 files

DragonFlyBSD/src a5e22f8 — lib/libnvmm Makefile

libnvmm: Use -O2 optimization level for significant performance gain

Suggested-by: Maxime Villard
DeltaFile
+3-0lib/libnvmm/Makefile
+3-01 files

DragonFlyBSD/src a7418ac — lib/libnvmm libnvmm_x86.c

libnvmm: Fix -Winline warnings

GCC 12.5 would give the following -Winline warnings:

```
cc   -pipe -O   -ggdb3 -std=gnu11 -Wmissing-include-dirs -Wsystem-headers -Wall -Wformat-security -Winit-self -Wextra -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wold-style-definition -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align -Wunused-parameter -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls  -Wno-pointer-sign -Wno-format-overflow -Wno-format-truncation -Wno-stringop-truncation -Wno-stringop-overflow -Wno-address-of-packed-member   -c libnvmm.c -o libnvmm.o
In file included from libnvmm.c:48:
libnvmm_x86.c: In function 'nvmm_gva_to_gpa':
libnvmm_x86.c:624:1: warning: inlining failed in call to 'x86_gva_to_gpa': --param max-inline-insns-single limit reached [-Winline]
  624 | x86_gva_to_gpa(struct nvmm_machine *mach, struct nvmm_vcpu *vcpu,
      | ^~~~~~~~~~~~~~
libnvmm_x86.c:722:14: note: called from here
  722 |         es = x86_gva_to_gpa(mach, vcpu, gva, gpa, NVMM_PROT_READ, prot, false);
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libnvmm_x86.c: In function 'read_guest_memory':
libnvmm_x86.c:624:1: warning: inlining failed in call to 'x86_gva_to_gpa': --param max-inline-insns-single limit reached [-Winline]
  624 | x86_gva_to_gpa(struct nvmm_machine *mach, struct nvmm_vcpu *vcpu,
      | ^~~~~~~~~~~~~~
libnvmm_x86.c:944:14: note: called from here

    [18 lines not shown]
DeltaFile
+8-4lib/libnvmm/libnvmm_x86.c
+8-41 files

DragonFlyBSD/src 545fbde — lib/libnvmm libnvmm.c libnvmm_x86.c

libnvmm: Micro optimizations

Obtained-from: NVMM Reference Implementation
DeltaFile
+225-165lib/libnvmm/libnvmm_x86.c
+7-5lib/libnvmm/libnvmm.c
+232-1702 files

DragonFlyBSD/src d5fa4c7 — lib/libnvmm libnvmm_x86.c

libnvmm: Use a common helper to fetch instruction bytes

Obtained-from: NVMM Reference Implementation
DeltaFile
+46-67lib/libnvmm/libnvmm_x86.c
+46-671 files

DragonFlyBSD/src 78d0810 — lib/libnvmm libnvmm_x86.c, test/testcases/libnvmm h_mem_assist_asm.S

libnvmm: Fix MOVZX emulation

The overridden operand_size was being used to select the register, and
this did not match the actual desired register size. This could result
in the wrong register being written to, for example EBP would be decoded
as CH.

Update the existing unit-test to exercise this case.

Obtained-from: NVMM Reference Implementation
DeltaFile
+3-3test/testcases/libnvmm/h_mem_assist_asm.S
+4-1lib/libnvmm/libnvmm_x86.c
+7-42 files

DragonFlyBSD/src 3bfa046 — sys/dev/virtual/nvmm nvmm_os.h nvmm_netbsd.c

nvmm: Improve OS independence

* Add os_copy_from_user() and os_copy_to_user() helpers.
* Split os_vmobj_map() into os_vmobj_map_{user,kern}(), which are the
  same for DragonFly and NetBSD; this helps the Haiku port.

Obtained-from: NVMM Reference Implementation
DeltaFile
+8-8sys/dev/virtual/nvmm/nvmm.c
+12-2sys/dev/virtual/nvmm/nvmm_netbsd.c
+12-2sys/dev/virtual/nvmm/nvmm_dragonfly.c
+10-2sys/dev/virtual/nvmm/nvmm_os.h
+42-144 files

DragonFlyBSD/src 9af6e5d — sys/dev/virtual/nvmm/x86 nvmm_x86_svmfunc.S

nvmm: Micro-optimize one instruction in svm_vmrun()

Obtained-from: NVMM Reference Implementation
DeltaFile
+2-2sys/dev/virtual/nvmm/x86/nvmm_x86_svmfunc.S
+2-21 files

DragonFlyBSD/src 9bd9bca — sys/dev/virtual/nvmm/x86 nvmm_x86_svm.c nvmm_x86_internal.h

nvmm: Make the ASM files more OS-independent

* Introduce OS-independent ASM_FUNCTION and ASM_END macros.
* Move the OS-dependant bits to nvmm_x86_internal.h.
* Fetch the hgdt pointer in C with os_curcpu_gdt(), so svm_vmrun()
  becomes OS-independent.
* Use RIP-relative addressing in vmx_insn_fail{valid,invalid}.

Obtained-from: NVMM Reference Implementation
DeltaFile
+14-30sys/dev/virtual/nvmm/x86/nvmm_x86_vmxfunc.S
+7-33sys/dev/virtual/nvmm/x86/nvmm_x86_svmfunc.S
+25-0sys/dev/virtual/nvmm/x86/nvmm_x86_internal.h
+5-2sys/dev/virtual/nvmm/x86/nvmm_x86_svm.c
+51-654 files

DragonFlyBSD/src 1085a76 — sys/dev/virtual/nvmm/x86 nvmm_x86_internal.h nvmm_x86_svm.c

nvmm: Ignore MSR_LS_CFG (0xC0011020) on AMD CPUs

On older AMD CPUs that do not support SSBD mitigations, Linux falls
back to writing to MSR_LS_CFG on each context switch if this MSR
exists. This creates significant noise in the QEMU output.

We can't simply inject #GP for accesses to this MSR, as that may
break compatibility with older guests which assume that MSR_LS_CFG
is present based solely on the reported CPU family and model.

So just ignore this MSR completely. This fixes a QEMU output storm
on Arch Linux (tested with archlinux-2019.05.02-x86_64.iso).

Obtained-from: NVMM Reference Implementation
DeltaFile
+4-2sys/dev/virtual/nvmm/x86/nvmm_x86_svm.c
+1-0sys/dev/virtual/nvmm/x86/nvmm_x86_internal.h
+5-22 files

DragonFlyBSD/src efd00cf — sys/dev/virtual/nvmm/x86 nvmm_x86_svm.c

nvmm: Simplify the VMCB cache handling

Obtained-from: NVMM Reference Implementation
DeltaFile
+13-24sys/dev/virtual/nvmm/x86/nvmm_x86_svm.c
+13-241 files

DragonFlyBSD/src e45a952 — sys/dev/virtual/nvmm/x86 nvmm_x86.h nvmm_x86_svm.c

nvmm: Support cache and process topology CPUID info for SVM

Support CPUIDs 0x8000001D and 0x8000001E for SVM.

Obtained-from: NVMM Reference Implementation
DeltaFile
+25-1sys/dev/virtual/nvmm/x86/nvmm_x86_svm.c
+14-0sys/dev/virtual/nvmm/x86/nvmm_x86.h
+39-12 files

DragonFlyBSD/src 5958216 — sys/dev/virtual/nvmm/x86 nvmm_x86_svm.c nvmm_x86_vmx.c

nvmm: Don't push exception error codes in real-mode guests

In real mode there are no error codes.

Obtained-from: NVMM Reference Implementation
DeltaFile
+8-5sys/dev/virtual/nvmm/x86/nvmm_x86_vmx.c
+5-4sys/dev/virtual/nvmm/x86/nvmm_x86_svm.c
+13-92 files

DragonFlyBSD/src 2543a4c — sys/dev/virtual/nvmm/x86 nvmm_x86_svm.c

nvmm: Fix SWINT reinjection in svm_exit_evt()

AMD CPUs have an issue where they may not set nrip if a VMEXIT
occurs during a SWINT event. Work around it by not reinjecting
SWINTs and just letting the guest re-execute the INT instruction.

Obtained-from: NVMM Reference Implementation
DeltaFile
+22-3sys/dev/virtual/nvmm/x86/nvmm_x86_svm.c
+22-31 files

DragonFlyBSD/src 35be1f3 — sys/dev/virtual/nvmm/x86 nvmm_x86_vmx.c nvmm_x86_svm.c

nvmm: Optimize *_vcpu_guest_fpu_enter() in *_vcpu_run()

Suggested-by: Maxime Villard
DeltaFile
+1-3sys/dev/virtual/nvmm/x86/nvmm_x86_vmx.c
+1-3sys/dev/virtual/nvmm/x86/nvmm_x86_svm.c
+2-62 files

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