HardenedBSD/src 43415c5sys/dev/dpaa qman.h sec_var.h, sys/kern sched_ule.c sched_4bsd.c

Merge remote-tracking branch 'rad/hardened/current/master' into hardened/current/cross-dso-cfi
DeltaFile
+2,291-0sys/dev/dpaa/sec_dev.c
+400-0sys/dev/dpaa/sec_jr.c
+162-0sys/dev/dpaa/sec_var.h
+46-33sys/kern/sched_4bsd.c
+46-25sys/kern/sched_ule.c
+26-1sys/dev/dpaa/qman.h
+2,971-5911 files not shown
+3,052-9317 files

HardenedBSD/src 13123a9sys/dev/dpaa qman.h sec_var.h, sys/kern sched_ule.c sched_4bsd.c

Merge remote-tracking branch 'rad/hardened/current/master' into hardened/current/pledge
DeltaFile
+2,291-0sys/dev/dpaa/sec_dev.c
+400-0sys/dev/dpaa/sec_jr.c
+162-0sys/dev/dpaa/sec_var.h
+46-33sys/kern/sched_4bsd.c
+46-25sys/kern/sched_ule.c
+26-1sys/dev/dpaa/qman.h
+2,971-5911 files not shown
+3,052-9317 files

HardenedBSD/src 958f5d0sys/kern kern_umtx.c

Merge remote-tracking branch 'rad/hardened/15-stable/main' into hardened/15-stable/pledge
DeltaFile
+12-8sys/kern/kern_umtx.c
+12-81 files

HardenedBSD/src c6ef161sys/dev/dpaa qman.h sec_var.h, sys/kern sched_ule.c sched_4bsd.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+2,291-0sys/dev/dpaa/sec_dev.c
+400-0sys/dev/dpaa/sec_jr.c
+162-0sys/dev/dpaa/sec_var.h
+46-33sys/kern/sched_4bsd.c
+46-25sys/kern/sched_ule.c
+26-1sys/dev/dpaa/qman.h
+2,971-5911 files not shown
+3,052-9317 files

HardenedBSD/src 8efcef6sys/kern kern_umtx.c

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+12-8sys/kern/kern_umtx.c
+12-81 files

HardenedBSD/src 1181ac7sys/dev/vt vt_core.c

vt: Reprogram display controller on KDSETMODE KD_TEXT for active window

When a graphical application (X.Org display server, Wayland compositor)
calls KDSETMODE to set the active VT back to KD_TEXT, vt(4) does not
reset the CRTC to point to its framebuffer, leaving the last image of
the graphical application visible instead of the text console until the
next VT switch.

Add a call to vd_postswitch to reset the CRTC, set VDF_INVALID to force
a redraw and schedule the flush timer, like vt(4) does in
vt_window_switch().

Sponsored by: Defenso

Signed-off-by: Quentin Thébault <quentin.thebault at defenso.fr>

Reviewed by:    vexeduxr
Pull request: https://github.com/freebsd/freebsd-src/pull/2308
DeltaFile
+23-1sys/dev/vt/vt_core.c
+23-11 files

HardenedBSD/src b774fbdlib/libc/tests/db db_hash_tamper_test.c

libc/db: Correct a typo in the the hash tampering test

Fixes the gcc build.

Fixes:  7f5f07b139a5
DeltaFile
+1-1lib/libc/tests/db/db_hash_tamper_test.c
+1-11 files

HardenedBSD/src 962125asys/kern sched_ule.c sched_4bsd.c, sys/sys sched.h

sched: rename sched_schedcpu() to sched_sysinit()

sched_schedcpu() is called only during SYSINIT to start kthread that
calls schedcpu() every second in 4BSD, but its name implies it's doing
what 4BSD's schedcpu() does. Rename this function to sched_sysinit() to
mark that schedulers can use it for its own SYSINIT routine. Note that
their SYSINIT routine does not necessarily need to be similar to 4BSD's
decay in schedcpu().

The scheduler.9 man page is planned to be rewritten from scratch, so no
change to it for now.

Reviewed by:    olce
Approved by:    olce (mentor)
MFC after:      2 weeks
Sponsored by:   FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D59437
DeltaFile
+3-3sys/kern/sched_shim.c
+2-2sys/kern/sched_ule.c
+2-2sys/kern/sched_4bsd.c
+2-1sys/sys/sched.h
+9-84 files

HardenedBSD/src 872074csys/kern sched_ule.c

sched_ule: fix comment on ts_slice

In ULE ts_slice stores the number of ticks of slice passed not
remaining.

Reviewed by:    olce
Approved by:    olce (mentor)
MFC after:      2 weeks
Sponsored by:   FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D59407
DeltaFile
+1-1sys/kern/sched_ule.c
+1-11 files

HardenedBSD/src 477d2easys/kern sched_ule.c

sched_ule: fix invalid tdq_slice() and sched_slice_min

sched_slice_min should always to be greater than zero. When modifying
sched_slice through sysctl, if the new value is less than
SCHED_SLICE_MIN_DIVISOR, sched_slice_min is computed to zero. Add
imax(1, ...) to prevent this.

tdq_slice() should not return a value less than sched_slice_min since
that will cause integer underflow of ts2->ts_slice in
sched_ule_fork_thread. SCHED_SLICE_MIN_DIVISOR is currently set to 6 so
when load is 5 and sched_slice is 4, the two if conditions in
tdq_slice() will pass and the function will return zero. Thus use imax()
so tdq_slice returns sched_slice_min at minimum.

Reviewed by:    olce
Approved by:    olce (mentor)
MFC after:      2 weeks
Sponsored by:   FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D59408
DeltaFile
+2-4sys/kern/sched_ule.c
+2-41 files

HardenedBSD/src 5803063sys/kern sched_ule.c

sched_ule: fix typo in comment

Reviewed by:    olce
Approved by:    olce (mentor)
MFC after:      2 weeks
Sponsored by:   FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D59409
DeltaFile
+1-1sys/kern/sched_ule.c
+1-11 files

HardenedBSD/src cd33abbsys/kern sched_4bsd.c

sched_4bsd: fix vague comment

The comment "was incremented in schedcpu()" doesn't give enough
background for decrementing ts_slptime by 1 (thus ignoring decay_cpu()
for 1 ts_slptime). More accurately, ts_slptime is decremented by 1
because decay_cpu() has already executed once in schedcpu() when
ts_slptime was 1.

Reviewed by:    olce
Approved by:    olce (mentor)
MFC after:      2 weeks
Sponsored by:   FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D59406
DeltaFile
+2-1sys/kern/sched_4bsd.c
+2-11 files

HardenedBSD/src 5a87939sys/kern sched_4bsd.c sched_ule.c

sched: factor out hogticks calculation into sched_update_hogticks()

Suggested by:   olce
Reviewed by:    olce
Approved by:    olce (mentor)
MFC after:      2 weeks
Sponsored by:   FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D59471
DeltaFile
+11-6sys/kern/sched_ule.c
+10-6sys/kern/sched_4bsd.c
+21-122 files

HardenedBSD/src f609ca7sys/kern sched_ule.c

sched_ule: fix typo goup to group

Reviewed by:    olce
Approved by:    olce (mentor)
MFC after:      2 weeks
Sponsored by:   FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D59400
DeltaFile
+10-10sys/kern/sched_ule.c
+10-101 files

HardenedBSD/src 351f673sys/kern sched_4bsd.c

sched_4bsd: fix comment in maybe_preempt()

The comment says the new thread's priority is not a realtime priority
while the code states pri > PRI_MAX_ITHD which is interrupt priorities
not realtime.

Reviewed by:    olce
Approved by:    olce (mentor)
MFC after:      2 weeks
Sponsored by:   FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D59402
DeltaFile
+1-1sys/kern/sched_4bsd.c
+1-11 files

HardenedBSD/src 179f5b2sys/kern sched_4bsd.c sched_ule.c

sched: fix kern.sched.{4bsd,ule}.slice

Fix three problems with kern.sched.{4bsd,ule}.slice:

 * Guarantee minimum slice is 1.
 * Recalculate hogticks on sysctl write.
 * For ULE, recalculate sched_slice_min on sysctl write.

Reviewed by:    olce
Approved by:    olce (mentor)
MFC after:      2 weeks
Sponsored by:   FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D59401
DeltaFile
+21-1sys/kern/sched_ule.c
+20-1sys/kern/sched_4bsd.c
+41-22 files

HardenedBSD/src 039498csys/kern sched_4bsd.c

sched_4bsd: move comment to correct location

Reviewed by:    olce
Approved by:    olce (mentor)
MFC after:      2 weeks
Sponsored by:   FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D59403
DeltaFile
+6-5sys/kern/sched_4bsd.c
+6-51 files

HardenedBSD/src 6c0c77esys/kern sched_4bsd.c

sched_4bsd: remove obsolete comment

'awake' checks if a thread, not a process, is awake.

Reviewed by:    olce
Approved by:    olce (mentor)
MFC after:      2 weeks
Sponsored by:   FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D59404
DeltaFile
+1-5sys/kern/sched_4bsd.c
+1-51 files

HardenedBSD/src 46416a5sys/kern sched_4bsd.c

sched_4bsd: remove obsolete comment

In old Unix, the whole process address space including scheduler-related
data was paged out to disk. We now allocate thread-related data with UMA
on wired memory which never page out. Thus this comment is now obsolete.

Reviewed by:    olce
Approved by:    olce (mentor)
MFC after:      2 weeks
Sponsored by:   FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D59398
DeltaFile
+0-5sys/kern/sched_4bsd.c
+0-51 files

HardenedBSD/src 5d67118sys/kern sched_4bsd.c

sched_4bsd: update function name in comment

In b43179fbe815 ("Create a new scheduler api..."), schedclock() was
renamed to sched_clock() but the function name in the comment remained
still. Update the comment to reflect up-to-date name for schedclock().

Reviewed by:    olce
Approved by:    olce (mentor)
Fixes: b43179fbe815 ("Create a new scheduler api...")
MFC after:      2 weeks
Sponsored by:   FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D59397
DeltaFile
+1-1sys/kern/sched_4bsd.c
+1-11 files

HardenedBSD/src 7997d2asys/kern sched_ule.c

sched_ule: remove unused KTR_ULE

Commit 62fa74d95a16 ("Add support for the new cpu...") removed all uses
of KTR_ULE, leaving the macro unused.

Reviewed by:    olce
Approved by:    olce (mentor)
Fixes:          62fa74d95a16 ("Add support for the new cpu...")
MFC after:      2 weeks
Sponsored by:   FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D59399
DeltaFile
+0-2sys/kern/sched_ule.c
+0-21 files

HardenedBSD/src e90be6fsys/kern sched_4bsd.c

sched_4bsd: add static assertion for nice weight

When NICE_WEIGHT * (PRIO_MAX - PRIO_MIN) exceeds the timeshare range,
two CPU-bound threads with different nice values can have the same
priority as their nice values are clamped to the timeshare range limit.
Add static assertion on NICE_WEIGHT to ensure that there is always
enough room for nice values in the both end of the timeshare priority
range.

Reviewed by:    olce
Approved by:    olce (mentor)
MFC after:      2 weeks
Sponsored by:   FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D59396
DeltaFile
+4-0sys/kern/sched_4bsd.c
+4-01 files

HardenedBSD/src 1dfefffsys/kern sched_4bsd.c

sched_4bsd: remove dumping from maybe_preempt()

'dumping' is true only when kernel is dumping after crash (see
minidumpsys()) so KERNEL_PANICKED() will catch this.

Reviewed by:    olce
Approved by:    olce (mentor)
MFC after:      2 weeks
Sponsored by:   FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D59395
DeltaFile
+1-2sys/kern/sched_4bsd.c
+1-21 files

HardenedBSD/src d29c9f5sys/kern sched_4bsd.c

sched_4bsd: remove kern.sched.4bsd.followon

kern.sched.4bsd.followon was enabled only for KSE. It was never compiled
since ad1e7d285ab1 and KSE was removed years ago. Now it's time to
remove this tunable.

Reviewed by:    olce
Approved by:    olce (mentor)
MFC after:      2 weeks
Sponsored by:   FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D59394
DeltaFile
+0-6sys/kern/sched_4bsd.c
+0-61 files

HardenedBSD/src 72ed4d0sys/kern kern_umtx.c

umtx: do not sleep on an unowned mutex after a spurious CAS failure

On ll/sc architectures casueword32() may report a spurious
store-conditional failure (reservation lost to an interrupt, preemption,
or another CPU touching the same reservation granule), and this is
indistinguishable from a genuine comparison mismatch: both return 1.
That is intentional since D20772 and documented in casueword(9) ("The
store can fail on load-linked/store-conditional architectures."), so
callers must cope.

do_lock_normal() does not fully cope.  When the initial
UMUTEX_UNOWNED -> id acquire CAS fails spuriously, the observed owner is
still UMUTEX_UNOWNED, so neither the UMUTEX_CONTESTED branch nor the
real-owner case applies, and execution falls through past the "rv == 1
but not contested, likely store failure" comment into the sleep path.
There, the contested-bit CAS (expecting the observed owner, i.e.
UMUTEX_UNOWNED) succeeds because the mutex really is unowned, stamping
m_owner = UMUTEX_CONTESTED with no owner tid, and the thread sleeps on
"umtxn" forever: nobody owns the mutex, so no unlock and no wakeup ever

    [30 lines not shown]
DeltaFile
+12-8sys/kern/kern_umtx.c
+12-81 files

HardenedBSD/src 8aab12csys/dev/amdsmu amdsmu.c amdsmu.h

amdsmu: Fix CPU-model-specific matching

For Krackan Point, CPU-model-specific matching would not work because
amdsmu_match() browses amdsmu_products[] in order and returns the first
match, and the Krackan Point's 'struct amdsmu_product' object variant
with a 'model' field of 0, indicating that any model matches, is listed
before the variant with model 0x70 in amdsmu_products[].

In practice, this means that reporting of IP blocks for Krackan Point
model 0x70 only was broken.  Specifically, not all the existing blocks
were reported and most statistics were not attributed to the right
blocks.

Fix this by making amdsmu_match() parse amdsmu_products[] in reverse, so
CPU-model-generic entries can continue to appear first and new specific
ones can be added after them, which is the expected chronological order
of additions.

While here, since the CPU model is between 0 and 255, change the type

    [11 lines not shown]
DeltaFile
+16-11sys/dev/amdsmu/amdsmu.h
+8-12sys/dev/amdsmu/amdsmu.c
+24-232 files

HardenedBSD/src 73bb247sys/conf files.powerpc, sys/dev/dpaa dpaa_common.h sec_var.h

dpaa: Add QorIQ Security Engine (SEC) driver

The QorIQ Security Engine (SEC) generally fits into the Data Path
Acceleration Architecture, accelerating cryptographic operations.

Currently this driver does not use the QMan interface, instead relying
on the job rings, as Linux also does, to reduce complexity until needed
for network protocol acceleration, like IPSec and OpenVPN.

Initial testing via `openssl speed -engine devcrpto -evp aes-128-cbc`
yields a ~200x throughput improvement, from 105MB/s to more than 20GB/s
for 16k block sizes.

Differential Revision:  https://reviews.freebsd.org/D59581
DeltaFile
+2,291-0sys/dev/dpaa/sec_dev.c
+400-0sys/dev/dpaa/sec_jr.c
+162-0sys/dev/dpaa/sec_var.h
+3-1sys/conf/files.powerpc
+4-0sys/dev/dpaa/dpaa_common.h
+2,860-15 files

HardenedBSD/src e6454ecsys/powerpc/conf QORIQ64

powerpc/conf: Add some crypto options to QORIQ64

With the DPAA Security Engine (SEC) KERN_TLS should provide some
enhancement over userland software TLS.  Also, add IPSEC_SUPPORT, so
that ipsec can be loaded if needed.
DeltaFile
+2-0sys/powerpc/conf/QORIQ64
+2-01 files

HardenedBSD/src 823466bsys/dev/dpaa dpaa_eth.c qman.c

dpaa: Add ContextA and ContextB to qman_fq_create

The SEC QMan interface stores context in context_a and context_b, so add
them to the frame queue creation.
DeltaFile
+26-1sys/dev/dpaa/qman.h
+16-1sys/dev/dpaa/qman.c
+3-3sys/dev/dpaa/dpaa_eth.c
+45-53 files

HardenedBSD/src 3266825lib/libc/db/hash hash.c, lib/libc/tests/db db_hash_tamper_test.c

Merge remote-tracking branch 'rad/hardened/current/master' into hardened/current/cross-dso-cfi
DeltaFile
+227-0lib/libc/tests/db/db_hash_tamper_test.c
+128-22sys/net/route/fib_algo.c
+71-0sys/dev/amdsmu/amdsmu.c
+35-12lib/libc/db/hash/hash.c
+27-7sys/dev/hyperv/netvsc/if_hn.c
+30-0sys/compat/linuxkpi/common/src/linux_page.c
+518-4118 files not shown
+670-7124 files