HardenedBSD/src efc1cfacontrib/capsicum-test linux.cc capability-fd.cc, tests/sys/capsicum linux.cc capability-fd.cc

Merge remote-tracking branch 'origin/hardened/current/master' into hardened/current/cross-dso-cfi
DeltaFile
+0-1,500contrib/capsicum-test/linux.cc
+1,500-0tests/sys/capsicum/linux.cc
+0-1,359contrib/capsicum-test/capability-fd.cc
+1,359-0tests/sys/capsicum/capability-fd.cc
+1,097-0tests/sys/capsicum/procdesc.cc
+0-1,097contrib/capsicum-test/procdesc.cc
+3,956-3,956134 files not shown
+11,872-10,021140 files

HardenedBSD/src fdcd67bsys/kern subr_firmware.c

firmware: Fix inverted FIRMWARE_GET_NOWARN logic

The try_binary_file() function has inverted logic for the
FIRMWARE_GET_NOWARN flag.  When the flag is set (meaning "don't warn"),
the code sets warn=true and makes noise anyway.

Invert the assignment to warn to correctly suppress warnings when
FIRMWARE_GET_NOWARN is set.

Reviewed by:    kevans
Differential Revision:  https://reviews.freebsd.org/D54955
DeltaFile
+1-1sys/kern/subr_firmware.c
+1-11 files

HardenedBSD/src b249cb2sys/kern sched_4bsd.c kern_synch.c, sys/sys sched.h proc.h

SCHED_4BSD: maybe_resched() cannot schedule ast() for curthread

maybe_resched() needs to schedule TDA_SCHED for curthread, but this
requires taking curthread lock while owning some other thread lock.
To avoid introducing the order:
- Use a scheduler-private TDP flag.
- Register an unconditional TDA_SCHED_PRIV for 4BSD.
When an AST needs to be scheduled, i.e. the current thread must do
context switch in the return to userspace path, set the flag.
Then the ast handler calls ast_scheduler(), which gives the same
effect as scheduling TDA_AST.

The overhead is a single function call on each userspace return, for
4BSD case.

Reported and tested by: pho (previous version)
Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D54945
DeltaFile
+19-2sys/kern/sched_4bsd.c
+2-0sys/sys/sched.h
+1-1sys/kern/kern_synch.c
+1-0sys/sys/proc.h
+23-34 files

HardenedBSD/src 0730a05share/man/man7 tuning.7

tuning.7: document schedulers knobs

Reviewed by:    emaste, olce, ziaee
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D54951
DeltaFile
+26-0share/man/man7/tuning.7
+26-01 files

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

HBSD: Resolve final merge conflict

Regen src.conf.5.

Signed-off-by:  Shawn Webb <shawn.webb at hardenedbsd.org>
DeltaFile
+0-12share/man/man5/src.conf.5
+0-121 files

HardenedBSD/src c0143barelease/tools azure.conf vagrant.conf

HBSD: Resolve merge conflicts for release configs

Signed-off-by:  Shawn Webb <shawn.webb at hardenedbsd.org>
DeltaFile
+0-13release/tools/azure.conf
+0-10release/tools/vagrant.conf
+0-8release/tools/ec2.conf
+0-313 files

HardenedBSD/src a8dc88fsys/netinet6 in6_pcb.c

HBSD: Resolve merge conflict for sys/netinet6/in6_pcb.c

FreeBSD now defaults this same sysctl node as we do. Let's apply a diff
reduction and take their change.

Signed-off-by:  Shawn Webb <shawn.webb at hardenedbsd.org>
DeltaFile
+0-8sys/netinet6/in6_pcb.c
+0-81 files

HardenedBSD/src 07e8b87bin/sh sh.1, release/tools vmimage.subr

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

Conflicts:
        release/tools/azure.conf (unresolved)
        release/tools/ec2.conf (unresolved)
        release/tools/vagrant.conf (unresolved)
        share/man/man5/src.conf.5 (unresolved)
        sys/netinet6/in6_pcb.c (unresolved)
DeltaFile
+252-157sys/kern/sched_ule.c
+195-181sys/kern/sched_4bsd.c
+234-0sys/kern/sched_shim.c
+83-113release/tools/vmimage.subr
+182-9bin/sh/sh.1
+101-7sys/sys/sched.h
+1,047-46734 files not shown
+1,201-62140 files

HardenedBSD/src 4b32fdbsys/compat/lindebugfs lindebugfs.c

lindebugfs: check that name is set as otherwise pfs_alloc_node_flags() panics

I have hit the case multiple times that some LinuxKPI field may not be
set during driver bringup and lindebugfs would cause a panic.
The backtrace goes like:

  strlen() at strlen+0x54
  pfs_create_dir() at pfs_create_dir+0x41
  debugfs_create_dir() at debugfs_create_dir+0xa1
  ...

While the problem is clearly in LinuxKPI or the driver, we likely
should at least add an assert to pfs_create_dir() if name is NULL
like we have for pfs_add_node() but for lindebugfs at least make
this a graceful error and continue without creating the dir instead
of panicing.

Sponsored by:   The FreeBSD Foundation
MFC after:      3 days

    [2 lines not shown]
DeltaFile
+3-0sys/compat/lindebugfs/lindebugfs.c
+3-01 files

HardenedBSD/src 9b2bc93sys/compat/freebsd32 freebsd32_misc.c, sys/sys ucred.h

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+8-4sys/compat/freebsd32/freebsd32_misc.c
+0-2sys/sys/ucred.h
+8-62 files

HardenedBSD/src e0c83ceshare/mk src.opts.mk

HBSD: Resolve merge conflict

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

HardenedBSD/src 3c86fddcontrib/capsicum-test linux.cc capability-fd.cc, tests/sys/capsicum linux.cc capability-fd.cc

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

Conflicts:
        share/mk/src.opts.mk (unresolved)
DeltaFile
+0-1,500contrib/capsicum-test/linux.cc
+1,500-0tests/sys/capsicum/linux.cc
+1,359-0tests/sys/capsicum/capability-fd.cc
+0-1,359contrib/capsicum-test/capability-fd.cc
+1,097-0tests/sys/capsicum/procdesc.cc
+0-1,097contrib/capsicum-test/procdesc.cc
+3,956-3,956134 files not shown
+11,875-10,015140 files

HardenedBSD/src ff870b7sys/kern sched_4bsd.c sched_shim.c

sched_shim: restore kern.ccpu sysctl

It is apparently should be considered part of the ABI, and is used by
the base top(1).  But do not declare the ccpu variable in headers, it is
needed only by 4bsd. So put the variable definition into sched_shim.c to
make the kernel buildable without SCHED_4BSD.

Reviewed by:    olce
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D54831
DeltaFile
+6-4sys/kern/sched_4bsd.c
+4-0sys/kern/sched_shim.c
+10-42 files

HardenedBSD/src 377c053sys/amd64/amd64 cpu_switch.S, sys/arm/arm swtch-v6.S

cpu_switch(): unconditionally wait on the blocked mutex transient

It is nop for 4BSD.

Reviewed by:    olce
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D54831
DeltaFile
+13-18sys/i386/i386/swtch.S
+1-6sys/arm/arm/swtch-v6.S
+0-5sys/amd64/amd64/cpu_switch.S
+1-2sys/arm64/arm64/swtch.S
+1-2sys/powerpc/powerpc/swtch32.S
+1-2sys/powerpc/powerpc/swtch64.S
+17-351 files not shown
+18-377 files

HardenedBSD/src b602ba1sys/kern sched_ule.c sched_4bsd.c, sys/net iflib.c

net/iflib.c: move out scheduler-depended code into the hook

Add sched_find_l2_neighbor().  This really should be not
scheduler-depended, in does not have anything to do with scheduler at
all.  But for now keep the same code structure.

Reviewed by:    olce
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D54831
DeltaFile
+3-79sys/net/iflib.c
+68-0sys/kern/sched_ule.c
+8-0sys/sys/sched.h
+7-0sys/kern/sched_4bsd.c
+1-0sys/kern/sched_shim.c
+87-795 files

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

x86/local_apic.c: remove direct SCHED_ULE use

Move the code to decide on the timer accounting into the scheduler hook.
Since there were no inclusion of opt_sched.h, it is probably done
unconditionally anyway.

Reviewed by:    olce
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D54831
DeltaFile
+22-0sys/kern/sched_4bsd.c
+1-14sys/x86/x86/local_apic.c
+7-0sys/kern/sched_ule.c
+3-0sys/sys/sched.h
+1-0sys/kern/sched_shim.c
+34-145 files

HardenedBSD/src 783b8a0sys/kern sched_4bsd.c sched_shim.c, sys/sys sched.h

kern/sched: deduplicate dtrace hook vars

Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D54831
DeltaFile
+0-6sys/kern/sched_4bsd.c
+6-0sys/kern/sched_shim.c
+0-6sys/kern/sched_ule.c
+6-0sys/sys/sched.h
+12-124 files

HardenedBSD/src 9409e86sys/kern sched_4bsd.c sched_shim.c, sys/sys sched.h

kern/sched: deduplicate sdt probes

Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D54831
DeltaFile
+0-18sys/kern/sched_4bsd.c
+18-0sys/kern/sched_shim.c
+0-18sys/kern/sched_ule.c
+11-0sys/sys/sched.h
+29-364 files

HardenedBSD/src 1322760sys/amd64/conf GENERIC, sys/conf NOTES

sys: enable both SCHED_ULE and SCHED_4BSD for some configs

Globally enable both schedulers for LINT.
Enable both schedulers for GENERIC on amd64.

Reviewed by:    olce
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D54831
DeltaFile
+1-1sys/conf/NOTES
+1-0sys/amd64/conf/GENERIC
+2-12 files

HardenedBSD/src 5a6e0e3sys/kern sched_ule.c

sysctl kern.sched.ule.topology_spec: allow to run if ULE is not initialized

Reviewed by:    olce
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D54831
DeltaFile
+2-1sys/kern/sched_ule.c
+2-11 files

HardenedBSD/src 1c4e16fsys/x86/x86 cpu_machdep.c

x86/cpu_machdep.c: unconditionally fence

For !SCHED_ULE, even if the fence is not needed, it is harmless.

Reviewed by:    olce
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D54831
DeltaFile
+0-3sys/x86/x86/cpu_machdep.c
+0-31 files

HardenedBSD/src a84a39dsys/kern sched_shim.c sched_4bsd.c, sys/sys sched.h

kern/sched: move duplicate preemption stat vars into sched_shim.c

Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D54831
DeltaFile
+5-0sys/kern/sched_shim.c
+0-4sys/kern/sched_4bsd.c
+0-4sys/kern/sched_ule.c
+3-0sys/sys/sched.h
+8-84 files

HardenedBSD/src eb45493sys/kern sched_ule.c

sys: Move ULE sysctls under kern.sched.ule

Reviewed by:    olce
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D54831
DeltaFile
+32-28sys/kern/sched_ule.c
+32-281 files

HardenedBSD/src ba8f429sys/kern sched_shim.c

kern/sched_shim.c: Add sysctl kern.sched.available

Reports all compiled-in schedulers.

Reviewed by:    olce
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D54831
DeltaFile
+31-0sys/kern/sched_shim.c
+31-01 files

HardenedBSD/src 7efbfd6sys/kern sched_shim.c, sys/sys sched.h

kern/sched_shim.c: provide required SYSINIT hooks

Reviewed by:    olce
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D54831
DeltaFile
+25-0sys/kern/sched_shim.c
+3-0sys/sys/sched.h
+28-02 files

HardenedBSD/src bab24f2sys/amd64/amd64 machdep.c, sys/arm/arm machdep.c

kern/sched_shim.c: Provide a scheduler selection machinery

Reviewed by:    olce
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D54831
DeltaFile
+49-0sys/kern/sched_shim.c
+14-0sys/sys/sched.h
+3-0sys/arm/arm/machdep.c
+2-0sys/amd64/amd64/machdep.c
+2-0sys/powerpc/powerpc/machdep.c
+2-0sys/riscv/riscv/machdep.c
+72-02 files not shown
+74-08 files

HardenedBSD/src a556ec4sys/kern sched_ule.c sched_4bsd.c

kern/sched_{ule,4bsd}.c: cleanup headers

Reviewed by:    olce
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D54831
DeltaFile
+0-2sys/kern/sched_ule.c
+0-2sys/kern/sched_4bsd.c
+0-42 files

HardenedBSD/src 8aa8289sys/kern sched_4bsd.c

sys: Move 4BSD sysctls under kern.sched.4bsd

Reviewed by:    olce
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D54831
DeltaFile
+17-13sys/kern/sched_4bsd.c
+17-131 files

HardenedBSD/src b125c4dsys/kern sched_4bsd.c

sys: Make sched_4bsd a sched instance

Reviewed by:    olce
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D54831
DeltaFile
+144-101sys/kern/sched_4bsd.c
+144-1011 files

HardenedBSD/src 0b474a4sys/sys sched.h

sys/sched.h: add SCHED_STAT_DECLARE()

Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D54831
DeltaFile
+5-0sys/sys/sched.h
+5-01 files