HardenedBSD/src c59953asys/security/mac mac_policy.h mac_prison.c, sys/security/mac_stub mac_stub.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+34-0usr.bin/tr/tr.c
+9-0sys/security/mac_test/mac_test.c
+7-0sys/security/mac_stub/mac_stub.c
+3-0sys/security/mac/mac_policy.h
+3-0sys/security/mac/mac_prison.c
+1-1sys/sys/param.h
+57-16 files

HardenedBSD/src 625dc44usr.bin/tr tr.c

tr: fix class handling in unicode world

toupper/tolower logic was only handled for CCLASS_TOUPPER and
CCLASS_TOLOWER, add support for CCLASS ([:alpha:])

PR:             219900
MFC After:      1 week
DeltaFile
+34-0usr.bin/tr/tr.c
+34-01 files

HardenedBSD/src 99e138fsys/security/mac mac_policy.h mac_prison.c, sys/security/mac_stub mac_stub.c

kern: mac: add a prison_cleanup entry point

The MAC framework provides a lot of useful functionality that can be
configured per-jail without requiring the use of labels.  Having another
entry point that we invoke just for general prison cleanup rather than
freeing the label is useful to allow a module that can otherwise work
off of a series of MAC entry points + sysctls for configuration to free
its per-jail configuration without having to bring in osd(9).

One such example in the wild is HardenedBSD's secadm, but some of my
own personal use had wanted it as well- it was simply overlooked in the
final version because my first policy made more sense with labels.  On
that note, it's expected that prison_cleanup and prison_destroy_label
will effectively be mutually exclusive -- the former only used when
a label isn't needed, the latter when it is.

Note that prison_cleanup isn't perfectly symmetrical w.r.t.
prison_created: the latter takes a label as well, because it's called
later in jail setup and a better point for propagation than when the

    [11 lines not shown]
DeltaFile
+9-0sys/security/mac_test/mac_test.c
+7-0sys/security/mac_stub/mac_stub.c
+3-0sys/security/mac/mac_policy.h
+3-0sys/security/mac/mac_prison.c
+1-1sys/sys/param.h
+23-15 files

HardenedBSD/src fe2dd04share/mk src.opts.mk

HBSD: Resolve merge conflict

Signed-off-by:  Shawn Webb <shawn.webb at hardenedbsd.org>
DeltaFile
+0-3share/mk/src.opts.mk
+0-31 files

HardenedBSD/src e748bc2bin/timeout timeout.c, share/man/man4 multicast.4

Merge remote-tracking branch 'origin/freebsd/current/main' into hardened/current/master

Conflicts:
        share/mk/src.opts.mk (unresolved)
DeltaFile
+73-85bin/timeout/timeout.c
+54-38usr.bin/diff/tests/diff_test.sh
+26-18usr.bin/diff/diff.c
+20-15sys/netinet6/ip6_mroute.c
+15-14sys/netinet/ip_mroute.c
+22-4share/man/man4/multicast.4
+210-17420 files not shown
+294-21526 files

HardenedBSD/src cc3d59flib/clang/libllvm Makefile

HBSD: Missed a file in the last merge conflict resolution

Signed-off-by:  Shawn Webb <shawn.webb at hardenedbsd.org>
DeltaFile
+4-2lib/clang/libllvm/Makefile
+4-21 files

HardenedBSD/src fc6a600usr.bin/diff3 diff3.c, usr.bin/diff3/tests diff3_test.sh

Merge remote-tracking branch 'origin/freebsd/current/main' into hardened/current/master
DeltaFile
+110-125usr.sbin/ngctl/main.c
+25-26usr.bin/diff3/diff3.c
+42-3usr.bin/diff3/tests/diff3_test.sh
+16-23usr.sbin/ngctl/msg.c
+18-13usr.sbin/ngctl/config.c
+18-10usr.sbin/ngctl/write.c
+229-20034 files not shown
+430-27040 files

HardenedBSD/src ed285eblib/clang/libclang Makefile, lib/clang/liblldb Makefile

HBSD: Resolve merge conflicts

This also brings us a little closer to upstream's llvm-related
Makefiles. Reintroduce the MK_LLVM_LINK_STATIC_LIBRARIES option,
defaulted to yes.

It is not advised for HardenedBSD users to set
WITHOUT_LLVM_LINK_STATIC_LIBRARIES just yet. Initial testing
demonstrated some issues with linking the right libraries. I do plan to
still move us towards supporting the src compiler toolchain being
compiled as PIEs.

Signed-off-by:  Shawn Webb <shawn.webb at hardenedbsd.org>
DeltaFile
+19-6lib/clang/libclang/Makefile
+20-5lib/clang/liblldb/Makefile
+0-5lib/clang/libllvm/Makefile
+0-4sys/netinet6/nd6_rtr.c
+0-4sys/arm64/arm64/pmap.c
+1-0share/mk/src.opts.mk
+40-246 files

HardenedBSD/src 07c4eb5sys/compat/freebsd32 freebsd32.h

sys/compat/freebsd32: Fix i386 compilation

The compile assertion now failing is due to the change '__int64_t' =>
'__int32_t' as the type of 'time32_t' on i386, which is the correct
value.  The use of 'freebsd32.h' on i386 may seem strange, but it comes
from 'kern_umtx.c' including it unconditionally as it needs 'struct
umutex32'.

Fixes:          87632ddf67b0 ("openzfs sys/types32.h: use abi_compat.h for time32_t")
Sponsored by:   The FreeBSD Foundation
DeltaFile
+1-1sys/compat/freebsd32/freebsd32.h
+1-11 files

HardenedBSD/src 2ce028esys/kern link_elf_obj.c, sys/sys elf_common.h

sys: ELF: Rename SHN_FBSD_CACHED => SHN_FREEBSD_CACHED

All other FreeBSD-specific constants have FREEBSD fully spelled out in
their names.  Be consistent.

No functional change (intended).

Reviewed by:    kib
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D55224
DeltaFile
+2-2sys/kern/link_elf_obj.c
+2-1sys/sys/elf_common.h
+4-32 files

HardenedBSD/src f2c2e5bshare/man/man4 multicast.4

multicast.4: Fix disabling multicast forwarding

Reviewed by: markj, glebius
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D55266
DeltaFile
+22-4share/man/man4/multicast.4
+22-41 files

HardenedBSD/src fd52a9bcontrib/diff/src diff3.c, gnu/usr.bin/diff3 Makefile

diff3: Use a format string to quiet a compiler warning

And bump WARNS to 2
DeltaFile
+1-1gnu/usr.bin/diff3/Makefile
+1-1contrib/diff/src/diff3.c
+2-22 files

HardenedBSD/src 08208cdbin/timeout timeout.c timeout.1

timeout: Clean up

* Annotate logv() and fix format string bug.

* Don't reinvent str2sig(3).

* Reorganize kill_self() so we unblock signals as late as possible, and
  use raise(2) instead of kill(2).

* Explicitly close unused pipe descriptors.

* Use correct type to collect result of read(2) and write(2).

* Compare return values to 0, not -1.

* Sort local variables according to style(9).

* Reduce unnecessary nesting.


    [8 lines not shown]
DeltaFile
+73-85bin/timeout/timeout.c
+1-1bin/timeout/timeout.1
+74-862 files

HardenedBSD/src 790f1d1usr.bin/diff diff.c, usr.bin/diff/tests diff_test.sh

diff: Tweak range of -C and -U arguments

POSIX uses the terms “positive decimal integer” for -C and “non-negative
decimal integer” for -U, which translates into lower bounds of 1 for -C
and 0 for -U.

POSIX does not specify a minimum upper bound for either mode, but as of
5fc739eb5949 both our backends support context sizes up to and including
INT_MAX, so use that.

Having had the opportunity to consult the Unix System Test Suite, the
diff test cases found therein happen to precisely match these bounds.

While here, switch to using strtonum() to parse numerical arguments, and
try to be more consistent in how we report usage errors.

MFC after:      1 week
Sponsored by:   Klara, Inc.
Reviewed by:    kevans
Differential Revision:  https://reviews.freebsd.org/D55261
DeltaFile
+38-24usr.bin/diff/tests/diff_test.sh
+26-18usr.bin/diff/diff.c
+64-422 files

HardenedBSD/src b253243usr.bin/diff/tests diff_test.sh

diff: Tweak recursion tests

The -r flag is not required to compare two directories; it is only
required to compare them recursively, i.e. descend into their common
subdirectories.  Adjust tests that use -r needlessly, and adjust the
dirloop test to verify that these two cases remain distinct.

MFC after:      1 week
Sponsored by:   Klara, Inc.
Reviewed by:    kevans
Differential Revision:  https://reviews.freebsd.org/D55262
DeltaFile
+16-14usr.bin/diff/tests/diff_test.sh
+16-141 files

HardenedBSD/src 596bf34sys/net bpf.c

bpf: don't call bpf_detachd() in bpf_setdlt()

The bpf_attachd() will perform bpf_detachd() itself.  Performing it twice
will lead to doing CK_LIST_REMOVE twice.

Reported & tested by:   bz
DeltaFile
+0-1sys/net/bpf.c
+0-11 files

HardenedBSD/src d19fd2fsys/netinet ip_mroute.c raw_ip.c, sys/netinet6 ip6_mroute.c raw_ip6.c

ip_mroute: Make the routing socket private

I have some patches which make ip_mroute and ip6_mroute multi-FIB-aware.
This enables running per-FIB routing daemons, each of which has a
separate routing socket.

Several places in the network stack check whether multicast routing is
configured by checking whether the multicast routing socket is non-NULL.
This doesn't directly translate in my proposed scheme, as each FIB would
have its own socket.  I'd like to modify the ip(6)_mroute code to store
all state, including the socket, in a per-FIB structure.  So, take a
step towards that and 1) hide the socket, 2) add a boolean flag which
indicates whether a multicast router is registered.

Reviewed by:    pouria, zlei, glebius, adrian
MFC after:      2 weeks
Sponsored by:   Stormshield
Sponsored by:   Klara, Inc.
Differential Revision:  https://reviews.freebsd.org/D55236
DeltaFile
+20-15sys/netinet6/ip6_mroute.c
+15-14sys/netinet/ip_mroute.c
+5-5sys/netinet/raw_ip.c
+4-4sys/netinet6/raw_ip6.c
+3-3sys/netinet/ip_mroute.h
+3-3sys/netinet6/ip6_mroute.h
+50-446 files not shown
+59-5012 files

HardenedBSD/src 06d07d4share/man/man5 src.conf.5

src.conf.5: regenerate after switch to BSD diff3
DeltaFile
+5-12share/man/man5/src.conf.5
+5-121 files

HardenedBSD/src 4d5c434share/mk src.opts.mk

diff3: use bsd diff3 by default
DeltaFile
+1-1share/mk/src.opts.mk
+1-11 files

HardenedBSD/src 284a0aausr.bin/diff3/tests conflict-merge.out conflict-Em.out

diff3: add 3 missing files from the testsuite

Fixes:  2cfca8e710f260b8a1bb1ee5e1836a52e468ef4b
DeltaFile
+25-0usr.bin/diff3/tests/conflict-merge.out
+19-0usr.bin/diff3/tests/conflict-Em.out
+44-02 files

HardenedBSD/src 605af06sys/dev/cxgbe t4_main.c

cxgbe(4): Show correct range of tids in sysctl_tids

The highest valid tid has to be adjusted for the hi-pri filter region.

MFC after:      1 week
Sponsored by:   Chelsio Communications
DeltaFile
+1-1sys/dev/cxgbe/t4_main.c
+1-11 files

HardenedBSD/src be7e4dcsys/dev/nvme nvme_private.h

nvme: Use size_t for payload size

Using uint32_t here can cause spurious compiler warnings.  I assume it
was done to constrain the range; use a KASSERT instead.

Sponsored by:   Klara, Inc.
Sponsored by:   NetApp, Inc.
Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D55279
DeltaFile
+3-1sys/dev/nvme/nvme_private.h
+3-11 files

HardenedBSD/src 10ac741sys/sys elf_common.h

elf_common.h: Add some AArch32 relocations

Reviewed by:    mmel
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55268
DeltaFile
+13-0sys/sys/elf_common.h
+13-01 files

HardenedBSD/src 6265f30lib/libsys/arm Makefile.sys

libsys/arm: include ARM EABI unwind bits into libsys

libsys required ARM EABI unwind symbols like __aeabi_unwind_cpp_pr0.
These symbols are normally provided by libc, but if a binary does
not link libc, the symbol ends up not being resolved.

Among other problems, this prevented gcc14 and newer from building
on arm.

Add the relevant symbols as hidden symbols into libsys to avoid this
problem.

(this patch was posted by jrtc27 who has asked me to move it along)

PR:             292539
Tested by:      fuz, Mark Millard <marklmi26-fbsd at yahoo.com>
Reviewed by:    mmel
Approved by:    markj (mentor)
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D55255
DeltaFile
+5-0lib/libsys/arm/Makefile.sys
+5-01 files

HardenedBSD/src 1782bc9lib/libc/arm/aeabi aeabi_unwind_cpp.c

libc/arm: use __builtin_trap() instead of abort() in aeabi_unwind stubs

This avoids a dependency on the abort symbol in libsys.

PR:             292539
Reviewed by:    mmel
Approved by:    markj (mentor)
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D55255
DeltaFile
+6-6lib/libc/arm/aeabi/aeabi_unwind_cpp.c
+6-61 files

HardenedBSD/src 8efcc64lib/libc/stdlib reallocarray.3, share/man/man3 stdbit.3

Summary: *.3: misc man page fixes

Approved by:    markj (mentor)
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D55249
DeltaFile
+1-1lib/libc/stdlib/reallocarray.3
+1-1share/man/man3/stdbit.3
+2-22 files

HardenedBSD/src 2cfca8eusr.bin/diff3 diff3.c, usr.bin/diff3/tests diff3_test.sh passwd-Em.out

diff3: fix merge mode

Make the merge mode compatible with GNU diff3
Add tests for all the changes, those tests are extracted from the
etcupdate testsuite.

This version passes the etcupdate testsuite and the diffutils diff3
test suite.

MFC After:      1 week
DeltaFile
+25-26usr.bin/diff3/diff3.c
+42-3usr.bin/diff3/tests/diff3_test.sh
+16-0usr.bin/diff3/tests/passwd-Em.out
+15-1usr.bin/diff3/tests/Makefile
+15-0usr.bin/diff3/tests/passwd-test.txt
+12-0usr.bin/diff3/tests/passwd-new.txt
+125-309 files not shown
+168-3015 files

HardenedBSD/src 1a13509sys/contrib/dev/broadcom/brcm80211/brcmfmac cfg80211.c sdio.c, sys/contrib/dev/broadcom/brcm80211/brcmsmac main.c

Merge remote-tracking branch 'origin/freebsd/current/main' into hardened/current/master

Conflicts:
        lib/clang/libclang/Makefile (unresolved)
        lib/clang/liblldb/Makefile (unresolved)
        lib/clang/libllvm/Makefile (unresolved)
        sys/arm64/arm64/pmap.c (unresolved)
        sys/netinet6/nd6_rtr.c (unresolved)
DeltaFile
+28,572-0sys/contrib/dev/broadcom/brcm80211/brcmsmac/phy/phy_n.c
+10,099-0sys/contrib/dev/broadcom/brcm80211/brcmsmac/phy/phytbl_n.c
+8,689-0sys/contrib/dev/broadcom/brcm80211/brcmfmac/cfg80211.c
+8,065-0sys/contrib/dev/broadcom/brcm80211/brcmsmac/main.c
+5,151-0sys/contrib/dev/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c
+4,650-0sys/contrib/dev/broadcom/brcm80211/brcmfmac/sdio.c
+65,226-0393 files not shown
+124,808-2,925399 files

HardenedBSD/src a8b8fectests/atf_python/sys/net vnet.py

atf_python/vnet: Make it possible to set the FIB of vnet interfaces

Reviewed by:    zlei, ngie
MFC after:      1 week
Sponsored by:   Stormshield
Sponsored by:   Klara, Inc.
Differential Revision:  https://reviews.freebsd.org/D54972
DeltaFile
+15-1tests/atf_python/sys/net/vnet.py
+15-11 files

HardenedBSD/src 3cbdcabusr.sbin/ngctl main.c msg.c

ngctl: Modernize code somewhat

* Replace fgets(3) with getline(3)

* Replace select(2) with poll(2)

* Avoid needlessly copying text around

* Correct use of getopt(3)

* Pick some style and whitespace nits

MFC after:      1 week
Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D55257
DeltaFile
+110-125usr.sbin/ngctl/main.c
+16-23usr.sbin/ngctl/msg.c
+6-8usr.sbin/ngctl/list.c
+4-6usr.sbin/ngctl/write.c
+4-6usr.sbin/ngctl/status.c
+4-5usr.sbin/ngctl/config.c
+144-1739 files not shown
+164-21215 files