]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agocxgbe(4): Avoid unsafe hardware access in the ifmedia ioctls.
Navdeep Parhar [Fri, 11 Feb 2022 23:37:17 +0000 (15:37 -0800)]
cxgbe(4): Avoid unsafe hardware access in the ifmedia ioctls.

The hardware is unavailable when the device is suspended or in the
middle of a reset.

MFC after: 1 week
Sponsored by: Chelsio Communications

2 years agoCast pointer to uintptr_t to avoid alignment warnings.
John Baldwin [Sat, 12 Feb 2022 00:04:52 +0000 (16:04 -0800)]
Cast pointer to uintptr_t to avoid alignment warnings.

Both struct ip and struct udphdr both have an aligment of 2, but the
cast from struct ip to a uint32_t pointer confused GCC 9 into raising
the required alignment to 4 and then raising a
-Waddress-of-packed-member error when casting to struct udphdr.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D31941

2 years agoktls: Write-lock the INP when changing a transmit TLS session.
John Baldwin [Fri, 11 Feb 2022 23:16:25 +0000 (15:16 -0800)]
ktls: Write-lock the INP when changing a transmit TLS session.

The TCP rate pacing code relies on being able to read this pointer
safely while holding an INP lock.  The initial TLS session pointer is
set while holding the write lock already.

Reviewed by: gallatin, hselasky
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D34086

2 years agovdso linker scripts: explicitly specify output arch and target
Konstantin Belousov [Thu, 3 Feb 2022 14:38:15 +0000 (16:38 +0200)]
vdso linker scripts: explicitly specify output arch and target

Requested by: jhb
Reviewed by: emaste, imp, jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D34157

2 years agolinuxkpi xarray: Correct expression in assertion.
John Baldwin [Fri, 11 Feb 2022 21:59:27 +0000 (13:59 -0800)]
linuxkpi xarray: Correct expression in assertion.

Reported by: GCC -Wparantheses
Reviewed by: wulf, hselasky
Differential Revision: https://reviews.freebsd.org/D34197

2 years agorescue: Link with -lncursesw instead of -lncursesw_real.
John Baldwin [Fri, 11 Feb 2022 21:58:59 +0000 (13:58 -0800)]
rescue: Link with -lncursesw instead of -lncursesw_real.

ld.bfd fails to link rescue with undefined symbol errors otherwise.

This reverts commit b158d4d7a12fad8e9c4509466d5f1ebd15862d9f.

Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D34123

2 years agocleankernel: A target to delete the kernel compile file
Warner Losh [Fri, 11 Feb 2022 19:50:51 +0000 (12:50 -0700)]
cleankernel: A target to delete the kernel compile file

With the meta-build, it's always a NO_CLEAN build. Provide a way to
remove so one can rebuild from scratch. 'cleankernel' will delete the
kernel and modules object directories. Document this in build(7).

Sponsored by: Netflix
Reviewed by: debdrup, markj
Differential Revision: https://reviews.freebsd.org/D32978

2 years agoucred.9: fix typo
Johan Jansson [Fri, 11 Feb 2022 16:46:37 +0000 (18:46 +0200)]
ucred.9: fix typo

PR: 261889
MFC after: 3 days

2 years agortld: Add ${TOKEN} aliases to $TOKEN
Konstantin Belousov [Fri, 11 Feb 2022 13:46:05 +0000 (15:46 +0200)]
rtld: Add ${TOKEN} aliases to $TOKEN

it seems that glibc supports them, and such spelling is mentioned in the
ld.bfd manual. Idea seems to auto-correct some quoting/makefile sytnax
errors on linker command line.

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

2 years agortld: make token substitution table-driven
Konstantin Belousov [Fri, 11 Feb 2022 13:44:36 +0000 (15:44 +0200)]
rtld: make token substitution table-driven

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

2 years agoMakefile.inc1: synthesize PKG_ABI from newvers.sh variables
Ed Maste [Thu, 10 Feb 2022 20:42:05 +0000 (15:42 -0500)]
Makefile.inc1: synthesize PKG_ABI from newvers.sh variables

Previously we inspected ${WSTAGEDIR}/usr/bin/uname to determine PKG_ABI,
but the file will not exist in some cases - for example, if building
only kernel packages.  We can instead synthesize the PKG_ABI from
information already provided by newvers.sh.

Reviewed by: kevans, manu (both earlier rev)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34249

2 years agocache: improve vnode vs name assertion in cache_enter_time
Mateusz Guzik [Wed, 9 Feb 2022 20:41:24 +0000 (21:41 +0100)]
cache: improve vnode vs name assertion in cache_enter_time

2 years agocache: remove NOCACHE handling from cache_fplookup_noentry
Mateusz Guzik [Wed, 9 Feb 2022 20:39:28 +0000 (21:39 +0100)]
cache: remove NOCACHE handling from cache_fplookup_noentry

It was copy-pasted from locked lookup. As LOOKUP operation cannot have
the flag set it was always ending up setting MAKEENTRY.

2 years agofd: make fget_unlocked take a thread argument
Mateusz Guzik [Fri, 11 Feb 2022 12:02:02 +0000 (12:02 +0000)]
fd: make fget_unlocked take a thread argument

Just like other fget routines. This enables embedding fd table pointer
in struct thread, avoiding taking a trip through proc.

2 years agofd: elide one acquire fence in fget_unlocked_seq
Mateusz Guzik [Tue, 1 Feb 2022 16:58:12 +0000 (17:58 +0100)]
fd: elide one acquire fence in fget_unlocked_seq

Still validate we got the stable state before returning an error though.

2 years agofd: split fget_unlocked_seq depending on CAPABILITIES
Mateusz Guzik [Fri, 11 Feb 2022 11:54:34 +0000 (11:54 +0000)]
fd: split fget_unlocked_seq depending on CAPABILITIES

This will simplify an upcoming change.

2 years agofd: split fget_cap depending on CAPABILITIES
Mateusz Guzik [Fri, 11 Feb 2022 11:45:57 +0000 (11:45 +0000)]
fd: split fget_cap depending on CAPABILITIES

This will simplify an upcoming change.

2 years agotty: switch ttyhook_register to use fget_cap_locked
Mateusz Guzik [Fri, 11 Feb 2022 12:00:25 +0000 (12:00 +0000)]
tty: switch ttyhook_register to use fget_cap_locked

It is still wrong-ish as fget* funcs don't expect to operate on abitrary
file descriptor tables, but this at least moves it out of the way of an
upcoming change while being bug-compatible.

2 years agoEmploy thread_cow_synced in setrlimit
Mateusz Guzik [Tue, 1 Feb 2022 13:22:22 +0000 (14:22 +0100)]
Employ thread_cow_synced in setrlimit

In order to avoid proc lock/unlock on next kernel entry.

2 years agoAdd PROC_COW_CHANGECOUNT and thread_cow_synced
Mateusz Guzik [Tue, 1 Feb 2022 13:13:13 +0000 (14:13 +0100)]
Add PROC_COW_CHANGECOUNT and thread_cow_synced

Combined they can be used to avoid a proc lock/unlock cycle in the
syscall handler for curthread, see upcoming examples.

2 years agoAdd lim_cowsync, similar to crcowsync
Mateusz Guzik [Tue, 1 Feb 2022 13:10:21 +0000 (14:10 +0100)]
Add lim_cowsync, similar to crcowsync

2 years agostress2: Added a regression test
Peter Holm [Fri, 11 Feb 2022 08:47:25 +0000 (09:47 +0100)]
stress2: Added a regression test
PR:     261707

2 years agolsvfs: one last style nit missed in 946585179dc4
Kyle Evans [Thu, 10 Feb 2022 22:13:35 +0000 (16:13 -0600)]
lsvfs: one last style nit missed in 946585179dc4

Space after `for`.

Sponsored by: Klara, Inc.

2 years agoriscv: Add static asssert for context size
Warner Losh [Thu, 10 Feb 2022 21:27:15 +0000 (14:27 -0700)]
riscv: Add static asssert for context size

Add a static assert for the siginfo_t, mcontext_t and ucontext_t
sizes. These are de-factor ABI options and cannot change size ever.

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

2 years agopowerpc: Add static asssert for context size
Warner Losh [Thu, 10 Feb 2022 21:27:08 +0000 (14:27 -0700)]
powerpc: Add static asssert for context size

Add a static assert for the siginfo_t, mcontext_t and ucontext_t
sizes. These are de-facto ABI options and cannot change size ever. For
powerpc64, also add asserts for {u,m}mcontext32_t and siginfo32.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D34213

2 years agoamd64: Add static asssert for context size
Warner Losh [Thu, 10 Feb 2022 21:27:01 +0000 (14:27 -0700)]
amd64: Add static asssert for context size

Add a static assert for the siginfo_t, mcontext_t and ucontext_t
sizes. These are de-facto ABI options and cannot change size ever.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D34212

2 years agoi386: Add static asssert for context size
Warner Losh [Thu, 10 Feb 2022 21:26:53 +0000 (14:26 -0700)]
i386: Add static asssert for context size

Add a static assert for the siginfo_t, mcontext_t and ucontext_t
sizes. These are de-facto ABI options and cannot change size ever.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D34211

2 years agoarm: Add static asssert for context size
Warner Losh [Thu, 10 Feb 2022 21:26:46 +0000 (14:26 -0700)]
arm: Add static asssert for context size

Add a static assert for the siginfo_t, mcontext_t and ucontext_t
sizes. These are de-facto ABI options and cannot change size ever.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D34210

2 years agoaarch64: Add static asssert for context size
Warner Losh [Thu, 10 Feb 2022 21:26:26 +0000 (14:26 -0700)]
aarch64: Add static asssert for context size

Add a static assert for the siginfo{,32}_t, mcontext{,32}_t and
ucontext{,32}_t sizes. These are de-facto ABI options and cannot change
size ever.

Reviewed by: kib, andrew, jhb
Differential Revision: https://reviews.freebsd.org/D32958

2 years agounionfs: fix typo in comment
Jason A. Harmening [Thu, 10 Feb 2022 21:14:11 +0000 (15:14 -0600)]
unionfs: fix typo in comment

I deleted the wrong word when writing up a comment in a prior change;
the covered vnode may be recursed during any unmount, not just forced
unmount.

2 years agolibthr: Disable stack unwinding on ARM.
John Baldwin [Thu, 10 Feb 2022 20:47:08 +0000 (12:47 -0800)]
libthr: Disable stack unwinding on ARM.

When a thread exits, _Unwind_ForcedUnwind() is used to walk up stack
frames executing pending cleanups pushed by pthread_cleanup_push().
The cleanups are popped by thread_unwind_stop() which is passed as a
callback function to _Unwind_ForcedUnwind().

LLVM's libunwind uses a different function type for the callback on
32-bit ARM relative to all other platforms.  The previous unwind.h
header (as well as the unwind.h from libcxxrt) use the non-ARM type on
all platforms, so this has likely been broken on 32-bit arm since it
switched to using LLVM's libunwind.

For now, just disable stack unwinding on 32-bit arm to unbreak the
build until a proper fix is tested.

2 years agoctfconvert: Rip out STABS support
Mark Johnston [Thu, 10 Feb 2022 20:36:19 +0000 (15:36 -0500)]
ctfconvert: Rip out STABS support

It is unused on FreeBSD and complicates some efforts to modify the CTF
format to permit wider type IDs, so remove it.  No functional change
intended.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agolibctf: Rip out CTFv1 support
Mark Johnston [Thu, 10 Feb 2022 20:32:23 +0000 (15:32 -0500)]
libctf: Rip out CTFv1 support

CTFv1 was obsolete before libctf was imported into FreeBSD, and
ctfconvert/ctfmerge can emit only CTFv2.  Make ctf.h a bit easier to
maintain by ripping v1 support out.  No functional change intended.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agotcp: Avoid conditionally defined fields in union lro_address
Mark Johnston [Thu, 10 Feb 2022 20:31:26 +0000 (15:31 -0500)]
tcp: Avoid conditionally defined fields in union lro_address

The layout of the structure ends up depending on whether the including
file includes opt_inet.h and opt_inet6.h, so different compilation units
can end up seeing different versions of the structure.  Fix this by
unconditionally defining the address fields.

As a side effect, this eliminates some duplication in the kernel's CTF
type graph.

Reviewed by: rscheff, tuexen
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34242

2 years agobin/df: allow -t option to be used together with -l
Stefan Eßer [Thu, 10 Feb 2022 20:09:34 +0000 (21:09 +0100)]
bin/df: allow -t option to be used together with -l

The df command provides a -l option to exclude all non-local file
systems and a -t option with a (positive or negative) list of file
system types to display.

This commit adds support for a combination of -l and -t. If both are
specified, the parameter list of the -t option is applied on top of
the selection of öocal file systems (independently of the order of
the -l and -t options).

E.g., "df -t noprocfs,sysfs -l" will select all local file systems
except those of type procfs and sysfs.

PR: 260921
Approved by: imp
Relnotes: yes
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D33748

2 years agorc: Allow the removal of firstboot_sentinel on read-only file systems
Jose Luis Duran [Thu, 10 Feb 2022 19:42:36 +0000 (12:42 -0700)]
rc: Allow the removal of firstboot_sentinel on read-only file systems

NanoBSD or, more generally, systems with root_rw_mount="NO" are not able
to remove the firstboot_sentinel file, typically /firstboot, because the
logic in /etc/rc is currently inverted.

When checkyesno root_rw_mount tests on a read-only file system, the
return is 1, hence avoiding the option to mount the system read-write.

Restore the ability to remove the firstboot_sentinel file on read-only
mounted file systems.

This change was introduced in 40adda8665bb, and partially fixed in
1ce07411fae8.

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

2 years agorc: Remove extra whitespace
Jose Luis Duran [Thu, 10 Feb 2022 19:42:33 +0000 (12:42 -0700)]
rc: Remove extra whitespace

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

2 years agonanobsd: Recursively copy fat partition
Jose Luis Duran [Thu, 10 Feb 2022 19:42:25 +0000 (12:42 -0700)]
nanobsd: Recursively copy fat partition

We have a directory structure for the FAT partition now with EFI and DTC
overlays, so we need to recursively copy it.

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

2 years agoDisable clang 14 warning about bitwise operators in one more place
Dimitry Andric [Thu, 10 Feb 2022 18:48:31 +0000 (19:48 +0100)]
Disable clang 14 warning about bitwise operators in one more place

Follow up 5f2aca839400, where I missed the -Werror warning still being
emitted in libsa.

Fixes: 5f2aca839400
MFC after: 3 days

2 years agolibctf: Use ctf_type_t instead of struct ctf_type
Mark Johnston [Wed, 9 Feb 2022 14:38:03 +0000 (09:38 -0500)]
libctf: Use ctf_type_t instead of struct ctf_type

For consistency with other CTF toolchain code.  No functional change
intended.

Fixes: 105fd928b0b5 ("libctf: Improve check for duplicate SOU definitions in ctf_add_type()")
MFC after: 1 week

2 years agoInstall unwind.h into /usr/include
John Baldwin [Thu, 10 Feb 2022 17:57:49 +0000 (18:57 +0100)]
Install unwind.h into /usr/include

Install headers from LLVM's libunwind in place of the headers from
libcxxrt and allow C applications to use the library.

As part of this, remove include/unwind.h and switch libthr over to
using the installed unwind.h.

Reviewed by: dim, emaste
MFC after: 10 days
Differential Revision: https://reviews.freebsd.org/D34065

2 years agolsvfs: restyle, no functional change
Kyle Evans [Thu, 10 Feb 2022 17:20:24 +0000 (11:20 -0600)]
lsvfs: restyle, no functional change

Namely:
- main was using two-space indentation
- re-sort local variables
- explicit braces for loop scope
- make flag bit comparison explicit

The first line of this commit message is unfortunately a lie, as it
introduces a minor functional change on non-FreeBSD systems.  Namely,
the first branch is now explicitly compared against `0` and the choice
was made to compare it as greater than 0 to avoid issues on other
systems where `argc != 0` on entry isn't guaranteed (negative when
checked there).

Sponsored by: Klara, Inc.

2 years agotcp: Add/update AccECN related statistics and numbers
Richard Scheffenegger [Wed, 9 Feb 2022 23:19:55 +0000 (00:19 +0100)]
tcp: Add/update AccECN related statistics and numbers

Reserve couters in the tcps struct in preparation
for AccECN, extend the debugging output for TF2
flags, optimize the syncache flags from individual
bits to a codepoint for the specifc ECN handshake.

This is in preparation of AccECN.

No functional chance except for extended debug
output capabilities.

Reviewed By: #transport, rrs
Sponsored by:        NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D34161

2 years agoFix gzip compressed core dumps on big endian architectures
Justin Hibbits [Thu, 10 Feb 2022 15:21:36 +0000 (09:21 -0600)]
Fix gzip compressed core dumps on big endian architectures

The gzip trailer words (size and CRC) are both little-endian per the spec.

MFC after: 3 days
Sponsored by: Juniper Networks, Inc.

2 years agoRevert "vm_pageout_scans: correct detection of active object"
Konstantin Belousov [Thu, 10 Feb 2022 14:50:42 +0000 (16:50 +0200)]
Revert "vm_pageout_scans: correct detection of active object"

This reverts commit 3de96d664aaaf8e3fb1ca4fc4bd864d2cf734b24.

Problem is that it is possible to reach the state with ref_count ==
1 for the mapped non-anonymous object. For instance, anonymous posix
shmfd or linux shmfs object could be mapped, and then corresponding
file descriptor closed, dropping the object reference owned by the
shmfd/shmfs file.  Then the check in inactive scan assumes that the
object and page are not mapped and frees the page, while they are not.

PR: 261707
Discussed with: markj
Sponsored by: The FreeBSD Foundation
MFC after: now

2 years agokldxref: add R_PPC_ADDR32 handler
Alfredo Dal'Ava Junior [Thu, 10 Feb 2022 15:12:04 +0000 (12:12 -0300)]
kldxref: add R_PPC_ADDR32 handler

Implements R_PPC_ADDR32 handler for kldxref, addressing
"kldxref: unhandled relocation type 1" when running
"kldxref /boot/kernel" on powerpc 32 bits.

Reviewed by: luporl
MFC after: 2 days
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D33745

2 years agomlx5ib: Add support for parsing udata in mlx5_ib_create_flow().
Hans Petter Selasky [Thu, 10 Feb 2022 10:13:36 +0000 (11:13 +0100)]
mlx5ib: Add support for parsing udata in mlx5_ib_create_flow().

Backport from Linux 5.17 (drivers/infiniband/hw/mlx5/fs.c)

This fixes creating flow rules from user-space after the
kernel space update based on Linux 5.7-rc1 .

Sponsored by: NVIDIA Networking

2 years agomlx5en: Make sure the NIC IP addresses are written to firmware on link up.
Hans Petter Selasky [Thu, 10 Feb 2022 10:12:21 +0000 (11:12 +0100)]
mlx5en: Make sure the NIC IP addresses are written to firmware on link up.

Fixes e059c120b4223fd5ec3af9def21c0519f439fe57 .

PR: 261746
MFC after: 1 day
Sponsored by: NVIDIA Networking

2 years agotcpsso.8: Add a history section to the manpage
Gordon Bergling [Thu, 10 Feb 2022 08:27:42 +0000 (09:27 +0100)]
tcpsso.8: Add a history section to the manpage

Mention that the tcpsso command first appeard in FreeBSD 14.

2 years agoAnnotate geom_md with MODULE_VERSION
Kyle Evans [Thu, 10 Feb 2022 06:15:29 +0000 (00:15 -0600)]
Annotate geom_md with MODULE_VERSION

This was missed in 74d6c131cbe2 where other geom modules were annotated
with MODULE_VERSION.  Again, the problem is the same: we can't detect
that geom_md is loaded into the kernel without it.

This was noticed in release builds on the cluster; mdconfig attempts to
load geom_md because it can't detect it in the kernel, but the cluster
config includes md(4) and does not build the kmod.  This problem would
have been masked on hosts with the kmod built, as the kmod attempts to
register the g_md module and fails.  With this commit, mdconfig would
not even try to load it again.

Reported by: re (cperciva)
MFC after: 3 days

2 years agodtrace: remove unnecessary fflush()
Chuck Silvers [Thu, 10 Feb 2022 01:09:26 +0000 (17:09 -0800)]
dtrace: remove unnecessary fflush()

This call was added back in the early days of dtrace porting and
no one knows why anymore.  The extra flushing causes lots of
unnecessary CPU overhead when a script produces lots of output,
as well as easily losing output because the command can't keep up.

Sponsored by: Netflix
Reviewed by: imp, markj
Differential Revision: https://reviews.freebsd.org/D34216

2 years agoInvert CPU arch test for LLDB default
Ed Maste [Wed, 9 Feb 2022 00:45:25 +0000 (19:45 -0500)]
Invert CPU arch test for LLDB default

LLDB currently defaults to enabled on all architectures except arm and
riscv64 (and can probably be enabled for 32-bit arm).  Switch to an
opt-out list.

Reviewed by: pkubaj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34218

2 years agolibarchive: import changes from upstream
Martin Matuska [Wed, 9 Feb 2022 23:35:42 +0000 (00:35 +0100)]
libarchive: import changes from upstream

Libarchive 3.6.0

New features:
PR #1614: tar: new option "--no-read-sparse"
PR #1503: RAR reader: filter support
PR #1585: RAR5 reader: self-extracting archive support

New features (not used in FreeBSD base):
PR #1567: tar: threads support for zstd (#1567)
PR #1518: ZIP reader: zstd decompression support

Security Fixes:
PR #1491, #1492, #1493, CVE-2021-36976:
   fix invalid memory access and out of bounds read in RAR5 reader
PR #1566, #1618, CVE-2021-31566:
   extended fix for following symlinks when processing the fixup list

Other notable bugfixes and improvements:
PR #1620: tar: respect "--ignore-zeros" in c, r and u modes
PR #1625: reduced size of application binaries

MFC after: 2 weeks
Relnotes: yes

2 years agonfsd: Reply NFSERR_SEQMISORDERED for bogus seqid argument
Rick Macklem [Wed, 9 Feb 2022 23:17:50 +0000 (15:17 -0800)]
nfsd: Reply NFSERR_SEQMISORDERED for bogus seqid argument

The ESXi NFSv4.1 client bogusly sends the wrong value
for the csa_sequence argument for a Create_session operation.
RFC8881 requires this value to be the same as the sequence
reply from the ExchangeID operation most recently done for
the client ID.

Without this patch, the server replies NFSERR_STALECLIENTID,
which is the correct response for an NFSv4.0 SetClientIDConfirm
but is not the correct error for NFSv4.1/4.2, which is
specified as NFSERR_SEQMISORDERED in RFC8881.
This patch fixes this.

This change does not fix the issue reported in the PR, where
the ESXi client loops, attempting ExchangeID/Create_session
repeatedly.

Reported by: asomers
Tested by: asomers
PR: 261291
MFC after: 1 week

2 years agoFix non-printable characters in NVMe model and serial numbers.
Kenneth D. Merry [Mon, 24 Jan 2022 21:19:25 +0000 (16:19 -0500)]
Fix non-printable characters in NVMe model and serial numbers.

The NVMe 1.4 spec simply says that Model and Serial numbers are
ASCII strings.  Unlike SCSI, it doesn't prohibit non-printable
characters or say that the strings should be padded with spaces.

Since 2014, we have had cam_strvis_sbuf(), which gives additional
options for handling non-ASCII characters.  That behavior hasn't
been available for non-sbuf consumers, so users of cam_strvis()
were left with having octal ASCII codes inserted.

So, to avoid having garbage or octal chracters in the strings, use
cam_strvis_sbuf() to create a new function, cam_strvis_flag(), and
re-implement cam_strvis() using cam_strvis_flag().

Now, for the NVMe drives, we can use cam_strvis_flag with the
CAM_STRVIS_FLAG_NONASCII_SPC flag.  This transforms non-printable
characters into spaces.

sys/cam/cam.c:
Add a new function, cam_strvis_flag(), that creates an sbuf
on the stack with the user's destination buffer, and calls
cam_strvis_sbuf() with the given flag argument.

Re-implement cam_strvis() to call cam_strvis_flag with the
CAM_STRVIS_FLAG_NONASCII_ESC argument.  This should be the
equivalent of the old cam_strvis() function, except for the
overhead of creating the sbuf and calling sbuf_putc/printf.

sys/cam/cam.h:
Declaration for cam_strvis_flag.

sys/cam/nvme/nvme_all.c:
In nvme_print_ident, use the NONASCII_SPC flag with
cam_strvis_flag().

sys/cam/nvme/nvme_da.c:
In ndaregister(), use cam_strvis_flag() with the
NONASCII_SPC flag for the disk description and serial
number we report to GEOM.

sys/cam/nvme/nvme_xpt.c:
In nvme_probe_done(), use cam_strvis_flag with the
NONASCII_SPC flag when storing the drive serial number
in the CAM EDT.

MFC after: 1 week
Sponsored by: Spectra Logic
Differential Revision: https://reviews.freebsd.org/D33973

2 years agosysctlbyname(): restore access to user variables
Stefan Eßer [Wed, 9 Feb 2022 21:56:00 +0000 (22:56 +0100)]
sysctlbyname(): restore access to user variables

The optimization of sysctlbyname() in commit d05b53e0baee7 had the
side-effect of not going through the fix-up for the user.* variables
in the previously called sysctl() function.

This lead to 0 or an empty strings being returned by sysctlbyname()
for all user.* variables.

An alternate implementation would store the user variables in the
kernel during system start-up. That would allow to remove the fix-up
code in the C library that is currently required to provide the actual
values.

This update restores the previous code path for the user.* variables
and keeps the performance optimization intact for all other variables.

Approved by: mjg
Reviewed by: kaktus
Differential Revision: https://reviews.freebsd.org/D34171

2 years agoEnable -Wdate-time warning
Ed Maste [Wed, 9 Feb 2022 22:10:03 +0000 (17:10 -0500)]
Enable -Wdate-time warning

This produces an "expansion of date or time macro is not reproducible"
warning or error upon use of __DATE__ or __TIME__.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29580

2 years agosnd_hda: Add some ATI HDMI codec IDs.
Alexander Motin [Wed, 9 Feb 2022 21:27:15 +0000 (16:27 -0500)]
snd_hda: Add some ATI HDMI codec IDs.

Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after: 1 week

2 years agoopps my patch lost the removal of the tlp_threshold counter increments
Randall Stewart [Wed, 9 Feb 2022 21:19:22 +0000 (16:19 -0500)]
opps my patch lost the removal of the tlp_threshold counter increments

2 years agocleanup of rack variables.
Randall Stewart [Wed, 9 Feb 2022 21:08:32 +0000 (16:08 -0500)]
cleanup of rack variables.

During a recent deep dive into all the variables so I could
discover why stack switching caused larger retransmits I examined
every variable in rack. In the process I found quite a few bits
that were not used and needed cleanup. This update pulls
out all the unused pieces from rack. Note there are *no* functional
changes here, just the removal of unused variables and a bit of
spacing clean up.

Reviewed by: Michael Tuexen, Richard Scheffenegger
Sponsored by: Netflix Inc.
Differential Revision: https://reviews.freebsd.org/D34205

2 years agopciconf: Fix PCIS_CRYPTO_ENTERTAIN copy/paste.
Alexander Motin [Wed, 9 Feb 2022 20:56:30 +0000 (15:56 -0500)]
pciconf: Fix PCIS_CRYPTO_ENTERTAIN copy/paste.

Submitted by:   Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after: 1 week

2 years agotcpsso: fix typo in man page
Michael Tuexen [Wed, 9 Feb 2022 20:16:42 +0000 (21:16 +0100)]
tcpsso: fix typo in man page

Reported by: maxim
Sponsored by: Netflix, Inc.

2 years agong pppoe(4): Add the required NET_EPOCH section to the hook
Aleksandr Fedorov [Wed, 9 Feb 2022 19:00:50 +0000 (22:00 +0300)]
ng pppoe(4): Add the required NET_EPOCH section to the hook
disconnection function.

Disconnecting hooks are called outside of NET_EPOCH, but
ng_pppoe_disconnect() calls NG_SEND_DATA_ONLY() which should be called
in NET_EPOCH.

PR: 257067
Reported by: niels=freebsd@bakker.net
Reviewed by: vmaffione (mentor), glebius, donner
Approved by: vmaffione (mentor), glebius, donner
Sponsored by: vstack.com
Differential Revision: https://reviews.freebsd.org/D34185

2 years agoin_pcb.c: fix compilation of an IPv4 only configuration
Michael Tuexen [Wed, 9 Feb 2022 18:53:39 +0000 (19:53 +0100)]
in_pcb.c: fix compilation of an IPv4 only configuration

While there, remove a duplicate inclusion of sysctl.h.

Reported by: Gary Jennejohn
Fixes: a35bdd4489b9 - main - tcp: add sysctl interface for setting socket options
Sponsored by: Netflix, Inc.

2 years agocrunchgen: remove -dc from linker invocation
Fangrui Song [Wed, 9 Feb 2022 00:59:53 +0000 (19:59 -0500)]
crunchgen: remove -dc from linker invocation

In GNU ld and ld.lld, -dc is used with -r to allocate space to COMMON
symbols.  It is presumably to work around legacy code which cannot
handle COMMON symbols in relocatable output.  ld.lld may remove -dc or
make it a no-op for the 15.0.0 release.

As of 7420b323a014 crunch/crunchide does not require -dc, as the symbol
hiding technique no longer relied on making symbols local.

In addition -fno-common is now the default in Clang and GCC, so -dc
serves no purpose as the compiler does not generate COMMON symbols
anyway.

See https://maskray.me/blog/2022-02-06-all-about-common-symbols for more
detail on common symbols.

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

2 years agousr.sbin: add tcpsso to Makefile
Michael Tuexen [Wed, 9 Feb 2022 18:22:18 +0000 (19:22 +0100)]
usr.sbin: add tcpsso to Makefile

2 years agousr.sbin: add tcpsso
Michael Tuexen [Wed, 9 Feb 2022 18:14:25 +0000 (19:14 +0100)]
usr.sbin: add tcpsso

tcpsso is a command line tool to apply a socket option to an
existing TCP endpoint, which is identified by the inp_gencnt.
tcpsso can be used, for example, to switch the congestion control
module or the TCP stack.

Reviewed by: rrs, rscheff, debdrup, pau amma
Relnotes: yes
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D34139

2 years agoMerge bmake-20220208
Simon J. Gerraty [Wed, 9 Feb 2022 17:25:03 +0000 (09:25 -0800)]
Merge bmake-20220208

        * unit-tests/Makefile: disable opt-debug-x-trace on Linux if there
        is any chance we have dash as .SHELL

        * meta.c: use a variable to hold command line to be filtered
        to avoid any side effects from content of command line.

Merge commit '535c59a6a9214436f5d6643775d29808e4b3408d'

2 years agoImport bmake-20220208
Simon J. Gerraty [Wed, 9 Feb 2022 17:22:21 +0000 (09:22 -0800)]
Import bmake-20220208

* unit-tests/Makefile: disable opt-debug-x-trace on Linux if there
is any chance we have dash as .SHELL

* meta.c: use a variable to hold command line to be filtered
to avoid any side effects from content of command line.

2 years agobhyve/snapshot: switch to nvlist for snapshot requests
Robert Wing [Wed, 9 Feb 2022 17:11:57 +0000 (08:11 -0900)]
bhyve/snapshot: switch to nvlist for snapshot requests

Switch to using an nvlist with nvlist_send()/nvlist_recv() to
communicate from bhyvectl(8) to bhyve(8).

The idea is that a bhyve process receives a command with with a set of
arguments. The nvlist here is structured to reflect that premise.

For example, to snapshot the vm, the expected nvlist looks like:

    { cmd=START_CHECKPOINT, filename="filename" }

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D33977

2 years agoUpdate vendor/libarchive libarchive/libarchive@9147def1d
Martin Matuska [Wed, 9 Feb 2022 13:11:38 +0000 (14:11 +0100)]
Update vendor/libarchive libarchive/libarchive@9147def1d

Libarchive 3.6.0

New features:
  PR #1614: tar: new option "--no-read-sparse"
  PR #1503: RAR reader: filter support
  PR #1585: RAR5 reader: self-extracting archive support

New features (not used in FreeBSD base):
  PR #1567: tar: threads support for zstd (#1567)
  PR #1518: ZIP reader: zstd decompression support

Security Fixes:
  PR #1491, #1492, #1493, CVE-2021-36976:
    fix invalid memory access and out of bounds read in RAR5 reader
  PR #1566, #1618, CVE-2021-31566:
    extended fix for following symlinks when processing the fixup list

Other notable bugfixes and improvements:
  PR #1620: tar: respect "--ignore-zeros" in c, r and u modes
  PR #1625: reduced size of application binaries

Obtained from: libarchive
Libarchive commit: 9147def1da7ad1bdd47b3559eb1bfeeb0e0f374b
Libarchive tag: v3.6.0

2 years agotcp: add sysctl interface for setting socket options
Michael Tuexen [Wed, 9 Feb 2022 11:24:41 +0000 (12:24 +0100)]
tcp: add sysctl interface for setting socket options

This interface allows to set a socket option on a TCP endpoint,
which is specified by its inp_gencnt. This interface will be
used in an upcoming command line tool tcpsso.

Reviewed by: glebius, rrs
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D34138

2 years agotcp: fix compliation when KERN_TLS is not defined
Michael Tuexen [Wed, 9 Feb 2022 11:16:43 +0000 (12:16 +0100)]
tcp: fix compliation when KERN_TLS is not defined

Reported by: Gary Jennejohn
Fixes: fd7daa727126 - main - tcp: make tcp_ctloutput_set() non-static
Sponsored by: Netflix, Inc.

2 years agoocs_fc: Fix a possible Null pointer dereference
Ram Kishore Vegesna [Wed, 9 Feb 2022 10:14:12 +0000 (15:44 +0530)]
ocs_fc: Fix a possible Null pointer dereference

Fix a possible Null pointer dereference in ocs_hw_get_profile_list_cb()

PR: 261453
Reported by: lwhsu

MFC after: 3 days

2 years agocron.8: Add periodic(8) to See Also
Mateusz Piotrowski [Wed, 9 Feb 2022 10:49:23 +0000 (11:49 +0100)]
cron.8: Add periodic(8) to See Also

2 years agovt: fix splash_cpu logos use of vd_drawrect
Stefan Grundmann [Wed, 9 Feb 2022 03:15:53 +0000 (22:15 -0500)]
vt: fix splash_cpu logos use of vd_drawrect

In the (extremely unlikely) case of vd->vd_height ==
vt_logo_sprite_height the vd_drawrect code would write outside of
frame-buffer memory.

MFC after: 1 week
Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D34220

2 years agobmake: make opt-debug-x-trace broken on Linux
Ed Maste [Wed, 9 Feb 2022 01:18:04 +0000 (20:18 -0500)]
bmake: make opt-debug-x-trace broken on Linux

It fails during GitHub cross-build actions from Ubuntu 20.04.

sjg investigated and found it is a dash bug; a more extensive change
to handle this case will come in the next bmake update.

Reviewed by: sjg
Differential Revision: https://reviews.freebsd.org/D34219

2 years agosrc.conf: regenerate
Piotr Kubaj [Wed, 9 Feb 2022 01:35:35 +0000 (02:35 +0100)]
src.conf: regenerate

2 years agopowerpc64le: enable CXGBETOOL and MLX5TOOL
Piotr Kubaj [Wed, 9 Feb 2022 01:13:54 +0000 (02:13 +0100)]
powerpc64le: enable CXGBETOOL and MLX5TOOL

While mlx5 is not yet enabled on powerpc64le, cxgbe is.
The binary seems to work properly.

Differential revision: https://reviews.freebsd.org/D34026
Reviewed by: emaste

2 years agotest-includes: Simplify $OBJDIR requirements
Warner Losh [Wed, 9 Feb 2022 00:23:31 +0000 (17:23 -0700)]
test-includes: Simplify $OBJDIR requirements

s=/=_=g in tested names so that all the objects live in $OBJDIR. This is
more robust than depending on side effects of auto OBJDIR features and
should fix buildworld issues some people have seen.

Suggested by: sjg@
Sponsored by: Netflix

2 years agotcp: make tcp_ctloutput_set() non-static
Michael Tuexen [Tue, 8 Feb 2022 17:49:44 +0000 (18:49 +0100)]
tcp: make tcp_ctloutput_set() non-static

tcp_ctloutput_set() will be used via the sysctl interface in a
upcoming command line tool tcpsso.

Reviewed by: glebius, rscheff
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D34164

2 years agoDisable clang 14 warning about bitwise operators in zstd
Dimitry Andric [Tue, 8 Feb 2022 20:46:03 +0000 (21:46 +0100)]
Disable clang 14 warning about bitwise operators in zstd

Parts of zstd, used in openzfs and other places, trigger a new clang 14
-Werror warning:

```
sys/contrib/zstd/lib/decompress/huf_decompress.c:889:25: error: use of bitwise '&' with boolean operands [-Werror,-Wbitwise-instead-of-logical]
                        (BIT_reloadDStreamFast(&bitD1) == BIT_DStream_unfinished)
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

While the warning is benign, it should ideally be fixed upstream and
then vendor-imported, but for now silence it selectively.

MFC after: 3 days

2 years agotty_info: Avoid warning by using logical instead of bitwise operators
Dimitry Andric [Sun, 6 Feb 2022 17:41:20 +0000 (18:41 +0100)]
tty_info: Avoid warning by using logical instead of bitwise operators

Since TD_IS_RUNNING() and TS_ON_RUNQ() are defined as logical
expressions involving '==', clang 14 warns about them being checked with
a bitwise operator instead of a logical one:

```
sys/kern/tty_info.c:124:9: error: use of bitwise '|' with boolean operands [-Werror,-Wbitwise-instead-of-logical]
        runa = TD_IS_RUNNING(td) | TD_ON_RUNQ(td);
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                 ||
sys/sys/proc.h:562:27: note: expanded from macro 'TD_IS_RUNNING'
                                ^
sys/kern/tty_info.c:124:9: note: cast one or both operands to int to silence this warning
sys/sys/proc.h:562:27: note: expanded from macro 'TD_IS_RUNNING'
                                ^
sys/kern/tty_info.c:129:9: error: use of bitwise '|' with boolean operands [-Werror,-Wbitwise-instead-of-logical]
        runb = TD_IS_RUNNING(td2) | TD_ON_RUNQ(td2);
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                  ||
sys/sys/proc.h:562:27: note: expanded from macro 'TD_IS_RUNNING'
                                ^
sys/kern/tty_info.c:129:9: note: cast one or both operands to int to silence this warning
sys/sys/proc.h:562:27: note: expanded from macro 'TD_IS_RUNNING'
                                ^
```

Fix this by using logical operators instead. No functional change
intended.

Reviewed by: cem, emaste, kevans, markj
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D34186

2 years agolibc binuptime(): use the right function to get the most significant bit index
Konstantin Belousov [Tue, 8 Feb 2022 19:13:40 +0000 (21:13 +0200)]
libc binuptime(): use the right function to get the most significant bit index

Reported and tested by: Jaroslaw Pelczar <jarek@jpelczar.com>
PR: 261781
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agoRemove device lio from i386's LINT-NOIP
Dimitry Andric [Tue, 8 Feb 2022 18:53:52 +0000 (19:53 +0100)]
Remove device lio from i386's LINT-NOIP

This fixes link errors for the LINT-NOIP kernel on i386:

```
ld: error: undefined symbol: tcp_lro_flush_all
>>> referenced by lio_droq.c
>>>               lio_droq.o:(lio_droq_process_packets)

ld: error: undefined symbol: tcp_lro_rx
>>> referenced by lio_core.c
>>>               lio_core.o:(lio_push_packet)

ld: error: undefined symbol: tcp_lro_init
>>> referenced by lio_main.c
>>>               lio_main.o:(lio_attach)

ld: error: undefined symbol: tcp_lro_free
>>> referenced by lio_main.c
>>>               lio_main.o:(lio_attach)
>>> referenced by lio_main.c
>>>               lio_main.o:(lio_destroy_nic_device)
*** [kernel] Error code 1
```

MFC after: 3 days

2 years agoriscv: Fix a race in pmap_pinit()
Mark Johnston [Tue, 8 Feb 2022 18:15:54 +0000 (13:15 -0500)]
riscv: Fix a race in pmap_pinit()

All pmaps share the top half of the address space.  With 3-level page
tables, the top-level kernel map entries are not static: they might
change if the kernel map is extended (via pmap_growkernel()) or a 1GB
mapping in the direct map is demoted (not implemented yet).  Thus the
riscv pmap maintains the allpmaps list to synchronize updates to
top-level entries.

When a pmap is created, it is inserted into this list after copying
top-level entries from the kernel pmap.  The copying is done without
holding the allpmaps lock, and it is possible for pmap_pinit() to race
with kernel map updates.  In particular, if a thread is modifying L1
entries, and a concurrent pmap_pinit() copies the old version of the
entries, it might not receive the update.

Fix the problem by copying the kernel map entries after inserting the
pmap into the list.  This ensures that the nascent pmap always receives
updates, though pmap_distribute_l1() may race with the page copy.

Reviewed by: mhorne, jhb
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34158

2 years agoktls: Disallow transmitting empty frames outside of TLS 1.0/CBC mode
Mark Johnston [Tue, 8 Feb 2022 17:36:41 +0000 (12:36 -0500)]
ktls: Disallow transmitting empty frames outside of TLS 1.0/CBC mode

There was nothing preventing one from sending an empty fragment on an
arbitrary KTLS TX-enabled socket, but ktls_frame() asserts that this
could not happen.  Though the transmit path handles this case for TLS
1.0 with AES-CBC, we should be strict and allow empty fragments only in
modes where it is explicitly allowed.

Modify sosend_generic() to reject writes to a KTLS-enabled socket if the
number of data bytes is zero, so that userspace cannot trigger the
aforementioned assertion.

Add regression tests to exercise this case.

Reported by: syzkaller
Reviewed by: gallatin, jhb
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34195

2 years agofile: Make fget*() and getvnode*() consistent about initializing *fpp
Mark Johnston [Tue, 8 Feb 2022 17:34:20 +0000 (12:34 -0500)]
file: Make fget*() and getvnode*() consistent about initializing *fpp

Most fget*() functions initialize the output parameter to NULL.  Make
the externally visible interface behave consistently, and make
fget_unlocked_seq() private to kern_descrip.c.

This fixes at least one bug in a consumer, _filemon_wrapper_openat(),
which assumes that getvnode() sets the output file pointer to NULL upon
an error.

Reported by: syzbot+01c0459408f896a5933a@syzkaller.appspotmail.com
Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34190

2 years agobhyve: Fix getaddrinfo() error handling
Mark Johnston [Tue, 8 Feb 2022 17:34:03 +0000 (12:34 -0500)]
bhyve: Fix getaddrinfo() error handling

- Use errx() since errno will not be set.
- Print the message returned by gai_strerror().

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agorelease.7: Drop obsolete notes about old versions of mkimg
Mark Johnston [Tue, 8 Feb 2022 17:33:48 +0000 (12:33 -0500)]
release.7: Drop obsolete notes about old versions of mkimg

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agosrc.conf: regenerate
Piotr Kubaj [Tue, 8 Feb 2022 13:14:02 +0000 (14:14 +0100)]
src.conf: regenerate

2 years agostress2: Updated test with problem found and mark it as a "no run"
Peter Holm [Tue, 8 Feb 2022 06:51:35 +0000 (07:51 +0100)]
stress2: Updated test with problem found and mark it as a "no run"

2 years agonetinet: simplify RSS ifdef statements
Franco Fichtner [Tue, 8 Feb 2022 02:22:03 +0000 (19:22 -0700)]
netinet: simplify RSS ifdef statements

Approved by: transport (rrs)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D31583

2 years agocxgbei: Replace worker thread pools with per-connection kthreads.
John Baldwin [Tue, 8 Feb 2022 00:20:40 +0000 (16:20 -0800)]
cxgbei: Replace worker thread pools with per-connection kthreads.

Having a single pool of worker threads adds extra complexity and
overhead.  The software backend also uses per-connection kthreads.

Sponsored by: Chelsio Communications

2 years agocxgbei: Dispatch sent PDUs to the NIC asynchronously.
John Baldwin [Tue, 8 Feb 2022 00:20:06 +0000 (16:20 -0800)]
cxgbei: Dispatch sent PDUs to the NIC asynchronously.

Previously the driver was called to send PDUs to the NIC synchronously
from the icl_conn_pdu_queue_cb callback.  However, this performed a
fair bit of work while holding the icl connection lock.  Instead,
change the callback to add sent PDUs to a STAILQ and defer dispatching
of PDUs to the NIC to a helper thread similar to the scheme used in
the TCP iSCSI backend.

- Replace rx_flags int and the sole RXF_ACTIVE flag with a simple
  rx_active bool.

- Add a pool of transmit worker threads for cxgbei.

- Fix worker thread exit to depend on the wakeup in kthread_exit()
  to fix a race with module unload.

Reported by: mav
Sponsored by: Chelsio Communications

2 years agoAdd more USB host controller PCI ID's.
Hans Petter Selasky [Mon, 7 Feb 2022 23:28:57 +0000 (00:28 +0100)]
Add more USB host controller PCI ID's.

Submitted by: Gary Jennejohn <gljennjohn@gmail.com>
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agoExtend the VMM stats interface to support a dynamic count of statistics.
John Baldwin [Mon, 7 Feb 2022 22:11:10 +0000 (14:11 -0800)]
Extend the VMM stats interface to support a dynamic count of statistics.

- Add a starting index to 'struct vmstats' and change the
  VM_STATS ioctl to fetch the 64 stats starting at that index.
  A compat shim for <= 13 continues to fetch only the first 64
  stats.

- Extend vm_get_stats() in libvmmapi to use a loop and a static
  thread local buffer which grows to hold the stats needed.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D27463

2 years agodummynet: don't use per-vnet locks to protect global data.
Kristof Provost [Thu, 27 Jan 2022 10:41:21 +0000 (11:41 +0100)]
dummynet: don't use per-vnet locks to protect global data.

The ref_count counter is global (i.e. not per-vnet) so we can't use a
per-vnet lock to protect it. Moreover, in callouts curvnet is not set,
so we'd end up panicing when trying to use DN_BH_WLOCK().

Instead we use the global sched_lock, which is already used when
evaluating ref_count (in unload_dn_aqm()).

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D34059

2 years agosystat: Eliminate write-only unit variable
Warner Losh [Mon, 7 Feb 2022 21:51:18 +0000 (14:51 -0700)]
systat: Eliminate write-only unit variable

Sponsored by: Netflix

2 years agosystat/iostat: Use bools for numbers and kbpt
Warner Losh [Mon, 7 Feb 2022 21:50:35 +0000 (14:50 -0700)]
systat/iostat: Use bools for numbers and kbpt

These are really bools, declare them as such.

Sponsored by: Netflix