FreeBSD/src 1041735lib/libc/gen Makefile.inc

libc: Add missing MLINK for stravis(3)

MFC after:      1 week
Fixes:          8dfeba04eb36 ("Update to a June 8th snapshot of (un)vis form NetBSD.")
Reviewed by:    ziaee
Differential Revision:  https://reviews.freebsd.org/D56260

(cherry picked from commit a09d06bc5bff64baab76220a66c3501b89899134)
DeltaFile
+1-0lib/libc/gen/Makefile.inc
+1-01 files

FreeBSD/src 621b3b8lib/libc/gen Makefile.inc

libc: Add missing MLINK for stravis(3)

MFC after:      1 week
Fixes:          8dfeba04eb36 ("Update to a June 8th snapshot of (un)vis form NetBSD.")
Reviewed by:    ziaee
Differential Revision:  https://reviews.freebsd.org/D56260

(cherry picked from commit a09d06bc5bff64baab76220a66c3501b89899134)
DeltaFile
+1-0lib/libc/gen/Makefile.inc
+1-01 files

FreeBSD/src 8bd82e3lib/libc/gen Makefile.inc

libc: Add missing MLINK for stravis(3)

MFC after:      1 week
Fixes:          8dfeba04eb36 ("Update to a June 8th snapshot of (un)vis form NetBSD.")
Reviewed by:    ziaee
Differential Revision:  https://reviews.freebsd.org/D56260

(cherry picked from commit a09d06bc5bff64baab76220a66c3501b89899134)
DeltaFile
+1-0lib/libc/gen/Makefile.inc
+1-01 files

FreeBSD/src e324486sys/compat/freebsd32 freebsd32.h

sys/compat/freebsd32: Fix i386 compilation

The compile assertion now failing is due to the change '__int64_t' =>
'__int32_t' as the type of 'time32_t' on i386, which is the correct
value.  The use of 'freebsd32.h' on i386 may seem strange, but it comes
from 'kern_umtx.c' including it unconditionally as it needs 'struct
umutex32'.

Fixes:          87632ddf67b0 ("openzfs sys/types32.h: use abi_compat.h for time32_t")
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit 07c4eb506be45a4b836665e14ad63034ef3d573a)
DeltaFile
+1-1sys/compat/freebsd32/freebsd32.h
+1-11 files

FreeBSD/src 5576645sys/dev/mfi mfi.c

dev/mfi: include sys/abi_compat.h unconditionally

not only for COMPAT_FREEBSD32 case.  The driver uses INPTR() for
non-compat32 code.

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week

(cherry picked from commit bf603dbbb2c9964bba3d5bf2ba2371a75a0cc521)
DeltaFile
+0-2sys/dev/mfi/mfi.c
+0-21 files

FreeBSD/src 5b2da23sys/dev/mfi mfi.c, sys/sys abi_types.h abi_compat.h

sys/event.h: reduce namespace pollution from sys/abi_compat.h

Split out types definitions into sys/abi_types.h, and only include
abi_types.h into sys/event.h.

Tested and reviewed by: bz
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D55202

(cherry picked from commit ecadac729a1b855fe0d77a682ee424c3da1eb3db)
DeltaFile
+39-0sys/sys/abi_types.h
+1-29sys/sys/abi_compat.h
+3-2sys/dev/mfi/mfi.c
+1-1sys/sys/event.h
+44-324 files

FreeBSD/src ac1e0dbsys/sys user.h

sys/user.h: remove XXXSKE markers

Reviewed by:    brooks
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D55135

(cherry picked from commit ec6cf0c52698f9056cb17456717849653a03f7e4)
DeltaFile
+3-3sys/sys/user.h
+3-31 files

FreeBSD/src b4d3f08sys/compat/freebsd32 freebsd32.h, sys/kern subr_devstat.c

devstat: Provide 32-bit compatibility

If a 32-bit process running on a 64-bit kernel requests kern.devstat.all,
translate each struct devstat to its 32-bit equivalent before copying it
out.

Also fix a bug where an early error would be ignored if there were no
devices to report.

MFC after:      1 week
Reviewed by:    kib
Differential Revision:  https://reviews.freebsd.org/D54591

(cherry picked from commit a11d132f6c62f32abe44b19f7527d97ddc239058)

freebsd32: Fix includes

The previous commit added <sys/cdefs.h>, which isn't actually needed.
Conversely, <sys/event.h> is needed (and has been for a long time) but

    [7 lines not shown]
DeltaFile
+49-7sys/kern/subr_devstat.c
+27-0sys/compat/freebsd32/freebsd32.h
+76-72 files

FreeBSD/src de88678sys/compat/freebsd32 freebsd32.h freebsd32_misc.c

sys/compat/freebsd32: FF clock struct: Don't pack, use 'ffcounter32'

Packing 'struct ffclock_estimate32', in absence of substitution of
'ffcounter' (some 'uint64_t') by a 32-bit compatible type, was necessary
on amd64 since 'uint64_t' is 8-byte aligned, which leaves a padding gap
of 4-byte between fields 'update_time' and 'update_ffcount'.  This gap
does not exist on i386 (or amd64 32-bit mode), as 'uint64_t' there is
only 4-byte aligned.

Change the type of the 'update_ffcount' and 'leapsec_next' fields to the
recently introduced 'freebsd32_uint64_t', and adapt copy-in and copy-out
accordingly.  Using `CP()` previously worked due to the '__packed__'
attribute.

Reviewed by:    kib
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D55282

(cherry picked from commit 7c2fc4419db43a8a7d1886b0b8e08aa97bfa31e4)
DeltaFile
+5-7sys/compat/freebsd32/freebsd32.h
+4-4sys/compat/freebsd32/freebsd32_misc.c
+9-112 files

FreeBSD/src e0c7fcdsys/compat/freebsd32 freebsd32.h, sys/kern kern_proc.c

sys/compat/freebsd32: use freebsd32_uint64_t for struct kinfo_proc32

Reviewed by:    brooks
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D55135

(cherry picked from commit 31fab773613b21183fbd5a313fa8c69d37fcb196)
DeltaFile
+2-2sys/kern/kern_proc.c
+2-2sys/compat/freebsd32/freebsd32.h
+4-42 files

FreeBSD/src b13bba2sys/compat/freebsd32 freebsd32.h, sys/kern kern_proc.c

sys/compat/freebsd32: ki_pd is missing from struct kinfo_proc32

This is missed by the sizeof(struct kinfo_proc32) assert due to another
bug: namely, the use of uint64_t type that has different alignment on
i386 than on amd64 host.

Fixes:  85078b8573332c2c83a79adea8a61b519fb3b6af
Reviewed by:    brooks
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D55135

(cherry picked from commit 154778e3585166f613fd3d2978a0cab2262d1611)
DeltaFile
+1-0sys/compat/freebsd32/freebsd32.h
+1-0sys/kern/kern_proc.c
+2-02 files

FreeBSD/src 7d8b297sys/compat/freebsd32 freebsd32_misc.c freebsd32.h

sys/compat/freebsd32: use freebsd32_uint64_t for struct ffclock_estimate32

Reviewed by:    brooks
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D55135

(cherry picked from commit 3dc72107d29d304ba21f04426ec82077d23cedcd)
DeltaFile
+2-2sys/compat/freebsd32/freebsd32_misc.c
+1-1sys/compat/freebsd32/freebsd32.h
+3-32 files

FreeBSD/src f381a87sys/compat/freebsd32 freebsd32.h freebsd32_misc.c

sys/compat/freebsd32: use freebsd32_uint64_t for several struct stat's

Reviewed by:    brooks
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D55135

(cherry picked from commit beee89472e3e0e3640c9db5c34a6e422830ff00f)
DeltaFile
+5-5sys/compat/freebsd32/freebsd32.h
+4-4sys/compat/freebsd32/freebsd32_misc.c
+9-92 files

FreeBSD/src 7320170sys/contrib/openzfs/include/os/freebsd/spl/sys types32.h, sys/contrib/openzfs/lib/libspl/include/sys types32.h

openzfs sys/types32.h: use abi_compat.h for time32_t

The time32_t typedef leaks into openzfs compilation environment
through sys/event.h.  Simultaneously, openzfs provides its own
definition that is only correct for amd64 on FreeBSD.

Try to fix it by using sys/abi_compat.h directly.  Since toolchain build
from the make buildworld uses host abi_compat.h, add a preprocessor
symbol __HAVE_TIME32_T to signal consumers that time32_t is typedef'ed.
If not defined, fall back to old and wrong time32_t, which is enough for
bootstraping toolchain.

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D55135

(cherry picked from commit 87632ddf67b01f3d4787d10332afc1eeece52e2d)
DeltaFile
+6-1sys/sys/abi_compat.h
+5-0sys/contrib/openzfs/lib/libspl/include/sys/types32.h
+2-1sys/contrib/openzfs/include/os/freebsd/spl/sys/types32.h
+13-23 files

FreeBSD/src d94d93bsys/compat/freebsd32 freebsd32_misc.c freebsd32.h

sys/compat/freebsd32: use freebsd32_uint64_t for struct kinfo_knote32

Reviewed by:    brooks
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D55135

(cherry picked from commit 485e916a67b4e700de5f50873e1e7b64de394b16)
DeltaFile
+3-28sys/compat/freebsd32/freebsd32_misc.c
+3-3sys/compat/freebsd32/freebsd32.h
+6-312 files

FreeBSD/src 4ebb7c8sys/sys abi_compat.h

sys/abi_compat.h: add Foundation copyright for uint64_t stuff

Reviewed by:    brooks
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D55135

(cherry picked from commit 9ce0c190d8b3570c0a537f84952dca8c6e462ec3)
DeltaFile
+5-0sys/sys/abi_compat.h
+5-01 files

FreeBSD/src 408e20asys/compat/freebsd32 freebsd32.h, sys/sys abi_compat.h

sys/abi_compat.h: fix UB for bintime32 handling

Do not cast and then access potentially unaligned uint64_t in the BT_CP()
macro.  Use freebsd32_uint64_t type and FU64_CP() for the frac member.

Noted by:       des
Reviewed by:    des, emaste
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D54663

(cherry picked from commit be1b2da855cc38531733b5c97891cd4a40a993bc)
DeltaFile
+1-1sys/sys/abi_compat.h
+1-1sys/compat/freebsd32/freebsd32.h
+2-22 files

FreeBSD/src fc30c3fsys/compat/freebsd32 freebsd32_misc.c, sys/sys event.h

sys/event.h: use freebsd32_uint64_t for kevent32 64bit members

Reviewed by:    brooks
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D55135

(cherry picked from commit ad639400dc9f1c5aec470996473bb54edc113dba)
DeltaFile
+6-32sys/compat/freebsd32/freebsd32_misc.c
+4-2sys/sys/event.h
+1-5usr.bin/kdump/kdump.c
+11-393 files

FreeBSD/src 3222cb7sys/compat/freebsd32 freebsd32.h, sys/dev/mfi mfi.c

sys/abi_compat.h: move freebsd32_uint64_t and FU64_CP() there

Use private names for uintXX_t types.
Remove conflicting (but equal) PTR_IN() definition from dev/mfi.c.

Reviewed by:    brooks
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D55135

(cherry picked from commit e651c64bcab08c7b12d8ad6e3ad0b1ef3af3b875)
DeltaFile
+21-1sys/sys/abi_compat.h
+0-18sys/compat/freebsd32/freebsd32.h
+0-2sys/dev/mfi/mfi.c
+21-213 files

FreeBSD/src fbc234csys/sys abi_compat.h

sys/abi_compat.h: normalize include guard name

Reviewed by:    brooks
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D55135

(cherry picked from commit c3a04a9585ae233c98ee2eef73e6a80d17512578)
DeltaFile
+3-3sys/sys/abi_compat.h
+3-31 files

FreeBSD/src a60b577sys/compat/freebsd32 freebsd32.h, sys/sys abi_compat.h

compat32: provide a type and a macro for (u)int64_t handling on non-x86 arches

uint64_t is 4-byte aligned on i386, but is 8-bytes aligned on all other
32bit arches FreeBSD supports.  Provide the freebsd32_uint64_t type and
the FU64_CP() macro, which are intended to be used where 32bit ABI uses
(u)int64_t type, and do proper layout and copying for the aggregate type.

Reviewed by:    des, emaste
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D54663

(cherry picked from commit 96acaa960023c20e852e04e7cc5c6a5faca36c67)
DeltaFile
+10-1sys/compat/freebsd32/freebsd32.h
+8-0sys/sys/abi_compat.h
+18-12 files

FreeBSD/src 207094asys/compat/freebsd32 freebsd32.h, sys/kern subr_devstat.c

devstat: Provide 32-bit compatibility

If a 32-bit process running on a 64-bit kernel requests kern.devstat.all,
translate each struct devstat to its 32-bit equivalent before copying it
out.

Also fix a bug where an early error would be ignored if there were no
devices to report.

MFC after:      1 week
Reviewed by:    kib
Differential Revision:  https://reviews.freebsd.org/D54591

(cherry picked from commit a11d132f6c62f32abe44b19f7527d97ddc239058)

freebsd32: Fix includes

The previous commit added <sys/cdefs.h>, which isn't actually needed.
Conversely, <sys/event.h> is needed (and has been for a long time) but

    [7 lines not shown]
DeltaFile
+49-7sys/kern/subr_devstat.c
+27-0sys/compat/freebsd32/freebsd32.h
+76-72 files

FreeBSD/src 938c076sys/dev/ixgbe if_ix.c ixgbe_sriov.h

ixgbe: Fix MRQC register value.

Focus on the MRQE field of the MRQC register, which is 4 bits wide,
and we use these 3 types of values.

  - IXGBE_MRQC_RSSEN 0x1  (non VF mode)
  - IXGBE_MRQC_VMDQRSS32EN 0xA (less than 33 VFs)
  - IXGBE_MRQC_VMDQRSS64EN 0xB (less than 65 VFs)

If we always take a bitwise OR with IXGBE_MRQC_RSSEN,
IXGBE_MRQC_VMDQRSS32EN will never be chosen.
Select these 3 types of values for the proper case.

Signed-off-by: Yuichiro NAITO <naito.yuichiro at gmail.com>

MFC after:      1 week
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2132
DeltaFile
+2-2sys/dev/ixgbe/if_ix.c
+1-1sys/dev/ixgbe/ixgbe_sriov.h
+1-1sys/dev/ixgbe/if_sriov.c
+4-43 files

FreeBSD/src fee3ebasys/amd64/amd64 machdep.c

kern/amd64/machdep: Replace memset in wrmsr_early_safe_end

GENERIC-KASAN kernel failed to boot on a Dell PowerEdge C6615 with
an AMD EPYC 8224P CPU; UEFI BIOS caught a #GP exception with %RIP
in kasan_memset where %GS relative pointer (curthread->td_pflags2)
was dereferenced. Investigation led to wrmsr_early_safe_end which
calls memset to clear early #GP IDT entry. Replacing memset with
__builtin_memset_inline still resulted in the compiler emitting a
call to the memset resolver in GENERIC-KASAN build and the kernel
stil faulted during boot. This version which has been successfully
tested with both GENERIC and GENERIC-KASAN kernels uses memset_early.

Signed-off-by: Kristofer Peterson <kris at tranception.com>
Reviewed-by: kib
(cherry picked from commit 615f1b9eb17c921bbcb0cce2b9ad61910361325b)
DeltaFile
+1-1sys/amd64/amd64/machdep.c
+1-11 files

FreeBSD/src cc5125ausr.sbin/bhyveload bhyveload.c

bhyveload: simplify cb_open() and eliminate minor TOCTOU

It's not at all clear why I wrote it like this, but we can do better.

I wouldn't think this really has any meaningful security implications
since the hierarchy in question can't really be modified by the guest
scripts, but it would seem to make it a little more robust.

Reviewed by:    bnovkov, markj

(cherry picked from commit 6da9d465c54bf2e3496e83db025c5d22f3b3cc17)
DeltaFile
+12-14usr.sbin/bhyveload/bhyveload.c
+12-141 files

FreeBSD/src 7bb6c19bin/ls ls.c, bin/ls/tests ls_tests.sh

ls: check fts_children() for errors that may not surface otherwise

In particular, if one simply does a non-recursive `ls` on a directory
that is not accessible, there are some classes of errors that may cause
it to fail that wouldn't be surfaced unless we do an fts_read() that
will recurse into the inaccessible directory.  Catch those kinds of
errors here since we cannot expect to an FTS_ERR/FTS_DNR entry to follow
up on them.

PR:             287451
Reviewed by:    kib
Discusssed with:        des

(cherry picked from commit 7bf81e39d83087dc7f984077b5eed5a48df794d4)
DeltaFile
+30-0bin/ls/tests/ls_tests.sh
+17-0bin/ls/ls.c
+47-02 files

FreeBSD/src a41c4d9release Makefile.vm

release: Pass optional VM_IMAGE_CONFIG to vm-image

`make vm-image` calls mk-vmimage.sh, which supports
`-c CONFFILE`. This file gets sourced before building the image.

One example of how to use it is to define
vm_extra_filter_base_packages() to filter the list of packages
installed into the VM image:

    # vm-nodbg32.conf
    vm_extra_filter_base_packages() {
        grep -v -E '(-dbg|lib32)'
    }

    $ make VM_IMAGE_CONFIG=path/to/vm-nodbg32.conf \
        VMFORMATS=raw \
        -DWITH_VMIMAGES \
        vm-image


    [3 lines not shown]
DeltaFile
+1-0release/Makefile.vm
+1-01 files

FreeBSD/src 2b5087elib/libbe be.c libbe.3, lib/libbe/tests target_prog.c be_create.sh

bectl: Add -E flag to create an empty boot environment

Signed-off-by: Pat Maddox <pat at patmaddox.com>
Reviewed by:    kevans
(cherry picked from commit 2e020c84cb5ee1452e448f27ff7a7b6076c0147a)
DeltaFile
+50-14lib/libbe/be.c
+14-2sbin/bectl/bectl.c
+13-1sbin/bectl/bectl.8
+7-4lib/libbe/tests/target_prog.c
+8-1lib/libbe/libbe.3
+9-0lib/libbe/tests/be_create.sh
+101-223 files not shown
+111-239 files

FreeBSD/src 2129e62. ObsoleteFiles.inc

ObsoleteFiles: remove the shar(1) manpage as well

Fixes:  3fde39073c ("shar: remove from the tree [...]")
(cherry picked from commit bb0734cf2446ce2be829edfa421af3aa558d2c70)
DeltaFile
+1-0ObsoleteFiles.inc
+1-01 files

FreeBSD/src 07ce814tools/build/mk OptionalObsoleteFiles.inc

OptionalObsoleteFiles: Add etc/zfs/compatibility.d

If the world is built and installed with WITHOUT_ZFS, then make
-DBATCH_DELETE_OLD_FILES delete-old-dirs will give the error:

> rmdir: /etc/zfs: Directory not empty

because /etc/zfs/compatibility.d is still there.  While we're here,
clean out /usr/share/zfs as well.

Co-authored-by: kevans

(cherry picked from commit 5c9d988d865cc4ce849507173c0a2e2f399d0f62)
DeltaFile
+58-0tools/build/mk/OptionalObsoleteFiles.inc
+58-01 files