]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
19 months agoldns: Disable -Warray-parameter warnings from GCC 12 on sha2.c.
John Baldwin [Wed, 28 Sep 2022 21:02:30 +0000 (14:02 -0700)]
ldns: Disable -Warray-parameter warnings from GCC 12 on sha2.c.

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D36758

(cherry picked from commit 5d27845e5a8b7324b91d6a6c2a63db2635671205)

19 months agolibc rpc: Fix mismatches in prototypes for array bounds.
John Baldwin [Wed, 28 Sep 2022 21:01:36 +0000 (14:01 -0700)]
libc rpc: Fix mismatches in prototypes for array bounds.

Various RPC functions used a bare pointer in function prototypes to
describe fixed-length buffer arguments but used a fixed-length array
in the function definition.  The manual page for these functions
describes the parameters as being fixed-length buffers, so update
the prototypes to match the definitions.

Reviewed by: imp, emaste
Reported by: GCC -Warray-parameter
Differential Revision: https://reviews.freebsd.org/D36757

(cherry picked from commit a2e41a585b3a8a54e09831ea476ccaa56142c1ae)

19 months agobsd.sys.mk: Add NO_WARRAY_PARAMETER helper variable.
John Baldwin [Wed, 28 Sep 2022 21:01:04 +0000 (14:01 -0700)]
bsd.sys.mk: Add NO_WARRAY_PARAMETER helper variable.

This variable expands to -Wno-array-parameter on GCC 11+.

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D36756

(cherry picked from commit 409dae262ffce0647ceb196193a34ad11e1e1edd)

19 months agozlib crc32: Add prototypes for recently-added static functions.
John Baldwin [Wed, 28 Sep 2022 21:00:27 +0000 (14:00 -0700)]
zlib crc32: Add prototypes for recently-added static functions.

This appeases -Wstrict-prototypes with GCC.  Using a separate
prototype using the OF macro seems to be consistent with the rest of
this file which still supports pre-ANSI C.

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D36755

(cherry picked from commit 7550e242ab4c118ba48171577ccadf81ba739847)

19 months agoipfilter: Cast uintmax_t values to size_t when adding to a pointer.
John Baldwin [Wed, 28 Sep 2022 20:58:34 +0000 (13:58 -0700)]
ipfilter: Cast uintmax_t values to size_t when adding to a pointer.

GCC warns about the mismatched sizes on 32-bit platforms where
uintmax_t is larger in size than a pointer.

Reviewed by: imp, cy
Differential Revision: https://reviews.freebsd.org/D36753

(cherry picked from commit 9c4f7e82348b656aef9660f859b76d6e894590aa)

19 months agontb: Use uintmax_t casts and %j to print physical addresses.
John Baldwin [Wed, 28 Sep 2022 20:56:31 +0000 (13:56 -0700)]
ntb: Use uintmax_t casts and %j to print physical addresses.

This fixes -Wint-to-pointer-cast errors with GCC when compiling on
i386 where physical addresses are not the same size as pointers.

Reviewed by: mav, imp
Differential Revision: https://reviews.freebsd.org/D36751

(cherry picked from commit 124e46735e07037afafbf0caa097faafb09c7329)

19 months agosplit: reset errno prior to getline()
Math Ieu [Thu, 27 Oct 2022 17:01:57 +0000 (12:01 -0500)]
split: reset errno prior to getline()

Something else may have set errno, breaking the post-getline() logic
that tries to detect the getline() error.  This was initially noted in
a jail on a system that has HPET, in a jail that does not expose
/dev/hpet0 -- we see an earlier error in libc's vdso bits.

Fixes: 5c053aa3c5e90 ("split: switch to getline() [...]")
(cherry picked from commit 172be8642d93851b0c083d0db240cf35fd56ab0e)

19 months agosplit: add word order fix
Kyle Evans [Tue, 25 Oct 2022 21:51:21 +0000 (16:51 -0500)]
split: add word order fix

This was meant to note that both pattern and line matching were
previously restricted, but words are difficult.  +line and rearrange.

Sponsored by: Klara, Inc.

(cherry picked from commit 7aaa50c6b58319ec948e8048fb165958bc47a356)

19 months agosplit: add some tests
Kyle Evans [Tue, 23 Aug 2022 02:08:03 +0000 (21:08 -0500)]
split: add some tests

This should cover all of the basic functionality, as well as the recent
enhancement to use a dynamic buffer size rather than limiting patterns
and lines to MAXBSIZE.

Reviewed by: bapt
Sponsored by: Klara, Inc.

(cherry picked from commit 75c3ca1ebf81224919f2b7a9edf2921ce76ea290)

19 months agosplit: switch to getline() for line/pattern matching
Kyle Evans [Tue, 23 Aug 2022 02:05:58 +0000 (21:05 -0500)]
split: switch to getline() for line/pattern matching

Get rid of split's home-grown logic for growing the buffer; arbitrarily
breaking at LONG_MAX bytes instead of 65536 bytes gives us much more
wiggle room.  Additionally, we'll actually fail out entirely if we can't
fit a line, which makes noticing this class of problem much easier.

Reviewed by: bapt, emaste, pauamma
Sponsored by: Klara, Inc.

(cherry picked from commit 5c053aa3c5e907bdd1ac466ce9b58611781c2c20)

19 months agotcp_bbr(4): Fix a typo in a source code comment
Gordon Bergling [Tue, 8 Nov 2022 13:59:56 +0000 (14:59 +0100)]
tcp_bbr(4): Fix a typo in a source code comment

- s/retranmitted/retransmitted/

(cherry picked from commit bcf8fb7f033a940d2ee403bcfbd03bdd2874012d)

19 months agopnfs.4: Fix a typo
Gordon Bergling [Tue, 8 Nov 2022 13:57:06 +0000 (14:57 +0100)]
pnfs.4: Fix a typo

- s/attrbute/attribute/

(cherry picked from commit 40b245af0f496f75a0396a88747474ced909fef5)

19 months agonfs: Fix common typos in source code comments
Gordon Bergling [Tue, 8 Nov 2022 13:58:32 +0000 (14:58 +0100)]
nfs: Fix common typos in source code comments

- s/attrbute/attribute/

(cherry picked from commit bf312482870fb663fac4446955ca6c3090d1e7f3)

19 months agovmm: Cherry pick illumos commit '13361 bhyve should mask RDT cpuid info'
Vitaliy Gusev [Thu, 30 Jun 2022 17:27:27 +0000 (10:27 -0700)]
vmm: Cherry pick illumos commit '13361 bhyve should mask RDT cpuid info'

Summary:
    commit  1a5f1879be09d3de900b2510692dd12003784d84
    Author: Patrick Mooney <pmooney@pfmooney.com>
    Date:   2020-12-16T20:02:23.000Z

        13361 bhyve should mask RDT cpuid info
        Reviewed by: Andy Fiddaman <andy@omnios.org>
        Reviewed by: Toomas Soome <tsoome@me.com>
        Approved by: Robert Mustacchi <rm@fingolfin.org>

    https://github.com/illumos/illumos-gate/commit/1a5f1879be09d3de900b2510692dd12003784d8

----

We saw similar warning of GP (on Intel Xeon CPU E5-2630 v4 and VM with Ubuntu 20.04 5.4.0-113-generic)  until this commit is applied:

```
[    1.658880] kernel: unchecked MSR access error: WRMSR to 0xc8f (tried to write 0x0000000000000000) at rIP: 0xffffffffacc735b4 (native_write_msr+0x4/0x30)
[    1.662734] kernel: Call Trace:
[    1.663885] kernel:  ? clear_closid_rmid.isra.0+0x36/0x40
[    1.665501] kernel:  resctrl_online_cpu+0xdc/0x3f0
[    1.666952] kernel:  ? __switch_to_asm+0x40/0x70
[    1.668358] kernel:  ? __switch_to+0x7f/0x480
[    1.669693] kernel:  ? cat_wrmsr+0x70/0x70
[    1.670970] kernel:  cpuhp_invoke_callback+0x9b/0x580
[    1.672541] kernel:  ? __schedule+0x2eb/0x740
[    1.673893] kernel:  cpuhp_thread_fun+0xb8/0x120
[    1.675304] kernel:  smpboot_thread_fn+0xd0/0x170
[    1.676685] kernel:  kthread+0x104/0x140
[    1.677948] kernel:  ? sort_range+0x30/0x30
[    1.679299] kernel:  ? kthread_park+0x90/0x90
[    1.680570] kernel:  ret_from_fork+0x35/0x40
[    1.682000] kernel: *** VALIDATE rdt ***
[    1.683454] kernel: resctrl: L3 monitoring detected
```

Reviewed by: markj, jhb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D35442

(cherry picked from commit 5afcca138f6b1f9d6413de586a0cf2baf16da764)

19 months agocxgbe: Use secq(9) to manage the timestamp generations.
John Baldwin [Mon, 26 Sep 2022 21:58:06 +0000 (14:58 -0700)]
cxgbe: Use secq(9) to manage the timestamp generations.

This is mostly cosmetic, but it also doesn't leave a gap of time where
no structures are valid.  Instead, we permit the ISR to continue to
use the previous structure if the write to update cal_current isn't
yet visible.

Reviewed by: gallatin
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D36669

(cherry picked from commit cee4fc7cada8244f375a6542f03d1f255c719bf1)

19 months agocxgbe: Compute timestamps via sbintime_t.
John Baldwin [Mon, 26 Sep 2022 21:57:26 +0000 (14:57 -0700)]
cxgbe: Compute timestamps via sbintime_t.

This uses fixed-point math already used elsewhere in the kernel for
sub-second time values.  To avoid overflows this does require updating
the calibration once a second rather than once every 30 seconds.  Note
that the cxgbe driver already queries multiple registers once a second
for the statistics timers.  This version also uses fewer instructions
with no branches (for the math portion) in the per-packet fast path.

Reviewed by: np
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D36663

(cherry picked from commit 2c74c9dac3a6e74a2c33d519cdcf1de145e7664c)

19 months agocxgbe(4): Fix potential integer overflow in t4_tstmp_to_ns.
Navdeep Parhar [Thu, 22 Sep 2022 15:57:25 +0000 (08:57 -0700)]
cxgbe(4): Fix potential integer overflow in t4_tstmp_to_ns.

Coverity flagged this in its latest run but it is not a problem in
practice as the card's core clock would have to be > 4.2GHz for any
overflow to occur.

CID 1498303:  Integer handling issues  (OVERFLOW_BEFORE_WIDEN)
Potentially overflowing expression "sc->params.vpd.cclk * 1000U" with type "unsigned int" (32 bits, unsigned) is evaluated using 32-bit arithmetic, and then used in a context that expects an expression of type "uint64_t" (64 bits, unsigned).

Reported by: Coverity Scan (CID 1498303)
Sponsored by: Chelsio Communications

(cherry picked from commit 02fac928ab687607786801cdf33f100c70cc6a2e)

19 months agocxgbe: fix kernel build without TCP_OFFLOAD or RATELIMIT
Konstantin Belousov [Wed, 21 Sep 2022 09:53:53 +0000 (12:53 +0300)]
cxgbe: fix kernel build without TCP_OFFLOAD or RATELIMIT

Reviewed by: np
Fixes: e398922eaf6
Sponsored by: Nvidia networking
Differential revision: https://reviews.freebsd.org/D36648

(cherry picked from commit 8d42019058ac96dbd8955ac28bb3dbc722587226)

19 months agocxgbe: fix the build after e398922eaf66978b5e556f6b4b095693c865f329
Mateusz Guzik [Tue, 20 Sep 2022 21:31:49 +0000 (21:31 +0000)]
cxgbe: fix the build after e398922eaf66978b5e556f6b4b095693c865f329

(cherry picked from commit d0b235c7152cde08c741f08e5e0834eb07651799)

19 months agoEnable M_TSTMP in Chelsio cxgbe driver by creating a mechanism that can sync the...
Randall Stewart [Tue, 20 Sep 2022 19:13:16 +0000 (15:13 -0400)]
Enable M_TSTMP in Chelsio cxgbe driver by creating a mechanism that can sync the time.

Chelsio has always been recording a timestamp in the mbuf (rcv_tstmp) but
not setting the M_TSTMP bit in the mbuf flags. This is because the timestamp
was just the free running 60bit clock. This change fixes that so that
we keep a synchronization by periodically (every 30 seconds after startup)
getting the timestamp and the current nanosecond time. We always keep
several sets around and the current one we always keep the current pair
and the previous pair of timestamps. This allows us to setup a ratio
between the two so we can correctly translate the time. Note that
we use special care to split the timestamp into seconds (per the clock tick)
and nanoseconds otherwise 64bit math would overflow.

Reviewed by: np
Sponsored by: Netflix Inc
Differential Revision: https://reviews.freebsd.org/D36315

(cherry picked from commit e398922eaf66978b5e556f6b4b095693c865f329)

19 months agobhyve virtio-scsi: Avoid out of bounds accesses to guest requests.
John Baldwin [Mon, 29 Aug 2022 22:36:11 +0000 (15:36 -0700)]
bhyve virtio-scsi: Avoid out of bounds accesses to guest requests.

- Ignore I/O requests with insufficiently sized input or output
  buffers (those not containing compete request headers).

- Ignore control requests with improperly sized buffers.

- While here, explicitly zero the output header of an I/O request to
  avoid leaking malloc garbage from the host if the header is not
  fully populated.

PR: 264521
Reported by: Robert Morris <rtm@lcs.mit.edu>
Reviewed by: mav, emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36271

(cherry picked from commit bb31aee26bd13307d97c5d5bf2b10bf05bdc18fd)

19 months agobhyve virtio-scsi: Tidy warning and debug prints.
John Baldwin [Mon, 29 Aug 2022 22:35:42 +0000 (15:35 -0700)]
bhyve virtio-scsi: Tidy warning and debug prints.

Use a consistent prefix ("virtio-scsi: ") similar to the e1000 device
model.

Reviewed by: mav, emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36270

(cherry picked from commit 62806a7f31e3b4813c4e6b70534c41f91bfe4e12)

19 months agobhyve e1000: Sanitize transmit ring indices.
John Baldwin [Mon, 29 Aug 2022 22:35:15 +0000 (15:35 -0700)]
bhyve e1000: Sanitize transmit ring indices.

When preparing to transmit pending packets, ensure that the head (TDH)
and tail (TDT) indices are in bounds.  Note that validating values
when they are written is not sufficient along as the transmit length
(TDLEN) could be changed turning a value that was valid when written
into an out of bounds value.

While here, add further restrictions to the head register (TDH).  The
manual states that writing to this value while transmit is enabled can
cause unexpected behavior and that it should only be written after a
reset.  As such, ignore attempts to write while transmit is active,
and also ignore writes of non-zero values.  Later e1000 chipsets have
this register as read-only.

Also ignore any attempts to transmit packets if the transmit ring's
size is zero.

PR: 264567
Reported by: Robert Morris <rtm@lcs.mit.edu>
Reviewed by: emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36269

(cherry picked from commit 7afe342dcb38b624488009bb6bdfa5337e628ffc)

19 months agocxgbe TOE TLS: Simplify a few routines.
John Baldwin [Mon, 8 Aug 2022 18:21:54 +0000 (11:21 -0700)]
cxgbe TOE TLS: Simplify a few routines.

Remove a few more remnants from the old pre-KTLS support and instead
assume that each work request sends a single TLS record.

Sponsored by: Chelsio Communications

(cherry picked from commit c6b3a3772c0872f625ebb43d6a334babc5def5f4)

19 months agocxgbe: Handle requests for TLS key allocations with no TLS key storage.
John Baldwin [Mon, 8 Aug 2022 18:21:54 +0000 (11:21 -0700)]
cxgbe: Handle requests for TLS key allocations with no TLS key storage.

If an adapter advertises support for TLS keys but an empty TLS key
storage area in on-board memory, fail the request rather than invoking
vmem_alloc on an uninitialized vmem.

Sponsored by: Chelsio Communications

(cherry picked from commit 1ca4f45ea89f10621bf7e9cfea1705d0a7940bea)

19 months agocxgbe: Rename t4_kern_tls.c to t6_kern_tls.c.
John Baldwin [Mon, 8 Aug 2022 18:21:53 +0000 (11:21 -0700)]
cxgbe: Rename t4_kern_tls.c to t6_kern_tls.c.

This implementation of NIC TLS is specific to T6 adapters.

Sponsored by: Chelsio Communications

(cherry picked from commit bbb2f537156b663560cb0a45933c0fafdd2525a3)

19 months agocxgbe: De-duplicate some of the code for managing TLS key contexts.
John Baldwin [Tue, 8 Jun 2021 18:11:51 +0000 (11:11 -0700)]
cxgbe: De-duplicate some of the code for managing TLS key contexts.

The NIC TLS and TOE TLS modes in cxgbe(4) both work with TLS key
contexts.  Previously, TOE TLS supported TLS key contexts created by
two different methods, and NIC TLS had a separate bit of code copied
from NIC TLS but specific to KTLS.  Now that TOE TLS only supports
KTLS, pull common code for creating TLS key contexts and programming
them into on-card memory into t4_keyctx.c.

Sponsored by: Chelsio Communications

(cherry picked from commit 18c69734e9ac74651ca794d3315ffc4b305ffc6e)

19 months agocxgbe tom: Remove orphaned function max_imm_tls_space().
John Baldwin [Wed, 16 Jun 2021 18:39:39 +0000 (11:39 -0700)]
cxgbe tom: Remove orphaned function max_imm_tls_space().

Reported by: markj
Fixes: 789f2d4b3f33 cxgbe tom: Remove support for non-KTLS TLS offload.
Sponsored by: Chelsio Communications

(cherry picked from commit 6e26b4f8f4f6a9dd2a3ef88050108925f83dc460)

19 months agocxgbe tom: Remove support for non-KTLS TLS offload.
John Baldwin [Fri, 28 May 2021 23:49:56 +0000 (16:49 -0700)]
cxgbe tom: Remove support for non-KTLS TLS offload.

TOE TLS offload was first supported via a customized OpenSSL developed
by Chelsio with proprietary socket options prior to KTLS being present
either in FreeBSD or upstream OpenSSL.  With the addition of KTLS in
both places, cxgbe's TOE driver was extended to support TLS offload
via KTLS as well.  This change removes the older interface leaving
only the KTLS bindings for TOE TLS.

Since KTLS was added to TOE TLS second, it was somehat shoe-horned
into the existing code.  In addition to removing the non-KTLS TLS
offload, refactor and simplify the code to assume KTLS, e.g. not
copying keys into a helper structure that mimic'ed the non-KTLS mode,
but using the KTLS session object directly when constructing key
contexts.

This also removes some unused code to send TX keys inline in work
requests for TOE TLS.  This code was never enabled, and was arguably
sending the wrong thing (it was not sending the raw key context as we
do for NIC TLS when using inline keys).

Sponsored by: Chelsio Communications

(cherry picked from commit 789f2d4b3f33d4414eaf0b4e7daef41e89d1b224)

19 months agodepend-cleanup.sh: Handle kqtest being renamed to kqueue_test.
John Baldwin [Thu, 14 Jul 2022 20:03:59 +0000 (13:03 -0700)]
depend-cleanup.sh: Handle kqtest being renamed to kqueue_test.

bmake will not think that object files such as read.o are out of date
due to common.h changing since the dependency is only recorded in
.depend.kqtest.read.o in an old object directory.

Reviewed by: markj
Fixes: 68fe988a40ca kqueue tests: Simplify the test runner
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D35820

(cherry picked from commit a985fad6e054cd66331956a8dbb20506c55189e5)

19 months agoxargs: fix exit code when using -P
liu-du [Sun, 16 Oct 2022 03:41:54 +0000 (03:41 +0000)]
xargs: fix exit code when using -P

currently when xargs runs in parallel mode (e.g. -P2), it somtimes
incorrectly returns zero exit code.  this commit fix it and also adds
tests.

Reviewed by: mjg
PR: 267110

(cherry picked from commit 0ca740d9a639ab635f5a28be9051d0124a9544a1)

19 months agobhyve: Document the "type" config variable for network device models.
John Baldwin [Thu, 30 Jun 2022 22:14:36 +0000 (15:14 -0700)]
bhyve: Document the "type" config variable for network device models.

(cherry picked from commit e5ed417bb442cddece6ffbd6f2ec87d70520241a)

19 months agobhyve virtio-net: Allow backend type to be explicitly specified.
Yan Ka Chiu [Thu, 30 Jun 2022 17:29:45 +0000 (10:29 -0700)]
bhyve virtio-net: Allow backend type to be explicitly specified.

Surrently virtio-net uses the prefix of the backing interface to
choose the backend.  This patch adds an additional option "type" to
choose the backend type explicitly.  This allows greater flexibility
for end users to manage bhyve specific resources (such as by naming
the tap interfaces to more descriptive names).  The option "type" is
optional.  When it is not presented, the backend is derived from the
name of the backend interface.

For example, the line `-s 3,virtio-net,bsdvm0,type=tap` will create a
virtio-net device for the guest using the tap interface "bsdvm0".

Adding a new "type" option preserves the current legacy format in which
the first value after virtio-net names an instance of a backend.

Note that tap interfaces not following the pattern "tap*" will not be
created on demand via devfs cloning but must be created explicitly.

Reviewed by: vmaffione, jhb
Differential Revision: https://reviews.freebsd.org/D35143

(cherry picked from commit b9c3e544c48e76dd01aa32e9b1f5cd4c1ad8532c)

19 months agocxgbei: Return limits for the specific adapter the socket is on.
John Baldwin [Mon, 18 Apr 2022 19:50:20 +0000 (12:50 -0700)]
cxgbei: Return limits for the specific adapter the socket is on.

Reviewed by: mav
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D34929

(cherry picked from commit 43d5661a9d0f44c73344e0f2fc094b7286987313)

19 months agoiscsi: Fetch limits based on a socket rather than assuming global limits.
John Baldwin [Mon, 18 Apr 2022 19:48:42 +0000 (12:48 -0700)]
iscsi: Fetch limits based on a socket rather than assuming global limits.

cxgbei needs the ability to return different limits based on the
connection (e.g. if the connection is over a T5 adapter or a T6
adapter as well as factoring in the MTU).

This change plumbs through the changes in the ioctls without changing
any of the backends.  The limits callback passed to icl_register now
accepts a second socket argument which holds the integer file
descriptor.  To support ABI compatiblity for old binaries, the
callback should return "global" values if the socket fd is zero.

The CTL_ISCSI_LIMITS argument used with CTL_ISCSI by ctld(8) now
accepts the socket fd in a field that was previously part of a
reserved spare field.  Old binaries zero this request which results in
passing a socket fd of 0 to the limits callback.

The ISCSIDREQUEST ioctl no longer returns limits.  Instead, iscsid(8)
invokes a new ISCSIDLIMITS ioctl after establishing the connection via
connect(2).  For ABI compat, if the old ISCSIDREQUEST is invoked, the
global limits are still fetched (with a socket fd of 0) and returned.

Reviewed by: mav
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D34928

(cherry picked from commit 7b02c1e8c6a17d11b69988f3e1b449b783785415)

19 months agoClang: Add Diags for targets pre to i686 for -fcf-protection
Ed Maste [Fri, 4 Nov 2022 15:59:49 +0000 (11:59 -0400)]
Clang: Add Diags for targets pre to i686 for -fcf-protection

Intel Control-flow Enforcement Technology (CET) provides new
instructions `endbr32/64` for the indirect branch control.
They are NOPs on i686 and new targets.  We need to check for that
in case it crashes on older targets.

PR: 264497, 267401
Reviewed by: dim
MFC after: 1 week
Obtained from: LLVM commit 52516782972730ff065a34123a9d8876da08c254
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37268

(cherry picked from commit 9c231325e77b1989c006daf083a3e9bd143c3d07)

19 months agomount_unionfs: remove jokey cautions from man page
Ed Maste [Mon, 31 Oct 2022 20:38:46 +0000 (16:38 -0400)]
mount_unionfs: remove jokey cautions from man page

There are known issues with unionfs, and the mount_unionfs man page has
a cautionary statement about its use.  The caution had additional
"humourous" statements like "BEWARE OF DOG" but they served only to
confuse the situation.  Remove them.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 6659516b1a47e34c184c62b8ad7982e5466db539)

19 months agoarm64 hwpmc: Support restricting counters to user or kernel mode.
John Baldwin [Fri, 11 Mar 2022 19:29:45 +0000 (11:29 -0800)]
arm64 hwpmc: Support restricting counters to user or kernel mode.

Support the "usr" and "os" qualifiers on arm64 events to restrict
event counting to either usermode or the kernel, respectively.  If
neither qualifier is given, events are counted in both.

Reviewed by: emaste
Sponsored by: University of Cambridge, Google, Inc.
Differential Revision: https://reviews.freebsd.org/D34527

(cherry picked from commit 6bb7ba4aa180f667c1b558de1fc364f41bab57ce)

19 months agoaarch64: Add constants for fields in the PMEVTYPERn_EL0 event registers.
John Baldwin [Fri, 11 Mar 2022 19:29:45 +0000 (11:29 -0800)]
aarch64: Add constants for fields in the PMEVTYPERn_EL0 event registers.

Reviewed by: andrew
Sponsored by: University of Cambridge, Google, Inc.
Differential Revision: https://reviews.freebsd.org/D34526

(cherry picked from commit 456d57a66d54dd365736536482660de99cf94a04)

19 months agoAdd more arm64 register op* and CR* values
Andrew Turner [Fri, 11 Mar 2022 11:19:05 +0000 (11:19 +0000)]
Add more arm64 register op* and CR* values

These will be used by bhyve/arm64.

Sponsored by: Innovate UK

(cherry picked from commit 4dc815608e1f3fbb6e1061eca86d7c7bc103a359)

19 months agoSort the M* and P* arm64 registers
Andrew Turner [Fri, 11 Mar 2022 10:31:05 +0000 (10:31 +0000)]
Sort the M* and P* arm64 registers

Sponsored by: Innovate UK

(cherry picked from commit 2abeef73004238d49f781b12b89e003ceb048018)

19 months agobhyve_config.5: Document gdb.address.
John Baldwin [Sat, 25 Sep 2021 17:07:18 +0000 (10:07 -0700)]
bhyve_config.5: Document gdb.address.

(cherry picked from commit 48759c4ed7f258baccd791c603baf22c8ddb1bb4)

19 months agobhyve: Update the -G description in the SYNPOSIS.
John Baldwin [Sat, 25 Sep 2021 17:01:43 +0000 (10:01 -0700)]
bhyve: Update the -G description in the SYNPOSIS.

It was missing both the 'w' flag and 'bind_address'.

(cherry picked from commit b70b050ab5e9368e6748e78cee38c3ecc4662c87)

19 months agobyhve: add option to specify IP address for gdb
Mariusz Zaborski [Thu, 19 Aug 2021 17:52:12 +0000 (19:52 +0200)]
byhve: add option to specify IP address for gdb

Allow user to specify the IP address available for gdb debugger.

Reviewed by: jhb, grehan, rgrimes, bcr (man pages)
Differential Revision: https://reviews.freebsd.org/D29607

(cherry picked from commit 2cdff9918e79dcd9bfcaa919b8364afa41cd1e02)

19 months agoRemove a write-only variable.
John Baldwin [Tue, 11 May 2021 21:56:23 +0000 (14:56 -0700)]
Remove a write-only variable.

While refactoring an earlier series of changes during review, the
'saved_data' variable stopped being used at the bottom of if_ioctl().

Suggested by: brooks
Reviewed by: brooks, imp, kib
Fixes: d17e0940f79f Rework compat shims in ifioctl().
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D30197

(cherry picked from commit ed93deba1106da2cd4755a61612c37bb67edc914)

19 months agoGroup all compat shim structures together to consolidate #ifdef's.
John Baldwin [Wed, 5 May 2021 20:59:09 +0000 (13:59 -0700)]
Group all compat shim structures together to consolidate #ifdef's.

Reviewed by: brooks, kib
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D29894

(cherry picked from commit 9c87db4b3c5b119809c7ff12d20ecbfd62f01996)

19 months agoUse thunks for compat ioctls using struct ifgroupreq.
John Baldwin [Wed, 5 May 2021 20:59:00 +0000 (13:59 -0700)]
Use thunks for compat ioctls using struct ifgroupreq.

Reviewed by: brooks, kib
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D29893

(cherry picked from commit 01e9cbc4c56d6eecc52f1e4547d56124243f0dd2)

19 months agoAdd freebsd32 compat shims for SIOC[GS]DRVSPEC.
John Baldwin [Wed, 5 May 2021 20:58:50 +0000 (13:58 -0700)]
Add freebsd32 compat shims for SIOC[GS]DRVSPEC.

Reviewed by: brooks, kib
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D29892

(cherry picked from commit d61d98f4ed68c5f6c81586a529057fe51fd50a60)

19 months agoRework compat shims in ifioctl().
John Baldwin [Wed, 5 May 2021 20:58:23 +0000 (13:58 -0700)]
Rework compat shims in ifioctl().

Centralize logic for handling compat ioctls into two blocks of code at
the start and end of the ioctl routine.  This avoids the conversion
logic being spread out both in multiple blocks in ifioctl as well as
various helper functions.

Reviewed by: brooks, kib
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D29891

(cherry picked from commit d17e0940f79fd96a2bf27413c1fe682dd8ee5bac)

19 months agoin6: Consolidate IN6_ARE_ADDR_EQUAL definitions
Mark Johnston [Wed, 2 Nov 2022 17:06:54 +0000 (13:06 -0400)]
in6: Consolidate IN6_ARE_ADDR_EQUAL definitions

It is ok to use memcmp() in the kernel.  No functional change intended.

Reviewed by: glebius, melifaro
MFC after: 1 week
Sponsored by: Modirum MDPay
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D37028

(cherry picked from commit 0d5d356b3649c2fba70bd8d657920620223831d3)

19 months agogetsockopt.2: Clarify the SO_REUSEPORT_LB text a bit
Mark Johnston [Wed, 2 Nov 2022 17:01:59 +0000 (13:01 -0400)]
getsockopt.2: Clarify the SO_REUSEPORT_LB text a bit

Refer to sockets rather than processes, since one can have multiple
sockets in a load-balancing group within the same process.

MFC after: 1 week
Sponsored by: Modirum MDPay
Sponsored by: Klara, Inc.

(cherry picked from commit d0f8e31761b7de6010e8b3ed49a1a5f9fc5726f7)

19 months agolibsysdecode: Match socket option names containing underscores
Mark Johnston [Wed, 2 Nov 2022 17:01:22 +0000 (13:01 -0400)]
libsysdecode: Match socket option names containing underscores

MFC after: 1 week
Sponsored by: Modirum MDPay
Sponsored by: Klara, Inc.

(cherry picked from commit 34c8598eb1bb101976d311051f9e630a6dfb6a0f)

19 months agoping_test: Fix tests ping_46 and ping6_46
Jose Luis Duran [Wed, 2 Nov 2022 11:43:40 +0000 (08:43 -0300)]
ping_test: Fix tests ping_46 and ping6_46

If no IPv4-host, IPv4-mcast-group or IPv6-host is passed, it will
display the usage.  The tests are passing because they are just checking
that the exit code is 1.

Fix the tests by checking the appropriate output message.

While here, change the description to match the output and add the
missing requirements.

Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D37250

(cherry picked from commit d481443acb1c77610ac50a226f402e4629a608fb)

19 months agoping_test: Code cleanup
Jose Luis Duran [Mon, 31 Oct 2022 08:23:33 +0000 (05:23 -0300)]
ping_test: Code cleanup

Mostly style fixes.

Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D37248

(cherry picked from commit fcae0b54d1339e2bafc52e419023297773d9b241)

19 months agoping: main.c: Consistent use of white space/tabs
Jose Luis Duran [Tue, 1 Nov 2022 05:19:22 +0000 (02:19 -0300)]
ping: main.c: Consistent use of white space/tabs

If a user has tabs set at a value other than 8, the output of the usage
may not be consistently aligned.

    % tabs -2

Before:
    % ping
    usage:
      ping [-4AaDdfHnoQqRrv] [-C pcp] [-c count] [-G sweepmaxsize]
          [-g sweepminsize] [-h sweepincrsize] [-i wait] [-l preload]
          [-M mask | time] [-m ttl] [-P policy] [-p pattern] [-S src_addr]
          [-s packetsize] [-t timeout] [-W waittime] [-z tos] IPv4-host
      ping [-4AaDdfHLnoQqRrv] [-C pcp] [-c count] [-I iface] [-i wait]
          [-l preload] [-M mask | time] [-m ttl] [-P policy] [-p pattern]
          [-S src_addr] [-s packetsize] [-T ttl] [-t timeout] [-W waittime]
                [-z tos] IPv4-mcast-group
      ping [-6AaDdfHnNoOquvyY] [-b bufsiz] [-c count] [-e gateway]
                [-I interface] [-i wait] [-k addrtype] [-l preload] [-m hoplimit]
                [-p pattern] [-P policy] [-S sourceaddr] [-s packetsize] [-t timeout]
          [-W waittime] [-z tclass] [IPv6-hops ...] IPv6-host

After:
    % ping
    usage:
      ping [-4AaDdfHnoQqRrv] [-C pcp] [-c count] [-G sweepmaxsize]
          [-g sweepminsize] [-h sweepincrsize] [-i wait] [-l preload]
          [-M mask | time] [-m ttl] [-P policy] [-p pattern] [-S src_addr]
          [-s packetsize] [-t timeout] [-W waittime] [-z tos] IPv4-host
      ping [-4AaDdfHLnoQqRrv] [-C pcp] [-c count] [-I iface] [-i wait]
          [-l preload] [-M mask | time] [-m ttl] [-P policy] [-p pattern]
          [-S src_addr] [-s packetsize] [-T ttl] [-t timeout] [-W waittime]
          [-z tos] IPv4-mcast-group
      ping [-6AaDdfHnNoOquvyY] [-b bufsiz] [-c count] [-e gateway]
          [-I interface] [-i wait] [-k addrtype] [-l preload] [-m hoplimit]
          [-p pattern] [-P policy] [-S sourceaddr] [-s packetsize] [-t timeout]
          [-W waittime] [-z tclass] [IPv6-hops ...] IPv6-host

Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D37246

(cherry picked from commit 526e8a7d5db390d1cbf490d8e1e0b41e057d81bf)

19 months agoping: Remove a vestigial notdef
Jose Luis Duran [Tue, 1 Nov 2022 08:01:36 +0000 (05:01 -0300)]
ping: Remove a vestigial notdef

It was once a function on 4.3BSD, pr_type() [1], used to convert an ICMP
"type" field to a printable string.  In 4.4BSD it was superseded by
pr_icmph() [2].

NetBSD [3] and OpenBSD [4] have already removed it.

[1]: https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.3BSD/usr/src/etc/ping.c
[2]: https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/src/sbin/ping/ping.c
[3]: https://github.com/NetBSD/src/commit/203dfd34867991fd002f747d74a96f26ae80d41c
[4]: https://github.com/openbsd/src/commit/9bbbbbb75d24e3d166ddd0cb6cb4417b78561309

Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D37247

(cherry picked from commit 909e2e1b6c340af2581be30aaa38bc8d97c55532)

19 months agompt(4): Fix two typos in debug statements
Gordon Bergling [Sat, 4 Jun 2022 18:41:15 +0000 (20:41 +0200)]
mpt(4): Fix two typos in debug statements

- s/Intermidiate/Intermediate/

Obtained from: NetBSD

(cherry picked from commit 00b0158d2ca6f0405468c2338d823091963c18ed)

19 months agoipfw: Have NAT steal the TH_RES1 bit, instead of the TH_AE bit
Richard Scheffenegger [Wed, 9 Nov 2022 09:54:34 +0000 (10:54 +0100)]
ipfw: Have NAT steal the TH_RES1 bit, instead of the TH_AE bit

The NAT module use of the tcphdr.th_x2 field now collides with the
use of this TCP header flag as AccECN (AE) bit. Use the topmost
bit instead to allow negotiation of AccECN across a NAT device.

Event: IETF 115 Hackathon
Reviewed By: #transport, tuexen
MFC after: 3 days
Approved by: re (gjb, early-MFC)
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D37300

(cherry picked from commit 0b00b801493aa1d4996b0891ea58fbef343f85df)

19 months agointro.3: Document 'libstdthreads' (the ISO C11 '<threads.h>' library).
Gordon Bergling [Mon, 7 Nov 2022 10:34:00 +0000 (11:34 +0100)]
intro.3: Document 'libstdthreads' (the ISO C11 '<threads.h>' library).

It's still relatively uncommon to see C11 '<threads.h>' being used,
but it's worth documenting, especially since FreeBSD requires a
different library for C11 threads  compared to glibc (part of '-lpthread')
or musl libc  (included by default).

PR: 267551
Submitted by: Alois Klink <alois plus freebsd at aloisklink dot com>
Reviewed by: pauamma
Differential Revision: https://reviews.freebsd.org/D37284

(cherry picked from commit 8a220816c72261efce304568498279fdda6b57cb)

19 months agore.4: Mention vendor driver for if_re(4)
Johannes Totz [Mon, 7 Nov 2022 12:16:52 +0000 (13:16 +0100)]
re.4: Mention vendor driver for if_re(4)

If this if_re(4) is causing problems then an updated driver from
the vendor can be found in the ports tree under net/realtek-re-kmod.

Reviewed by: debdrup, koobs, emaste
Differential Revision: https://reviews.freebsd.org/D33677

(cherry picked from commit a9a35c9e35370d09be5cbcd32f287b12f40812a5)

19 months agoReenable basic_signal:trap_signal_test on i386
Li-Wen Hsu [Thu, 25 Aug 2022 04:09:00 +0000 (12:09 +0800)]
Reenable basic_signal:trap_signal_test on i386

This is fixed in dc4a2d1d0e838579f21d9d1fef8655f902f06ab2

PR: 265889
Sponsored by: The FreeBSD Foundation
MFC with: dc4a2d1d0e838579f21d9d1fef8655f902f06ab2

(cherry picked from commit 9ea2716b7758b72725b932f1ad9f3457a69cbea6)

19 months agobridge tests: re-enable span test
Kristof Provost [Wed, 2 Nov 2022 10:58:04 +0000 (11:58 +0100)]
bridge tests: re-enable span test

The root cause of the intermittent span test failures has been
identified as a race between sending the packet and starting the bpf
capture.
This is now resolved, so the test can be re-enabled.

PR: 260461
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit e1274b5b2646a49c1e3efce6c9918c99716d3c07)

19 months agotests: make sniffer more robust
Kristof Provost [Wed, 2 Nov 2022 10:55:39 +0000 (11:55 +0100)]
tests: make sniffer more robust

The Sniffer class is often used by test tools such as pft_ping to verify
that packets actually get sent where they're expected.

It starts a background thread to capture packets, but this thread needs
some time to start, leading to intermittent test failures when the
capture doesn't start before the relevant packet is sent.

Add a semaphore to ensure the Sniffer constructor doesn't return until
the capture is actually running.

PR: 260461
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 67557372dfef87eb94681a97a4157198efe21992)

19 months agovmm: do not leak halted_cpus bit after suspension
Konstantin Belousov [Mon, 31 Oct 2022 23:30:55 +0000 (01:30 +0200)]
vmm: do not leak halted_cpus bit after suspension

PR: 267468

(cherry picked from commit 4d447b30f7be761b0c2877513e79f484511a00a5)

19 months agogrep: correct argument name in man page
Elvin Aslanov [Tue, 1 Nov 2022 14:07:56 +0000 (18:07 +0400)]
grep: correct argument name in man page

MFC after: 1 week
Fixes: 4dc88ebedf94 ("Add BSD grep to the base system...")
Pull Request: https://github.com/freebsd/freebsd-src/pull/622

(cherry picked from commit 085a42d0cff1a446e8a0eab1471970093e5235de)

19 months agonetgraph/ng_bridge: add missing array terminator
Kristof Provost [Mon, 31 Oct 2022 08:47:01 +0000 (09:47 +0100)]
netgraph/ng_bridge: add missing array terminator

PR: 267457
Reported by: Robert Morris <rtm@lcs.mit.edu>
MFC after: 1 week

(cherry picked from commit 23559c9d0dc2fb81115bc02c33a0103219f3fb55)

19 months agosmartpqi(4): Fix two typos in kernel error messages
Gordon Bergling [Tue, 25 Oct 2022 11:17:20 +0000 (13:17 +0200)]
smartpqi(4): Fix two typos in kernel error messages

- s/runnning/running/

(cherry picked from commit d53e97bb5490cdedb37bd4e25646c5379b196c93)

19 months agoMake SYNOPSIS match DESCRIPTION.
Pau Amma [Sun, 5 Jun 2022 18:05:25 +0000 (18:05 +0000)]
Make SYNOPSIS match DESCRIPTION.

While there, fix nits reported by igor and mandoc -T lint.

Differential Revision: https://reviews.freebsd.org/D35405

Reviewed by: debdrup, gbe, gjb

Approved by: gjb (mentor)

MFC after: 3 days

(cherry picked from commit 5cc5c9254da048dae5c5ade622405e51dc8a3862)

19 months agotools/build/make.py: fix cross build on Fedora Linux
Alfredo Dal'Ava Junior [Tue, 1 Nov 2022 23:59:58 +0000 (20:59 -0300)]
tools/build/make.py: fix cross build on Fedora Linux

Fedora defines shell functions for some commands used by FreeBSD build
scripts. Unortunatelly it makes them behave incorrectly for our purposes.

For instance 'which which' returns something like:

which ()
{
    ( alias;
    eval ${which_declare} ) | /usr/bin/which --tty-only --read-alias ...
}

instead of

/usr/bin/which

This patch unsets those functions to restore original/expected behavior

Reviewed by: emaste, imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D36900

(cherry picked from commit b7ac17b48bdfc688b54b29aa4feacb535c91aec2)

19 months agobhyve: Handle snapshots of unconfigured virtio-net devices
Vitaliy Gusev [Sun, 23 Oct 2022 18:47:56 +0000 (14:47 -0400)]
bhyve: Handle snapshots of unconfigured virtio-net devices

In case of device reset or not configured - features_negotiated is not
set, calling calling pci_vtnet_neg_features is wrong and resume gets
"Segmentation fault".

Reviewed by: markj
Sponsored by: vStack
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D36244

(cherry picked from commit 3b5e5ce87bc885f35100d77b31ac81d3f98342bf)

19 months agointr_event(9): document intr_event_handle()
Mitchell Horne [Sun, 30 Oct 2022 14:02:20 +0000 (11:02 -0300)]
intr_event(9): document intr_event_handle()

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

(cherry picked from commit 334fc46f05b4e149b8e23dbce0147a86caf3a8b0)

19 months agoddb: print the actual syscall name
Mitchell Horne [Fri, 28 Oct 2022 21:20:05 +0000 (18:20 -0300)]
ddb: print the actual syscall name

Some architectures will pretty-print a system call trap in the
backtrace. Rather than printing the symbol, use the syscallname()
function to pull the string from the sv_syscallnames array corresponding
to the process. This simplifies the function somewhat.

Mostly, this will result in dropping the "sys" prefix, e.g. "sys_exit"
will now be printed simply as "exit".

Make two minor tweaks to the function signature: use a u_int for the
syscall number since this is a more correct type (see the 'code' member
of struct syscall_args), and make the thread pointer the first argument.
The latter is more natural and conventional.

Suggested by:   jrtc27
Reviewed by: jrtc27, markj, jhb
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37200

(cherry picked from commit aba921bd9e1869dae9ae4cc6e0c048f997401034)

19 months agolinux: populate sv_syscallnames in each sysentvec
Mitchell Horne [Fri, 28 Oct 2022 21:19:39 +0000 (18:19 -0300)]
linux: populate sv_syscallnames in each sysentvec

This allows the syscallname() function to give a usable result for Linux
ABIs.

Reported by: jrtc27
Reviewed by: jrtc27, markj, jhb
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37199

(cherry picked from commit 1da65dcb1c57fae7be75ddf1bd300ddf19ced850)
(cherry picked from commit f396f9b6c96f6d68d4e3606ddb090287230fc565)

19 months agolinux, linux64: improve SRCS formatting
Mitchell Horne [Sat, 29 Oct 2022 15:28:16 +0000 (12:28 -0300)]
linux, linux64: improve SRCS formatting

Sort the entries alphabetically, and list them with one entry per line.
This makes the diffs much cleaner when adding or removing a new entry,
as I will do in the next commit.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 331784880821c6aa55188d0950e98d898c42203c)

19 months agoriscv: decode syscall in ddb backtrace
Mitchell Horne [Sun, 2 Oct 2022 22:47:24 +0000 (19:47 -0300)]
riscv: decode syscall in ddb backtrace

This presents the existing information in a slightly more readable way.

Reviewed by: jrtc27, markj, jhb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D36565

(cherry picked from commit 791bfa60e8ac85381d449bae5caa0999950a7039)

19 months agoddb: de-duplicate decode_syscall()
Mitchell Horne [Sun, 2 Oct 2022 22:46:00 +0000 (19:46 -0300)]
ddb: de-duplicate decode_syscall()

Only i386 and amd64 print the decoded syscall name in the backtrace.
This de-duplication facilitates further changes and adoption by other
platforms.

Reviewed by: jrtc27, markj, jhb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D36565

(cherry picked from commit 754cb545b68ba0a1643792763d000018ffe2afec)
(cherry picked from commit 6f8a182b15c4c14cfb9462b806a928ddaf47c87e)
(cherry picked from commit 89e5ef8917af900558c2d275f5d5c4c703520ead)
(cherry picked from commit 85b715baae22ca12f2d24e1b2980f3d5b32937b8)

19 months agossh: correct parse_cert_times case for hex "to" time
Ed Maste [Thu, 3 Nov 2022 13:44:52 +0000 (09:44 -0400)]
ssh: correct parse_cert_times case for hex "to" time

This appeared to be a copy-paste error from the "from" time case above.

Reported by: Coverity Scan
CID: 1500407
Reviewed by: markj
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37252

(cherry picked from commit 0657b2325df3d85967870a928d58b24ffcf3f1ea)

19 months agotee.1: Add a HISTORY section
Gordon Bergling [Sun, 30 Oct 2022 10:29:59 +0000 (11:29 +0100)]
tee.1: Add a HISTORY section

The most accurate information I have found is that
tee(1) first appeared in Version 7 AT&T UNIX.

Reviewed by: pauamma
Differential Revision: https://reviews.freebsd.org/D37206

(cherry picked from commit 514df63539db57d356e81f63369ca1a894c253e1)

19 months agostrfmon: Remove XXX marks
Jose Luis Duran [Fri, 28 Oct 2022 09:20:33 +0000 (06:20 -0300)]
strfmon: Remove XXX marks

(cherry picked from commit f0a15aafcb863f796e2a7f94d0fd8a857fb56103)

19 months agostrfmon_l: Use specified locale for number formatting
Jose Luis Duran [Fri, 28 Oct 2022 01:24:48 +0000 (22:24 -0300)]
strfmon_l: Use specified locale for number formatting

(cherry picked from commit 621bf91893ad96c2ec46e603bf4c5b8762e3f730)

19 months agostrfmon_test: Add a test for strfmon_l
Jose Luis Duran [Fri, 28 Oct 2022 02:53:43 +0000 (23:53 -0300)]
strfmon_test: Add a test for strfmon_l

(cherry picked from commit 29972f06f95d6f5f550ac81367d5ebda8d6860a8)

19 months agostrfmon_test: Reserve space for the null terminator
Jose Luis Duran [Thu, 27 Oct 2022 10:01:24 +0000 (07:01 -0300)]
strfmon_test: Reserve space for the null terminator

(cherry picked from commit edcee003e5a79386653c8092af3577a112e95451)

19 months agostrfmon_l(3): Add name to the man page
Jose Luis Duran [Fri, 28 Oct 2022 08:29:16 +0000 (05:29 -0300)]
strfmon_l(3): Add name to the man page

(cherry picked from commit d96088b3ab5f5b833a78ff363f540cc5fa2c1e78)

19 months agoarm64: Implement cpu_ptrace().
Olivier Houchard [Thu, 27 Oct 2022 21:25:59 +0000 (23:25 +0200)]
arm64: Implement cpu_ptrace().

Add a minimal implementation of cpu_ptrace() for arm64. It is only used to
get/set VFP registers for 32bits binaries, as it is apparently what we use
there, instead of the MI PT_GETFPREGS/PT_SETFPREGS.

PR: 267361
MFC After: 1 week

(cherry picked from commit d78c2cd831d346b94c00c72b5a94a1a4f0dd3e53)
Signed-off-by: Olivier Houchard <cognet@FreeBSD.org>
19 months agonxprtc: Fix timing issue with register access.
Tetsuya Uemura [Fri, 4 Nov 2022 21:49:52 +0000 (15:49 -0600)]
nxprtc: Fix timing issue with register access.

My Adafruit PCF8523 RTC on either RPi2B or RPi3B+ failed to work around
80 ~ 90 % of boot-ups, by printing the following log lines.

nxprtc0: <NXP PCF8523 RTC> at addr 0xd0 on iicbus0
nxprtc0: cannot set up timer
Warning: no time-of-day clock registered, system time will not be set accurately

This is due to pcf8523_start_timer(sc) returned non-zero in
nxprtc_start() due to a register read failure of PCF8523_R_TMR_A_FREQ or
PCF8523_R_TMR_CLKOUT or a failure to program a new value.

The pause_sbt("nxpbat") sleep was too short and caused the register
access failures.

PR: 266093
(cherry picked from commit e2386f18eca2f6f75f7c5c2d49d603e3d2674509)

20 months agoif_vxlan(4): Check the size of data available in mbuf before using them
Zhenlei Huang [Fri, 30 Sep 2022 07:55:29 +0000 (09:55 +0200)]
if_vxlan(4): Check the size of data available in mbuf before using them

PR: 261711
Reviewed by: kp
Tested by: Alfa (burak.sn at outlook.com)
Approved by: kp (mentor)
Differential Revision: https://reviews.freebsd.org/D36794

(cherry picked from commit 8707cb19e68128c181477d87f960182c14e15f12)

20 months agoxilinx: Fix a typo in a source code comment
Gordon Bergling [Tue, 1 Nov 2022 07:00:53 +0000 (08:00 +0100)]
xilinx: Fix a typo in a source code comment

- s/interrut/interrupt/

(cherry picked from commit 34fcce0087f394e869c4bf097552398a01da580e)

20 months agoisci(4): Fix a typo in a source code comment
Gordon Bergling [Tue, 1 Nov 2022 06:58:26 +0000 (07:58 +0100)]
isci(4): Fix a typo in a source code comment

- s/interrutp/interrupt/

(cherry picked from commit 5014dc958f0f3b7ba0c0a6ff84faa45151af51ac)

20 months agoisci(4): Fix common typos in source code comments
Gordon Bergling [Tue, 1 Nov 2022 07:34:11 +0000 (08:34 +0100)]
isci(4): Fix common typos in source code comments

- s/assinged/assigned/

(cherry picked from commit 816d5c1e98ffb71b20edce010050e0803b150e02)

20 months agobxe(4): Fix a typo in a source code comment
Gordon Bergling [Tue, 1 Nov 2022 06:55:55 +0000 (07:55 +0100)]
bxe(4): Fix a typo in a source code comment

- s/interrutps/interrupts/

(cherry picked from commit e902e62644eebea1ae9b0679ab71a669f3596004)

20 months agobhyve: Make sure that the VNC version is initialized
Mark Johnston [Thu, 27 Oct 2022 14:46:36 +0000 (10:46 -0400)]
bhyve: Make sure that the VNC version is initialized

clang warned that "client_ver" can be left uninitialized.  This change
causes the new connection to be dropped if a version string is not
presented.

Reviewed by: jhb

(cherry picked from commit 04336c0562488080300e68157ada5bc8eae71e54)

20 months agobhyve: Fix an apparent pointer arithmetic bug in the xhci emulation
Mark Johnston [Thu, 27 Oct 2022 14:46:53 +0000 (10:46 -0400)]
bhyve: Fix an apparent pointer arithmetic bug in the xhci emulation

Also remove the out-parameter of pci_xhci_find_stream(), since it's
unused by all callers.

Reviewed by: jhb

(cherry picked from commit a309ad7bd1230353da3d7c98afd850c1e9427944)

20 months agoIncrease MAX_APIC_ID safeguard to 0x800
Ed Maste [Thu, 20 Oct 2022 13:04:37 +0000 (09:04 -0400)]
Increase MAX_APIC_ID safeguard to 0x800

MAX_APIC_ID must be at least twice MAXCPU.  Increase it to 0x800 so that
it is possible to set MAXCPU to 512 or 1024 in a custom kernel config
file.

Note that increasing this limit does not itself cause any allocations
to be larger; it just allows madt_parse_cpu() to process higher APIC
IDs.

APIC IDs may be sparse and so we can waste memory.  This is independent
of this change, but becomes more of an issue as the maximum APIC ID
grows.  This should be addressed with future work.

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

(cherry picked from commit c8113dad7ed4024376901a834fc239d754292049)

20 months agoarm64: fix build without FDT
Kyle Evans [Thu, 29 Sep 2022 19:33:33 +0000 (14:33 -0500)]
arm64: fix build without FDT

static_kenv is only used under `FDT`, and `try_load_dtb` is only defined
with `FDT`.

Reviewed by: andrew, imp, manu

(cherry picked from commit 78f3c734a5b755ceb47fea220e94755c8e82bd67)

20 months agoextres: regulator: fix the build without FDT
Kyle Evans [Thu, 29 Sep 2022 19:33:33 +0000 (14:33 -0500)]
extres: regulator: fix the build without FDT

The regnode interface is currently only built for FDT, thus not
applicable to ACPI-only kernels.  Move the "regnode_if.h" include
underneath a previously existing FDT cpp segment.

Reviewed by: andrew, imp, manu

(cherry picked from commit 23c318ed86c4b4e6c474823a944f5fb9f2f1c2fd)

20 months agoarm64: coresight: fix the build without FDT
Kyle Evans [Thu, 29 Sep 2022 19:33:33 +0000 (14:33 -0500)]
arm64: coresight: fix the build without FDT

coresight_cpu_debug only has an FDT attachment, so let's not build it
for kernels without FDT.

coresight.h includes sys/malloc.h via header pollution
dev/ofw/openfirm.h; include it directly in case we're building without
FDT.

Reviewed by: andrew, manu

(cherry picked from commit b4c2a5b689864430583eee96e449519db15911b9)

20 months agoextres: syscon: pull in sys/malloc.h (fix !FDT)
Kyle Evans [Thu, 29 Sep 2022 19:33:32 +0000 (14:33 -0500)]
extres: syscon: pull in sys/malloc.h (fix !FDT)

syscon currently includes sys/malloc.h via header pollution from
dev/ofw/ofw_bus.h -> dev/ofw/openfirm.h.  Fix the build without FDT
defined by including sys/malloc.h directly.

Reviewed by: andrew, imp, manu

(cherry picked from commit 79794d5c18b7df9458b3c609a189bf2159e234e4)

20 months agouart: uart_cpu_arm64: fix the build without FDT
Kyle Evans [Thu, 29 Sep 2022 19:33:32 +0000 (14:33 -0500)]
uart: uart_cpu_arm64: fix the build without FDT

clang 14 doesn't properly determine that we're unconditionally returning
if we have ACPI but not FDT.  Push FDT setup entirely into a new
function, much like we currently do with ACPI, and just return ENXIO if
that doesn't succeed.

Reviewed by: andrew, manu (earlier version)

(cherry picked from commit 4a4ad02da3c8f598b4ccf15b6cac9de3ebce3ba1)

20 months agousb: musb_otg_allwinner: de-constify bus_space_tags
Mitchell Horne [Tue, 27 Sep 2022 16:18:42 +0000 (11:18 -0500)]
usb: musb_otg_allwinner: de-constify bus_space_tags

The SAN interceptors simply take a bus_space_tag_t, so we're
dropping qualifiers here.  const semantics with a ptr typedef mean we'd
have to drop or change the bus_space_tag_t abstraction used in the SAN
sanitizers in order to make a compatible change there, which likely
isn't worth it.

Reviewed by: andrew, markj
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.

(cherry picked from commit 26d786331bf85c172318badf28b0a5094ad25022)

20 months agokasan: disable kasan_mark() after a violation
Mitchell Horne [Tue, 27 Sep 2022 16:01:02 +0000 (11:01 -0500)]
kasan: disable kasan_mark() after a violation

Specifically, when we receive a violation and we're configured to panic,
kasan_enabled gets unset before we descend into panic().  At this point,
there's no longer any reason to allow marking as kasan_shadow_check() is
disabled -- we have some inherent risk of faulting or panicking if the
system's in a bad enough state with no benefit.

Reviewed by: markj
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.

(cherry picked from commit f2963b530e17c5eff66bc5f4860b1cd224d3d033)