FreeBSD/src 8cbd394usr.bin/stat/tests stat_test.sh

stat: Nits in stat tests

* Use ourselves as test file instead of /COPYRIGHT, which may or may not
  be present in the test environment.

* atf-check understands \n in strings, use it.

* Some file systems don't like creating small holes, so create large ones
  instead.  This means we need two variables: ps (page size) is the
  minimum size of a data region and the alignment for a hole, while hs
  (hole size) is the minimum size of the holes we create.  This makes no
  difference on FreeBSD but makes it easier to port the test to other
  platforms.

MFC after:      1 week
Sponsored by:   Klara, Inc.
Reviewed by:    kevans
Differential Revision:  https://reviews.freebsd.org/D56304
DeltaFile
+13-12usr.bin/stat/tests/stat_test.sh
+13-121 files

FreeBSD/src a7e07d0lib/libgcc_s Symbol.map

libgcc_s: export __extendhftf2

We've compiled it since the LLVM 13 import in 2021, but for some reason
never exported it.  A user of CheriBSD recently caused Morello LLVM to
emit a reference to it so finish the job and export it.

Reviewed by:    dim, emaste
Fixes:          6e75b2fbf9a0 ("Merge llvm-project release/13.x llvmorg-13.0.0-rc1-97-g23ba3732246a")
MFC after:      1 week
Sponsored by:   DARPA, AFRL
See also:       https://github.com/CTSRD-CHERI/cheribsd/issues/2614
Differential Revision:  https://reviews.freebsd.org/D56310
DeltaFile
+1-0lib/libgcc_s/Symbol.map
+1-01 files

FreeBSD/src 16aa49fsys/compat/linprocfs linprocfs.c

compat/linprocfs: Fix auxv sbuf leak

linprocfs_doauxv() allocates an automatic sbuf before validating
whether the requested read can be satisfied.

When the computed auxv read length exceeds IOSIZE_MAX, or when the
buffer length is too big, the function returns early without
releasing the sbuf.

Route these early exits through a shared cleanup path so the sbuf is
always deleted after sbuf_new_auto() succeeds.

Signed-off-by:  Shunchao Hu <ankohuu at gmail.com>
Reviewed by:    des, spmzt, zlei, aokblast
MFC after:      2 weeks
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2118
DeltaFile
+11-8sys/compat/linprocfs/linprocfs.c
+11-81 files

FreeBSD/src 96a685clib/msun/aarch64 fenv.c fenv.h

lib/msun/aarch64: provide export file for arch-specific fenv methods

Reported and tested by: fluffy
Reviewed by:    emaste
Fixes:  3a01e1e1a50cb9a9594aac2148dc920a6b295428
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D56283
DeltaFile
+18-0lib/msun/aarch64/fenv.c
+9-5lib/msun/aarch64/fenv.h
+10-0lib/msun/aarch64/Symbol.map
+37-53 files

FreeBSD/src c913dcelib/msun Makefile, lib/msun/amd64 Makefile.inc

lib/msun: centralize addition of the arch-specific symbol map files

This also adds the aarch64 symbols, exporting them.

Reported and tested by: fluffy
Reviewed by:    emaste
Fixes:  3a01e1e1a50cb9a9594aac2148dc920a6b295428
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D56283
DeltaFile
+0-1lib/msun/amd64/Makefile.inc
+0-1lib/msun/arm/Makefile.inc
+0-1lib/msun/i387/Makefile.inc
+0-1lib/msun/powerpc/Makefile.inc
+0-1lib/msun/riscv/Makefile.inc
+1-0lib/msun/Makefile
+1-56 files

FreeBSD/src 0ddaa4cetc/mtree BSD.tests.dist, tests/sys/arch Makefile Makefile.inc

arm64: Add arm64 SVE tests

Add the tests/sys/arch directory for architecture-specific tests and
use it to add arm64 SVE tests. These test the kernel is managing the
SVE state in a way we expect.

These tests require SVE hardware support to run so will skip when they
can't detect it.

Reviewed by:    markj
Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D43311
DeltaFile
+438-0tests/sys/arch/aarch64/sve.c
+46-0tests/sys/arch/aarch64/sve_ptrace_helper.c
+8-0tests/sys/arch/aarch64/Makefile
+5-0tests/sys/arch/Makefile
+3-0tests/sys/arch/Makefile.inc
+2-0etc/mtree/BSD.tests.dist
+502-01 files not shown
+503-07 files

FreeBSD/src 04132e0sys/vm vm_fault.c

vm_fault: Reset m_needs_zeroing properly

- When allocating a page, we should only consider the PG_ZERO flag when
  handling the top-level page.
- Unconditionally reset the flag when restarting the fault handler.
  Previously, vm_fault_busy_sleep() would fail to reset it.

PR:             294039
Reviewed by:    kib
Tested by:      Peter Much <pmc at citylink.dinoex.sub.org>
MFC after:      3 days
Fixes:          cff67bc43df1 ("vm_fault: only rely on PG_ZERO when the page was newly allocated")
Differential Revision:  https://reviews.freebsd.org/D56234
DeltaFile
+3-4sys/vm/vm_fault.c
+3-41 files

FreeBSD/src 8a68c25sys/kern imgact_elf.c

imgact_elf: Unconditionally initialize a variable in a note handler

In the sb == NULL case, we are computing the size of the note using a
dummy sbuf drain handler which counts bytes and discards the contents of
the buffer, so the fact that "structsize" is uninitialized doesn't
matter.  But, the compiler may complain about this, so we might as well
just initialize it unconditionally to silence the warning, as other
handlers already do.

PR:             292811
MFC after:      1 week
DeltaFile
+1-1sys/kern/imgact_elf.c
+1-11 files

FreeBSD/src 77df024sys/netinet6 ip6_mroute.c

ip6_mroute: VNETify counters

Commit a223d6c489c7 made most of the ip6_mroute state per-VNET, but
failed to do this for a couple of counter structures.  Make them
per-VNET too.

Reported by:    zlei
Reviewed by:    pouria, zlei
Fixes:          a223d6c489c7 ("ip6_mroute: Start putting global variables into a structure")
Differential Revision:  https://reviews.freebsd.org/D56253
DeltaFile
+10-8sys/netinet6/ip6_mroute.c
+10-81 files

FreeBSD/src f6f5d92sys/arm64/arm64 trap.c

arm64: Have a common call to userret

Rather than each exception calling userret use a common copy. As
syscallret already calls userret we need to skip it in that case.

Reviewed by:    kib
Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D55250

(cherry picked from commit 14e97448fcebbe4b038eaf5628933abe5f9e690d)
DeltaFile
+9-21sys/arm64/arm64/trap.c
+9-211 files

FreeBSD/src cf9949fsys/arm64/arm64 pmap.c

arm64: Optimise the repeated TLBI workaround

It has been reported that the overhead of repeating all TLBI
instructions is too large [1]. The Software Developer Errata Notices
(SDEN) for the relevant Arm CPUs have been updated so a single
"tlbi vale1is, xzr" followed by "dsb ish"  is sufficient to work around
the issues.

Replace the places we repeat TLBI instructions with the new sequence.

[1] https://lore.kernel.org/linux-arm-kernel/20260218164348.2022831-1-mark.rutland@arm.com/

Reviewed by:    kib
Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D55646

(cherry picked from commit 80b4129bef8b908eb19fe47853cb6e45e4513d76)
DeltaFile
+14-30sys/arm64/arm64/pmap.c
+14-301 files

FreeBSD/src 1d4a619sys/arm64/vmm vmm.c

arm64/vmm: Support PMU v3p9

The only new register is read-only. As the kernel just passes the
registers to the guest directly no further change should be needed.

Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D51764

(cherry picked from commit d1650d226205cdf07fb19e0c9b10b47b941e8747)
DeltaFile
+1-1sys/arm64/vmm/vmm.c
+1-11 files

FreeBSD/src 767f1aasys/arm64/include armreg.h

arm64: Fix the ESR_ELx_EC_MASK definition

Sponsored by:   Arm Ltd

(cherry picked from commit f4d1a3ab0271216df05bab14c641d8023cc43a04)
DeltaFile
+1-1sys/arm64/include/armreg.h
+1-11 files

FreeBSD/src 920f5f6sys/arm64/arm64 identcpu.c

arm64: Treat the PMUVer field of ID_AA64DFR0 as unsigned

The PMUVer field of ID_AA64DFR0 contains an unsigned version of the
Performance Monitors Extension, but it is currently treated as signed.
Change it to unsigned.

Reviewed by:    andrew
Sponsored by:   Arm Ltd
Signed-off-by:  Kajetan Puchalski <kajetan.puchalski at arm.com>
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2062

(cherry picked from commit e40e5458616d13b44cd407aa1afff620f8ff8766)
DeltaFile
+1-1sys/arm64/arm64/identcpu.c
+1-11 files

FreeBSD/src ffaa67esys/arm64/include elf.h

arm64: Add more HWCAP values

Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D55219

(cherry picked from commit 3a960425df759a7bb8f946d23f035c63f3a5de7a)
DeltaFile
+21-0sys/arm64/include/elf.h
+21-01 files

FreeBSD/src ca69c5dsys/arm/arm generic_timer.c, sys/arm64/arm64 pmap.c ptrauth.c

arm64: Assume get_kernel_reg returns true

It now only returns true so this can be assumed and doesn't need to be
checked.

Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D55105

(cherry picked from commit a8c3933840448eaf04ecfe162c0d05caf11090a4)
DeltaFile
+17-22sys/arm64/vmm/vmm_arm64.c
+9-12sys/arm64/arm64/pmap.c
+6-9sys/arm64/arm64/ptrauth.c
+3-4sys/dev/hwpmc/hwpmc_arm64.c
+3-4sys/arm/arm/generic_timer.c
+3-4sys/libkern/gsb_crc32.c
+41-555 files not shown
+49-7211 files

FreeBSD/src 91ce7a1sys/dev/virtio/gpu virtio_gpu.c

vtgpu: Support virtio gpu on Parallels Desktop

The Parallels Desktop Virtio GPU implementation doesn't handle
enqueuing the VIRTIO_GPU_CMD_RESOURCE_ATTACH_BACKING request and
memory list together.

Work around this by splitting them before sending them to be enqueued.

Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D55147

(cherry picked from commit 1ea0721e1a566fdb552b0a919c22667844a894d9)
DeltaFile
+38-13sys/dev/virtio/gpu/virtio_gpu.c
+38-131 files

FreeBSD/src edc0dd0sys/arm64/arm64 trap.c

arm64: Enable MOPS usage in the kernel

Support handling kernel-side MOE exceptions.

Reported by:    andrew
Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D54943

(cherry picked from commit 18af5a180b29f425b8427263be5517d3573ca220)
DeltaFile
+63-60sys/arm64/arm64/trap.c
+63-601 files

FreeBSD/src c91d1desys/arm64/arm64 identcpu.c

arm64: Move creating the ID register views earlier

These are needed when enabling CPU features so should be processed
earlier in the boot.

Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D55103

(cherry picked from commit 0ea31fe851344af022103fa81dcdf00ef0dddc1d)
DeltaFile
+26-13sys/arm64/arm64/identcpu.c
+26-131 files

FreeBSD/src db2a34bsbin/nvmecontrol identify_ext.c

nvmecontrol: Remove an incorrect use of PAGE_SIZE

The mdts value is in terms of the nvme page size, not the host page
size. On many architectures these are both 4k, however on arm64 it is
possible to build a system with the host page size of 16k.

Use NVME_MPS_SHIFT to get the correct nvme page shift.

Reviewed by:    imp
Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D55334

(cherry picked from commit bfb7c81f93b534f8c10928d80ea56c8177a6f39f)
DeltaFile
+1-1sbin/nvmecontrol/identify_ext.c
+1-11 files

FreeBSD/src b608ec4sys/arm64/arm64 copyinout.S copyinout_ifunc.c, sys/conf files.arm64

arm64: Add MOPS implementations of copyin/copyout

Reimplement copyin() & copyout() as ifuncs.

Reviewed by:    andrew
Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D54947

(cherry picked from commit 1224347817c450596797ae6bcbfcc81927cb1f88)
DeltaFile
+52-6sys/arm64/arm64/copyinout.S
+50-0sys/arm64/arm64/copyinout_ifunc.c
+1-0sys/conf/files.arm64
+103-63 files

FreeBSD/src e40964fsys/arm64/arm64 pmap.c support.S, sys/arm64/include machdep.h

arm64: Add MOPS implementation of pagezero()

Reimplement pagezero() as ifunc. As pagezero() is only used in pmap.c,
move ifunc to that file.

Reviewed by:    andrew
Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D54946

(cherry picked from commit 7d7295df9b13b98ac395b206667e7586c602862b)
DeltaFile
+22-0sys/arm64/arm64/pmap.c
+12-0sys/arm64/arm64/support.S
+0-10sys/arm64/arm64/machdep.c
+0-1sys/arm64/include/machdep.h
+34-114 files

FreeBSD/src 44d6e17sys/arm64/arm64 machdep.c memcpy.S, sys/arm64/include cpu.h

arm64: Add MOPS implementations of memset(), memcpy() and memmove()

Enable the use of MOPS implementations of memset, memcpy and memmove within
the kernel. Fix pre-ifunc resolution uses of these functions.

Reported by:    andrew
Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D55051

(cherry picked from commit 2ccbf06c0285ca1c06681e7212da8e7d1e87fe19)
DeltaFile
+36-2sys/arm64/arm64/machdep.c
+20-4sys/arm64/arm64/memcpy.S
+10-2sys/arm64/arm64/memset.S
+5-5sys/arm64/arm64/pmap.c
+6-1sys/arm64/include/cpu.h
+3-2sys/arm64/arm64/identcpu.c
+80-161 files not shown
+81-177 files

FreeBSD/src 7a70c9fsys/arm64/arm64 identcpu.c

arm64: Panic if the ID register isn't known

This will allow for callers to be simplified & not need to check the
return status.

Keep the return type for now so this can be MFCd without breaking the
KBI.

Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D55104

(cherry picked from commit 3b0b6aa2cd05b516ecf4b72f9a3c2aadddf3c94e)
DeltaFile
+2-2sys/arm64/arm64/identcpu.c
+2-21 files

FreeBSD/src 8b5d77blib/libc/tests/string strrchr_test.c Makefile

libc/tests/string: add a more comprehensive unit test for strrchr()

The unit tests are patterned after those for memrchr().
This catches the issue found in 293915.

PR:             293915
Reviewed by:    strajabot
Reported by:    safonov.paul at gmail.com
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D56037
DeltaFile
+156-0lib/libc/tests/string/strrchr_test.c
+2-0lib/libc/tests/string/Makefile
+158-02 files

FreeBSD/src 2bcdab5usr.sbin/mfiutil mfiutil.8

mfiutil.8: Fix typo - missing macro for dev node

MFC after: 3 days
DeltaFile
+2-1usr.sbin/mfiutil/mfiutil.8
+2-11 files

FreeBSD/src bf08810stand/lua core.lua core.lua.8

lualoader: allow the local module to filter out the BE list

This allows something like the following local.lua to install a filter
to implement its own notion of hidden BEs using a naming convention of
a leading dot to hide them:

-- file: /boot/lua/local.lua
local core = require("core")

local function be_hide(be)
    if core.isSingleUserBoot() then
        -- All BEs are accepted for single-user
        return true
    end

    local name = be:match("/([^/]+)$")
    if not name then
        -- Accept malformed BEs, for whatever reason
        return true

    [15 lines not shown]
DeltaFile
+18-2stand/lua/core.lua
+12-1stand/lua/core.lua.8
+30-32 files

FreeBSD/src 19ab46csys/dev/acpica acpi.c

acpi: Parse _S3D in s2idle instead of _S255D

Previously, when entering s2idle, we were parsing the _S255D object to
get the shallowest D-state supported by device, as
acpi_stype_to_sstate() returns -1 for s2idle.

Instead, we should read _S3D.

Relevant document:
https://uefi.org/htmlspecs/ACPI_Spec_6_4_html/07_Power_and_Performance_Mgmt/device-power-management-objects.html#s3d-s3-device-state

Reviewed by:    olce
Tested by:      emaste, olce
Approved by:    olce
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D55118
DeltaFile
+52-32sys/dev/acpica/acpi.c
+52-321 files

FreeBSD/src 1c793e7usr.bin/stat/tests readlink_test.sh

stat: Nits in readlink tests

* The f_flag test may fail if a component of the full path to the
  temporary directory is a symbolic link.

* The n_flag test had an empty head; give it a description.

* Use consistent quoting.

MFC after:      1 week
Sponsored by:   Klara, Inc.
Reviewed by:    kevans
Differential Revision:  https://reviews.freebsd.org/D56293
DeltaFile
+6-3usr.bin/stat/tests/readlink_test.sh
+6-31 files

FreeBSD/src 095cbb1sys/x86/cpufreq hwpstate_amd.c

hwpstate_amd: Expose nodes as much as possible in legacy pstate

Reviewed by:    olce
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D55606
DeltaFile
+91-65sys/x86/cpufreq/hwpstate_amd.c
+91-651 files