HardenedBSD/src 0dd7706lib/libc/stdlib/malloc/jemalloc jemalloc.3, lib/libefivar uefi-dputil.c efivar-dp-xlate.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+412-125lib/libefivar/uefi-dputil.c
+179-21lib/libc/stdlib/malloc/jemalloc/jemalloc.3
+67-0tests/sys/netpfil/pf/sctp.py
+4-7sys/dev/nvme/nvme.h
+5-5lib/libefivar/efivar-dp-xlate.c
+6-1libexec/rtld-elf/rtld.1
+673-15912 files not shown
+690-17218 files

HardenedBSD/src a49ee72sys/kern kern_event.c

Merge branch 'freebsd/14-stable/main' into hardened/14-stable/master
DeltaFile
+12-4sys/kern/kern_event.c
+12-41 files

HardenedBSD/src 9af9f5fsys/kern kern_event.c

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+12-4sys/kern/kern_event.c
+12-41 files

HardenedBSD/src b1b0fb3sys/riscv/conf GENERIC

fib_algo: add FIB_ALGO to GENERIC kernel config on riscv

FIB_ALGO modular FIB lookups have been enabled by default on
amd64 and arm64 since 2021, so enable it on riscv as well.

Reviewed by:    melifaro
MFC after:      1 month
DeltaFile
+1-0sys/riscv/conf/GENERIC
+1-01 files

HardenedBSD/src 80ec82alib/libc/stdlib/malloc/jemalloc jemalloc.3

jemalloc: apply freebsd changes to jemalloc 5.3.0 man page

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1890
DeltaFile
+31-1lib/libc/stdlib/malloc/jemalloc/jemalloc.3
+31-11 files

HardenedBSD/src bf4c748lib/libc/stdlib/malloc/jemalloc jemalloc.3

jemalloc: import jemalloc 5.3.0 man page

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1890
DeltaFile
+180-52lib/libc/stdlib/malloc/jemalloc/jemalloc.3
+180-521 files

HardenedBSD/src 51f278elib/libsys lseek.2

lseek.2: SEEK_HOLE, SEEK_DATA & ENXIO conform to POSIX 2024

Signed-off-by: Ricardo Branco <rbranco at suse.de>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1891
DeltaFile
+2-1lib/libsys/lseek.2
+2-11 files

HardenedBSD/src 4c8bf76usr.sbin/fdread fdread.c

fdread: Fix logic bug when reading by sector

When reading by sector (because reading a whole track failed), we can
accidentally fall into the "should not happen" path, which both
(a) emits a spurious error message and (b) fouls up our position
accounting going forward.  Ensure we do not inappropriately fall into
that path.

Avoid obscuring the "short after" message in cases where it happens.

Signed-off-by: Matt Jacobson <mhjacobson at me.com>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1897
DeltaFile
+2-1usr.sbin/fdread/fdread.c
+2-11 files

HardenedBSD/src f7725c3sys/conf NOTES

NOTES: Fix a typo in a comments

Signed-off-by: ykla yklaxds at gmail.com
Sponsored by:   Chinese FreeBSD Community
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1899
DeltaFile
+1-1sys/conf/NOTES
+1-11 files

HardenedBSD/src 6fa0057lib/libefivar uefi-dputil.c

libefivar: Support UefiDevicePathLib under StandaloneMm

This change added an instance of UefiDevicePathLib for StandaloneMm. It
abstracts DevicePathFromHandle function into different files for
Standalone MM and other instances to avoid linking gBS into MM_STANDALONE
drivers.

No functional change intended, as this function and its invocation are ifdefd
out.

Obtained from:  https://github.com/tianocore/edk2/commit/14a746bb6a92d59669c67a970479558734cf2383

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1894
DeltaFile
+0-33lib/libefivar/uefi-dputil.c
+0-331 files

HardenedBSD/src ca6fef2lib/libefivar uefi-dputil.c

libefivar: Change OPTIONAL keyword usage style

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3760

Update all use of ', OPTIONAL' to ' OPTIONAL,' for function params.

Note that the link above no longer exists.  The commit message was kept
verbatim.  An archive of the bug report can be found at:
https://web.archive.org/web/20240714185609/https://bugzilla.tianocore.org/show_bug.cgi?id=3760

Obtained from:  https://github.com/tianocore/edk2/commit/d0e2f8232a26453fc0191629ed44ff2a46ea073e

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1894
DeltaFile
+5-5lib/libefivar/uefi-dputil.c
+5-51 files

HardenedBSD/src a4e3e72sys/amd64/conf NOTES

NOTES: Remove duplicate options KCSAN entries

Signed-off-by: ykla yklaxds at gmail.com
Sponsored by: Chinese FreeBSD Community
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1900
DeltaFile
+0-1sys/amd64/conf/NOTES
+0-11 files

HardenedBSD/src 8494a3dlib/libefivar uefi-dputil.c

libefivar: Apply uncrustify changes

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737

Apply uncrustify changes to .c/.h files in the MdePkg package

Note that the link above no longer exists.  The commit message was kept
verbatim.  An original copy of the bug report can be found at:
https://web.archive.org/web/20241008121707/https://bugzilla.tianocore.org/show_bug.cgi?id=3737

Obtained from:  https://github.com/tianocore/edk2/commit/2f88bd3a1296c522317f1c21377876de63de5be7

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1894
DeltaFile
+52-50lib/libefivar/uefi-dputil.c
+52-501 files

HardenedBSD/src 136ff60lib/libefivar uefi-dputil.c

libefivar: Replace BSD License with BSD+Patent License

https://bugzilla.tianocore.org/show_bug.cgi?id=1373

Replace BSD 2-Clause License with BSD+Patent License.  This change is
based on the following emails:

  https://lists.01.org/pipermail/edk2-devel/2019-February/036260.html
  https://lists.01.org/pipermail/edk2-devel/2018-October/030385.html

RFCs with detailed process for the license change:

  V3: https://lists.01.org/pipermail/edk2-devel/2019-March/038116.html
  V2: https://lists.01.org/pipermail/edk2-devel/2019-March/037669.html
  V1: https://lists.01.org/pipermail/edk2-devel/2019-March/037500.html

Note that the link above no longer exists.  The commit message was kept
verbatim.  An archive of the bug report can be found at:
https://web.archive.org/web/20240714192319/https://bugzilla.tianocore.org/show_bug.cgi?id=1373

    [5 lines not shown]
DeltaFile
+2-8lib/libefivar/uefi-dputil.c
+2-81 files

HardenedBSD/src 5b7b60alib/libefivar uefi-dputil.c

libefivar: Add and comment out unused functions

This commit introduces gratuitous white space and unused functions.
This functionality is guarded/commented out.  This change is necessary
to reduce the differences with the reference file in subsequent commits.

No functional change intended.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1894
DeltaFile
+320-2lib/libefivar/uefi-dputil.c
+320-21 files

HardenedBSD/src 9677ae7lib/libefivar uefi-dputil.c

libefivar: MdePkg: Clean up source files

1. Do not use tab characters
2. No trailing white space in one line
3. All files must end with CRLF

No functional change.

Obtained from:  https://github.com/tianocore/edk2/commit/9095d37b8fe5bfc3d02adad6ba7fd7359ebc0107

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1894
DeltaFile
+38-38lib/libefivar/uefi-dputil.c
+38-381 files

HardenedBSD/src ef19114lib/libefivar uefi-dputil.c

libefivar: Move functions to match reference file

Move a few functions to match their locations in the reference file.
No functional change intended.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1894
DeltaFile
+99-101lib/libefivar/uefi-dputil.c
+99-1011 files

HardenedBSD/src 5c2ae0alib/libefivar uefi-dputil.c

libefivar: Add sanity check for FilePath device path

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1497

Current implementation of IsDevicePathValid() is not enough for type
of MEDIA_FILEPATH_DP, which has NULL-terminated string in the device
path. This patch add a simple NULL character check at Length position.

Note that the link above no longer exists.  The commit message was kept
verbatim.  An archived version of the bug report can be found at:
https://web.archive.org/web/20240714191428/https://bugzilla.tianocore.org/show_bug.cgi?id=1497

Add the const keyword to avoid errors/warnings about dropping a const
qualifier.

Obtained from:  https://github.com/tianocore/edk2/commit/2f7a96d6ec13b292d6f31295f3195913921173e1

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1894
DeltaFile
+10-1lib/libefivar/uefi-dputil.c
+10-11 files

HardenedBSD/src fd606b6lib/libefivar uefi-dputil.c

libefivar: Add a checking step

Add a checking step in DevicePathUtilities.c to verify DevicePath.
https://bugzilla.tianocore.org/show_bug.cgi?id=1372

v2: Remove ASSERT() and the redundant checking step. Update related
    description.

Note that the link above no longer exists.  The commit message was kept
verbatim.  An archived version of the bug report can be found at:
https://web.archive.org/web/20240714192353/bugzilla.tianocore.org/show_bug.cgi?id=1372

Obtained from:  https://github.com/tianocore/edk2/commit/fd02394228ee1dc2378cccfde6098c461f96dd42

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1894
DeltaFile
+9-10lib/libefivar/uefi-dputil.c
+9-101 files

HardenedBSD/src b38f48dlib/libefivar uefi-dplib.h efivar-dp-parse.c

libefivar: Standardize #ifndef __FreeBSD__

Standardize preprocessor directives that comment out unused functions
(essentially #if 0).

No functional change intended.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1894
DeltaFile
+1-2lib/libefivar/uefi-dplib.h
+0-1lib/libefivar/efivar-dp-parse.c
+1-32 files

HardenedBSD/src 0e614a4lib/libefivar efivar-dp-xlate.c FreeBSD-update, sys/sys efi-edk2.h

libefivar: Fix (some) typos

Fix typos in the files that are owned by the project.

Bring back a "duplicate word" removal (node node), which should have
been "node Node", the second "node" is not capitalized in the reference
file (yet).  We'll bring it back capitalized to avoid it from triggering
automated checking scripts and possibly reverting this change again.  A
few other typos were not fixed, as we strive to keep as close to the
reference files as possible, these fixes should be submitted to the
reference project (tianocore/edk2) in the not so distant future.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1894
DeltaFile
+5-5lib/libefivar/efivar-dp-xlate.c
+1-1lib/libefivar/FreeBSD-update
+1-1lib/libefivar/efivar.h
+1-1lib/libefivar/uefi-dputil.c
+1-1sys/sys/efi-edk2.h
+9-95 files

HardenedBSD/src fad4c92. UPDATING, sys/kern link_elf.c link_elf_obj.c

Revert "kernel linker: Disable local sym resolution by default"

I've received a report of a failure from resolving kern_kmq_open.
Revert for now as we are currently in stabweek.

This reverts commit 9562994a7aacee2baae6ddee1a7b558b48ae39ef.

Reported by:    mav
DeltaFile
+0-9UPDATING
+1-1sys/kern/link_elf.c
+1-1sys/kern/link_elf_obj.c
+2-113 files

HardenedBSD/src 301b8a8sys/dev/nvme nvme.h

nvme: Minor style(9) fixes

<sys/systm.h> needs to be first after <sys/param.h>. And we don't need
both sys/param.h and sys/types.h.

Fixes:          032fbda024d78
Sponsored by:   Netflix
DeltaFile
+4-7sys/dev/nvme/nvme.h
+4-71 files

HardenedBSD/src bc3b72fsys/netpfil/pf pf.c, tests/sys/netpfil/pf sctp.py

pf: relax sctp v_tag verification

pf was too strict when validating SCTP tags. When a server receives a
retransmitted INIT it will reply with a random initiate tag every time.
However, pf saves the first initiate tag and expects every subsequent INIT_ACK
retransmission to have the same tag. This is not the case, leading to endless
INIT/INIT_ACK cycles.

Allow the tag to be updated as long as we've not gone past COOKIE_WAIT.

Add a test case to verify this.

MFC after:      2 weeks
See also:       https://redmine.pfsense.org/issues/16516
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+67-0tests/sys/netpfil/pf/sctp.py
+5-1sys/netpfil/pf/pf.c
+72-12 files

HardenedBSD/src a8151f1libexec/rtld-elf rtld.1

Add description of the LD_DEBUG environment variable.
DeltaFile
+6-1libexec/rtld-elf/rtld.1
+6-11 files

HardenedBSD/src 23ddcd2sys/kern kern_event.c

kevent: Hold the knlist mutex when invoking f_event(NOTE_FORK)

In general f_event is supposed to be called with the knlist mutex held,
so lock it earlier to follow this protocol.  Also make sure that the
update to kn_fflags is synchronized.

Lock the kqueue itself earlier in the case where the knote is activated,
to avoid locking and unlocking the kqueue twice.

PR:             291005
Reported by:    Qiu-ji Chen <chenqiuji666 at gmail.com>
Reviewed by:    kib
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D53762

(cherry picked from commit d795c753e262b97a93dc353aa66b858e1b1969d1)
DeltaFile
+12-4sys/kern/kern_event.c
+12-41 files

HardenedBSD/src f8bf6f8sys/kern kern_event.c

kevent: Hold the knlist mutex when invoking f_event(NOTE_FORK)

In general f_event is supposed to be called with the knlist mutex held,
so lock it earlier to follow this protocol.  Also make sure that the
update to kn_fflags is synchronized.

Lock the kqueue itself earlier in the case where the knote is activated,
to avoid locking and unlocking the kqueue twice.

PR:             291005
Reported by:    Qiu-ji Chen <chenqiuji666 at gmail.com>
Reviewed by:    kib
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D53762

(cherry picked from commit d795c753e262b97a93dc353aa66b858e1b1969d1)
DeltaFile
+12-4sys/kern/kern_event.c
+12-41 files

HardenedBSD/src 238ad59lib/libpfctl libpfctl.c

libpfctl: improve error handling

If we fail to open /dev/pf don't try to close it again. That would result in
errno getting overwritten by close(), hiding potentially useful information.

MFC after:      2 weeks
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+2-2lib/libpfctl/libpfctl.c
+2-21 files

HardenedBSD/src 9562994. UPDATING, sys/kern link_elf.c link_elf_obj.c

kernel linker: Disable local sym resolution by default

In 95c20faf11a1 and ecd8245e0d77 kib introduced support to have the
kernel linker stop resolving local symbols from other files, but did
not enable it by default to avoid surprises.  Flip the default now,
before FreeBSD 16.0.

The debug.link_elf_leak_locals and debug.link_elf_obj_leak_locals
sysctls are available to revert to the previous behaviour if necessary.

PR:             207898
Reviewed by:    bz
Relnotes:       Yes
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D47742
DeltaFile
+9-0UPDATING
+1-1sys/kern/link_elf.c
+1-1sys/kern/link_elf_obj.c
+11-23 files

HardenedBSD/src 60f0102sys/dev/e1000 if_em.c, sys/dev/nvme nvme_ctrlr.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+1-1sys/dev/nvme/nvme_ctrlr.c
+1-1sys/dev/e1000/if_em.c
+2-22 files