]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agolink_elf_obj: Process global ifunc relocs after other global relocs
Mark Johnston [Thu, 25 Nov 2021 21:52:17 +0000 (16:52 -0500)]
link_elf_obj: Process global ifunc relocs after other global relocs

This is needed to ensure that resolvers that reference global symbols
return correct results.

Reviewed by: kib
Sponsored by: The FreeBSD Foundation

(cherry picked from commit b11e6fd75b1bb9d337b0edab14d160ff65b11aae)

2 years agomake_dev.9: Fix a typo
Mark Johnston [Thu, 25 Nov 2021 16:32:30 +0000 (11:32 -0500)]
make_dev.9: Fix a typo

(cherry picked from commit cc7decfcf93be2a9e78923cc9782fd913f70b78e)

2 years agork_spi: declare support for rk3328
Andriy Gapon [Thu, 25 Nov 2021 21:12:11 +0000 (23:12 +0200)]
rk_spi: declare support for rk3328

Tested on Rock64 using the onboard SPI flash.

(cherry picked from commit 8c12ee5021e293c992a7b54215fda1edfbebaa25)

2 years agoswap_pager: lock vnode in swapdev_strategy()
Konstantin Belousov [Wed, 24 Nov 2021 11:26:46 +0000 (13:26 +0200)]
swap_pager: lock vnode in swapdev_strategy()

(cherry picked from commit b19740f4ce7a542783f87de2fee48476a7801d86)

2 years agoswapon: extend the region where the swap vnode is locked
Konstantin Belousov [Wed, 24 Nov 2021 03:06:02 +0000 (05:06 +0200)]
swapon: extend the region where the swap vnode is locked

(cherry picked from commit 6ddf41faa6f54738db9b3f313086974b6403d680)

2 years agoswap pager: lock vnode around VOP_CLOSE()
Konstantin Belousov [Tue, 23 Nov 2021 09:16:53 +0000 (11:16 +0200)]
swap pager: lock vnode around VOP_CLOSE()

(cherry picked from commit a6d04f34a4db6ff3fd5431ae10d4b877337fc138)

2 years agomountd: Fix handling of usernames that start with a digit
Rick Macklem [Thu, 18 Nov 2021 21:35:25 +0000 (13:35 -0800)]
mountd: Fix handling of usernames that start with a digit

yocalebo_gmail.com submitted a patch for mountd.c that
fixes the case where a username starts with a digit.
Without this patch, the username that starts with a
digit is misinterpreted as a numeric uid.
With this patch, any string that does not entirely
convert to a decimal number via strtoul() is considered
a user/group name.

(cherry picked from commit f4bf849bb894f4934b8df6c04a820dfa52e9576c)

2 years agorc.conf.5: Add entries for NFS
Rick Macklem [Thu, 18 Nov 2021 15:59:34 +0000 (07:59 -0800)]
rc.conf.5: Add entries for NFS

Entries for a few recently defined rc variables
were missing from rc.conf.5.  This patch adds
those.

It was not obvious to me what the ordering is,
so I added them to the area where other nfsd
related variables are.  I can easily move them.

I also replaced "are" with "is", since it seems to
read better.

This is a content change.

(cherry picked from commit 9dae2d03bc644be38196cf76c55039af1a7c1ba6)

2 years agonfsd: Add a new rc variable nfs_server_maxio
Rick Macklem [Wed, 17 Nov 2021 00:02:53 +0000 (16:02 -0800)]
nfsd: Add a new rc variable nfs_server_maxio

Since vfs.nfsd.srvmaxio can only be set when nfsd.ko
is loaded, but nfsd is not running, setting it in
/etc/sysctl.conf is not feasible when "options NFSD"
was not specified for the kernel.

This patch adds a new rc variable nfs_server_maxio,
which sets vfs.nfsd.srvmaxio at the correct time.

rc.conf.5 will be patched separately.

(cherry picked from commit 5509bad74e44eed3b9d54fbd74d3752b88428147)

2 years agopowerpc64le: add LINT64LE kernel config
Alfredo Dal'Ava Junior [Mon, 29 Nov 2021 15:08:26 +0000 (12:08 -0300)]
powerpc64le: add LINT64LE kernel config

Add configuration file to be used by "FreeBSD-<branch>-powerpc64le-LINT"
CI/Jenkins job

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

(cherry picked from commit e671037b3c49734566e7e0af74ba1a64f45b77a2)

2 years agopowerpc64: make autoboot possible on powernv machines
Alfredo Dal'Ava Junior [Fri, 26 Nov 2021 00:02:53 +0000 (21:02 -0300)]
powerpc64: make autoboot possible on powernv machines

It's required to specify a default boot option in order to make
petitboot's autoboot feature work.

Tested on Raptor Blackbird

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

(cherry picked from commit b6644f529ca4c13975727c5625415fcc30c60af6)

2 years agopf tests: Test PR259689
Kristof Provost [Mon, 8 Nov 2021 12:28:43 +0000 (13:28 +0100)]
pf tests: Test PR259689

We didn't populate dyncnt/tblcnt, so `pfctl -sr -vv` might not have the
table element count.

PR: 259689
MFC after: 3 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D32893

(cherry picked from commit 2de49deeca0b1377664dee2cd0a43ee7cf6b4bc4)

2 years agopf: ensure we populate dyncnt/tblcnt in struct pf_addr_wrap
Kristof Provost [Mon, 8 Nov 2021 12:25:20 +0000 (13:25 +0100)]
pf: ensure we populate dyncnt/tblcnt in struct pf_addr_wrap

PR: 259689
MFC after: 3 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D32892

(cherry picked from commit 218a8a491c4980dcc941908f9505d37e7f052868)

2 years agonet tests: basic if_stf test
Kristof Provost [Fri, 5 Nov 2021 14:20:19 +0000 (15:20 +0100)]
net tests: basic if_stf test

Test the 6to4 code.

MFC after: 3 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D32850

(cherry picked from commit eb5e0755f7496d1328d572b4d181c70b39152f08)

2 years agoif_stf: style(9) pass
Kristof Provost [Fri, 5 Nov 2021 10:20:16 +0000 (11:20 +0100)]
if_stf: style(9) pass

As stated in style(9): "Values in return statements should be enclosed
in parentheses."

MFC after: 3 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D32848

(cherry picked from commit 3576121c8b1fcaa31b3a45ea52ff83f7c5855266)

2 years agoif_stf: enable use in vnet jails
Kristof Provost [Fri, 5 Nov 2021 11:01:37 +0000 (12:01 +0100)]
if_stf: enable use in vnet jails

The cloner must be per-vnet so that cloned interfaces get destroyed when
the vnet goes away. Otherwise we fail assertions in vnet_if_uninit():

panic: vnet_if_uninit:475 tailq &V_ifnet=0xfffffe01665fe070 not empty
cpuid = 19
time = 1636107064
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe015d0cac60
vpanic() at vpanic+0x187/frame 0xfffffe015d0cacc0
panic() at panic+0x43/frame 0xfffffe015d0cad20
vnet_if_uninit() at vnet_if_uninit+0x7b/frame 0xfffffe015d0cad30
vnet_destroy() at vnet_destroy+0x170/frame 0xfffffe015d0cad60
prison_deref() at prison_deref+0x9b0/frame 0xfffffe015d0cadd0
sys_jail_remove() at sys_jail_remove+0x119/frame 0xfffffe015d0cae00
amd64_syscall() at amd64_syscall+0x12e/frame 0xfffffe015d0caf30
fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe015d0caf30
--- syscall (508, FreeBSD ELF64, sys_jail_remove), rip = 0x8011e920a, rsp = 0x7fffffffe788, rbp = 0x7fffffffe810 ---
KDB: enter: panic

MFC after: 3 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D32849

(cherry picked from commit 8e45fed3aefd00ff544efce8fedeba5e099d3d01)

2 years agonetinet: Remove unneeded mb_unmapped_to_ext() calls
Mark Johnston [Wed, 24 Nov 2021 18:20:09 +0000 (13:20 -0500)]
netinet: Remove unneeded mb_unmapped_to_ext() calls

in_cksum_skip() now handles unmapped mbufs on platforms where they're
permitted.

Reviewed by: glebius, jhb
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 44775b163bfa902ea96658343e852062e2e67a8e)

2 years agonetinet: Implement in_cksum_skip() using m_apply()
Mark Johnston [Wed, 24 Nov 2021 18:19:54 +0000 (13:19 -0500)]
netinet: Implement in_cksum_skip() using m_apply()

This allows it to work with unmapped mbufs.  In particular,
in_cksum_skip() calls no longer need to be preceded by calls to
mb_unmapped_to_ext() to avoid a page fault.

PR: 259645
Reviewed by: gallatin, glebius, jhb
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 0d9c3423f59bb305301f5a5bc7c8f5daf7b7aa52)

2 years agonetinet: Deduplicate most in_cksum() implementations
Mark Johnston [Wed, 24 Nov 2021 18:19:44 +0000 (13:19 -0500)]
netinet: Deduplicate most in_cksum() implementations

in_cksum() and related routines are implemented separately for each
platform, but only i386 and arm have optimized versions.  Other
platforms' copies of in_cksum.c are identical except for style
differences and support for big-endian CPUs.

Deduplicate the implementations for the rest of the platforms.  This
will make it easier to implement in_cksum() for unmapped mbufs.  On arm
and i386, define HAVE_MD_IN_CKSUM to mean that the MI implementation is
not to be compiled.

No functional change intended.

Reviewed by: kp, glebius
Sponsored by: The FreeBSD Foundation

(cherry picked from commit ecbbe831445a4b94279e5932828d60076e4ca444)

2 years agonetinet: Remove in_cksum.c
Mark Johnston [Wed, 24 Nov 2021 18:19:34 +0000 (13:19 -0500)]
netinet: Remove in_cksum.c

It does not get compiled into the kernel.  No functional change
inteneded.

Reviewed by: kp, glebius, cy
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 5195bcc2126b302802643f5204d1030e5893fb62)

2 years agonatd: Remove uneeded in_cksum.h includes
Mark Johnston [Wed, 24 Nov 2021 18:30:28 +0000 (13:30 -0500)]
natd: Remove uneeded in_cksum.h includes

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 517373f7230207e60e4561bc44c8b3c44acea963)

2 years agonetinet: Remove in_cksum_update()
Mark Johnston [Wed, 24 Nov 2021 18:15:40 +0000 (13:15 -0500)]
netinet: Remove in_cksum_update()

It was never implemented on powerpc or riscv and appears to have been
unused since it was added in 1998.  No functional change intended.

Reviewed by: kp, glebius, cy
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 09100f936be0684aa8caef441b96345960fd9c72)

2 years agosafexcel: Fix -Wunused-but-set-variable warnings
Mark Johnston [Wed, 24 Nov 2021 18:30:39 +0000 (13:30 -0500)]
safexcel: Fix -Wunused-but-set-variable warnings

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 60c95f316374fdd383f70b50e98ad097460accf3)

2 years agoldconfig(8): check for no-args command line after options are parsed
Konstantin Belousov [Fri, 19 Nov 2021 04:07:58 +0000 (06:07 +0200)]
ldconfig(8): check for no-args command line after options are parsed

(cherry picked from commit 3ede04c78c7c726ed79a39d22c65a58d0ecc5d00)

2 years agoldconfig: use libexec/rtld-elf/rtld_paths.h
Konstantin Belousov [Fri, 19 Nov 2021 03:45:31 +0000 (05:45 +0200)]
ldconfig: use libexec/rtld-elf/rtld_paths.h

(cherry picked from commit af9115870670f508c11b3d173bcff5116d8ef320)

2 years agortld_paths.h: Provide _PATH_ELF32_HINTS string, unconditionally
Konstantin Belousov [Fri, 19 Nov 2021 03:44:33 +0000 (05:44 +0200)]
rtld_paths.h: Provide _PATH_ELF32_HINTS string, unconditionally

(cherry picked from commit f340188625d4e0e4db850becb0a9b25448053e10)

2 years agoldconfig(8): nostd/-s does nothing
Konstantin Belousov [Fri, 19 Nov 2021 05:21:21 +0000 (07:21 +0200)]
ldconfig(8): nostd/-s does nothing

(cherry picked from commit b828161d123bec894bc5a320ef26d6afc9b13ae8)

2 years agoldconfig: start of cleanup
Konstantin Belousov [Fri, 19 Nov 2021 03:35:50 +0000 (05:35 +0200)]
ldconfig: start of cleanup

(cherry picked from commit 3f2c6f5598410b7233b0acd1c804a0473fa1e9fa)

2 years agoldconfig: remove a comment which is another remnant of a.out support
Konstantin Belousov [Wed, 24 Nov 2021 20:44:20 +0000 (22:44 +0200)]
ldconfig: remove a comment which is another remnant of a.out support

(cherry picked from commit 83511ce5c473406e0661247e40971be28e218684)

2 years agoktls.4: fix openssl-devel port name
Sergey A. Osokin [Fri, 12 Nov 2021 14:31:48 +0000 (09:31 -0500)]
ktls.4: fix openssl-devel port name

PR: 259630
(cherry picked from commit b39a93b18ef17dcb1897186b1f01999337b9f8b9)

2 years agoevdev: Add parentheses around '-' expression in operand of '&'.
John Baldwin [Wed, 15 Sep 2021 16:03:18 +0000 (09:03 -0700)]
evdev: Add parentheses around '-' expression in operand of '&'.

This fixes a -Wparentheses error with GCC 9.

Reviewed by: wulf
Differential Revision: https://reviews.freebsd.org/D31947

(cherry picked from commit d99c87c8d54a02a229cbeaa19ec8784b1d5afbb9)

2 years agoHyper-V: vPCI: Prepopulate device bars
Wei Hu [Sat, 27 Nov 2021 06:42:34 +0000 (06:42 +0000)]
Hyper-V: vPCI: Prepopulate device bars

In recent Hyper-V releases on Windows Server 2022, vPCI code does not
initialize the last 4 bit of device bar registers. This behavior change
could result weird problems cuasing PCI code failure when configuring
bars.

Just write all 1's to those bars whose probed values are not the same
as current read ones. This seems to make Hyper-V vPCI and
pci_write_bar() to cooperate correctly on these releases.

Reported by: khng@freebsd.org
Tested by: khng@freebsd.org
MFC after: 2 weeks
Sponsored by: Microsoft

(cherry picked from commit 75412a521f60d4b0393c730ffb284e7c6ff9d2de)

2 years agosctp: Remove now-unneeded mb_unmapped_to_ext() calls
Mark Johnston [Tue, 16 Nov 2021 18:38:09 +0000 (13:38 -0500)]
sctp: Remove now-unneeded mb_unmapped_to_ext() calls

sctp_delayed_checksum() now handles unmapped mbufs, thanks to m_apply().

No functional change intended.

Reviewed by: tuexen
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 756bb50b6a867f3309ce76d76f1842a667dd303a)

2 years agosctp: Use m_apply() to calcuate a checksum for an mbuf chain
Mark Johnston [Tue, 16 Nov 2021 18:36:30 +0000 (13:36 -0500)]
sctp: Use m_apply() to calcuate a checksum for an mbuf chain

m_apply() works on unmapped mbufs, so this will let us elide
mb_unmapped_to_ext() calls preceding sctp_calculate_cksum() calls in
the network stack.

Modify sctp_calculate_cksum() to assume it's passed an mbuf header.
This assumption appears to be true in practice, and we need to know the
full length of the chain.

No functional change intended.

Reviewed by: tuexen, jhb
Sponsored by: The FreeBSD Foundation

(cherry picked from commit b4d758a0cc54d991d2bdf7f697ec0b6b3fd6230d)

2 years agombuf: Only allow extpg mbufs if the system has a direct map
Mark Johnston [Tue, 16 Nov 2021 18:31:04 +0000 (13:31 -0500)]
mbuf: Only allow extpg mbufs if the system has a direct map

Some upcoming changes will modify software checksum routines like
in_cksum() to operate using m_apply(), which uses the direct map to
access packet data for unmapped mbufs.  This approach of course does not
work on platforms without a direct map, so we have to disallow the use
of unmapped mbufs on such platforms.

I believe this is the right tradeoff: we only configure KTLS on amd64
and arm64 today (and one KTLS consumer, NFS TLS, requires a direct map
already), and the use of unmapped mbufs with plain sendfile is a recent
optimization.  If need be, m_apply() could be modified to create
CPU-private mappings of extpg mbuf pages as a fallback.

So, change mb_use_ext_pgs to be hard-wired to zero on systems without a
direct map.  Note that PMAP_HAS_DMAP is not a compile-time constant on
some systems, so the default value of mb_use_ext_pgs has to be
determined during boot.

Reviewed by: jhb
Discussed with: gallatin
Sponsored by: The FreeBSD Foundation

(cherry picked from commit fcaa890c4469118255d463495b4044eef484fa3e)

2 years agoext2fs: check for eh_depth in ext4_ext_check_header()
Neel Chauhan [Wed, 17 Nov 2021 00:25:04 +0000 (16:25 -0800)]
ext2fs: check for eh_depth in ext4_ext_check_header()

PR: 259112
Reported by: Robert Morris <rtm@lcs.mit.edu>
Reviewed by: fsu (src)
Differential Revision: https://reviews.freebsd.org/D33030

(cherry picked from commit be60d8f276fa20fc11ad814e54c9c2540f79c7da)

2 years agosyslogd: fix WITHOUT_INET builds
Artem Khramov [Sat, 12 Jun 2021 17:21:13 +0000 (20:21 +0300)]
syslogd: fix WITHOUT_INET builds

Since 2d82b47 syslogd can't be built with `WITHOUT_INET` or
`WITHOUT_INET6` build variables set, because `iovlist_truncate` is not
defined but used.

This change wraps the problematic `iovlist_truncate` call within ifdef
directive.  It's compiled out in this situation...

Pull Request: https://github.com/freebsd/freebsd-src/pull/475
Reviewed by: imp@ (commit message slightly tweaked)

(cherry picked from commit f06fa6f88733d709a5f9dd3a27b1a08571e49e6b)

PR: 260098

2 years agosrc.conf.5: regen
Ed Maste [Mon, 29 Nov 2021 14:16:17 +0000 (09:16 -0500)]
src.conf.5: regen

2 years agoDo not build libatf-c++ when WITHOUT_CXX
Ed Maste [Fri, 29 Oct 2021 03:01:21 +0000 (23:01 -0400)]
Do not build libatf-c++ when WITHOUT_CXX

libatf-c++ requires C++ support.

From jrtc27: bit slightly odd this isn't gated by MK_TESTS (which itself
depends on MK_CXX), but this makes sense given the current behaviour.

Reported by: Michael Dexter, Build Option Survey
Reviewed by: imp, jrtc27
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32732

(cherry picked from commit 6ce99625ca7acecaa64723f0440007eb3f60f53d)

2 years agosrc.opts.mk: Add WITHOUT_CXX dependencies
Ed Maste [Fri, 29 Oct 2021 01:43:33 +0000 (21:43 -0400)]
src.opts.mk: Add WITHOUT_CXX dependencies

OFED, OPENMP, and PMC depend on C++ support.  Force them off when
building WITHOUT_CXX.

Reported by: Michael Dexter, Build Option Survey
Reviewed by: imp, jrtc27
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32730

(cherry picked from commit 0e1c864898c1803835b1be0d59342ca761051db8)

2 years agoDon't build sanitizer runtimes under WITHOUT_CXX
Ed Maste [Fri, 29 Oct 2021 00:49:12 +0000 (20:49 -0400)]
Don't build sanitizer runtimes under WITHOUT_CXX

In the past we built the sanitizer runtimes when building Clang
(and using Clang as the compiler) but 7676b388adbc changed this to
be conditional only on using Clang, to make the runtimes available
for external Clang.

They fail to build when WITHOUT_CXX is set though, so add MK_CXX
as part of the condition.

Reported by: Michael Dexter, Build Option Survey
Reviewed by: imp, jrtc27
Fixes: 7676b388adbc ("Always build the sanitizer runtimes...")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32731

(cherry picked from commit ad09e2c8cfbc2cf6f2b8826c121d6de8b3bfe96d)

2 years agonet tests: basic if_gif(4) test case
Kristof Provost [Thu, 4 Nov 2021 16:15:19 +0000 (17:15 +0100)]
net tests: basic if_gif(4) test case

MFC after: 3 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D32836

(cherry picked from commit 6e0755b37b20f776c7a9ac7a720db1af13966717)

2 years agoif_gif: fix vnet shutdown panic
Kristof Provost [Thu, 4 Nov 2021 17:05:58 +0000 (18:05 +0100)]
if_gif: fix vnet shutdown panic

If an if_gif exists and has an address assigned inside a vnet when the
vnet is shut down we failed to clean up the address, leading to a panic
when we ip_destroy() and the V_in_ifaddrhashtbl is not empty.

This happens because of the VNET_SYS(UN)INIT order, which means we
destroy the if_gif interface before the addresses can be purged (and
if_detach() does not remove addresses, it assumes this will be done by
the stack teardown code).

Set subsystem SI_SUB_PSEUDO just like if_bridge so the cleanup
operations happen in the correct order.

MFC after: 3 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D32835

(cherry picked from commit 8ca6c11a7cf834721c03cbe1a1aab0a17bae4d4d)

2 years agoHoist cddl prebuild lib dependency definitions out of a MK_ZFS block
Mark Johnston [Fri, 26 Nov 2021 14:27:19 +0000 (09:27 -0500)]
Hoist cddl prebuild lib dependency definitions out of a MK_ZFS block

The compilation of several libraries under cddl/lib is not conditional
on MK_ZFS = "yes", so their dependency on libspl is not conditional
either.  Unbreak buildworld when WITHOUT_ZFS is set.

Reported by: bz
Fixes: 9e9c651caceb ("cddl: fix missing ZFS library dependencies")

(cherry picked from commit 7b3642da21cb4b1c301d8c6b6ce0847d19d8a473)

2 years agocddl: fix missing ZFS library dependencies
Greg V [Sat, 16 Oct 2021 16:29:28 +0000 (19:29 +0300)]
cddl: fix missing ZFS library dependencies

In 9fae47666 zfsd got a libspl dependency to avoid undefined references.
However that workaround did not help external consumers of libzfs_core.

Fix all missing dependencies lld 13 and the rtld complain about.

Reviewed by: freqlabs, markj

(cherry picked from commit 9e9c651caceb9ecd17131e8bb29791ba4cf1cec7)

2 years agoamd64: Initialize kernel_pmap's active CPU set to all_cpus
Mark Johnston [Mon, 15 Nov 2021 17:41:24 +0000 (12:41 -0500)]
amd64: Initialize kernel_pmap's active CPU set to all_cpus

This is in preference to simply filling the cpuset, and allows the
conditional in pmap_invalidate_cpu_mask() to be elided.

Also export pmap_invalidate_cpu_mask() outside of pmap.c for use in a
subsequent commit.

Suggested by: kib
Reviewed by: alc, kib
Tested by: pho
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 71e6e9da225aede95f6813a0fcf886538d0da9fe)

2 years agovm_page: Remove vm_page_sbusy() and vm_page_xbusy()
Mark Johnston [Mon, 15 Nov 2021 16:35:52 +0000 (11:35 -0500)]
vm_page: Remove vm_page_sbusy() and vm_page_xbusy()

They are unused today and cannot be safely used in the face of unlocked
lookup, in which pages may be busied without the object lock held.

Obtained from: jeff (object_concurrency patches)
Reviewed by: kib

(cherry picked from commit a2665158d03e87dad410384e5c61c72e675f3edd)

2 years agovm_page: Consolidate page busy sleep mechanisms
Mark Johnston [Mon, 15 Nov 2021 16:35:44 +0000 (11:35 -0500)]
vm_page: Consolidate page busy sleep mechanisms

- Modify vm_page_busy_sleep() and vm_page_busy_sleep_unlocked() to take
  a VM_ALLOC_* flag indicating whether to sleep on shared-busy, and fix
  up callers.
- Modify vm_page_busy_sleep() to return a status indicating whether the
  object lock was dropped, and fix up callers.
- Convert callers of vm_page_sleep_if_busy() to use vm_page_busy_sleep()
  instead.
- Remove vm_page_sleep_if_(x)busy().

No functional change intended.

Obtained from: jeff (object_concurrency patches)
Reviewed by: kib

(cherry picked from commit 87b646630c4892e21446cd096bea6bcaecea33ac)

2 years agovm: Add a mode to vm_object_page_remove() which skips invalid pages
Mark Johnston [Mon, 15 Nov 2021 16:44:04 +0000 (11:44 -0500)]
vm: Add a mode to vm_object_page_remove() which skips invalid pages

This will be used to break a deadlock in ZFS between the per-mountpoint
teardown lock and page busy locks.  In particular, when purging data
from the page cache during dataset rollback, we want to avoid blocking
on the busy state of invalid pages since the busying thread may be
blocked on the teardown lock in zfs_getpages().

Add a helper, vn_pages_remove_valid(), for use by filesystems.  Bump
__FreeBSD_version so that the OpenZFS port can make use of the new
helper.

PR: 258208
Reviewed by: avg, kib, sef
Tested by: pho (part of a larger patch)
Sponsored by: The FreeBSD Foundation

(cherry picked from commit d28af1abf031ee87a478b37180e3f0c518caedf6)

2 years agoFix segment size in compressing core dumps
Justin Hibbits [Fri, 1 Oct 2021 18:39:18 +0000 (13:39 -0500)]
Fix segment size in compressing core dumps

A core segment is bounded in size only by memory size.  On 64-bit
architectures this means a segment can be much larger than 4GB.
However, compress_chunk() takes only a u_int, clamping segment size to
4GB-1, resulting in a truncated core.  Everything else, including the
compressor internally, uses size_t, so use size_t at the boundary here.

This dates back to the original refactor back in 2015 (r279801 /
aa14e9b7).

PR: 260006
Sponsored by: Juniper Networks, Inc.

(cherry picked from commit 63cb9308a75b99fe057409705bc1b2ac0293f578)

2 years agopchtherm: Let the driver be compiled into the kernel
N.J. Mann [Mon, 22 Nov 2021 17:04:05 +0000 (12:04 -0500)]
pchtherm: Let the driver be compiled into the kernel

PR: 259776

(cherry picked from commit a11983366ea72165809837a667d58e2ad440c496)

2 years agonfsstat: Add output for counts of new RPCs to the "-E" option
Rick Macklem [Sun, 14 Nov 2021 21:36:14 +0000 (13:36 -0800)]
nfsstat: Add output for counts of new RPCs to the "-E" option

Add output to the "-E" option for new RPCs related
to NFSv4.1/4.2. Also, add output of the counts for
allocated layouts and the title for the "Client"
section (which was lost during a previous commit).

(cherry picked from commit 75c666197cc7574f6f0d48344f8725f72072fc84)

2 years agostyle.Makefile.5: Do not require $FreeBSD$ SCM IDs
Mateusz Piotrowski [Thu, 18 Nov 2021 21:00:30 +0000 (22:00 +0100)]
style.Makefile.5: Do not require $FreeBSD$ SCM IDs

It's no longer required to have those SCM IDs at the start of makefiles.

MFC after: 3 days

(cherry picked from commit 1ac5586c6d86134922e18871b270ca483c00bf8b)

2 years agoos-release.5: Fix quoting of dots
Mateusz Piotrowski [Tue, 23 Nov 2021 10:34:44 +0000 (11:34 +0100)]
os-release.5: Fix quoting of dots

Dots needs to escaped with \& to be places inside Ql quotes.

MFC after: 3 days

(cherry picked from commit ee7485bef53df9108a20e497dac6341d030248ce)

2 years agoffs_softdep: Fix a typo in a source code comment
Gordon Bergling [Fri, 19 Nov 2021 18:17:41 +0000 (19:17 +0100)]
ffs_softdep: Fix a typo in a source code comment

- s/conditonally/conditionally/

(cherry picked from commit bebff615877efdf549e5033b47ade4d8553f6a77)

2 years agoppbus(4): Fix a typo in source code comment
Gordon Bergling [Fri, 19 Nov 2021 18:19:36 +0000 (19:19 +0100)]
ppbus(4): Fix a typo in source code comment

- s/quering/querying/

Obtained from: NetBSD

(cherry picked from commit 975e2e3f84b0b7425185c9bb43722da779e8cd98)

2 years agolpr(1): Fix a typo in a source code comment
Gordon Bergling [Fri, 19 Nov 2021 19:04:09 +0000 (20:04 +0100)]
lpr(1): Fix a typo in a source code comment

-s /debuging/debugging/

(cherry picked from commit 840d72371bdc48be58152c839160c492bef7f1b7)

2 years agofirewire(4): Fix a typo in a source code comment
Gordon Bergling [Fri, 19 Nov 2021 18:50:56 +0000 (19:50 +0100)]
firewire(4): Fix a typo in a source code comment

- s/unavailabe/unavailable/

(cherry picked from commit 3e5ddef0fd391049f378456e10a0cea015652bc0)

2 years agoixl(4): Fix a typo in a sysctl description
Gordon Bergling [Fri, 19 Nov 2021 18:59:28 +0000 (19:59 +0100)]
ixl(4): Fix a typo in a sysctl description

(cherry picked from commit d7125850f031f8e763ff35c70fda310a1419b876)

2 years agoiscsi(4): Fix a typo in a source code comment
Gordon Bergling [Fri, 19 Nov 2021 18:29:21 +0000 (19:29 +0100)]
iscsi(4): Fix a typo in a source code comment

- s/conditon/condition/

(cherry picked from commit 5e21882bb4e7d36ebcf0300234486a54ff4e7b13)

2 years agosched_ule(4): Fix two typo in source code comments
Gordon Bergling [Fri, 19 Nov 2021 18:13:28 +0000 (19:13 +0100)]
sched_ule(4): Fix two typo in source code comments

- s/conditons/conditions/
- s/unconditonally/unconditionally/

(cherry picked from commit 15b5c347f1916d14e84765ae68921755ee930612)

2 years agoTWL: Fix a typo in a source code comment
Gordon Bergling [Fri, 19 Nov 2021 18:26:34 +0000 (19:26 +0100)]
TWL: Fix a typo in a source code comment

- s/maxium/maximum/

(cherry picked from commit 8b11850f9d04c096d8ed3647db512f8feceefaf4)

2 years agomkimg: zero entry in vhdx_write_metadata
Ed Maste [Sun, 21 Nov 2021 00:29:11 +0000 (19:29 -0500)]
mkimg: zero entry in vhdx_write_metadata

Otherwise _reserved might contain uninitialized data.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 036af1053acd6cae68c5fb6bed30508f2e40be13)

2 years agoFix coredump_phnum test with ASLR enabled
Ed Maste [Sun, 21 Nov 2021 17:17:20 +0000 (12:17 -0500)]
Fix coredump_phnum test with ASLR enabled

coredump_phnum intends to generate a core file with many PT_LOAD
segments.  Previously it called mmap() in a loop with alternating
protections, relying on each mapping following the previous, to produce
a core file with many page-sized PT_LOAD segments.  With ASLR on we no
longer have this property of each mmap() following the previous.

Instead, perform a single allocation, and then use mprotect() to set
alternating pages to PROT_READ.

PR: 259970
Reported by: lwhsu, mw
Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33070

(cherry picked from commit 8ec4c5dae32765701ac70811455084efd1570c32)

2 years agong_h4: add deprecation notice
Ed Maste [Thu, 25 Nov 2021 16:55:34 +0000 (11:55 -0500)]
ng_h4: add deprecation notice

It is already gone in FreeBSD 14.

Sponsored by: The FreeBSD Foundation

2 years agoicee: allow configuration via hints on FDT-based systems
Andriy Gapon [Thu, 4 Nov 2021 11:56:22 +0000 (13:56 +0200)]
icee: allow configuration via hints on FDT-based systems

On-board devices should be configured via the FDT and overlays.
Hints are primarily useful for external and temporarily attached devices.
Adding hints is much easier and faster than writing and compiling
an overlay.

(cherry picked from commit 01e3492337cb48484e03be38340cc67ac5e30a5b)

2 years agods1307: allow configuration via hints on FDT-based systems
Andriy Gapon [Thu, 4 Nov 2021 11:55:35 +0000 (13:55 +0200)]
ds1307: allow configuration via hints on FDT-based systems

On-board devices should be configured via the FDT and overlays.
Hints are primarily useful for external and temporarily attached devices.
Adding hints is much easier and faster than writing and compiling
an overlay.

(cherry picked from commit 27645265c4e49ad7eaa25847a280307acb138da8)

2 years agosddadone: 'error' gets assigned only errno codes, never MMC_ERR codes
Andriy Gapon [Fri, 9 Jul 2021 14:28:40 +0000 (17:28 +0300)]
sddadone: 'error' gets assigned only errno codes, never MMC_ERR codes

(cherry picked from commit e17b58ecbcb644f76cceda4ca7ff08f7677b5dfd)

2 years agopNFS: Add nfsstats counters for number of Layouts
Rick Macklem [Sat, 13 Nov 2021 01:32:55 +0000 (17:32 -0800)]
pNFS: Add nfsstats counters for number of Layouts

For pNFS, Layouts are issued by the server to indicate
where a file's data resides on the DS(s).  This patch
adds counters for how many layouts are allocated to
the nfsstatsv1 structure, using two reserved fields.

(cherry picked from commit ce9676de86f267986f61979151101e3d8a6d61bc)

2 years agoofwfb: fix vga/hdmi console with ASMEDIA during boot on powerpc64(le)
Alfredo Dal'Ava Junior [Wed, 3 Nov 2021 16:42:28 +0000 (13:42 -0300)]
ofwfb: fix vga/hdmi console with ASMEDIA during boot on powerpc64(le)

On recent OpenBMC firmware, the onboard ASMEDIA video card framebuffer
address was removed from device tree for security purposes (value is set
to zero to avoid leaking the address).

This patch works around the problem by taking framebuffer base address
from the "ranges" property of a parent node.

Reviewed by: luporl, jhibbits (on IRC)
MFC after: 2 weeks
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D30626

(cherry picked from commit b042d10cdc71ddd6ef3449261d712b05c648746e)

2 years agolibpfct: be consistent with u_int vs. uint
Kristof Provost [Fri, 5 Nov 2021 08:37:56 +0000 (09:37 +0100)]
libpfct: be consistent with u_int vs. uint

Always use uint64_t over u_int64_t, for the sake of consistency.

No functional change.

MFC after: 3 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 7bb3c927f7d9c48b356b4d20907b813f9b83273b)

2 years agolagg: fix unused-but-set-variable
Kristof Provost [Fri, 19 Nov 2021 16:22:48 +0000 (17:22 +0100)]
lagg: fix unused-but-set-variable

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

(cherry picked from commit 3142d4f622d2f95da5c7c52f60ce840411a07b0a)

2 years agopf tests: basic test for ridentifier
Kristof Provost [Fri, 29 Oct 2021 15:52:59 +0000 (17:52 +0200)]
pf tests: basic test for ridentifier

MFC after: 3 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D32751

(cherry picked from commit 508161111dc23cee0a41fa70de865743c694502f)

2 years agopf: Introduce ridentifier
Kristof Provost [Fri, 29 Oct 2021 15:40:53 +0000 (17:40 +0200)]
pf: Introduce ridentifier

Allow users to set a number on rules which will be exposed as part of
the pflog header.
The intent behind this is to allow users to correlate rules across
updates (remember that pf rules continue to exist and match existing
states, even if they're removed from the active ruleset) and pflog.

Obtained from: pfSense
MFC after: 3 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D32750

(cherry picked from commit 76c5eecc3490d89a9a3492ed2354802b69d69602)

2 years agoUpdate deprecation version for drivers removed in main
Ed Maste [Thu, 25 Nov 2021 16:47:03 +0000 (11:47 -0500)]
Update deprecation version for drivers removed in main

Removal of the amr, esp, iir, mly and twa drivers was planned before
FreeBSD 13, but did not happen before the branch.  Update the
depreciation notices to indicate that they are gone in FreeBSD 14.

Sponsored by: The FreeBSD Foundation

2 years agocloudabi: add deprecation notice in stable branches
Ed Maste [Thu, 25 Nov 2021 16:45:59 +0000 (11:45 -0500)]
cloudabi: add deprecation notice in stable branches

It has been removed from main before 14.0.

Sponsored by: The FreeBSD Foundation

2 years agobridge(4): Use American spelling of "behavior"
Guangyuan Yang [Mon, 22 Nov 2021 02:41:49 +0000 (21:41 -0500)]
bridge(4): Use American spelling of "behavior"

Fixes: 8406182dbeb972698775e2468902bc5f6e593d72
Reported by: Pau Amma <pauamma@gundo.com>

(cherry picked from commit 28ba36c65db8b4d95abcd543b97f2ec5161cdae5)

2 years agokmod_syms.awk: fix removal of the export list from the symbol table
Konstantin Belousov [Sun, 7 Nov 2021 09:00:07 +0000 (11:00 +0200)]
kmod_syms.awk: fix removal of the export list from the symbol table

(cherry picked from commit 0d7a6199b61d55caf0a682ef072bdd107472ab49)

2 years agoFix some modules to export more used symbols
Konstantin Belousov [Sun, 7 Nov 2021 08:42:24 +0000 (10:42 +0200)]
Fix some modules to export more used symbols

(cherry picked from commit 5bb3134a8c21cb87b30e135ef168483f0333dabb)

2 years agoUPDATING: Add an entry for commit 6e8e261f0d4e
Rick Macklem [Thu, 25 Nov 2021 00:47:03 +0000 (16:47 -0800)]
UPDATING: Add an entry for commit 6e8e261f0d4e

This is a direct commit.

2 years agoparam.h: Bump __FreeBSD_version to 1300522
Rick Macklem [Thu, 25 Nov 2021 00:39:52 +0000 (16:39 -0800)]
param.h: Bump __FreeBSD_version to 1300522

Commit 6e8e261f0d4e changed the internal KAPI between the NFS modules.
Bump __FreeBSD_version to 1300522.

This is a direct commit.

2 years agonfscl: Add a LayoutError RPC for NFSv4.2 pNFS mounts
Rick Macklem [Thu, 11 Nov 2021 23:43:58 +0000 (15:43 -0800)]
nfscl: Add a LayoutError RPC for NFSv4.2 pNFS mounts

If a pNFS server's DS runs out of disk space, it replies
NFSERR_NOSPC to the client doing writing.  For the Linux
client, it then sends a LayoutError RPC to the MDS server to
tell it about the error.  This patch adds the same to the
FreeBSD NFSv4.2 pNFS client, to maintain Linux compatible
behaviour, particlularily for non-FreeBSD pNFS servers.

(cherry picked from commit 44744f75386e2102584acbca24fbe67de16051ca)

2 years agonfsd: Fix the NFSv4.2 pNFS MDS server for NFSERR_NOSPC via LayoutError
Rick Macklem [Mon, 8 Nov 2021 23:58:00 +0000 (15:58 -0800)]
nfsd: Fix the NFSv4.2 pNFS MDS server for NFSERR_NOSPC via LayoutError

If a pNFS server's DS runs out of disk space, it replies
NFSERR_NOSPC to the client doing writing.  For the Linux
client, it then sends a LayoutError RPC to the MDS server to
tell it about the error and keeps retrying, doing repeated
LayoutGets to the MDS and Write RPCs to the DS.  The Linux client is
"stuck" until disk space on the DS is free'd up unless
a subsequent LayoutGet request is sent a NFSERR_NOSPC
reply.
The looping problem still occurs for NFSv4.1 mounts, but no
fix for this is known at this time.

This patch changes the pNFS MDS server to reply to LayoutGet
operations with NFSERR_NOSPC once a LayoutError reports the
problem, until the DS has available space.  This keeps the Linux
NFSv4.2 from looping.

Found during recent testing because of issues w.r.t. a DS
being out of space found during a recent IEFT NFSv4 working
group testing event.

(cherry picked from commit f8dc06303bac39be53872de7429aa54694b3f86a)

2 years agonfsd: Fix f_bavail and f_ffree for NFSv4 when negative
Rick Macklem [Mon, 8 Nov 2021 20:59:31 +0000 (12:59 -0800)]
nfsd: Fix f_bavail and f_ffree for NFSv4 when negative

Since the NFS Space_available and Files_available are unsigned,
the NFSv3 server sets them to 0 when negative, so that they
do not appear to be large positive values for non-FreeBSD clients.
This patch fixes the NFSv4 server to do the same.

Found during a recent IEFT NFSv4 working group testing event.

(cherry picked from commit d70ca5b00eede3367ce659a03b2f9cc9729cd0dd)

2 years agoiser: Remove redundant linuxkpi MODULE_DEPEND
Ka Ho Ng [Mon, 15 Nov 2021 06:04:08 +0000 (14:04 +0800)]
iser: Remove redundant linuxkpi MODULE_DEPEND

Since ibcore depends on linuxkpi, there is no need to pull in the
linuxkpi dependency in iser.

Sponsored by: The FreeBSD Foundation
Reviewed by: trasz
Differential Revision: https://reviews.freebsd.org/D32977

(cherry picked from commit f7523c8a19d008412ccc969b12eeb756613f3678)

2 years agopf tests: route_to:icmp_nat_head requires scapy
Kristof Provost [Wed, 3 Nov 2021 09:34:20 +0000 (10:34 +0100)]
pf tests: route_to:icmp_nat_head requires scapy

Document the requirement so the test is skipped if scapy is not
installed.

MFC after: 3 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 11703705c2f77498246b9523aae44040bd346c00)

2 years agoriscv: add COMPAT_FREEBSD12 option
Kristof Provost [Tue, 16 Nov 2021 19:46:26 +0000 (20:46 +0100)]
riscv: add COMPAT_FREEBSD12 option

Turn on compat option for older FreeBSD versions (i.e. 12). We do not
enable the compat options for 11 or older because riscv was never
supported in those versions.

Reviewed by: jrtc27 (previous version)
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D33015

(cherry picked from commit 23e1961e78b0ac4d1cf03426d1a642962069f2b9)

2 years agodevfs.rules: Correctly unhide pf in vnet jails
Zhenlei Huang [Wed, 3 Nov 2021 11:46:48 +0000 (12:46 +0100)]
devfs.rules: Correctly unhide pf in vnet jails

Revision 9e9be081d8 introduced a new devfs rule devfsrules_jail_vnet. It
includes rule devfsrules_jail which include other rules. Unfortunately
devfs could not recursively parse the action include and thus
devfsrules_jail_vnet will expose all nodes.

PR: 255660
Reviewed by: kp
Obtained from: Gijs Peskens <gijs@peskens.net>
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D32814

(cherry picked from commit 7acd322ebe2072b1d73b1d19c14ab12a300ba8e8)

2 years agotop.1: Use the Dq macros instead of \*lq and \*rq
Mateusz Piotrowski [Thu, 18 Nov 2021 14:55:27 +0000 (15:55 +0100)]
top.1: Use the Dq macros instead of \*lq and \*rq

MFC after: 3 days

(cherry picked from commit 01e3140571bab1a7283e33669de171865cdb8028)

2 years agotop.1: Improve description of -m
Mateusz Piotrowski [Thu, 18 Nov 2021 14:31:48 +0000 (15:31 +0100)]
top.1: Improve description of -m

Describe -m argument as "mode" instead of "display".

MFC after: 3 days

(cherry picked from commit c947fc5fae31c5935a57abcaa76f40fc8950ce59)

2 years agotop.1: Fix a typo in description of H interactive command
Mateusz Piotrowski [Thu, 18 Nov 2021 12:50:56 +0000 (13:50 +0100)]
top.1: Fix a typo in description of H interactive command

B is listed as an interactive command to toggle the display of threads.
This is a typo introduced during the conversion of the manual page to
mdoc.

Fixes: 9d6cce02a78c967e69b603d503545c4b43d7765f
MFC after: 3 days

(cherry picked from commit b8135ed67ce86e40fa7b46653ff54c769f2e7c98)

2 years agotop.1: Sort options alphabetically
Mateusz Piotrowski [Thu, 18 Nov 2021 13:11:23 +0000 (14:11 +0100)]
top.1: Sort options alphabetically

While here, add a short sentence introducing the options.

MFC after: 3 days

(cherry picked from commit 112539041590259a9d1e34999a80dc607c69f4db)

2 years agotop: Sort flags in usage message
Mateusz Piotrowski [Thu, 18 Nov 2021 13:21:34 +0000 (14:21 +0100)]
top: Sort flags in usage message

While here, fix the indentation of the second line in the message.

MFC after: 3 days

(cherry picked from commit 82d0f865ee9a93213876c14342b147e31b7ade0d)

2 years agoExport symbols from opensolaris.ko and dtrace.ko
Mark Johnston [Wed, 17 Nov 2021 16:01:59 +0000 (11:01 -0500)]
Export symbols from opensolaris.ko and dtrace.ko

Both modules provide many symbols used by various DTrace provider
modules, so just export everything.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 8a693ccf86f90469910c5b2425ddb8a75e298487)

2 years agopca954x: driver for PCA954x / TCA954x I2C switches
Andriy Gapon [Tue, 18 Aug 2020 09:16:28 +0000 (12:16 +0300)]
pca954x: driver for PCA954x / TCA954x I2C switches

At the moment only PCA9548A is supported and has been tested.

(cherry picked from commit c0525ab1d1ce69ab3d589e95733caedb04e0dcbd)

2 years agoarm64, riscv: Fix TRAF_PC() to return the PC, not the return address.
John Baldwin [Fri, 1 Oct 2021 18:53:12 +0000 (11:53 -0700)]
arm64, riscv: Fix TRAF_PC() to return the PC, not the return address.

Reviewed by: mhorne
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D31969

(cherry picked from commit 0177102173f39e17366a32eb22653aeb5248c355)

2 years agoriscv: Assert that SUM is not set in SSTATUS for exceptions.
John Baldwin [Wed, 21 Apr 2021 20:57:20 +0000 (13:57 -0700)]
riscv: Assert that SUM is not set in SSTATUS for exceptions.

Reviewed by: mhorne
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D29764

(cherry picked from commit 6a3a6fe34bf36b6e745b3e9ad1a991de057729c7)

2 years agoriscv: Clear SUM in SSTATUS for supervisor mode exceptions.
John Baldwin [Wed, 21 Apr 2021 20:57:04 +0000 (13:57 -0700)]
riscv: Clear SUM in SSTATUS for supervisor mode exceptions.

Previously, a page fault taken during copyin/out and related functions
would run the entire fault handler while permitting direct access to
user addresses.  This could also leak across context switches (e.g. if
the page fault handler was preempted by an interrupt or slept for disk
I/O).

To fix, clear SUM in assembly after saving the original version of
SSTATUS in the supervisor mode trapframe.

Reviewed by: mhorne, jrtc27
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D29763

(cherry picked from commit 753bcca440a4d2c95f48536b586131b84c0bb87e)

2 years agoktls: Split encrypt vs decrypt OCF counters.
John Baldwin [Tue, 16 Nov 2021 17:58:52 +0000 (09:58 -0800)]
ktls: Split encrypt vs decrypt OCF counters.

Reviewed by: gallatin, markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D33006

(cherry picked from commit 16bea05ac3275d41663939da0d5c26d89f15cd53)

2 years agoktls tests: Check the return values of close().
John Baldwin [Tue, 16 Nov 2021 17:56:15 +0000 (09:56 -0800)]
ktls tests: Check the return values of close().

Suggested by: markj
Reviewed by: markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D33004

(cherry picked from commit 694c708d6a0d00f84fa53357a1cc8a72272a26e3)