FreeBSD/src 7982985sys/security/mac mac_policy.h

kern: mac: bump the MAC_VERSION for 16.x

Reviewed by:    bapt
Differential Revision:  https://reviews.freebsd.org/D55703
DeltaFile
+2-1sys/security/mac/mac_policy.h
+2-11 files

FreeBSD/src 28b0084sys/security/mac mac_framework.c mac_policy.h

kern: mac: sprinkle a bit of const correctness

mpc_name and mpc_fullname are string literals in correct usage, so they
should really be const instead.

mpc_ops aren't typically const, but the framework shouldn't be doing
anything to clobber it; thus, good to constify it as a reminder.

Switch to using a slightly more semantically correct `void **` in the
fastpath bits while we're here, since we only do arithmetic on the outer
layer of pointer and compare the inner to a pointer-typed (NULL).

Reviewed by:    bapt
Differential Revision:  https://reviews.freebsd.org/D55702
DeltaFile
+5-5sys/security/mac/mac_framework.c
+3-3sys/security/mac/mac_policy.h
+8-82 files

FreeBSD/src 0faa88fsys/kern vfs_mount.c, sys/security/mac mac_vfs.c mac_policy.h

kern: vfs: add MAC checks for mount/unmount/update

The unmount check is straightforward and only really needs the
struct mount and flags used, in case a MAC policy wants to reject
force-unmounts or do special handling for FSID-based unmounts.

The mount check offers as much information as I think might be of
interest to a MAC policy: the vnode to be mounted on, vfsconf, and
applicable mount options.   XNU also has a later version that just takes
a struct mount for everything that VFS_MOUNT() has to offer, but my
draft policy doesn't need any of that.  It also doesn't really need the
unmount check, but it seems reasonable to add it while I'm here.

The update check similarly passes the flags/options for the operation,
along with the struct mount and label.

Reviewed by:    kib, olce
Differential Revision:  https://reviews.freebsd.org/D55601
DeltaFile
+50-0sys/security/mac/mac_vfs.c
+37-0sys/security/mac_test/mac_test.c
+28-0sys/security/mac_stub/mac_stub.c
+24-1sys/kern/vfs_mount.c
+12-0sys/security/mac/mac_policy.h
+7-0sys/security/mac/mac_framework.h
+158-16 files

FreeBSD/src 2ddefc8libexec/rtld-elf rtld.c

rtld: fix processing of preloaded z_initfirst objects

(cherry picked from commit 9b844b495e8e63439ffe523757ac7444a16317af)
DeltaFile
+5-0libexec/rtld-elf/rtld.c
+5-01 files

FreeBSD/src f3ca689usr.bin/kdump kdump.c Makefile

kdump: tweaks for the extended errors decoding

(cherry picked from commit 5c89d661a023c83a2001cf5b354b09c7d3ac91d8)
DeltaFile
+20-3usr.bin/kdump/kdump.c
+1-0usr.bin/kdump/Makefile
+21-32 files

FreeBSD/src 75ae51busr.bin/kdump kdump.c

kdump(1): add sys/ prefix for exterror source file name

(cherry picked from commit 4d062dbc20dce5a94da8dca1253ac9337b951c51)
DeltaFile
+1-1usr.bin/kdump/kdump.c
+1-11 files

FreeBSD/src 0b6f465libexec/rtld-elf rtld.c

rtld: fix processing of preloaded z_initfirst objects

(cherry picked from commit 9b844b495e8e63439ffe523757ac7444a16317af)
DeltaFile
+5-0libexec/rtld-elf/rtld.c
+5-01 files

FreeBSD/src 68d2339sys/sys param.h

Bump __FreeBSD_version for changing various kernel APIs to use pointers

Effort:         CHERI upstreaming
Sponsored by:   AFRL, DARPA
DeltaFile
+1-1sys/sys/param.h
+1-11 files

FreeBSD/src 9a6e9d7sys/amd64/amd64 pmap.c, sys/arm64/arm64 pmap.c

VM_PAGE_TO_DMAP: Wrapper macro to return direct map address for a page

Effort:         CHERI upstreaming
Reviewed by:    kib
Sponsored by:   AFRL, DARPA
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2068
DeltaFile
+18-24sys/powerpc/aim/mmu_radix.c
+20-21sys/amd64/amd64/pmap.c
+12-12sys/arm64/arm64/pmap.c
+5-17sys/powerpc/aim/mmu_oea64.c
+10-12sys/riscv/riscv/pmap.c
+10-12sys/opencrypto/criov.c
+75-9816 files not shown
+105-13922 files

FreeBSD/src 496453esys/amd64/amd64 pmap.c, sys/arm64/arm64 pmap.c

amd64/aarch64 pmap: Switch type of pmap_preinit_mapping.va to void *

Effort:         CHERI upstreaming
Reviewed by:    kib
Sponsored by:   AFRL, DARPA
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2068
DeltaFile
+17-15sys/amd64/amd64/pmap.c
+13-11sys/arm64/arm64/pmap.c
+30-262 files

FreeBSD/src 120a5e3sys/amd64/amd64 pmap.c, sys/arm64/arm64 pmap.c

DMAP_TO_VM_PAGE: Wrapper macro to map direct map address to a page

Effort:         CHERI upstreaming
Suggested by:   kib
Reviewed by:    kib
Sponsored by:   AFRL, DARPA
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2068
DeltaFile
+15-15sys/amd64/amd64/pmap.c
+5-5sys/powerpc/booke/pmap_64.c
+3-3sys/powerpc/aim/mmu_radix.c
+2-2sys/riscv/riscv/pmap.c
+2-2sys/arm64/arm64/pmap.c
+2-0sys/vm/vm_page.h
+29-273 files not shown
+32-309 files

FreeBSD/src bee1aaesys/contrib/ncsw/user/env xx.c

ncsw: Allow pmap_kextract to handle direct map addresses

Effort:         CHERI upstreaming
Reviewed by:    kib
Sponsored by:   AFRL, DARPA
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2068
DeltaFile
+1-5sys/contrib/ncsw/user/env/xx.c
+1-51 files

FreeBSD/src 30af462sys/i386/linux linux_machdep.c, sys/kern kern_exec.c

kmap_alloc_wait/kmap_free_wakeup: Use void * instead of vm_offset_t

Effort:         CHERI upstreaming
Reviewed by:    kib
Sponsored by:   AFRL, DARPA
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2068
DeltaFile
+6-8sys/kern/kern_exec.c
+6-4sys/vm/vm_kern.c
+2-2sys/vm/vm_extern.h
+1-1sys/i386/linux/linux_machdep.c
+15-154 files

FreeBSD/src c49cbf8sys/powerpc/aim mmu_oea64.c moea64_native.c

powerpc aim64: Return vm_paddr_t from moea64_bootstrap_alloc

Consistently use vm_paddr_t for the type returned from
moea64_bootstrap_alloc and avoid temporarily smuggling it via a
pointer.  Instead, be explicit in the places that assume a 1:1
mapping.

Effort:         CHERI upstreaming
Reviewed by:    kib
Sponsored by:   AFRL, DARPA
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2068
DeltaFile
+10-7sys/powerpc/aim/mmu_oea64.c
+7-8sys/powerpc/aim/moea64_native.c
+1-1sys/powerpc/aim/mmu_oea64.h
+1-1sys/powerpc/aim/mmu_radix.c
+19-174 files

FreeBSD/src 8a0ff50sys/vm vm_glue.c

vm_kstack: Use void * instead of vm_offset_t

Effort:         CHERI upstreaming
Reviewed by:    kib
Sponsored by:   AFRL, DARPA
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2068
DeltaFile
+34-35sys/vm/vm_glue.c
+34-351 files

FreeBSD/src 2d0634dsys/arm64/arm64 pmap.c, sys/i386/i386 copyout.c pmap.c

kva_alloc/free: Use void * instead of vm_offset_t

Effort:         CHERI upstreaming
Reviewed by:    kib
Sponsored by:   AFRL, DARPA
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2068
DeltaFile
+29-29sys/arm64/arm64/pmap.c
+24-22sys/i386/i386/copyout.c
+21-21sys/i386/i386/pmap.c
+15-15sys/powerpc/aim/mmu_oea64.c
+13-12sys/kern/subr_devmap.c
+13-11sys/vm/vm_kern.c
+115-11037 files not shown
+246-23943 files

FreeBSD/src fe2957fsys/amd64/amd64 machdep.c, sys/amd64/include stack.h

sys: Switch td_kstack from vm_offset_t to char *

Effort:         CHERI upstreaming
Reviewed by:    kib
Sponsored by:   AFRL, DARPA
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2068
DeltaFile
+6-6sys/vm/vm_glue.c
+5-5sys/kern/kern_thread.c
+4-4sys/riscv/include/stack.h
+4-4sys/amd64/amd64/machdep.c
+4-4sys/amd64/include/stack.h
+4-4sys/arm/include/stack.h
+27-2723 files not shown
+65-6529 files

FreeBSD/src 025b39bsys/dev/gve gve_qpl.c gve.h

gve: Convert a couple of structure members from vm_offset_t to char *

Effort:         CHERI upstreaming
Reviewed by:    kib
Sponsored by:   AFRL, DARPA
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2068
DeltaFile
+6-6sys/dev/gve/gve_qpl.c
+2-2sys/dev/gve/gve.h
+2-2sys/dev/gve/gve_tx.c
+10-103 files

FreeBSD/src ec3a0b2sys/amd64/amd64 pmap.c, sys/arm64/arm64 pmap.c

pmap_map_io_transient: Use void * instead of vm_offset_t for vaddr array

Effort:         CHERI upstreaming
Reviewed by:    kib
Sponsored by:   AFRL, DARPA
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2068
DeltaFile
+14-10sys/amd64/amd64/pmap.c
+6-4sys/arm64/arm64/pmap.c
+6-4sys/riscv/riscv/pmap.c
+2-2sys/arm64/include/pmap.h
+2-2sys/riscv/riscv/uio_machdep.c
+2-2sys/dev/cxgbe/cxgbei/icl_cxgbei.c
+32-244 files not shown
+40-3210 files

FreeBSD/src e275013sys/arm64/arm64 pmap.c, sys/compat/linuxkpi/common/src linux_page.c

pmap_qenter/qremove: Use void * instead of vm_offset_t

Effort:         CHERI upstreaming
Reviewed by:    kib
Sponsored by:   AFRL, DARPA
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2068
DeltaFile
+15-18sys/kern/vfs_bio.c
+15-16sys/powerpc/aim/mmu_radix.c
+12-11sys/compat/linuxkpi/common/src/linux_page.c
+11-11sys/kern/kern_kcov.c
+12-10sys/arm64/arm64/pmap.c
+12-10sys/i386/i386/pmap.c
+77-7639 files not shown
+224-21545 files

FreeBSD/src 573e631sys/amd64/include sf_buf.h, sys/arm64/include sf_buf.h

sf_buf_kva: Return a pointer instead of a vm_offset_t

This removes the need for several casts to pointer in callers.

Effort:         CHERI upstreaming
Reviewed by:    kib
Sponsored by:   AFRL, DARPA
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2068
DeltaFile
+3-3sys/dev/ti/if_ti.c
+3-3sys/sys/sf_buf.h
+2-2sys/riscv/include/sf_buf.h
+2-2sys/arm64/include/sf_buf.h
+2-2sys/amd64/include/sf_buf.h
+1-2sys/net/bpf_zerocopy.c
+13-1412 files not shown
+25-2618 files

FreeBSD/src ac7d527sys/arm/arm pmap-v6.c, sys/powerpc/aim mmu_oea64.c mmu_radix.c

pmap_map: Use void * for the return value instead of vm_offset_t

Effort:         CHERI upstreaming
Reviewed by:    kib
Sponsored by:   AFRL, DARPA
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2068
DeltaFile
+5-6sys/powerpc/aim/mmu_oea64.c
+5-4sys/powerpc/aim/mmu_radix.c
+4-4sys/powerpc/booke/pmap.c
+4-4sys/vm/vm_page.c
+3-3sys/arm/arm/pmap-v6.c
+3-3sys/powerpc/aim/mmu_oea.c
+24-2412 files not shown
+40-4018 files

FreeBSD/src fe3e92esys/amd64/amd64 pmap.c, sys/arm64/arm64 pmap.c

PHYS_TO_DMAP: Return a void * instead of a vm_offset_t

Add a new PHYS_TO_DMAP_ADDR that still returns an address for use in
places that only need an address and not a pointer.

Effort:         CHERI upstreaming
Reviewed by:    kib
Sponsored by:   AFRL, DARPA
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2068
DeltaFile
+86-85sys/amd64/amd64/pmap.c
+60-63sys/arm64/arm64/pmap.c
+49-52sys/powerpc/aim/mmu_radix.c
+36-36sys/riscv/riscv/pmap.c
+22-24sys/powerpc/booke/pmap_64.c
+14-15sys/powerpc/aim/mmu_oea64.c
+267-27567 files not shown
+426-44973 files

FreeBSD/src 2c6d8f1sys/amd64/amd64 pmap.c, sys/amd64/include vmparam.h

sys: Permit passing pointers to VIRT_IN_DMAP and DMAP_TO_PHYS

Add explicit uintptr_t casts to the arguments to these macros so that
the work both with virtual addresses (e.g. vm_offset_t) and pointers.

Drop no-longer-needed casts in various invocations of DMAP_TO_PHYS.

Effort:         CHERI upstreaming
Reviewed by:    kib
Sponsored by:   AFRL, DARPA
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2068
DeltaFile
+15-18sys/amd64/amd64/pmap.c
+11-6sys/riscv/include/vmparam.h
+11-6sys/arm64/include/vmparam.h
+10-6sys/amd64/include/vmparam.h
+7-7sys/arm64/arm64/pmap.c
+6-6sys/powerpc/aim/mmu_radix.c
+60-4910 files not shown
+75-6416 files

FreeBSD/src d886368sys/amd64/amd64 pmap.c, sys/amd64/include pmap.h

pmap_change_prot: Use void * instead of vm_offset_t

Effort:         CHERI upstreaming
Reviewed by:    kib
Sponsored by:   AFRL, DARPA
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2068
DeltaFile
+3-3sys/amd64/amd64/pmap.c
+3-3sys/arm64/arm64/pmap.c
+2-2sys/kern/link_elf.c
+1-1sys/amd64/include/pmap.h
+1-1sys/arm64/include/pmap.h
+1-1sys/kern/link_elf_obj.c
+11-116 files

FreeBSD/src fe9f0b1sys/arm/arm busdma_machdep.c, sys/arm64/arm64 busdma_bounce.c

busdma: Use char * instead of vm_offset_t for bounce page kernel pointers

Effort:         CHERI upstreaming
Reviewed by:    kib
Sponsored by:   AFRL, DARPA
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2068
DeltaFile
+15-15sys/kern/subr_busdma_bounce.c
+11-15sys/x86/x86/busdma_bounce.c
+9-11sys/powerpc/powerpc/busdma_machdep.c
+8-10sys/arm/arm/busdma_machdep.c
+8-10sys/arm64/arm64/busdma_bounce.c
+8-10sys/riscv/riscv/busdma_bounce.c
+59-716 files

FreeBSD/src dfb804esys/amd64/amd64 pmap.c, sys/arm64/arm64 pmap.c

pmap_change_attr: Use void * instead of vm_offset_t

Effort:         CHERI upstreaming
Reviewed by:    kib
Sponsored by:   AFRL, DARPA
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2068
DeltaFile
+12-12sys/powerpc/aim/mmu_radix.c
+9-8sys/riscv/riscv/pmap.c
+5-5sys/amd64/amd64/pmap.c
+4-3sys/arm64/arm64/pmap.c
+4-3sys/powerpc/booke/pmap.c
+3-3sys/compat/linuxkpi/common/include/asm/set_memory.h
+37-3420 files not shown
+62-5926 files

FreeBSD/src ef159bdsys/riscv/include cpufunc.h, sys/riscv/riscv cbo.c busdma_bounce.c

riscv: Switch the address argument to cpu_dcache_* to a pointer

No functional change, but this is friendlier for CHERI.

Effort:         CHERI upstreaming
Reviewed by:    kib
Sponsored by:   AFRL, DARPA
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2068
DeltaFile
+15-12sys/riscv/riscv/cbo.c
+9-9sys/riscv/riscv/busdma_bounce.c
+9-9sys/riscv/thead/thead.c
+4-4sys/riscv/include/cpufunc.h
+2-2sys/riscv/sifive/sifive_ccache.c
+1-1sys/riscv/riscv/pmap.c
+40-376 files

FreeBSD/src 1150654sys/arm/arm busdma_machdep.c, sys/arm64/arm64 busdma_bounce.c

pmap_quick_(enter|remove)_page: Use void * instead of vm_offset_t

Effort:         CHERI upstreaming
Reviewed by:    kib
Sponsored by:   AFRL, DARPA
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2068
DeltaFile
+31-31sys/arm/arm/busdma_machdep.c
+30-30sys/riscv/riscv/busdma_bounce.c
+28-28sys/arm64/arm64/busdma_bounce.c
+15-15sys/x86/x86/busdma_bounce.c
+13-13sys/powerpc/powerpc/busdma_machdep.c
+12-12sys/dev/ata/ata-lowlevel.c
+129-12918 files not shown
+197-19524 files

FreeBSD/src c72edc2sys/dev/ahci ahci_pci.c

ahci(4): Add another device ID for Marvell 9128 SATA controller: 0x91a3

This was encountered on a Gigabyte GA-P55A-UD4 motherboard identifying itself
as:
ahci0 at pci0:2:0:0:       class=0x01018f rev=0x11 hdr=0x00 vendor=0x1b4b device=0x91a3 subvendor=0x1458 subdevice=0xb000
    vendor     = 'Marvell Technology Group Ltd.'
    class      = mass storage
    subclass   = ATA

The physical chip has "88SE9128-NAA2" printed on it.

Similar code has been in Linux for a long time:
https://github.com/torvalds/linux/commit/50be5e3657cd2851a297dc0b3fd459f25829d29b

Co-authored-by: Michael Osipov <michaelo at FreeBSD.org>
PR:             288526
Reviewed by:    jhb
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D56464
DeltaFile
+2-0sys/dev/ahci/ahci_pci.c
+2-01 files