HardenedBSD/src e128314 — contrib/bc/vs bc.vcxproj.filters bcl.vcxproj, contrib/bc/vs/tests tests_bc.bat

Merge remote-tracking branch 'rad/hardened/current/master' into hardened/current/pledge
DeltaFile
+0-301contrib/bc/vs/bc.vcxproj
+0-264contrib/bc/vs/bcl.vcxproj
+0-170contrib/bc/vs/bc.vcxproj.filters
+136-32sys/compat/linuxkpi/common/include/linux/pm_runtime.h
+108-8contrib/llvm-project/compiler-rt/lib/asan/asan_allocator.cpp
+0-104contrib/bc/vs/tests/tests_bc.bat
+244-87936 files not shown
+559-1,22042 files

HardenedBSD/src 5144c16 — usr.sbin/virtual_oss/virtual_oss main.c

Merge remote-tracking branch 'rad/hardened/15-stable/main' into hardened/15-stable/pledge
DeltaFile
+5-2usr.sbin/virtual_oss/virtual_oss/main.c
+5-21 files

HardenedBSD/src 5ad3d74 — contrib/bc/vs bc.vcxproj.filters bcl.vcxproj, contrib/bc/vs/tests tests_bc.bat

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+0-301contrib/bc/vs/bc.vcxproj
+0-264contrib/bc/vs/bcl.vcxproj
+0-170contrib/bc/vs/bc.vcxproj.filters
+136-32sys/compat/linuxkpi/common/include/linux/pm_runtime.h
+108-8contrib/llvm-project/compiler-rt/lib/asan/asan_allocator.cpp
+0-104contrib/bc/vs/tests/tests_bc.bat
+244-87936 files not shown
+559-1,22042 files

HardenedBSD/src f363935 — usr.sbin/virtual_oss/virtual_oss main.c

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+5-2usr.sbin/virtual_oss/virtual_oss/main.c
+5-21 files

HardenedBSD/src 0008561 — contrib/llvm-project/compiler-rt/lib/sanitizer_common sanitizer_internal_defs.h

compiler-rt: enable use of .preinit_array after ef758b59a44e

After base ef758b59a44e6b5b2d2dc178b97c01cde1b34570 we can enable usage
of .preinit_array in compiler-rt's sanitizers. The comment that stated
"On FreeBSD, .preinit_array functions are called with rtld_bind_lock
writer lock held. It will lead to dead lock ..." can also be removed.

PR:             298943
MFC after:      1 week
DeltaFile
+2-5contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
+2-51 files

HardenedBSD/src a3fbf20 — contrib/llvm-project/compiler-rt/lib/asan asan_allocator.h asan_allocator.cpp, contrib/llvm-project/compiler-rt/lib/hwasan hwasan_allocation_functions.cpp

Merge commit a5fa4dba6e2e from llvm-project (by PiJoules):

  [compiler-rt] Add interceptors for free_[aligned_]sized for asan+hwasan (#189109)

This avoids a jemalloc assertion when running sanitized applications
against glib, which uses free_sized(3).

PR:             298943
MFC after:      1 week
DeltaFile
+32-0contrib/llvm-project/compiler-rt/lib/hwasan/hwasan_allocation_functions.cpp
+22-0contrib/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp
+13-0contrib/llvm-project/compiler-rt/lib/asan/asan_allocator.cpp
+3-0contrib/llvm-project/compiler-rt/lib/asan/asan_allocator.h
+70-04 files

HardenedBSD/src 6b0f641 — contrib/llvm-project/compiler-rt/lib/asan asan_malloc_mac.cpp asan_malloc_linux.cpp

Merge commit 681c2ee4dfbf from llvm-project (by Justin King):

  asan: refactor interceptor allocation/deallocation functions (#145087)

  Do some refactoring to allocation/deallocation interceptors. Expose
  explicit per-alloc_type functions and stop accepting explicit AllocType.
  This ensures we do not accidentally mix.

  NOTE: This change rejects attempts to call `operator new(<some_size>,
  static_cast<std::align_val_t>(0))`.

  For https://github.com/llvm/llvm-project/issues/144435

  Signed-off-by: Justin King <jcking at google.com>

This a prerequisite for adding sanitizer interceptors for free_sized(3)
and free_aligned_sized(3).

PR:             298943
MFC after:      1 week
DeltaFile
+97-10contrib/llvm-project/compiler-rt/lib/asan/asan_allocator.cpp
+32-32contrib/llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp
+19-5contrib/llvm-project/compiler-rt/lib/asan/asan_allocator.h
+5-5contrib/llvm-project/compiler-rt/lib/asan/asan_malloc_win.cpp
+4-4contrib/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp
+3-3contrib/llvm-project/compiler-rt/lib/asan/asan_malloc_mac.cpp
+160-591 files not shown
+161-607 files

HardenedBSD/src 2d935a1 — share/man/man4 mgb.4 Makefile

man.4: Create if_mgb.4 symlink on supported architectures only.

Fixes:                  05c49e2aa643 ("man: Link mgb.4 to if_mgb.4")
Fixes:                  e0a5aa37c1ef
Differential revision:  https://reviews.freebsd.org/D60551
DeltaFile
+2-1share/man/man4/Makefile
+1-1share/man/man4/mgb.4
+3-22 files

HardenedBSD/src e0a5aa3 — share/man/man4 Makefile

man4: Only link mgb.4 to if_mgb.4 where mgb.4 is installed

mgb.4 is only installed on amd64 and i386, move the MLINKS entry into
the amd64/i386 block next to _mgb.4.

Fixes:          05c49e2aa643 ("man: Link mgb.4 to if_mgb.4")
MFC after:      3 days
Sponsored by:   The FreeBSD Foundation
DeltaFile
+1-1share/man/man4/Makefile
+1-11 files

HardenedBSD/src 94d4ba0 — contrib/bc/vs bcl.vcxproj.filters bc.vcxproj.filters, contrib/bc/vs/tests tests_dc.bat tests_bc.bat

contrib/bc: remove vs sub-directory

Some of the files in the vs sub-directory are checked out with  CRLF
line breaks via .getattributes. This causes issues when checking out
the source tree with other tools that operate on Git repositories like
"got". Remove the vs sub-directory from the contrib tree, since it is
not required on FreeBSD.
DeltaFile
+0-301contrib/bc/vs/bc.vcxproj
+0-264contrib/bc/vs/bcl.vcxproj
+0-170contrib/bc/vs/bc.vcxproj.filters
+0-104contrib/bc/vs/tests/tests_bc.bat
+0-87contrib/bc/vs/bcl.vcxproj.filters
+0-61contrib/bc/vs/tests/tests_dc.bat
+0-9873 files not shown
+1-1,0559 files

HardenedBSD/src 67be955 — sys/netgraph ng_ksocket.c

netgraph/ng_ksocket: Enter epoch on NG_SEND_DATA_ONLY

The work queued by ng_send_fn() is intentionally processed
outside of the epoch in ngthread().
It is ng_ksocket's responsibility to enter epoch if it decides
to send data from such work.

Reviewed by:    glebius
Fixes:  104827151e2a ("ng_iface: don't recursively enter epoch ...")
Differential Revision:  https://reviews.freebsd.org/D60589
DeltaFile
+8-1sys/netgraph/ng_ksocket.c
+8-11 files

HardenedBSD/src b8b23cf — usr.sbin/virtual_oss/virtual_oss main.c

virtual_oss(8): Fix cuse.ko check

There is no need at all to load the cuse module to just access the tool help.

kldload always checks for permissions first returning -EPERM if the user can't
load modules and -EEXIST if the user can, but the module is already loaded.

Approved by:            christos@
Differential Revision:  https://reviews.freebsd.org/D59844
MFC after:              2 weeks

(cherry picked from commit 5aac18d0faec96c768baf1a9de63a50de3796023)
DeltaFile
+5-2usr.sbin/virtual_oss/virtual_oss/main.c
+5-21 files

HardenedBSD/src 9820afb — sys/compat/linuxkpi/common/include/linux kernel.h, sys/conf std.nodebug std.debug

LinuxKPI: introduce LINUXKPI_DEBUG to enable LinuxKPI debugging

This allows us to build kernels which will (if the sysctl is enabled
too) show pr_debug() and pr_devel() output.

Enable it by default for debug kernels.

This option can later also be used for other LinuxKPI parts, like
skbuffs, netdevice, rcu, ... to conditionally compile in debugging
support to further justify its existence beyond an in-code #define.

Sponsored by:   The FreeBSD Foundation
MFC after:      3 days
Reviewed by:    dumbbell, emaste
Differential Revision: https://reviews.freebsd.org/D54060
DeltaFile
+4-2sys/compat/linuxkpi/common/include/linux/kernel.h
+3-0sys/conf/options
+1-0sys/conf/std.nodebug
+1-0sys/conf/std.debug
+1-0sys/conf/kmod.mk
+10-25 files

HardenedBSD/src bbfd52d — sys/compat/linuxkpi/common/include/linux seqlock.h rwsem.h

LinuxKPI: use LINUXKPI_DEBUG to determine on witness lock tracing

LinuxKPI by default tells witness to ignore the locks, which is
unhelpful in case of panics like 'panic: sleeping thread holds lnxspin'.
While I have edited the lock initialitzation manually in the past,
make this dependent on both LINUXKPI_DEBUG and WITNESS.
Define an internal _LKPI_MTX_NOWITNESS (and equivalent for other lock
types used) and set them accordingly in kconfig.h, a file automatically
included to all LinuxKPI compiled code (like global.h). (*)
In addition, in the debug case, also define WITNESS_ALL to get file,
line, and lock name as a lock name rather than just, e.g., lnxspin.

(*) We will need another follow-up as -include ordering is currently
wrong for LinuxKPI modules. See D60207.

Sponsored by:   The FreeBSD Foundation
MFC after:      3 days
Reviewed by:    dumbbell
Differential Revision: https://reviews.freebsd.org/D59231
DeltaFile
+28-1sys/compat/linuxkpi/common/include/linux/kconfig.h
+5-3sys/compat/linuxkpi/common/include/linux/spinlock.h
+2-2sys/compat/linuxkpi/common/include/linux/mutex.h
+1-1sys/compat/linuxkpi/common/include/linux/seqlock.h
+1-1sys/compat/linuxkpi/common/include/linux/rwsem.h
+1-1sys/compat/linuxkpi/common/include/linux/rwlock.h
+38-94 files not shown
+42-1310 files

HardenedBSD/src 3521cce — sys/compat/lindebugfs lindebugfs.c, sys/compat/linuxkpi/common/include/linux debugfs.h

lindebugfs: implement debugfs_create_devm_seqfile()

Implement debugfs_create_devm_seqfile() keyed by device and a
read function.

This was implemented months ago in order to support debugfs with mt76
but hasn't been exercised since.

The code does not really seem to belong in lindebugfs, but also does
not really fit into debugfs.h (rather fs.h?); leave it here with a
comment for now as neither dumbbell nor I could come up with a better
place.

Sponsored by:   The FreeBSD Foundation
MFC after:      3 days
Reviewed by:    dumbbell
Differential Revision: https://reviews.freebsd.org/D57524
DeltaFile
+42-0sys/compat/lindebugfs/lindebugfs.c
+5-0sys/compat/linuxkpi/common/include/linux/debugfs.h
+47-02 files

HardenedBSD/src 863fe7a — sys/compat/linuxkpi/common/include/linux pm_runtime.h

LinuxKPI: re-implement pm_runtime.h

The original implementation was based on OpenBSD under public domain
but just defined the functions to void.
FreeBSD later extended the file with more inline functions or dealing
with differences in Linux versions.

This rework tries to group some functions, adds properly typed arguments
and return values in some cases.
It further adjusts return values based on the !CONFIG_PM expectations.

Lastly pr_debug() calls are added so we could see if/how much these
functions are used in new/other works rather than code just compiling
but the functions entirely being ignored without the knowledge of the
person porting code.

Sponsored by:   The FreeBSD Foundation
MFC after:      3 days
Reviewed by:    dumbbell
Differential Revision: https://reviews.freebsd.org/D58169
DeltaFile
+136-32sys/compat/linuxkpi/common/include/linux/pm_runtime.h
+136-321 files

HardenedBSD/src 53beb69 — sys/compat/linuxkpi/common/include/linux device.h, sys/compat/linuxkpi/common/include/linux/device devres.h

LinuxKPI; factor out parts of device.h into device/devres.h

In [1] it was pointed out that devm_kmemdup_* have moved apparently
in Linux 7.0 into their own device/devres.h header file from device.h.
Move them and other parts (some being dependencies) along.

device/devres.h gets included from device.h so all that changes is
prototype, macro, and inline function ordering.

This should prepare us in case drivers start directly including
the sub-header.  It also helps to keep device.h more reasable.

Suggested by:   dumbbell (in D56396) [1]
MFC after:      3 days
Reviewed by:    emaste
Differential Revision: https://reviews.freebsd.org/D60213
DeltaFile
+70-0sys/compat/linuxkpi/common/include/linux/device/devres.h
+1-52sys/compat/linuxkpi/common/include/linux/device.h
+71-522 files

HardenedBSD/src 33901f0 — sys/netgraph/bluetooth/drivers/ubt ng_ubt.c

ng_ubt: ignore further MediaTek USB BT devices

Following 8b21c469dbd6 add more entries for various MT BT USB VPI
combinations given we currently do not support any of them.

Suggested by:   thierry (while testing MT7920 wireless)
MFC after:      3 days
Reviewed by:    emaste, imp
Differential Revision: https://reviews.freebsd.org/D60279
DeltaFile
+10-0sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c
+10-01 files

HardenedBSD/src 800e477 — contrib/netbsd-tests/lib/libc/gen t_dir.c, lib/libsys mount.2

Merge remote-tracking branch 'rad/hardened/current/master' into hardened/current/pledge
DeltaFile
+238-0tests/sys/vfs/nmount_check_fsid.c
+44-9sys/kern/vfs_mount.c
+31-8sys/riscv/riscv/mp_machdep.c
+29-5lib/libsys/mount.2
+0-15sys/net/if_gre.c
+10-4contrib/netbsd-tests/lib/libc/gen/t_dir.c
+352-418 files not shown
+387-5714 files

HardenedBSD/src 74c540a — contrib/netbsd-tests/lib/libc/gen t_dir.c, lib/libsys mount.2

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+238-0tests/sys/vfs/nmount_check_fsid.c
+44-9sys/kern/vfs_mount.c
+31-8sys/riscv/riscv/mp_machdep.c
+29-5lib/libsys/mount.2
+0-15sys/net/if_gre.c
+10-4contrib/netbsd-tests/lib/libc/gen/t_dir.c
+352-418 files not shown
+387-5714 files

HardenedBSD/src 8a7df6c — lib/libc/tests/sys Makefile

tests/libc: only build brk_test where libc provides sbrk

Replace the exclusion list with an allowlist of the architectures
whose libc exports brk/sbrk: amd64, i386, arm and powerpc.

On aarch64, riscv and loongarch libc does not export those symbols
and the test cannot run, so do not build it there. New architectures
now default to not building the test unless brk support is added.

MFC after:      1 week
Signed-off-by:  Xiaoqiang Zhao <zhaoxiaoqiang007 at gmail.com>
Reviewed by:    ngie
Differential Revision:  https://reviews.freebsd.org/D60357
DeltaFile
+2-1lib/libc/tests/sys/Makefile
+2-11 files

HardenedBSD/src d45f069 — contrib/netbsd-tests/lib/libc/gen t_dir.c, contrib/netbsd-tests/lib/libc/sys t_mlock.c

tests/libc: use an allowlist for sbrk in NetBSD-derived tests

sbrk is obsolete and libc only provides it on amd64, arm, i386 and
powerpc.  Replace the growing exclusion lists in t_dir.c and t_mlock.c
with a single positive HAVE_SBRK definition per file, so architectures
without sbrk need not be enumerated as they are added.

Signed-off-by: Xiaoqiang Zhao <zhaoxiaoqiang007 at gmail.com>
Reviewed by:    ngie
Differential Revision:  https://reviews.freebsd.org/D60358
DeltaFile
+10-4contrib/netbsd-tests/lib/libc/gen/t_dir.c
+11-3contrib/netbsd-tests/lib/libc/sys/t_mlock.c
+21-72 files

HardenedBSD/src e8431fa — contrib/netbsd-tests/lib/libc/gen t_dir.c, contrib/netbsd-tests/lib/libc/sys t_mlock.c

Revert "tests/libc: use an allowlist for sbrk in NetBSD-derived tests"

Need to update the commit message.

This reverts commit 36b849b5c76406bb6d9341bfb1a7f16ae5c189c9.
DeltaFile
+3-11contrib/netbsd-tests/lib/libc/sys/t_mlock.c
+4-10contrib/netbsd-tests/lib/libc/gen/t_dir.c
+7-212 files

HardenedBSD/src 36b849b — contrib/netbsd-tests/lib/libc/gen t_dir.c, contrib/netbsd-tests/lib/libc/sys t_mlock.c

tests/libc: use an allowlist for sbrk in NetBSD-derived tests

sbrk is obsolete and libc only provides it on amd64, arm, i386 and
powerpc.  Replace the growing exclusion lists in t_dir.c and t_mlock.c
with a single positive HAS_SBRK definition per file, so architectures
without sbrk need not be enumerated as they are added.

Signed-off-by: Xiaoqiang Zhao <zhaoxiaoqiang007 at gmail.com>
Reviewed by:    ngie
Differential Revision:  https://reviews.freebsd.org/D60358
DeltaFile
+10-4contrib/netbsd-tests/lib/libc/gen/t_dir.c
+11-3contrib/netbsd-tests/lib/libc/sys/t_mlock.c
+21-72 files

HardenedBSD/src ef758b5 — libexec/rtld-elf rtld.c

rtld: release rtld_bind_lock around calls to .preinit_array initializers

We unlock the bind lock around .init calls anyway.  Also, the main
object cannot be unloaded.

Reported and reviewed by:       dim
PR:     298943
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D60588
DeltaFile
+5-3libexec/rtld-elf/rtld.c
+5-31 files

HardenedBSD/src f877ace — sys/net if_gre.c

if_gre(4): Cleanup unused RSS macros

RSS hash calculations no longer depend on RSS macro.
Therefore, remove unused macros and its XOR fallback.

Reviewed by:    adrian
Fixes:  9c55b2e8cd6b ("rss: Enable portions of RSS globally to ...")
Differential Revision:  https://reviews.freebsd.org/D60556
DeltaFile
+0-15sys/net/if_gre.c
+0-151 files

HardenedBSD/src 4639904 — libexec/rtld-elf rtld.c

rtld: fix indent

Sponsored by:   The FreeBSD Foundation
MFC after:      3 days
DeltaFile
+2-2libexec/rtld-elf/rtld.c
+2-21 files

HardenedBSD/src c3ac061 — lib/libsys mount.2, sys/kern vfs_mount.c

nmount: Introduce the "check_fsid" option

See the manpage addition for rationale

Reviewed by:    ziaee, kib
Approved by:    ziaee, kib
Differential Revision:  https://reviews.freebsd.org/D59930
DeltaFile
+238-0tests/sys/vfs/nmount_check_fsid.c
+44-9sys/kern/vfs_mount.c
+29-5lib/libsys/mount.2
+5-0tests/sys/vfs/Makefile
+316-144 files

HardenedBSD/src 21f2245 — sys/net if_me.c

if_me: Do not reuse gre(4)'s static sysctl OID number

if_me(4) registers its net.link.me node with the static OID number
IFT_TUNNEL, the same number if_gre(4) has used for net.link.gre since
2003, so the two tunnel drivers collide under net.link.  Until
d35c4cfad580 that only printed a warning and left two nodes with the
same number; since then sysctl_register_oid() panics, so loading if_me
after if_gre (or the other way round) takes the box down:

  kldload if_gre
  kldload if_me
  panic: sysctl: OID number(131) is already in use for 'me'

Use OID_AUTO like the other tunnel drivers.  Nothing addresses the node
by number.

Reviewed by:            ae
MFC after:              3 days
Sponsored by:           Rubicon Communications, LLC ("Netgate")
Differential Revision:  https://reviews.freebsd.org/D60536
DeltaFile
+1-1sys/net/if_me.c
+1-11 files

HardenedBSD/src f627ff5 — sys/riscv/include smp.h cpu.h, sys/riscv/riscv pmap.c mp_machdep.c

riscv/pmap.c: Don't pass hartid map to 'smp_rendezvous_cpus'

The pm_active bitmask is indexed by hart IDs which can differ from
CPU IDs. `pmap_invalidate_range_svinval` assumes that the map is
indexed by CPU IDs, which is wrong and causes remote TLB invalidations
on unrelated CPUs.

Fix this by adding a routine that converts a hart-indexed bitmask
to a CPU ID-indexed bitmask. While we're here, fix a similar issue
in `pmap_active_cpus`.

Fixes:  99360212c739 ("riscv/pmap.c: Add an Svinval-aware variant of pmap_invalidate_range")
Reported by:    markj
Reviewed by:    markj, mhorne
Differential Revision:  https://reviews.freebsd.org/D60072
DeltaFile
+31-8sys/riscv/riscv/mp_machdep.c
+6-5sys/riscv/riscv/pmap.c
+3-0sys/riscv/include/cpu.h
+0-1sys/riscv/include/smp.h
+40-144 files