FreeBSD/src 1acf507release/tools ec2.conf

EC2: Don't use unicode in boot loader

The boot loader menu is disabled by default in EC2, but if it is ever
turned on, the default (unicode) output breaks EC2's web interface to
the serial console.

Set loader_menu_frame="ascii" instead.

MFC after:      3 days
Sponsored by:   Amazon

(cherry picked from commit 277830b4d3ae9999c80bf915b5491850e91c6516)
(cherry picked from commit 251907ca480eff7f6177f52959b71a6cfce45579)
DeltaFile
+4-1release/tools/ec2.conf
+4-11 files

FreeBSD/src c25839csys/kern subr_intr.c

intrng: Shuffle unhandled interrupts too

When interrupt vectors are first allocated, they get assigned to
CPU #0; at SI_SUB_SMP / SI_ORDER_SECOND (aka once we have multiple
CPUs), the intr_irq_shuffle SYSINIT clears their CPU sets with the
effect of forcing them to be assigned to new CPUs later.

In case where interrupt vectors were allocated *but not yet bound*
this code did not run, with the effect that those interrupts would
remain pinned to CPU #0 forever.  This affected the ena(4) driver,
which allocates interrupts for I/O when the device is attached but
doesn't set them up until the interface is brought up much later in
the boot process (and, crucially, long after intr_irq_shuffle runs).

Adjust intr_irq_shuffle to clear the CPU set for an interrupt source
even if it currently has no handlers, so that it will be properly
assigned to a CPU when it is used later.

Reviewed by:    andrew, mhorne

    [5 lines not shown]
DeltaFile
+13-1sys/kern/subr_intr.c
+13-11 files

FreeBSD/src 660a79erelease/tools ec2.conf

EC2: Don't use unicode in boot loader

The boot loader menu is disabled by default in EC2, but if it is ever
turned on, the default (unicode) output breaks EC2's web interface to
the serial console.

Set loader_menu_frame="ascii" instead.

MFC after:      3 days
Sponsored by:   Amazon

(cherry picked from commit 277830b4d3ae9999c80bf915b5491850e91c6516)
(cherry picked from commit 251907ca480eff7f6177f52959b71a6cfce45579)
DeltaFile
+4-1release/tools/ec2.conf
+4-11 files

FreeBSD/src b109809sys/kern subr_intr.c

intrng: Shuffle unhandled interrupts too

When interrupt vectors are first allocated, they get assigned to
CPU #0; at SI_SUB_SMP / SI_ORDER_SECOND (aka once we have multiple
CPUs), the intr_irq_shuffle SYSINIT clears their CPU sets with the
effect of forcing them to be assigned to new CPUs later.

In case where interrupt vectors were allocated *but not yet bound*
this code did not run, with the effect that those interrupts would
remain pinned to CPU #0 forever.  This affected the ena(4) driver,
which allocates interrupts for I/O when the device is attached but
doesn't set them up until the interface is brought up much later in
the boot process (and, crucially, long after intr_irq_shuffle runs).

Adjust intr_irq_shuffle to clear the CPU set for an interrupt source
even if it currently has no handlers, so that it will be properly
assigned to a CPU when it is used later.

Reviewed by:    andrew, mhorne

    [5 lines not shown]
DeltaFile
+13-1sys/kern/subr_intr.c
+13-11 files

FreeBSD/src cc66722tests/sys/netinet raw.c

tests/netinet/raw: fix ssize_t printf(3) format

Fixes:  c1481c9f4a425db7295332be87f837bfb7d127df
DeltaFile
+1-1tests/sys/netinet/raw.c
+1-11 files

FreeBSD/src c1481c9tests/sys/netinet raw.c Makefile

tests/netinet: provide test for raw_ip.c:rip_input()

The test creates differently bound SOCK_RAW sockets and sends different
probe packets.  There is expected results matrix that every probe is
checked against.
DeltaFile
+219-0tests/sys/netinet/raw.c
+3-0tests/sys/netinet/Makefile
+222-02 files

FreeBSD/src b0b6364sys/fs/tarfs tarfs_io.c

tarfs: swap deprecated ZSTD_resetDStream() with ZSTD_DCtx_reset()

ZSTD_resetDStream() is deprecated since 1.5.4: https://github.com/facebook/zstd/commit/5d8cfa6b96a6442ab1251f9de3b47a0eb12561a0

This change is needed to MFV zstd 1.5.7.

Approved by:    emaste (mentor)
MFC after:      3 days
Differential Revision:  https://reviews.freebsd.org/D55835

(cherry picked from commit 922d73540d2d9897e5e8160c445cefa13581564e)
DeltaFile
+2-2sys/fs/tarfs/tarfs_io.c
+2-21 files

FreeBSD/src 317c242sys/fs/tarfs tarfs_io.c

tarfs: swap deprecated ZSTD_resetDStream() with ZSTD_DCtx_reset()

ZSTD_resetDStream() is deprecated since 1.5.4: https://github.com/facebook/zstd/commit/5d8cfa6b96a6442ab1251f9de3b47a0eb12561a0

This change is needed to MFV zstd 1.5.7.

Approved by:    emaste (mentor)
MFC after:      3 days
Differential Revision:  https://reviews.freebsd.org/D55835

(cherry picked from commit 922d73540d2d9897e5e8160c445cefa13581564e)
DeltaFile
+2-2sys/fs/tarfs/tarfs_io.c
+2-21 files

FreeBSD/src 9031b83sbin/pfctl pfctl.c pfctl.8

pfctl: consistency

% pfctl -F ethernet
Ethernet rules cleared

% pfctl -s ethernet
pfctl: Unknown show modifier 'ethernet'

pfctl accepts 'ethernet' (or any prefix of it) in the -F flag but
accepts only 'ether' (or any prefix of it) in the -s flag, which seems
inconsistent.  This change brings the two to parity while remaining
backwards compatible.

Reviewed by:    kp
MFC after:      2 weeks
Signed-off-by: Seth Hoffert <seth.hoffert at gmail.com>
(cherry picked from commit 36acf1bd32ed5749af4a9f735aeea1a3434fe42f)
DeltaFile
+1-1sbin/pfctl/pfctl.c
+1-1sbin/pfctl/pfctl.8
+2-22 files

FreeBSD/src 2353fa1sys/compat/linuxkpi/common/include/linux fs.h

LinuxKPI: Fix simple_read_from_buffer for zero-size and off-the-end reads

I noticed that the buf_size < 0 check can never be true (it's a
size_t) and decided to check for this condition by an alternate
expression, and I also noticed that a read_size of 0 would incorrectly
return -EFAULT.  Instead, return success for both of these cases as
reading beyond the EOF of a normal file also returns EOF, not EINVAL.

Reviewed by:    bz
Sponsored by:   AFRL, DARPA
Differential Revision:  https://reviews.freebsd.org/D55845
DeltaFile
+2-2sys/compat/linuxkpi/common/include/linux/fs.h
+2-21 files

FreeBSD/src 2cf1514sys/compat/lindebugfs lindebugfs.c, sys/compat/linuxkpi/common/include/linux fs.h seq_file.h

lindebugfs: Pass user buffer pointers to the read/write file operations

The Linux file_operations API expects the read and write operations
to take a single user buffer pointer (along with the length and the
file offset as an in/out parameter).

However, the debugfs_fill function was violating this part of the
contract as it was passing down kernel pointers instead.  An earlier
commit (5668c22a13c6befa9b8486387d38457c40ce7af4) hacked around this
by modifying simple_read_from_buffer() to treat its user pointer
argument as a kernel pointer instead.  However, other commits keep
tripping over this same API mismatch
(e.g. 78e25e65bf381303c8bdac9a713ab7b26a854b8c passes a kernel pointer
to copy_from_user in fops_str_write).

Instead, change debugfs_fill to use the "raw" pseudofs mode where the
uio is passed down to directly to the fill callback rather than an
sbuf.  debufs_fill now iterates over the iovec in the uio similar to
the implementation of uiomove invoking the read or write operation on

    [24 lines not shown]
DeltaFile
+54-27sys/compat/lindebugfs/lindebugfs.c
+23-12sys/compat/linuxkpi/common/src/linux_simple_attr.c
+13-15sys/compat/linuxkpi/common/include/linux/fs.h
+1-1sys/compat/linuxkpi/common/include/linux/seq_file.h
+1-1sys/compat/linuxkpi/common/src/linux_seq_file.c
+92-565 files

FreeBSD/src 14e9744sys/arm64/arm64 trap.c

arm64: Have a common call to userret

Rather than each exception calling userret use a common copy. As
syscallret already calls userret we need to skip it in that case.

Reviewed by:    kib
Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D55250
DeltaFile
+9-21sys/arm64/arm64/trap.c
+9-211 files

FreeBSD/src 58d74d7sys/compat/linuxkpi/common/src linux_simple_attr.c linux_seq_file.c

LinuxKPI: Use simple_read_from_buffer in simple_attr_read and seq_read

Reviewed by:    bz
Sponsored by:   AFRL, DARPA
Differential Revision:  https://reviews.freebsd.org/D55879
DeltaFile
+2-11sys/compat/linuxkpi/common/src/linux_simple_attr.c
+2-9sys/compat/linuxkpi/common/src/linux_seq_file.c
+4-202 files

FreeBSD/src c181c8fsys/compat/linuxkpi/common/src linux_seq_file.c

LinuxKPI: Clear the sbuf at the start of each call to seq_read

Each invocation of seq_read invokes the seq_file.show callback which
writes into the sbuf.  Then it invokes sbuf_finish before copying the
data into the caller's buffer.  Without this, a second call to
seq_read on the same file would try to append data to a finished sbuf.

Reviewed by:    bz
Sponsored by:   AFRL, DARPA
DeltaFile
+1-0sys/compat/linuxkpi/common/src/linux_seq_file.c
+1-01 files

FreeBSD/src edc9c3eusr.sbin/virtual_oss/virtual_oss main.c

virtual_oss: Combine -d, -l and -L option getopt code

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D55671

(cherry picked from commit a2b601343bf9261c4ada51e4d4c30c5b9320bb2b)
DeltaFile
+3-21usr.sbin/virtual_oss/virtual_oss/main.c
+3-211 files

FreeBSD/src 1d13d93sys/dev/virtio virtqueue.c

virtio: Ensure power-of-two alignment for indirect queue

Some platforms enforce power-of-two alignment for bus_dma tags. Rounding up
the natural size may result in over-alignment, but should be safe.

PR:             293770
Reviewed by:    andrew
Fixes:          c499ad6f997c ("virtio: Use bus_dma for ring and indirect buffer allocations")
Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D55843
DeltaFile
+1-1sys/dev/virtio/virtqueue.c
+1-11 files

FreeBSD/src 7b9bb32sys/netinet6 nd6.c

ndp: don't send unsolicited NA for multicast address

During link-layer address change event, don't send unsolicited
NA for multicast addresses.

Reviewed by: adrian, zlei
Differential Revision: https://reviews.freebsd.org/D55885
DeltaFile
+2-1sys/netinet6/nd6.c
+2-11 files

FreeBSD/src a8b9a05sys/net if_bridge.c

if_bridge(4): don't sleep under epoch(9) in destruction

bridge tries to run callout_drain(9) twice under epoch
during destruction.
once for bridge_timer, which is not required to be under epoch.
second time for the BSTP callout, which is already disabled
earlier inside bridge_delete_member.

Reviewed by: glebius, zlei
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D55876
DeltaFile
+2-2sys/net/if_bridge.c
+2-21 files

FreeBSD/src e39d3a6sys/sys pmc.h

pmc.h: bump PMC_VERSION_MINOR

Bump for the addition of PMC_OP_GETCAPS and the recently added Intel
CPUs.

Sponsored by:   The FreeBSD Foundation
DeltaFile
+1-1sys/sys/pmc.h
+1-11 files

FreeBSD/src 209d9fbusr.sbin/pmcstat pmcstat.c

pmcstat: Implement PMC_CAP_SYSWIDE

Implement the PMC_CAP_SYSWIDE capability flag in the same manner as the
PMC_CAP_DOMWIDE flag.  This flag was previously introduced along side
the domain wide flag, but is yet to be used anywhere.

Reviewed by:    mhorne
Sponsored by:   Netflix
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2075
DeltaFile
+5-2usr.sbin/pmcstat/pmcstat.c
+5-21 files

FreeBSD/src 44a983dlib/libpmc libpmc.c, share/man/man4 hwpmc.4

libpmc: Query hwpmc for caps

This change allows for fine-grained capabilities per counter index. This
is particularly useful for AMD where subclasses are not exposed to the
general PMC code, but other architectures also have asymmetric behaviors
when it comes to specific counter indices.

A new PMC_OP_GETCAPS op is added to the hwpmc(4) ioctl interface.

Reviewed by:    mhorne
Sponsored by:   Netflix
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2058
DeltaFile
+45-0sys/dev/hwpmc/hwpmc_mod.c
+9-10lib/libpmc/libpmc.c
+15-0sys/dev/hwpmc/hwpmc_amd.c
+14-1sys/sys/pmc.h
+4-0share/man/man4/hwpmc.4
+87-115 files

FreeBSD/src f0e0c4clib/libpmc/pmu-events jevents.c

jevents: include file path in whitelist error message

A small enhancement.

Reviewed by:    Ali Mashtizadeh <ali at mashtizadeh.com>
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D55830
DeltaFile
+1-1lib/libpmc/pmu-events/jevents.c
+1-11 files

FreeBSD/src 6580d04sys/fs/nfsserver nfs_nfsdserv.c

nfs_nfsdserv.c: Fix handling of archive flag for mkdir

An NFSv4.1/4.2 client can set/clear the archive, hidden
and system flags when creating non-regular files, such
as directories.

Without this patch, the setting of va_flags causes an
EPERM failure, since they are specified for VOP_MKDIR(),
VOP_MKNOD() and VOP_SYMLINK().

This patch sets va_flags == VNOVAL for the above VOP_xxx()
calls and then sets/clears the flags after creation,
which fixes the problem.

This bug only affects the Windows NFSv4.1/4.2 client.

PR:     293691
Tested by:      Dan Shelton <dan.f.shelton at gmail.com>
MFC after:      2 weeks
DeltaFile
+13-1sys/fs/nfsserver/nfs_nfsdserv.c
+13-11 files

FreeBSD/src 83d7a49sys/vm vm_fault.c

vm_fault: expand KASSERT message in vm_fault_populate_cleanup

Include index values and object pointer in the diagnostic
to improve debugging of pindex mismatches.

No functional change.

Signed-off-by: Isa Isoux <isa at isoux.org>
Reviewed by: kib, pouria
Pull Request: https://github.com/freebsd/freebsd-src/pull/2038
DeltaFile
+4-1sys/vm/vm_fault.c
+4-11 files

FreeBSD/src aa15df4sys/sys queue.h

queue.h: Reorder STAILQ_INSERT_TAIL

The current implementation briefly violates the tail invariant.  This
is not usually an issue, but if an insert is in flight when a panic
occurs, we may then trip the invariant while dumping core.

MFC after:      1 week
Sponsored by:   Klara, Inc.
Sponsored by:   NetApp, Inc.
Reviewed by:    obiwac, olce, jhb
Differential Revision:  https://reviews.freebsd.org/D55819
DeltaFile
+2-1sys/sys/queue.h
+2-11 files

FreeBSD/src 889d10dsys/dev/nvme nvme_private.h nvme_qpair.c

nvme: Replace bus_space_[read|write]_4 with bus_[read|write]_4

The goal this change is to remove the use of the tag and handle
needed by bus_space_[read|write]_4.

Fixes:                  b3d9e5013f3e5 (Don't active memory space)
Requested by:           jhb
Reviewed by:            gallatin, imp, jhb, jrtc27
Differential Revision:  https://reviews.freebsd.org/D55818
DeltaFile
+6-11sys/dev/nvme/nvme_private.h
+3-4sys/dev/nvme/nvme_qpair.c
+0-3sys/dev/nvme/nvme_pci.c
+0-2sys/dev/nvme/nvme_ahci.c
+9-204 files

FreeBSD/src 4e3beefsys/dev/nvme nvme_private.h nvme_ahci.c

nvme: Removed unused 'regs' variable

The private struct has a 'regs' member that's only written to
and otherwise unused. This change removes it.

Fixes:                  b3d9e5013f3e5 (Don't active memory space)
Requested by:           jhb
Reviewed by:            imp, jhb, jrtc27
Differential Revision:  https://reviews.freebsd.org/D55817
DeltaFile
+0-2sys/dev/nvme/nvme_private.h
+0-1sys/dev/nvme/nvme_ahci.c
+0-1sys/dev/nvme/nvme_pci.c
+0-43 files

FreeBSD/src e073105sys/net if.c

ifnet: Remove unreachable code

The ioctls SIOCSIFVNET and SIOCSIFRVNET are for userland only. For
SIOCSIFVNET, if_vmove_loan(), the interface is obtained from current
VNET. For SIOCSIFRVNET, if_vmove_reclaim(), a valid child prison is
held before getting the interface. In both cases the VNET of the
obtained interfaces is stable, so there's no need to check it.

No functional change intended.

Reviewed by:    glebius, jamie (for #jails)
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D55828
DeltaFile
+0-18sys/net/if.c
+0-181 files

FreeBSD/src 8065ff6sys/net if.c

ifnet: Fix decreasing the vnet interface count

It should be decreased only when the interface has been successfully
removed from the "active" list.

This prevents vnet_if_return() from potential OOB writes to the
allocated memory "pending".

Reviewed by:    kp, pouria
Fixes:          a779388f8bb3 if: Protect V_ifnet in vnet_if_return()
MFC after:      3 days
Differential Revision:  https://reviews.freebsd.org/D55873
DeltaFile
+3-3sys/net/if.c
+3-31 files

FreeBSD/src 33e0568sys/dev/usb/net if_ure.c

ure(4): Fix spurious link flaps from MII

A race condition in the MII layer causes spurious link down events.
In `statchg`, on link down, check if the PHY reports the link as
actually down using the BMSR register, if not, force the status of the
link to back up and restart TX. Do the same in a MII `linkchg` handler.
On actual link up, restart TX in case it went idle and down.

PR:             252165
Signed-off-by:  Rafael Kitover <rkitover at gmail.com>
Reviewed by:    pouria
Differential Revision: https://reviews.freebsd.org/D55682
DeltaFile
+66-3sys/dev/usb/net/if_ure.c
+66-31 files