HardenedBSD/src 4eee292sys/cam cam_periph.c cam_compat.c

Revert "cam: better ioctl compatibility for cd"

This reverts commit 028b16e2088a682c1abfb74fa5eb7ff64405ffff.

The wrong version wound up in my branch, revert while I find the right
version.

Sponsored by:           Netflix
DeltaFile
+1-21sys/cam/cam_periph.c
+0-6sys/cam/cam_compat.c
+1-272 files

HardenedBSD/src 5a0e903sys/conf files.x86

ipmi: Sort ipmi lines.

Sponsored by:           Netflix
DeltaFile
+5-5sys/conf/files.x86
+5-51 files

HardenedBSD/src 0632661sys/dev/ipmi ipmi_smbios.c, sys/dev/smbios smbios.h

smbios: Add length sanity checking

D28743 was commited, reverted and then f689cb23b2782 landed before it
was recommitted. However, D28743 included an extra length check. Redo
that functionality so we check both the number of entries as well as the
length checks for wacky data.

Sponsored by:           Netflix
Reviewed by:            gallatin
Differential Revision:  https://reviews.freebsd.org/D45763
DeltaFile
+5-3sys/dev/smbios/smbios.h
+2-2sys/dev/ipmi/ipmi_smbios.c
+7-52 files

HardenedBSD/src ce41beesys/dev/ipmi ipmi_smbios.c

ipmi_smbios: Only search for the BIOS signature on x86

Sponsored by:           Netflix
DeltaFile
+2-0sys/dev/ipmi/ipmi_smbios.c
+2-01 files

HardenedBSD/src 169d069sys/conf files.arm64, sys/modules/ipmi Makefile

smbios: Compile into the kernel more completely

Compile more of the IPMI into the kernel, and include all the
dependencies in ipmi.ko.

Sponsored by:           Netflix
Reviewed by:            andrew
Differential Revision:  https://reviews.freebsd.org/D45765
DeltaFile
+8-3sys/modules/ipmi/Makefile
+4-0sys/conf/files.arm64
+12-32 files

HardenedBSD/src 2e35684sys/arm64/conf std.arm64

arm64: Add smbios to kernel

Sponsored by:           Netflix
Reviewed by:            gallatin, andrew
Differential Revision:  https://reviews.freebsd.org/D45764
DeltaFile
+3-0sys/arm64/conf/std.arm64
+3-01 files

HardenedBSD/src 028b16esys/cam cam_periph.c cam_compat.c

cam: better ioctl compatibility for cd

Unlike xpt and pass driver, there's no test for ENOTTY in cdioctl to try
the compatbility ioctls. Add one.

However, this is a disk ioctl, not a cdev ioctl. To get around this, we
cast the struct disk * to a struct cdev * to pass through. We cast it
back in a simple wrapper function.

PR:                     198336
Sponsored by:           Netflix
MFC after:              2 weeks
Differential Revision:  https://reviews.freebsd.org/D42666
Differential Revision:  https://reviews.freebsd.org/D35312
DeltaFile
+21-1sys/cam/cam_periph.c
+6-0sys/cam/cam_compat.c
+27-12 files

HardenedBSD/src 0a59a6bshare/man/man9 style.9

style: Allow C++ comments

Attempt to craft the more-or-less conesnsus view on C++ BCPL-style
comments.  Allowing them seemed to have wide support. Consistent use was
highly desired. What constituted consistent use, however, didn't have
good consensus especially with multi-line comments. Craft something
that's a little vague to allow what appears to be a range in common
practices elsewhere and no good way to drive this do absolute agreement.

We should revisit this point in 6-12 months after we get some experience
with it.

Sponsored by:           Netflix
Discussed with:         many in the code reivew, see discussion there
Differential Revision:  https://reviews.freebsd.org/D35960
DeltaFile
+6-0share/man/man9/style.9
+6-01 files

HardenedBSD/src a05a680sys/dev/bhnd/cores/chipc chipc.c, sys/dev/nvdimm nvdimm_acpi.c nvdimm_e820.c

newbus: replace -1 in BUS_ADD_CHILD(...-1) with DEVICE_UNIT_ANY

Sponsored by:           Netflix
DeltaFile
+6-6sys/dev/bhnd/cores/chipc/chipc.c
+1-1sys/dev/nvdimm/nvdimm_acpi.c
+1-1sys/dev/nvdimm/nvdimm_e820.c
+1-1sys/dev/ppbus/if_plip.c
+1-1sys/dev/ppbus/lpbb.c
+1-1sys/dev/ppbus/lpt.c
+11-1138 files not shown
+49-4944 files

HardenedBSD/src 5b56413sys/dev/ahci ahci.c, sys/dev/nfsmb nfsmb.c

newbus: globally replace device_add_child(..., -1) with DEVICE_UNIT_ANY

Sponsored by:           Netflix
DeltaFile
+688-0sys/dev/xen/pcifront/pcifront.c
+8-8sys/dev/sound/pci/emu10kx.c
+3-3sys/powerpc/ps3/ps3bus.c
+3-3sys/dev/nfsmb/nfsmb.c
+3-3sys/dev/ahci/ahci.c
+3-3sys/dev/usb/misc/cp2112.c
+708-20175 files not shown
+894-206181 files

HardenedBSD/src 29d13f3share/man/man9 device_add_child.9

newbus: Document new DEVICE_UNIT_ANY

In the past, device_add_child took a -1 to mean any unit. Document it
now taking DEVICE_UNIT_ANY.

Sponsored by:           Netflix
DeltaFile
+2-2share/man/man9/device_add_child.9
+2-21 files

HardenedBSD/src 22ea1ecshare/man/man9 devclass.9 DEVICE_IDENTIFY.9, sys/kern subr_bus.c

newbus: introduce DEVICE_UNIT_ANY

Right now we pass a bare -1 for situations where any unit number will do.
Instead, introduce a DEVICE_UNIT_ANY to use instead of the bare constant.
Update documentation and examples where -1 is currently used, though
additional doc updates may be needed.

Sponsored by:           Netflix
DeltaFile
+20-20sys/kern/subr_bus.c
+4-3share/man/man9/devclass.9
+1-1share/man/man9/DEVICE_IDENTIFY.9
+1-0sys/sys/bus.h
+26-244 files

HardenedBSD/src 195a96fstand/i386/loader Makefile

stand: Stop building in fat, ext2fs, gzip and bzip to BIOS /boot/loader

This saves space to allow pxeboot to work again. Users desiring these
features can turn them on for their custom build. While these are useful
for some specialized applications, they aren't needed to boot the
typical system, and we're low on space.

          text    data     bss      dec       hex   filename
Before: 465866   20740   31612   518218   0x7e84a   loader_lua.bin
After:  441535   17484   31092   490111   0x77a7f   loader_lua.bin

Savings: 28,107 bytes

Sponsored by:           Netflix
Reviewed by:            kevans
Differential Revision:  https://reviews.freebsd.org/D42416
DeltaFile
+4-4stand/i386/loader/Makefile
+4-41 files

HardenedBSD/src 744991dtools/build/cross-build progname.c

cross-build: progname.c is used only on linux, so no ifdefs needed

The logic in the makefile ensures this is only present on Linux, so no
ifdef is needed. I overlooked comments to the effect in the original
pull request somehow.

Fixes:                  0e03402139da
Suggested by:           arichards, jrtc27
Sponsored by:           Netflix
Differential Revision:  https://reviews.freebsd.org/D45374
DeltaFile
+0-2tools/build/cross-build/progname.c
+0-21 files

HardenedBSD/src 4a0b795tools/build fcntl.h, tools/build/cross-build/include/linux fcntl.h

cross-build: Move fcntl.h workaround to Linux specific file

Move the cdefs.h inclusion to the Linux specific file. Either place will
work, but it makes more sense to do it in the Linux specific file since
it's a Linux specific workaround.

Fixes:                  4300e053618f
Suggested by:           arichards, jrtc27
Sponsored by:           Netflix
Differential Revision:  https://reviews.freebsd.org/D45373
DeltaFile
+7-0tools/build/cross-build/include/linux/fcntl.h
+0-7tools/build/fcntl.h
+7-72 files

HardenedBSD/src 18cf1e5tools/build/cross-build/include/linux/sys stat.h

cross-build: Define DEFFILEMODE and ALLPERMS if not defined

GLIBC defines these, but MUSL does not. FreeBSD's bootstrap code uses
these defines, so define them if they aren't yet defined.

Co-authored-by:         Val Packett <val at packett.cool>
Sponsored by:           Netflix
Pull Request:           https://github.com/freebsd/freebsd-src/pull/1066
Differential Revision:  https://reviews.freebsd.org/D45375
DeltaFile
+8-0tools/build/cross-build/include/linux/sys/stat.h
+8-01 files

HardenedBSD/src f68c4b4sys/dev/nvme nvme.h

nvme: Add bit names for nvme 2.0 for Async Events

NVME 2.0 has defined a number of new bits for async events. Add
defines for them.

Sponsored by:           Netflix
DeltaFile
+10-2sys/dev/nvme/nvme.h
+10-21 files

HardenedBSD/src e5d75cfcontrib/llvm-project/llvm/lib/CodeGen CalcSpillWeights.cpp

Merge branch 'freebsd/14-stable/main' into hardened/14-stable/master
DeltaFile
+6-1contrib/llvm-project/llvm/lib/CodeGen/CalcSpillWeights.cpp
+6-11 files

HardenedBSD/src dd88ec2contrib/llvm-project/llvm/lib/CodeGen CalcSpillWeights.cpp

Merge branch 'freebsd/13-stable/main' into hardened/13-stable/master
DeltaFile
+6-1contrib/llvm-project/llvm/lib/CodeGen/CalcSpillWeights.cpp
+6-11 files

HardenedBSD/src 82283casys/cddl/dev/dtrace/aarch64 dtrace_isa.c, sys/cddl/dev/dtrace/amd64 dtrace_isa.c

dtrace: Avoid including dtrace_isa.c directly into dtrace.c

This was done in the original DTrace import, presumably because that
made it a bit easier to handle includes.  However, this can cause
dtrace_getpcstack() to be inlined into dtrace_probe(), resulting in a
missing frame in stack traces since dtrace_getpcstack() takes care to
bump "aframes" to account for its own stack frame.

To avoid this, compile dtrace_isa.c separately on all platforms.  Add
requisite includes.

MFC after:      2 weeks
Sponsored by:   Innovate UK
DeltaFile
+3-0sys/cddl/dev/dtrace/aarch64/dtrace_isa.c
+2-1sys/cddl/dev/dtrace/amd64/dtrace_isa.c
+2-1sys/cddl/dev/dtrace/i386/dtrace_isa.c
+2-0sys/cddl/dev/dtrace/powerpc/dtrace_isa.c
+1-1sys/cddl/dev/fbt/x86/fbt_isa.c
+1-0sys/modules/dtrace/dtrace/Makefile
+11-35 files not shown
+15-411 files

HardenedBSD/src 1c30cf9sys/kern kern_malloc.c

malloc: Handle large malloc sizes in malloc_size()

Reviewed by:    kib, emaste
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D45661
DeltaFile
+1-1sys/kern/kern_malloc.c
+1-11 files

HardenedBSD/src f890020bin/pax tar.c cpio.c

pax: Clear arcn in each read function.

Instead of initializing individual fields to zero, clear the entire
struct prior to populating it.

MFC after:      1 week
Sponsored by:   Klara, Inc.
Reviewed by:    0mp, markj
Differential Revision:  https://reviews.freebsd.org/D46097
DeltaFile
+2-18bin/pax/tar.c
+3-9bin/pax/cpio.c
+5-272 files

HardenedBSD/src 647d4a8bin/ls print.c ls.1, bin/ls/tests ls_tests.sh

ls: Make -, apply to -s as well as -l.

While here, remove a bogus comment about a gcc bug.  The bug was in ls,
which used an incorrect format string, and in libc, which accepted it.

MFC after:      1 week
Reviewed by:    brooks
Differential Revision:  https://reviews.freebsd.org/D46067
DeltaFile
+16-0bin/ls/tests/ls_tests.sh
+6-8bin/ls/print.c
+3-1bin/ls/ls.1
+2-1bin/ls/ls.c
+27-104 files

HardenedBSD/src 096dfa3. ObsoleteFiles.inc, share/man/man9 vm_page_alloc.9 Makefile

vm: Retire vm_page_alloc_freelist{,_domain}()

Once upon a time, I created vm_page_alloc_freelist{,_domain}() to
support faster allocation of pages that were mapped by the partial
direct map on 32-bit MIPS.  At the time, I expected that these
functions might find other uses too, but those other uses never
materialized.  So, these functions have not been used for some time
now.  Instead, people use the more general vm_page_alloc_contig().

Reviewed by:    kib, markj
Differential Revision:  https://reviews.freebsd.org/D46063
DeltaFile
+6-45sys/vm/vm_page.c
+1-25share/man/man9/vm_page_alloc.9
+4-0ObsoleteFiles.inc
+0-2share/man/man9/Makefile
+0-2sys/vm/vm_page.h
+11-745 files

HardenedBSD/src cd836f6sys/arm/nvidia/drm2 tegra_bo.c, sys/kern subr_vmem.c

vm: Retire kmem_arena

It has simply been an alias for the kernel_arena for many years now.
Enough time has passed to retire it.  Any out-of-tree kernel modules
that directly use kmem_arena should switch to kernel_arena.

Reviewed by:    kib, markj
Differential Revision:  https://reviews.freebsd.org/D46057
DeltaFile
+2-2sys/arm/nvidia/drm2/tegra_bo.c
+0-2sys/kern/subr_vmem.c
+0-1sys/vm/vm_kern.h
+2-53 files

HardenedBSD/src 8d87e47contrib/llvm-project/llvm/lib/CodeGen CalcSpillWeights.cpp

Fix llvm register allocator for native/cross build differences

Work around an issue in LLVM's register allocator, which can cause
slightly different i386 object files, when produced by a native or cross
build of clang.

This adds another volatile qualifier to a float variable declaration in
the weightCalcHelper() function, which otherwise produces slightly
different float results on amd64 and i386 hosts. In turn, this can lead
to different (but equivalent) register choices, and thus non-identical
assembly code.

See https://github.com/llvm/llvm-project/issues/99396 for more details.

Note this is a temporary fix, meant to merge in time for 13.4. As soon
as upstream has a permanent solution we will import that.

PR:             276961
Reported by:    cperciva

    [3 lines not shown]
DeltaFile
+6-1contrib/llvm-project/llvm/lib/CodeGen/CalcSpillWeights.cpp
+6-11 files

HardenedBSD/src 2c75d99contrib/llvm-project/llvm/lib/CodeGen CalcSpillWeights.cpp

Fix llvm register allocator for native/cross build differences

Work around an issue in LLVM's register allocator, which can cause
slightly different i386 object files, when produced by a native or cross
build of clang.

This adds another volatile qualifier to a float variable declaration in
the weightCalcHelper() function, which otherwise produces slightly
different float results on amd64 and i386 hosts. In turn, this can lead
to different (but equivalent) register choices, and thus non-identical
assembly code.

See https://github.com/llvm/llvm-project/issues/99396 for more details.

Note this is a temporary fix, meant to merge in time for 13.4. As soon
as upstream has a permanent solution we will import that.

PR:             276961
Reported by:    cperciva

    [3 lines not shown]
DeltaFile
+6-1contrib/llvm-project/llvm/lib/CodeGen/CalcSpillWeights.cpp
+6-11 files

HardenedBSD/src 8880825usr.sbin/wpa/wpa_supplicant Makefile

wpa: Fix gcc build

Order of libraries still matters with GCC toolchains. Moving the
wpapasn library before the wpacommon specification resolves the link
problem.

This issue was not detected by make universe.

Fixes:          a90b9d015907
MFC after:      2 months
X-MFC with:     a90b9d015907
DeltaFile
+1-1usr.sbin/wpa/wpa_supplicant/Makefile
+1-11 files

HardenedBSD/src 124ae0eshare/man/man4 tarfs.4

tarfs: Fix typo.

MFC after:      3 days
PR:             280354
DeltaFile
+1-1share/man/man4/tarfs.4
+1-11 files

HardenedBSD/src c0df224sys/kern kern_malloc.c

kern_malloc: remove '.' and '\n' from KASSERT/panic

KASSERT and panic calls should not have a '.' at the end of the message
and do not need '\n'.  Remove these.

No functional changes.

Reported by:    markj (during review of D45812)
Sponsored by:   The FreeBSD Foundation
MFC after:      3 days
Reviewed by:    markj, kib
Differential Revision: https://reviews.freebsd.org/D46093
DeltaFile
+3-3sys/kern/kern_malloc.c
+3-31 files