FreeBSD/src 4517fbfsys/fs/nfs nfs_commonkrpc.c nfs_var.h, sys/fs/nfsclient nfs_clstate.c

nfscl: Add support for CB_RECALL_SLOT

The callback CB_RECALL_SLOT is required for NFSv4.1/4.2.
Fortunately, there does not appear to be any extant
NFSv4.1/4.2 servers that use it.  Since commit b97a478896e9
fixed handling of session slot shrinking, this patch
adds support for CB_RECALL_SLOT, which shrinks the
number of session slots as well.

MFC after:      2 weeks
DeltaFile
+18-0sys/fs/nfsclient/nfs_clstate.c
+2-2sys/fs/nfs/nfs_commonkrpc.c
+1-0sys/fs/nfs/nfs_var.h
+21-23 files

FreeBSD/src 9ab9e13sys/cddl/dev/fbt/aarch64 fbt_isa.c

dtrace/arm64: Fix enumeration of FBT return probes

On arm64, the FBT provider treats tail calls as return probes.  Ignoring
the question of whether this is really correct, the implementation is
wrong: instr is a pointer to uint32_t, so the removed multiplication by
the instruction size is wrong.  As a result, FBT would create return
probes for intra-function branches.

MFC after:      2 weeks
Sponsored by:   Innovate UK

(cherry picked from commit 4da070ce6c015a994ec4ecf3d31ee94810ea19f1)
DeltaFile
+1-2sys/cddl/dev/fbt/aarch64/fbt_isa.c
+1-21 files

FreeBSD/src 31af1basys/kern subr_stats.c

Reinstate returning EOVERFLOW from stats_v1_blob_clone()

a0993376ec5f (from D43179) subtly changed stats_v1_blob_clone() to stop returning EOVERFLOW in the case where the user buffer is not large enough to receive the entire statsblob. This results in any consumers which are implemented to retry on receiving EOVERFLOW to instead give up after receiving an empty statsblob header.

Fix by latching any errors recorded prior to copyout.

Reviewed by:    markj
Obtained from:  Netflix, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D44585
Fixes:  a0993376ec5f ("stats: Check for errors from copyout()")

(cherry picked from commit 7eb92c502eb503d808a51296e426de625239a0d9)
DeltaFile
+6-4sys/kern/subr_stats.c
+6-41 files

FreeBSD/src d1b2630tests/sys/geom/class/eli setkey_test.sh

geli tests: Use shorter passphrases in setkey_passphrase

There is an undocumented limit on the length of a GELI passphrase, and
the test exceeded that.  Most of the time it worked because a nul
terminator would appear early enough in the string.

Reported by:    Jenkins
Fixes:          2b7b09ac9675 ("geli tests: Add a regression test for geli setkey -J")

(cherry picked from commit c4b927c341e23eea17f75d139aafcf58545c5b0e)
DeltaFile
+3-3tests/sys/geom/class/eli/setkey_test.sh
+3-31 files

FreeBSD/src a50d5a7sys/arm/ti/am335x am335x_dmtimer.c

ti/am335x: Fix the device_set_descf() call in am335x_dmtimer_probe()

Fixes: 459dc61c8b05 ("arm: Convert drivers to use device_set_desc(f)()")

Reviewed by:    markj, imp, manu
Approved by:    markj, imp, manu (mentor)
Differential Revision:  https://reviews.freebsd.org/D45699

(cherry picked from commit 332f00cdbafa944472a5c2d9d1701466ab762f90)
DeltaFile
+1-1sys/arm/ti/am335x/am335x_dmtimer.c
+1-11 files

FreeBSD/src 4a6d4cdcddl/contrib/opensolaris/cmd/dtrace dtrace.c, cddl/contrib/opensolaris/lib/libdtrace/common dt_open.c dtrace.h

libdtrace: Generalize handling of data models a bit

Make it easier to support data models other than ILP32 and LP64 by
avoiding constructs which assume that it must be one or the other.

No functional change intended.

MFC after:      2 weeks
Sponsored by:   Innovate UK

(cherry picked from commit 096a5c6cd28c417456d5ce3598be15e6b656af5c)
DeltaFile
+7-1cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
+3-4cddl/contrib/opensolaris/cmd/dtrace/dtrace.c
+1-0cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h
+11-53 files

FreeBSD/src 40c56cccddl/contrib/opensolaris/lib/libdtrace/common dt_dis.c

libdtrace: Use designators to initialize the opcode array

No functional change intended.

MFC after:      2 weeks
Sponsored by:   Innovate UK

(cherry picked from commit 51688136b161089b317edc34c3a3e9b40d54a18a)
DeltaFile
+80-80cddl/contrib/opensolaris/lib/libdtrace/common/dt_dis.c
+80-801 files

FreeBSD/src 3e6fddasys/kern subr_ticks.S

clock: Use .balign to align ticksl

The .align directive has a different behaviour on 32-bit arm than on
other platforms.  Use .balign instead, which has consistent behaviour on
all architectures.

Reported by:    kib
Reviewed by:    jrtc27, kib
Fixes:          6b82130e6c9a ("clock: Add a long ticks variable, ticksl")
Differential Revision:  https://reviews.freebsd.org/D48430

(cherry picked from commit 159d29d3948294cdc9ee4cc3951d004de6797a32)
DeltaFile
+1-1sys/kern/subr_ticks.S
+1-11 files

FreeBSD/src a267ceasys/conf files, sys/kern subr_ticks.s subr_ticks.S

clock: Simplify subr_ticks and rename

- We can use builtin constants for the size of int and long to simplify
  definitions.
- The file should have a .S prefix since we want to run it through the
  preprocessor, though apparently this happens anyway with .s...
- Move ticks and ticksl from .data to .bss.

Reported by:    jrtc27
Reviewed by:    jrtc27, kib, emaste
Fixes:          6b82130e6c9a ("clock: Add a long ticks variable, ticksl")
Differential Revision:  https://reviews.freebsd.org/D48420

(cherry picked from commit b2b974f7ef4cddff251d0de69d8da13232b25e4d)
DeltaFile
+0-44sys/kern/subr_ticks.s
+36-0sys/kern/subr_ticks.S
+1-1sys/conf/files
+37-453 files

FreeBSD/src f44f65fsys/arm64/arm64 trap.c

arm64: Clean up usage of the dtrace invop handler

- Don't consume the breakpoint if all invop handlers returned a non-zero
  value.
- Fix style nits.

MFC after:      2 weeks
Sponsored by:   Innovate UK

(cherry picked from commit 853cd8723494ccc2e972aaa09e7d04ede1508c95)
DeltaFile
+3-4sys/arm64/arm64/trap.c
+3-41 files

FreeBSD/src 467fa30sys/kern subr_ticks.s kern_clock.c, sys/sys kernel.h timetc.h

clock: Add a long ticks variable, ticksl

For compatibility with Linux, it's useful to have a tick counter of
width sizeof(long), but our tick counter is an int.  Currently the
linuxkpi tries paper over this difference, but this cannot really be
done reliably, so it's desirable to have a wider tick counter.  This
change introduces ticksl, keeping the existing ticks variable.

Follow a suggestion from kib to avoid having to maintain two separate
counters and to avoid converting existing code to use ticksl: change
hardclock() to update ticksl instead of ticks, and then use assembler
directives to make ticks and ticksl overlap such that loading ticks
gives the bottom 32 bits.  This makes it possible to use ticksl in the
linuxkpi without having to convert any native code, and without making
hardclock() more complicated or expensive.  Then, the linuxkpi can be
modified to use ticksl instead of ticks.

Reviewed by:    olce, kib, emaste
MFC after:      1 month

    [3 lines not shown]
DeltaFile
+44-0sys/kern/subr_ticks.s
+15-13sys/kern/kern_clock.c
+9-0sys/sys/kernel.h
+2-2sys/kern/kern_tc.c
+1-1sys/kern/subr_param.c
+1-1sys/sys/timetc.h
+72-171 files not shown
+73-177 files

FreeBSD/src bfe8eb7sys/cddl/contrib/opensolaris/uts/common/sys dtrace_impl.h

dtrace: Remove the noinline qualifier from dtrace_getarg()

It serves no purpose after commit 82283cad12a4.  No functional change
intended.

Fixes:  82283cad12a4 ("dtrace: Avoid including dtrace_isa.c directly into dtrace.c")
MFC after:      2 weeks

(cherry picked from commit 494a2b14722e8955af54e306305f462e5765c1e4)
DeltaFile
+0-4sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h
+0-41 files

FreeBSD/src 618a876share/man/man5 pf.conf.5

pf.conf.5: document how any matches any non-loopback interface

ok benno

Obtained from:  OpenBSD, henning <henning at openbsd.org>, 527559b86a
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+7-1share/man/man5/pf.conf.5
+7-11 files

FreeBSD/src cba525esbin/pfctl parse.y

pfctl: relax the cfg file secrecy check slightly to allow group readability

default permissions and mtree NOT changed.
prodded by benno, ok phessler benno jmatthew theo pelikan florian

Obtained from:  OpenBSD, henning <henning at openbsd.org>, 7140c133f0
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+2-2sbin/pfctl/parse.y
+2-21 files

FreeBSD/src 8e8a77csys/netpfil/pf if_pflog.c

pf: allow multiple pflog interfaces to be created

Fixes:          3bf6554017b78f03bb779a5a3115034243e5c6c7
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+1-1sys/netpfil/pf/if_pflog.c
+1-11 files

FreeBSD/src 26a7be9tests/sys/netpfil/pf pass_block.sh

pf tests: basic 'any' interface test case

Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+34-0tests/sys/netpfil/pf/pass_block.sh
+34-01 files

FreeBSD/src a261457sbin/pfctl parse.y

pfctl: if_item can be "any" now

Allows things like:
        block out on $someif received-on any

to prevent packets to get forwarded to $someif.

Obtained from:  OpenBSD, henning <henning at openbsd.org>, 5984d04852
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+9-0sbin/pfctl/parse.y
+9-01 files

FreeBSD/src 7e7f880share/man/man4 pf.4, sys/net pfvar.h

pf: use time_t for storing time_t values

No change to the underlying type, so no ABI change.

We define __time_t as uint64_t if __LP64__, otherwise uint32_t,
and only define __LP64__ if long is 64 bits.
In other words: __time_t == long.

ok henning@ deraadt@

Obtained from:  OpenBSD, guenther <guenther at openbsd.org>, 6c1b69a0ff
Sponsored by:   Rubicon Communications, LLC ("Netgate")
Differential Revision:  https://reviews.freebsd.org/D48963
DeltaFile
+20-20sys/netpfil/pf/pf_table.c
+6-6sys/net/pfvar.h
+2-2share/man/man4/pf.4
+28-283 files

FreeBSD/src d2bb198sys/net pfvar.h, sys/netpfil/pf pf_if.c

pf: introduce a way to match "any" interface, excluding loopback ones

pfi_kkif_attach() annotates the kif with a flag indicating it is the "any" match.
pfi_kif_match obeys() that flag.

ok benno

Obtained from:  OpenBSD, henning <henning at openbsd.org>, 4be478ce5d
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+9-0sys/netpfil/pf/pf_if.c
+1-0sys/net/pfvar.h
+10-02 files

FreeBSD/src 0f63c4ausr.bin/limits/tests limits_test.sh

limits tests: Try to fix spurious cputime test failures

I very occasionally see test failures caused by the total CPU time being
several milliseconds under 3s.  The test runs "limits -t 3 time <busy
loop>" and verifies that the reported time elapsed is at least 3s (and
not too much more).  In particular, any time spent executing time(1)
itself is counted against the limit but not recorded in the output.

I think it makes more sense to reverse the order, so that the CPU time
limit is not applied to time(1) itself.  This also resolves the test
failures I was seeing, which were reproducible only under load (i.e.,
running many tests in parallel).

MFC after:      2 weeks
Sponsored by:   Klara, Inc.
DeltaFile
+2-2usr.bin/limits/tests/limits_test.sh
+2-21 files

FreeBSD/src 3663197sys/kern kern_ktrace.c

ktr: Use STAILQ_EMPTY_ATOMIC when checking for records in ktr_drain()

This is an unlocked check, and after commit 34740937f7a4 the debug
checks in STAILQ_EMPTY may spuriously fail here.  In particular, the per
process queue is updated under the global ktrace mutex, not held in
ktr_drain().  If a record is enqueued concurrently, the recording thread
will schedule an AST to drain the queue again, so it should not be
possible for a race to leave records in the queue indefinitely.

Reviewed by:    kib, olce
Reported by:    syzbot+d67eddd8c4923ee28bb7 at syzkaller.appspotmail.com
MFC after:      2 weeks
Fixes:          34740937f7a4 ("queue: New debug macros for STAILQ")
Differential Revision:  https://reviews.freebsd.org/D48899
DeltaFile
+1-1sys/kern/kern_ktrace.c
+1-11 files

FreeBSD/src d2870b8share/man/man3 queue.3, sys/sys queue.h

queue: Add atomic variants for *_EMPTY

In some places, these macros are used without a lock, under the
assumption that they are naturally atomic.  After commit
34740937f7a4 ("queue: New debug macros for STAILQ"), this assumption is
false.

Provide *_EMPTY_ATOMIC for such cases.  This lets us include extra debug
checks for the non-atomic case, and gives us a way to explicitly
annotate unlocked checks, which generally deserve extra scrutiny and
might otherwise raise reports from KCSAN.

Reviewed by:    kib, olce (previous version)
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D48899
DeltaFile
+25-1share/man/man3/queue.3
+12-0sys/sys/queue.h
+37-12 files

FreeBSD/src fbacadfsys/modules/vmm Makefile

vmm: Add vmm_fence.c to SRCS for vmm.ko on riscv

Fixes:  8f6b66a9d3f2 ("riscv vmm: implement SBI RFNC extension.")
DeltaFile
+1-0sys/modules/vmm/Makefile
+1-01 files

FreeBSD/src 649a910usr.sbin/bhyve pci_passthru.c

bhyve: Avoid holding /dev/pci open unnecessarily

Some device models, LPC in particular, will call pci_host_read_config()
when probing for devices.  Currently this results in pcifd_init()
opening /dev/pci, and thus bhyve holds the fd open even when it's not
needed.

Modify pci_host_{read,write}_config() to open /dev/pci independent of
the global pcifd.  This means that these routines can only be used
during VM initialization, as capsicum will prevent further opens
afterward.  Introduce internal wrappers which use the global pcifd,
intended for the passthru code.

Reviewed by:    jhb
MFC after:      3 weeks
Fixes:          563fd2240e13 ("bhyve: export funcs for read/write pci config")
Differential Revision:  https://reviews.freebsd.org/D48908
DeltaFile
+83-36usr.sbin/bhyve/pci_passthru.c
+83-361 files

FreeBSD/src 685fb42sys/netpfil/pf pf.c, tests/sys/netpfil/pf pflog.sh

pf: Log the intended action when a NAT rule matches a packet

When a packet matches a binat/nat/rdr rule, pf logs the match.  The log
metadata includes the rule's action on the packet, e.g., PF_PASS.  NAT
rules have their own actions: PF_BINAT, PF_NAT, PF_RDR.

Before commit 948e8413aba0 ("pflog: pass the action to pflog directly"),
pflog_packet() would obtain the action from the rule definition, whereas
after that commit the action is passed as a parameter.  When a NAT rule
matches, we want to log the rule action, but after that commit, PF_PASS
is hard-coded.  Restore the previous behaviour.

Add a regression test which installs a redirect, logs packets matching
the redirect rule, and verifies that the corresponding pflog entry
includes the correct action.

Reviewed by:    kp
Fixes:          948e8413aba0 ("pflog: pass the action to pflog directly")
MFC after:      2 weeks

    [3 lines not shown]
DeltaFile
+59-0tests/sys/netpfil/pf/pflog.sh
+1-1sys/netpfil/pf/pf.c
+60-12 files

FreeBSD/src d46d45btools/tools/fib_multibind sink.c

tools/fib_multibind: Remove a redundant calculation

No functional change intended.

Reported by:    kevans
Fixes:          3fa552149885 ("tools: Add a small program to demonstrate FIB handling in bind(2)")
Sponsored by:   Klara, Inc.
Sponsored by:   Stormshield
DeltaFile
+1-1tools/tools/fib_multibind/sink.c
+1-11 files

FreeBSD/src b968644sys/dev/usb/wlan if_mtw.c

mtw: Use correct cmd for radio

Approved by:    adrian, wireless
Differential Revision:  https://reviews.freebsd.org/D49003
DeltaFile
+1-1sys/dev/usb/wlan/if_mtw.c
+1-11 files

FreeBSD/src 031800csys/dev/gve gve_tx.c gve_main.c

gve: Do minor cleanup and bump version

This commit fixes several minor issues:

- Removes an unnecessary function pointer parameter on gve_start_tx_ring
- Adds a presubmit check against style(9)
- Replaces mb() and rmb() macros with native
  atomic_thread_fence_seq_cst() and atomic_thread_fence_acq()
  respectively
- Fixes various typos throughout
- Increments the version number to 1.3.2

Co-authored-by: Vee Agarwal <veethebee at google.com>
Signed-off-by: Vee Agarwal <veethebee at google.com>
Signed-off-by: Jasper Tran O'Leary <jtranoleary at google.com>

Reviewed by:    delphij, markj
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D48969
DeltaFile
+7-9sys/dev/gve/gve_tx.c
+3-3sys/dev/gve/gve_main.c
+3-3sys/dev/gve/gve.h
+2-2sys/dev/gve/gve_sysctl.c
+2-2sys/dev/gve/gve_desc.h
+1-1sys/dev/gve/gve_rx_dqo.c
+18-202 files not shown
+20-228 files

FreeBSD/src 73c3fe4sys/dev/gve gve_tx_dqo.c

gve: Fix qpl_buf_head being initialized improperly

Currently, for DQO QPL our MPASS assertion on qpl_buf_head for available
pending_pkts (i.e. not holding a packet) fails due to incorrect
initialization. The MPASS fails on the first run of packets through the
ring when INVARIANTS is on, and when INVARIANTS is off, things work
without a bug.

The MPASS guards against improper reaping of "pending_pkt" objects,
and thus was failing for the first run through the ring. By correctly
initializing the objects in this patch we make the MPASS not fail on the
first run too.

Signed-off-by: Vee Agarwal <veethebee at google.com>
Signed-off-by: Jasper Tran O'Leary <jtranoleary at google.com>

Reviewed by:    delphij, markj
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D48968
DeltaFile
+16-9sys/dev/gve/gve_tx_dqo.c
+16-91 files

FreeBSD/src 62b2d0csys/dev/gve gve_main.c

gve: Fix memory leak during reset

Before this change, during reset we were allocating new memory for
priv->ptype_lut_dqo, irq_db_array and the counter_array over the old
memory. This change ensures we do not allocate new memory during reset
and avoid memory leaks.

Signed-off-by: Vee Agarwal <veethebee at google.com>
Signed-off-by: Jasper Tran O'Leary <jtranoleary at google.com>

Reviewed by:    delphij, markj
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D48970
DeltaFile
+41-8sys/dev/gve/gve_main.c
+41-81 files