HardenedBSD/src b1097e9bin/pwd pwd.c, bin/pwd/tests pwd_test.sh

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+249-0usr.bin/m4/tests/m4_test.sh
+54-47bin/pwd/pwd.c
+94-0bin/pwd/tests/pwd_test.sh
+0-44usr.bin/m4/tests/regress.gnuprefix.out
+22-22usr.bin/xinstall/xinstall.c
+44-0usr.bin/m4/tests/regress.gnuprefix.err
+463-11321 files not shown
+601-17727 files

HardenedBSD/src 4bc40d5usr.sbin/daemon daemon.c daemon.8

daemon: Add option for output file mode

The daemon utility has always created its output file with a fixed mode
of 0600. This causes issues for log collection setups where the collector
does not run as root but instead relies on group access to the watched
daemon’s log file.

Introduce a new option that allows specifying the output file mode using
install(1)-style semantics. This enables non-root log collectors to access
the file as intended and improves compatibility with log rotation tools.

Reviewed by:    kevans
MFC after:      1 week
Relnotes:       yes
Differential Revision:  https://reviews.freebsd.org/D54930

(cherry picked from commit a3b90a1f008365d9f62773998f89f9c872e2bed5)
DeltaFile
+21-7usr.sbin/daemon/daemon.c
+15-2usr.sbin/daemon/daemon.8
+36-92 files

HardenedBSD/src f201382usr.bin/diff diffdir.c, usr.bin/diff/tests diff_test.sh

diff: Improve directory loop detection

When we're done processing a directory, remove its entry from the tree
of visited inodes, ensuring that we only report a loop when we encounter
a descendant-to-ancestor link, not when we encounter a cousin-to-cousin
or sibling-to-sibling link.

MFC after:      1 week
Reported by:    Bakul Shah <bakul at iitbombay.org>
Sponsored by:   Klara, Inc.
Reviewed by:    kevans
Differential Revision:  https://reviews.freebsd.org/D55248

(cherry picked from commit 71569594d860a59d8362770a56d806e1d31fb946)
DeltaFile
+17-3usr.bin/diff/diffdir.c
+5-0usr.bin/diff/tests/diff_test.sh
+22-32 files

HardenedBSD/src 78c53adusr.bin/m4 eval.c, usr.bin/m4/tests m4_test.sh defn.m4

m4: Change defn processing order

Currently, defn pushes its arguments on the stack in order, which means
they are then processed in reverse order.  POSIX does not specify what
order they are processed in, which arguably suggests that they should be
processed in the order they are listed.  Push them in reverse order so
they will be processed in their original order.  This matches GNU m4.

PR:             292937
MFC after:      1 week
Sponsored by:   Klara, Inc.
Reviewed by:    obiwac, imp
Differential Revision:  https://reviews.freebsd.org/D55116

(cherry picked from commit 25a8168f86a1222388475ce858da405e4d06c1c3)
DeltaFile
+9-0usr.bin/m4/tests/m4_test.sh
+5-0usr.bin/m4/tests/defn.m4
+1-1usr.bin/m4/eval.c
+2-0usr.bin/m4/tests/Makefile
+1-0usr.bin/m4/tests/regress.defn.out
+18-15 files

HardenedBSD/src 4917376bin/pwd pwd.c, bin/pwd/tests pwd_test.sh

pwd: Error out if writing to stdout failed

POSIX requires us to print a diagnostic and return a non-zero exit
code if writing to stdout failed.

MFC after:      1 week
Sponsored by:   Klara, Inc.
Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D55227

(cherry picked from commit 5b398611607b0dab2f2550ef73f62d41dab6fac5)
DeltaFile
+21-0bin/pwd/tests/pwd_test.sh
+2-0bin/pwd/pwd.c
+23-02 files

HardenedBSD/src 24b95c5bin/pwd pwd.c pwd.1

pwd: Clean up and adopt POSIX semantics

According to POSIX, the default should be -L.  Based on code history,
whoever first wrote BSD pwd(1) could not figure out how to implement
-L and therefore made -P the default (and only) option. Support for -L
was later added, but the default was never changed.

Clean up the code, make -L the default, and rewrite getcwd_logical() to
reject paths that contain dot or dot-dot, as required by POSIX.

MFC after:      1 week
Reviewed by:    olce
Differential Revision:  https://reviews.freebsd.org/D55146

(cherry picked from commit 2df923c5d2d02350abc29f61b603c5b9615b225c)
DeltaFile
+52-47bin/pwd/pwd.c
+2-2bin/pwd/pwd.1
+54-492 files

HardenedBSD/src 9f1bff6usr.bin/xinstall xinstall.c, usr.bin/xinstall/tests install_test.sh

install: Expect EINTR while copying

Both copy_file_range() and read() / write() in our fallback loop can be
interrupted before copying anything at all, in which case it returns -1
and sets errno to EINTR.  If that happens, we should retry, not fail.

While here, drop the size argument from copy() (we always want to copy
the entire file anyway) and add test cases which exercise the metalog
and digest functionality.

PR:             293028
MFC after:      1 week
Reviewed by:    kevans
Differential Revision:  https://reviews.freebsd.org/D55168

(cherry picked from commit 0fb940fd63dd9b6d6b848421c53b1e9ac8387265)
DeltaFile
+22-22usr.bin/xinstall/xinstall.c
+38-0usr.bin/xinstall/tests/install_test.sh
+60-222 files

HardenedBSD/src 77385e9bin/cp utils.c

cp: Expect EINTR while copying

Both copy_file_range() and copy_fallback() can be interrupted before
they have read anything at all, in which case they return -1 and set
errno to EINTR.  If that happens, we should retry, not fail.

PR:             293028
MFC after:      1 week
Reviewed by:    kevans
Differential Revision:  https://reviews.freebsd.org/D55167

(cherry picked from commit 7aa30669d6e04444b8ad1e4863a6e674fcac4afc)
DeltaFile
+5-2bin/cp/utils.c
+5-21 files

HardenedBSD/src 36fa675bin/pwd Makefile, bin/pwd/tests pwd_test.sh Makefile

pwd: Add tests

MFC after:      1 week
Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D55153

(cherry picked from commit 36ec2b1c104f9e5383a160e21109e1308fce0364)
DeltaFile
+73-0bin/pwd/tests/pwd_test.sh
+6-2bin/pwd/Makefile
+4-0bin/pwd/tests/Makefile
+2-0etc/mtree/BSD.tests.dist
+85-24 files

HardenedBSD/src 955fdd4usr.bin/m4/tests m4_test.sh regress.gnuprefix.err

m4: Convert tests to ATF

MFC after:      1 week
Sponsored by:   Klara, Inc.
Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D55115

(cherry picked from commit 16e073df4a33646fa0e0fba5b41ddc6b44df3605)
DeltaFile
+240-0usr.bin/m4/tests/m4_test.sh
+44-0usr.bin/m4/tests/regress.gnuprefix.err
+0-44usr.bin/m4/tests/regress.gnuprefix.out
+0-32usr.bin/m4/tests/regress.sh
+8-5usr.bin/m4/tests/Makefile
+0-5usr.bin/m4/tests/legacy_test.sh
+292-865 files not shown
+298-8911 files

HardenedBSD/src b5fa384sys/dev/asmc asmcvar.h asmc.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+69-0sys/dev/asmc/asmcvar.h
+9-0sys/dev/asmc/asmc.c
+78-02 files

HardenedBSD/src f39e730lib/libc/net sockatmark.3, sbin/setkey setkey.8

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+8-7sbin/setkey/setkey.8
+1-1lib/libc/net/sockatmark.3
+9-82 files

HardenedBSD/src 7786840lib/libc/net sockatmark.3

lib/libc/net/sockatmark.3: fix groff mdoc warning

PR:     293072

(cherry picked from commit 10fde719587c22085c95759a242e9c51d249d024)
DeltaFile
+1-1lib/libc/net/sockatmark.3
+1-11 files

HardenedBSD/src c838c3fsbin/setkey setkey.8

sbin/setkey/setkey.8: cleanup groff mdoc warnings

PR:     293072

(cherry picked from commit c67d8acca30e9f96f0a56f197003d0a4c663a060)
DeltaFile
+8-7sbin/setkey/setkey.8
+8-71 files

HardenedBSD/src 90d79ddsys/dev/asmc asmcvar.h asmc.c

asmc: Add MacPro3,1 temperature sensor support

Test and verified with Sonicblue7

Reviewed by:    adrian
Differential Revision:  https://reviews.freebsd.org/D54952
DeltaFile
+69-0sys/dev/asmc/asmcvar.h
+9-0sys/dev/asmc/asmc.c
+78-02 files

HardenedBSD/src 2fe040csys/netinet6 in6_mcast.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+11-8sys/netinet6/in6_mcast.c
+11-81 files

HardenedBSD/src 83ab2b3sbin/camcontrol camcontrol.c, sys/cam cam_periph.c

cam/scsi: Restore scsi_start_stop() and add scsi_start_stop_pc()

Revert the argument change that broke libcam in 8c35de49 and move
power_condition support to scsi_start_stop_pc().

Reported by:            imp
Reviewed By:            #cam, imp (mentor)
Sponsored by:           Samsung Electronics
Differential Revision:  https://reviews.freebsd.org/D54822

(cherry picked from commit 8ef8c6abfadfc9eb0465ce57c6b09ca310415bdd)
Signed-off-by: Shawn Webb <shawn.webb at hardenedbsd.org>
DeltaFile
+34-0sys/cam/scsi/scsi_all.c
+4-0sys/cam/scsi/scsi_all.h
+1-1sys/dev/ufshci/ufshci_sim.c
+0-2sys/cam/scsi/scsi_cd.c
+0-1sbin/camcontrol/camcontrol.c
+0-1sys/cam/cam_periph.c
+39-52 files not shown
+39-78 files

HardenedBSD/src 64f3efccontrib/blocklist/bin blacklistd.c blacklistd.conf.5

blocklist: blacklist: Chase recent upstream changes

MFC after:      3 days

(cherry picked from commit a25b12c6ce63be1fefb31d14daca332682fd31fc)
Signed-off-by: Shawn Webb <shawn.webb at hardenedbsd.org>
DeltaFile
+14-14contrib/blocklist/bin/blacklistd.c
+3-3contrib/blocklist/bin/blacklistd.conf.5
+17-172 files

HardenedBSD/src bb34d2bcontrib/blocklist/bin blocklistd.c run.c, contrib/blocklist/port popenve.c

Vendor import of blocklist 2026-02-07 (10a907f)

Upstream hash 10a907f09f5a92068d86dcb4ef4f91d7bc10c501.

Obtained from:https://github.com/zoulasc/blocklist

(cherry picked from commit a39ba5e2935176fe982235556e46ba3f51178187)
Signed-off-by: Shawn Webb <shawn.webb at hardenedbsd.org>
DeltaFile
+39-36contrib/blocklist/port/popenve.c
+14-14contrib/blocklist/bin/blocklistd.c
+9-8contrib/blocklist/bin/run.c
+3-3contrib/blocklist/bin/blocklistd.conf.5
+2-3contrib/blocklist/bin/support.c
+67-645 files

HardenedBSD/src 79eff4asys/netinet6 in6_mcast.c

netinet6: Return EAFNOSUPPORT for non-IPv6 addresses in mcast sockopts.

This is a non-functional change; it just returns the correct errno value
where IPv6 multicast socket options were passed non-AF_INET6 arguments,
in preparation for handling PR 193246 with a side-call into netinet as
xnu currently does.

Reviewed by:    glebius
Approved by:    glebius
PR:             193246 (with refinements)
Differential revision:  https://reviews.freebsd.org/D55233
DeltaFile
+11-8sys/netinet6/in6_mcast.c
+11-81 files

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_prison.c mac_policy.h, 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_prison.c
+3-0sys/security/mac/mac_policy.h
+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
+20-5lib/clang/liblldb/Makefile
+19-6lib/clang/libclang/Makefile
+0-5lib/clang/libllvm/Makefile
+0-4sys/arm64/arm64/pmap.c
+0-4sys/netinet6/nd6_rtr.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