HardenedBSD/src dc585ef — lib/libsysdecode sysdecode_mask.3

HBSD: Resolve merge conflict

Signed-off-by:  Shawn Webb <shawn.webb at hardenedbsd.org>
DeltaFile
+1-5lib/libsysdecode/sysdecode_mask.3
+1-51 files

HardenedBSD/src 6bd7f1d — crypto/openssh ChangeLog ed25519.c, sys/contrib/openzfs/cmd/zpool zpool_main.c

Merge remote-tracking branch 'rad/hardened/current/master' into hardened/current/pledge

Conflicts:
        lib/libsysdecode/sysdecode_mask.3 (unresolved)
DeltaFile
+4,598-1,983crypto/openssh/ed25519.c
+0-5,021sys/crypto/openssl/aarch64/vpsm4-armv8.S
+0-4,543sys/crypto/openssl/aarch64/vpsm4_ex-armv8.S
+1,973-1,163crypto/openssh/ChangeLog
+1,043-1,051sys/contrib/openzfs/cmd/zpool/zpool_main.c
+1,948-66sys/contrib/openzfs/lib/libnvpair/libnvpair.abi
+9,562-13,8271,738 files not shown
+88,516-46,2371,744 files

HardenedBSD/src 2e25901 — lib/libc/stdio printf-pos.c, lib/libc/tests/stdio swprintf_test.c snprintf_test.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+78-0lib/libc/stdio/printf-pos.c
+4-10stand/uboot/main.c
+10-0lib/libc/tests/stdio/swprintf_test.c
+10-0lib/libc/tests/stdio/snprintf_test.c
+1-0stand/efi/loader/decompress.c
+103-105 files

HardenedBSD/src cb0dc49 — lib/libcasper/libcasper zygote.c libcasper_service.c, lib/libfetch common.c

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+38-48lib/libfetch/common.c
+20-8sys/fs/nfsserver/nfs_nfsdstate.c
+8-4lib/libcasper/libcasper/libcasper_service.c
+8-0usr.bin/logger/logger.c
+3-3lib/libcasper/libcasper/zygote.c
+77-635 files

HardenedBSD/src 5e809bf — lib/libc/stdio printf-pos.c, lib/libc/tests/stdio swprintf_test.c snprintf_test.c

stdio: Fix positional %wN / %wfN conversion

MFC after:      1 week
Fixes:          bce0bef3c6ab ("libc: Implement N2680.")
Fixes:          12b1c1e3fb44 ("libc: Add test cases for N2680.")
DeltaFile
+68-0lib/libc/stdio/printf-pos.c
+8-0lib/libc/tests/stdio/swprintf_test.c
+8-0lib/libc/tests/stdio/snprintf_test.c
+84-03 files

HardenedBSD/src 0e3fce2 — lib/libc/stdio printf-pos.c, lib/libc/tests/stdio swprintf_test.c snprintf_test.c

stdio: Fix positional %B / %b conversion

MFC after:      1 week
Fixes:          d9dc1603d6e4 ("libc: Implement N2630.")
Fixes:          b9385720f34b ("libc: Add unit tests for N2630 and possible collateral damage.")
DeltaFile
+10-0lib/libc/stdio/printf-pos.c
+2-0lib/libc/tests/stdio/swprintf_test.c
+2-0lib/libc/tests/stdio/snprintf_test.c
+14-03 files

HardenedBSD/src 70cf7c6 — stand/uboot main.c

ubldr: Pass the whole loaderdev name to disk_parsedev()

p - 4 is one byte before the string for 3-letter types, so whether
loaderdev=mmc0p2 parsed depended on that byte. disk_parsedev() now skips any
name prefix itself.

Reported by:    llm-postcr
Reviewed by:    imp
Approved by:    imp
Fixes:          d18ed8e19c3c ("stand: Try to parse vdisk correctly")
Sponsored by:   Netfix
Differential Revision:  https://ron-dev.freebsd.org/FreeBSD/src/pulls/105
DeltaFile
+4-10stand/uboot/main.c
+4-101 files

HardenedBSD/src cf58c86 — stand/efi/loader decompress.c

loader.efi: Clear the zstd stream pointer in zstd_fini()

do_download_ramdisk() calls decomp_fini() a second time to free the buffer when
it gives up after a finished download, so zstd freed its strem twice and libsa
libsa panicked. Clear the pointer like xz_fini().

Reported by:    llm-postcr
Reviewed by:    imp
Approved by:    imp
Fixes:          afee781523e4 ("loader.efi: Recognize new memdisk=<url> and memcd=<url> options")
Sponsored by:   Netflix
DeltaFile
+1-0stand/efi/loader/decompress.c
+1-01 files

HardenedBSD/src da10fe4 — usr.sbin/sysconf sysconf_ucl_lex.c sysconf_ucl_style.c, usr.sbin/sysconf/tests sysconf_test.sh

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+524-29usr.sbin/sysconf/tests/sysconf_test.sh
+458-0usr.sbin/sysconf/sysconf_ucl_array.c
+447-0usr.sbin/sysconf/sysconf_ucl_text.c
+442-0usr.sbin/sysconf/sysconf_ucl_write.c
+414-0usr.sbin/sysconf/sysconf_ucl_style.c
+338-0usr.sbin/sysconf/sysconf_ucl_lex.c
+2,623-2932 files not shown
+4,793-7738 files

HardenedBSD/src 6871285 — usr.sbin/sysconf sysconf_ucl_lex.c sysconf_ucl_style.c, usr.sbin/sysconf/tests sysconf_test.sh

sysconf: Add ucl and pkg targets

ucl reads and rewrites Universal Configuration Language files with
libucl(3), the private library pkg(8) links, so what sysconf reads is
what pkg reads. Each file is parsed on its own and every scalar is
addressed by its dotted path (FreeBSD-ports.enabled); the last file
to define a path is authoritative. A write changes only the one
statement, in the file's own separator, terminator, quoting, and
boolean style, then re-parses the result with libucl and refuses the
write unless the parsed contents differ in exactly the requested key.
Removing the last key of an object removes the object.

Arrays are leaves, read back as compact JSON. name+=word and
name-=word on an array add and strike elements. Under an array a
path component is an index, as uclcmd(1) spells it: name.i reaches
one element (name.i=value sets it, name.i+=word edits it, -x name.i
strikes it), name.i.j reaches into a nested array, and name.# is the
count (name.#=value appends). A negative index counts from the end.
Under an object the same component is a key, so a key named 404 or #

    [21 lines not shown]
DeltaFile
+524-29usr.sbin/sysconf/tests/sysconf_test.sh
+458-0usr.sbin/sysconf/sysconf_ucl_array.c
+447-0usr.sbin/sysconf/sysconf_ucl_text.c
+442-0usr.sbin/sysconf/sysconf_ucl_write.c
+414-0usr.sbin/sysconf/sysconf_ucl_style.c
+338-0usr.sbin/sysconf/sysconf_ucl_lex.c
+2,623-2920 files not shown
+4,614-4926 files

HardenedBSD/src e23c13a — sys/dev/pci pci_dw.h pci_dw.c

pci_dw: Honor the max-link-speed property

The root port reports in LNKCAP the highest link speed the core was
synthesized for, which can be more than the PHY behind it supports.  On
the RK3568 pcie2x1 the root port advertises 8GT/s while the PHY only
does 5GT/s.  The link stays at 2.5GT/s after the directed speed change.

Read max-link-speed from the device tree and write it to the Max Link
Speed field of LNKCAP and to the Target Link Speed field of LNKCTL2
before requesting the speed change.  Nothing changes when the property
is absent.

Tested on a Quartz64 Model A with a Samsung 970 EVO Plus NVMe drive: the
link now trains at 5GT/s and the sequential throughput goes from 200MB/s
to 400MB/s.

Differential Revision:  https://reviews.freebsd.org/D61014
DeltaFile
+54-0sys/dev/pci/pci_dw.c
+1-0sys/dev/pci/pci_dw.h
+55-02 files

HardenedBSD/src 495c899 — sys/dev/mii mcommphy.c

mcommphy: Set the 10/100 TX delay of the YT8511

The TX clock delay of the YT8511 is split in two registers.  The delay
used in gigabit mode is in the clock gating page and was already set
from the RGMII mode, but the one used in the 10/100 modes is in the next
page and was left at its reset value of 2ns.  With a phy-mode that does
not ask for a TX delay in the PHY, the MAC provides it and the PHY adds
another 2ns in the 10/100 modes.

Set it like the gigabit one, like Linux does.

Tested on a Quartz64 Model A, gigabit and 100Mbit links.

Reviewed by:    oh
Differential Revision:  https://reviews.freebsd.org/D61015
DeltaFile
+13-0sys/dev/mii/mcommphy.c
+13-01 files

HardenedBSD/src 3dcd4a2 — usr.bin/top machine.h display.h

top: implement pid highlighting

Implement PID highlighting. This can be activated by pressing
'L' and entering a PID to highlight. Highlighting can be cleared
by entering '+' as a PID to highlight. This feature is inspired by
the OpenBSD top, which uses 'P' key for that. We have to use 'L'
because 'P' is already used for toggling per-CPU statistics.

Reviewed by:    kib
Obtained from:  OpenBSD (partially)
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D61090
DeltaFile
+47-11usr.bin/top/top.c
+40-4usr.bin/top/display.c
+8-1usr.bin/top/top.1
+4-1usr.bin/top/machine.c
+2-2usr.bin/top/machine.h
+2-2usr.bin/top/display.h
+103-212 files not shown
+105-228 files

HardenedBSD/src cd7a2cf — share/man/man4 ip.4

ip.4: Fix markup typos

At least INADDR_ANY and IP_MULTICAST_IF are definitely Dv's.

MFC after:      3 days
DeltaFile
+2-2share/man/man4/ip.4
+2-21 files

HardenedBSD/src 22a4f5d — share/man/man4 ip.4

ip.4: Fix ip_mreqn imr_address field name

This manual used imr_interface when describing the second field of
struct ip_mreqn, but sys/netinet/in.h names that field imr_address.
Note that ip_mreq below does have imr_interface which is unchanged.

PR:             300680
MFC after:      3 days
Reviewed by:    ziaee
Closes:         https://github.com/freebsd/freebsd-src/pull/2553
DeltaFile
+4-4share/man/man4/ip.4
+4-41 files

HardenedBSD/src e14d720 — sys/dev/usb/controller xhci.h xhci.c, sys/netinet/tcp_stacks bbr.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+148-127sys/dev/usb/controller/xhci.c
+28-35usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c
+3-4sys/netinet/tcp_stacks/bbr.c
+6-1sys/dev/usb/controller/xhci.h
+185-1674 files

HardenedBSD/src 34436bb — sys/netinet/tcp_stacks bbr.c

tcp bbr: cleanup

No functional change intended.

MFC after:      3 days
MFC to:         stable/14
MFC to:         stable/15
Sponsored by:   Netflix, Inc.
DeltaFile
+3-4sys/netinet/tcp_stacks/bbr.c
+3-41 files

HardenedBSD/src 3b795a9 — sys/dev/usb/controller xhci.h xhci.c

xhci: Enlarge total transfer number

We enlarge the total number of queued transfer. Also, to make controller
always busy. We enqueue the xfer as much as possible to the ring in
multiple enter code.

Differential Revision: https://reviews.freebsd.org/D61246
DeltaFile
+15-14sys/dev/usb/controller/xhci.c
+4-1sys/dev/usb/controller/xhci.h
+19-152 files

HardenedBSD/src f8a67d6 — sys/dev/usb/controller xhci.h xhci.c

xhci: Map stream id to occupied slot

In xhci_check_transfer, we tried to iterate through STREAM * NUM_SLOTS
and find the correct stream. However, stream is rear nowadaya both on
FreeBSD and Linux. In which means that such STREAM * NUM_SLOTS array is
sparse.

As a result, we use a bit map to map stream id to slot. For a
xhci_mask[stream_id], it contains the slot_id bitmap over which slot has
been occupied.

Differential Revision: https://reviews.freebsd.org/D61247
DeltaFile
+133-113sys/dev/usb/controller/xhci.c
+2-0sys/dev/usb/controller/xhci.h
+135-1132 files

HardenedBSD/src b352368 — usr.sbin/bsnmpd/modules/snmp_hostres hostres_device_tbl.c

snmp_hostres(3): check if sysconf(3) fails

While here inline single time use function.

Reported by:    llm-postcr
Fixes:          4edbd4e35c4e0fb7cf10ed5e9b12a2b76bef2cec
DeltaFile
+28-35usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c
+28-351 files

HardenedBSD/src 3fcb98b — contrib/openbsm/compat uuid_stream.h, contrib/openbsm/libbsm bsm_token.c bsm_io.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+0-786stand/liblua/luaconf.h
+0-769lib/liblua/luaconf.h
+167-1contrib/openbsm/libbsm/bsm_io.c
+83-1contrib/openbsm/libbsm/bsm_token.c
+54-26sys/dev/acpica/acpi_pci_link.c
+80-0contrib/openbsm/compat/uuid_stream.h
+384-1,58394 files not shown
+1,243-1,771100 files

HardenedBSD/src 58817a5 — tests/sys/kern Makefile vn_io_fault1.c

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+66-0tests/sys/kern/vn_io_fault1.c
+3-0tests/sys/kern/Makefile
+69-02 files

HardenedBSD/src 079f82d — . UPDATING

UPDATING: note login-name validation in pw(8)/pwd_mkdb(8)

An existing master.passwd with a login name containing a now-disallowed
charater will make pwd_mkdb(8) fail until the name is fixed, which blocks
passwd(1), chpass(1) and pw(8).  Warn users to audit their accounts
befroe updating.

Reviewed by:    bcr
Differential Revision:  https://reviews.freebsd.org/D61507
DeltaFile
+23-0UPDATING
+23-01 files

HardenedBSD/src 538c48b — sys/kern sched_ule.c

sched_ule: Fix rare deadlock on stealing a migrated lock-blocked thread

Thread stealing ultimately happens in tdq_move() which, while holding
the locks of the source and destination runqueues, has to wait for the
stolen thread to be lock-unblocked.  If it is indeed lock-blocked, the
corresponding sched_switch_migrate() needs to re-acquire the lock of the
runqueue of the CPU it is running on before being able to lock-unblock
it.  This amounts to adding a "hidden" and variable additional
lock-ordering dependency between the 'struct tdq' locks held by
tdq_move() and that of an arbitray third 'struct tdq', possibly
violating the ordering established by tdq_lock_pair().  In that case,
other steals occurring in parallel and involving the same queues can
deadlock the scheduler.

Fix that by having sched_switch_migrate() hold its current CPU's
runqueue's lock in addition to the remote CPU's before the migrated
thread can appear on the remote runqueue, so that it does not have to
re-acquire the former, removing the "hidden" lock-ordering dependency.


    [127 lines not shown]
DeltaFile
+44-9sys/kern/sched_ule.c
+44-91 files

HardenedBSD/src 2210a2f — sys/kern sched_ule.c

sched_ule: tdq_move(): INVARIANTS: Remove a superfluous assertion

That the lock of the stolen thread is the same as the source runqueue is
already checked by sched_rem().

MFC after:      3 days
Sponsored by:   The FreeBSD Foundation
DeltaFile
+0-1sys/kern/sched_ule.c
+0-11 files

HardenedBSD/src 3a1f5a2 — sys/sys proc.h

proc.h: Order thread_lock*() functions more logically

Also matches the implementation order in 'kern_mutex.c'.

No functional change.

MFC after:      3 days
Sponsored by:   The FreeBSD Foundation
DeltaFile
+1-1sys/sys/proc.h
+1-11 files

HardenedBSD/src 136e3a3 — sys/kern sched_ule.c

sched_ule: sched_rem(): Use THREAD_LOCKPTR_ASSERT() instead of MPASS()

This gives a better message.

While here, add some empty lines to make INVARIANTS-only statements
stand out for better readability.

No functional change.

MFC after:      3 days
Sponsored by:   The FreeBSD Foundation
DeltaFile
+4-1sys/kern/sched_ule.c
+4-11 files

HardenedBSD/src 00add43 — sys/kern sched_ule.c

sched_ule: tdq_add(): INVARIANTS: Add check, fix name in assertion strings

Change the assertion on the to-add thread's lock so that it also fails
if the thread's lock is not that of the 'tdq' (the checks that it is
lock-unblocked and locked remain).

It is tempting to add another check that the thread's 'ts_cpu'
corresponds to the passed runqueue (in other words, that it has been set
correctly), but that requires to add a call to thread_lock_block_wait()
which should not be present in non-debug code, and that may prevent some
races from happening on INVARIANTS, so I gave up on it.

Fix the function name in assertion strings, as sched_add() is not the
only (direct or indirect) caller of tdq_add().

MFC after:      3 days
Sponsored by:   The FreeBSD Foundation
DeltaFile
+4-4sys/kern/sched_ule.c
+4-41 files

HardenedBSD/src 2ba9deb — sys/kern sched_ule.c

sched_ule: Document fields of 'struct runq_steal_pred_data'

While here, re-order them to have inputs before outputs.

No functional change.

MFC after:      3 days
Sponsored by:   The FreeBSD Foundation
DeltaFile
+3-3sys/kern/sched_ule.c
+3-31 files

HardenedBSD/src 408a1ec — sys/geom geom_ctl.c, sys/sys priv.h

geom: Check file flags before handling control request

Pass fflag down to g_ctl_req() and:

* Refuse all requests unless fflag has the FREAD bit set

* Refuse all but getxml unless fflag also has the FWRITE bit set

This should allow us to restore read access to /dev/geom.ctl for group
operator; they will then be able to run `gpart list` or `gpart backup`
but not commands that actually modify the table.

For backward compatibility, we set the FWRITE bit if it is not already
set and the calling thread has the PRIV_GEOM privilege, which is
automatically granted to a jailed or unjailed superuser.  This should
cover the case of older binaries (which open /dev/geom.ctl read-only)
running as root on a newer kernel.  Since we intend to merge this to
stable/15, the compatibility code is conditional on COMPAT_FREEBSD14.


    [4 lines not shown]
DeltaFile
+38-8sys/geom/geom_ctl.c
+1-0sys/sys/priv.h
+39-82 files