HardenedBSD/src 4bb1d65share/man/man9 mbuf.9, sys/dev/dwc if_dwc.c

Merge remote-tracking branch 'origin/hardened/current/master' into hardened/current/cross-dso-cfi
DeltaFile
+23-9sys/netinet/ip_fastfwd.c
+6-10sys/dev/dwc/if_dwc.c
+6-0sys/netinet/ip_input.c
+3-2share/man/man9/mbuf.9
+38-214 files

HardenedBSD/src dd6301eshare/man/man9 mbuf.9, sys/dev/dwc if_dwc.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+23-9sys/netinet/ip_fastfwd.c
+6-10sys/dev/dwc/if_dwc.c
+6-0sys/netinet/ip_input.c
+3-2share/man/man9/mbuf.9
+38-214 files

HardenedBSD/src 6f15ba8share/man/man9 mbuf.9, sys/netinet ip_fastfwd.c ip_input.c

ip: improve deferred computation of checksums

This patch adds the same functionality for the IPv4 header checksum
as was done erlier for the SCTP/TCP/UDP transport checksum.
When the IP implementation sends a packet, it does not compute the
corresponding checksum but defers that. It will determine whether the
network interface selected for the packet has the requested capability
and computes the checksum in software, if the selected network
interface does not have the requested capability.
Do this not only for packets being sent by the local IP stack, but
also when forwarding packets. Furthermore, when such packets are
delivered to a local IP stack, do not compute or validate the checksum,
since such packets have never been on the wire. This allows to support
checksum offloading also in the case of local virtual machines or
jails. Support for epair interfaces will be added in a separate commit.

Reviewed by:            pouria, tuexen
MFC after:              1 week
Differential Revision:  https://reviews.freebsd.org/D54455
DeltaFile
+23-9sys/netinet/ip_fastfwd.c
+6-0sys/netinet/ip_input.c
+3-2share/man/man9/mbuf.9
+32-113 files

HardenedBSD/src 3d771e0sys/dev/dwc if_dwc.c

dwc: cleanup

No functional change intended.

Reviewed by:            Timo Völker
MFC after:              3 days
Differential Revision:  https://reviews.freebsd.org/D54788
DeltaFile
+6-10sys/dev/dwc/if_dwc.c
+6-101 files

HardenedBSD/src e752e7dlib/libc/posix1e mac.conf.5 mac.conf, lib/libjail jail.c

Merge remote-tracking branch 'origin/hardened/current/master' into hardened/current/cross-dso-cfi
DeltaFile
+9-6lib/libjail/jail.c
+2-6sys/security/mac/mac_syscalls.c
+2-2share/man/man4/mac.4
+2-1lib/libc/posix1e/mac.conf.5
+1-0lib/libc/posix1e/mac.conf
+16-155 files

HardenedBSD/src 4a2ea69lib/libc/posix1e mac.conf.5 mac.conf, lib/libjail jail.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+9-6lib/libjail/jail.c
+2-6sys/security/mac/mac_syscalls.c
+2-2share/man/man4/mac.4
+2-1lib/libc/posix1e/mac.conf.5
+1-0lib/libc/posix1e/mac.conf
+16-155 files

HardenedBSD/src a399b3flib/libbe libbe.3 be.c, lib/libc/gen sysconf.c

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+137-3lib/libc/tests/sys/cpuset_test.c
+57-16sbin/bectl/bectl.c
+31-26lib/libutil/login_class.c
+14-2lib/libbe/libbe.3
+15-1lib/libc/gen/sysconf.c
+12-0lib/libbe/be.c
+266-486 files not shown
+293-5912 files

HardenedBSD/src 6dabfd3stand/lua core.lua

lualoader: fix pruning of non-existent default kernel

Removing the kernel from the list of available kernels is sufficient to
avoid rendering it in the list, but we need more for booting to actually
work.  Notably, the 'kernel' loader.conf var was left intact to its
default value, so if one didn't use the kernel selector in the menu then
we'd try to boot the nonexistent 'kernel' instead of the new default
(first autodetected).

There's room to improve the error messages here, but for now let's just
make it actually work correctly.

PR:             292232
Fixes:  d04415c520b03 ("loader: lua: remove the default kernel [...]")
(cherry picked from commit e30086ab4c8778ea70a3b19e83546ce1b4a16492)
DeltaFile
+6-0stand/lua/core.lua
+6-01 files

HardenedBSD/src bc859balib/libbe libbe.3 be.c, sbin/bectl bectl.c

bectl: log modifying functions to zpool history

Modeled directly after the method used by the zfs/zpool commands: flag
commands with a "please log me" flag, and when there, reconstruct the
command line. On success, call the library function to add it to the
log.

(Majority of the change by Rob; minor edits by kevans@)

Signed-off-by: Rob Norris <rob.norris at klarasystems.com>
Co-authored-by: Kyle Evans <kevans at FreeBSD.org>
Sponsored by:   Modirum MDPay
Sponsored by:   Klara, Inc.
(cherry picked from commit 2a87929671e6e6919c18f2c25d60f2c73c3d18f4)
DeltaFile
+57-16sbin/bectl/bectl.c
+14-2lib/libbe/libbe.3
+12-0lib/libbe/be.c
+2-0lib/libbe/be.h
+85-184 files

HardenedBSD/src 5b2a742share/man/man9 make_dev.9

makedev(9): drop an additional note about cdevpriv dtors

These were previously somewhat safe to call destroy_dev(9), but will now
also cause a deadlock in the same fashion that d_close doing so would
previously.  Amend the note to point it out, in case it's useful for
someone.

Reviewed by:    imp, kib, markj

(cherry picked from commit 90314c04f10f583c37c59ec51fd628e3deaf3622)
DeltaFile
+8-4share/man/man9/make_dev.9
+8-41 files

HardenedBSD/src e760f45lib/libc/gen sysconf.c sysconf.3, lib/libc/tests/sys cpuset_test.c

libc: report _SC_NPROCESSORS_ONLN more accurately in cpu-limited jails

We don't support CPU hotplug, but we do support cpuset(8) restrictions
on jails (including prison0, which uses cpuset 1).  The process cannot
widen its cpuset beyond its root set, so it makes sense to instead
report the number of cpus enabled there rather than the total number
in the system.

This change is effectively a nop for the majority of systems and jails
in the wild, though it does reduce the performance of this query now
that we can't take advantage of AT_NCPUS being provided in the auxinfo.

The implementation here is notably different than Linux, which would not
take cgroups into account.  They do, however, take CPU hotplug into
account, so the possibility for it to diverge from (and be lower than)
the # configured count to reflect what the process can actually be
scheduled on doesn't really diverge in semantics.

Reviewed by:    kib

    [2 lines not shown]
DeltaFile
+137-3lib/libc/tests/sys/cpuset_test.c
+15-1lib/libc/gen/sysconf.c
+4-2lib/libc/gen/sysconf.3
+156-63 files

HardenedBSD/src d15be6dlib/libutil login_class.c

libutil: defer setting the MAC label until after the login class

MAC policies, like mac_biba(4), may forbid changing the login class once
a label has been applied.  For setting up the initial login context,
this isn't really expected and in-fact may break some class-based
configuration.

Defer setting the MAC label until after the login class is set, and
remove the requirement that we have a pwd entry since the label is
pulled from the login class -- we only use pwd for syslog in this path.

Patch is largely by Kevin Barry, with some modifications and this commit
message by kevans@.

PR:             177698
Reviewed by:    des, olce
Co-authored-by: Kevin Barry <ta0kira gmail com>

(cherry picked from commit 98edcbcce0a4650084bd86e704cfa38bf590250c)
DeltaFile
+31-26lib/libutil/login_class.c
+31-261 files

HardenedBSD/src b5b3bf5lib/libc/posix1e mac_text.3 mac_free.3

libc: fix description issues in mac_text(3)/mac_free(3)

mac_text(3) as-written would seem to indicate that a `mac_t` should be
freed with free(3), but this isn't the case.  One can derive from
context from when the change was introduced and COMPATIBILITY that this
was intended to talk about *text in `mac_to_text`, so move the comment
there.

PR:             179832
Co-authored-by: Priit Järv <priit cc ttu ee>

(cherry picked from commit 081218b7a2006e5b6783e51f66fd751871ac1272)
DeltaFile
+5-3lib/libc/posix1e/mac_text.3
+2-2lib/libc/posix1e/mac_free.3
+7-52 files

HardenedBSD/src bef0475share/man/man4 mac.4

mac(4): also list jails in the example enumeration of objects

The prison may also be considered part of the subject by way of its
ucred association, but I don't think this is significantly different
enough today than before recent work -- policies could have always
taken them into account, and some did (e.g., mac_bsdextended).

Reported by:    olce
Reviewed by:    olce, ziaee
Differential Revision:  https://reviews.freebsd.org/D54748
DeltaFile
+2-2share/man/man4/mac.4
+2-21 files

HardenedBSD/src 3f3b53elib/libc/posix1e mac.conf.5 mac.conf, lib/libjail jail.c

jail(3): fix common usage after mac.label support

Nobody else's mac.conf(5) has any entries for jails, so they get a
trivial ENOENT and we fail before we can fetch any jail parameters.
Most notably, this breaks `jls -s` / `jls -n` if you do not have any
loaded policy that applies jail labels.

Add an entry that works for everyone, and hardcode that as an ENOENT
fallback in libjail to provide a smoother transition.  This is probably
not harmful to leave in long-term, since mac.conf(5) will override it.

This unearthed one additional issue, in that mac_get_prison() in the
MAC framework handled the no-label-policies bit wrong.  We don't want
to break jail utilities enumerating jail parameters automatically, so
we must ingest the label in all cases -- we can still use it as a small
optimization to avoid trying to copy out any label.  We will break
things if a non-optional element is specified in the copied in label,
but that's expected.


    [8 lines not shown]
DeltaFile
+9-6lib/libjail/jail.c
+2-6sys/security/mac/mac_syscalls.c
+2-1lib/libc/posix1e/mac.conf.5
+1-0lib/libc/posix1e/mac.conf
+14-134 files

HardenedBSD/src e2663c4sbin/pfctl parse.y, sbin/pfctl/tests/files pf1077.ok

Merge remote-tracking branch 'origin/hardened/current/master' into hardened/current/cross-dso-cfi
DeltaFile
+11-11share/man/man5/pf.conf.5
+3-3tests/sys/netpfil/pf/limiters.sh
+1-1sbin/pfctl/tests/files/pf1077.ok
+2-0sys/amd64/conf/HARDENEDBSD-CORE
+2-0sys/netpfil/pf/pf.h
+1-1sbin/pfctl/parse.y
+20-162 files not shown
+21-188 files

HardenedBSD/src 4bd6f93sbin/pfctl parse.y, sbin/pfctl/tests/files pf1077.ok pf1076.in

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+11-11share/man/man5/pf.conf.5
+3-3tests/sys/netpfil/pf/limiters.sh
+1-1sbin/pfctl/tests/files/pf1077.ok
+1-1sbin/pfctl/tests/files/pf1076.in
+1-1sbin/pfctl/parse.y
+2-0sys/netpfil/pf/pf.h
+19-171 files not shown
+19-187 files

HardenedBSD/src a447896usr.bin/sockstat main.c

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+4-4usr.bin/sockstat/main.c
+4-41 files

HardenedBSD/src f51bc79usr.bin/sockstat main.c

sockstat: improve formataddr() according to style(9)

Reviewed by:    des
MFC after:      3 days
Differential Revision:  https://reviews.freebsd.org/D54412

(cherry picked from commit f89f7e58ba1d54c6a683e3cc899938895496c088)
DeltaFile
+4-4usr.bin/sockstat/main.c
+4-41 files

HardenedBSD/src 2e0e45asbin/pfctl parse.y, sbin/pfctl/tests/files pf1077.ok pf1076.in

pfctl(8): change default limiter action from no-match to block

pf(4) users who use limiters in current should update the rules
accordingly to reflect the change in default behavior. The existing
rule which reads as follows:

    pass in from any to any state limiter test

needs to be changed to:

    pass in from any to any state limiter test (no-match)

OK dlg@

Obtained from:  OpenBSD, sashan <sashan at openbsd.org>, c600931321
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+11-11share/man/man5/pf.conf.5
+3-3tests/sys/netpfil/pf/limiters.sh
+1-1sbin/pfctl/tests/files/pf1077.ok
+2-0sys/netpfil/pf/pf.h
+1-1sbin/pfctl/parse.y
+1-1sbin/pfctl/tests/files/pf1076.in
+19-176 files

HardenedBSD/src 68a449fsys/modules/sctp Makefile

sctp: improve compilation as module

When compiling SCTP as a module, don't compile sctp_crc32.c into
the module. This avoids code and variable duplication since
sctp_crc32.c is compiled into the kernel. In particular, the variable
system_base_info is not duplicated. This fixes the handling of the
statistic counters sctps_sendhwcrc and sctps_sendswcrc when using
sctp_delayed_cksum.

MFC after:      3 days
DeltaFile
+0-1sys/modules/sctp/Makefile
+0-11 files

HardenedBSD/src 103903esys/amd64/conf HARDENEDBSD-CORE

HBSD: Disable WITNESS' checking of vnode locks

FreeBSD relatively recently changed how vnode locking works in the
kernel. There are a few places that still need to be updated.
HardenedBSD's use of filesystem extended attributes seems to trip
WITNESS vnode lock checking when ZFS is used. This causes a kernel
panic, which is more likely to be triggered during a package build.

So, for now, let's disable the vnode lock checks. I plan to revisit this
when I have more available time.

Signed-off-by:  Shawn Webb <shawn.webb at hardenedbsd.org>
DeltaFile
+2-0sys/amd64/conf/HARDENEDBSD-CORE
+2-01 files

HardenedBSD/src b08b25blib/libthr/tests pthread_tryjoin_test.c, lib/libthr/thread thr_join.c

Merge remote-tracking branch 'origin/hardened/current/master' into hardened/current/cross-dso-cfi
DeltaFile
+54-22lib/libthr/thread/thr_join.c
+62-0lib/libthr/tests/pthread_tryjoin_test.c
+20-7sys/x86/x86/local_apic.c
+23-3share/man/man3/pthread_join.3
+0-20sys/amd64/vmm/vmm.c
+11-1sys/kern/init_main.c
+170-5312 files not shown
+204-6918 files

HardenedBSD/src 31f652clib/libthr/tests pthread_tryjoin_test.c, lib/libthr/thread thr_join.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+54-22lib/libthr/thread/thr_join.c
+62-0lib/libthr/tests/pthread_tryjoin_test.c
+20-7sys/x86/x86/local_apic.c
+23-3share/man/man3/pthread_join.3
+0-20sys/amd64/vmm/vmm.c
+11-1sys/kern/init_main.c
+170-5312 files not shown
+204-6918 files

HardenedBSD/src 39cb9fbusr.bin/grep zgrep.1, usr.bin/grep/tests grep_freebsd_test.sh

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+0-18usr.bin/grep/zgrep.1
+11-0usr.bin/grep/tests/grep_freebsd_test.sh
+11-182 files

HardenedBSD/src c0898bdusr.bin/usbhidctl usbhidctl.1

usbhidctl.1: adjust option list indent

For improved legibility.
DeltaFile
+1-1usr.bin/usbhidctl/usbhidctl.1
+1-11 files

HardenedBSD/src d80f249usr.bin/grep/tests grep_freebsd_test.sh

grep/tests: Fix up the zgrep executable path in a newly added test

Fixes:  da5d94d29a5e ("Remove obsolete BUGS section from zgrep(1) man page, add test")
(cherry picked from commit 045112f148fa092c92ec53204708f638b226ff8f)
DeltaFile
+1-1usr.bin/grep/tests/grep_freebsd_test.sh
+1-11 files

HardenedBSD/src 6aca792usr.bin/grep zgrep.1, usr.bin/grep/tests grep_freebsd_test.sh

Remove obsolete BUGS section from zgrep(1) man page, add test

I forgot to check/update the man page with D54217. While here add
a test for multiple -e flags.

Reviewed by:    markj
Approved by:    markj
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D54632

(cherry picked from commit da5d94d29a5ec29817476c39ae2b2ad1666c3f06)
DeltaFile
+0-18usr.bin/grep/zgrep.1
+11-0usr.bin/grep/tests/grep_freebsd_test.sh
+11-182 files

HardenedBSD/src 902e305lib/libthr/tests pthread_tryjoin_test.c Makefile

lib/libthr: add pthread_tryjoin(3) test

Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D54766
DeltaFile
+62-0lib/libthr/tests/pthread_tryjoin_test.c
+1-0lib/libthr/tests/Makefile
+63-02 files

HardenedBSD/src 7f026a5share/man/man3 pthread_join.3 Makefile

Document pthread_tryjoin_np(3)

Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D54766
DeltaFile
+23-3share/man/man3/pthread_join.3
+2-1share/man/man3/Makefile
+25-42 files