]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoMake sure all tasklets are drained before unloading the LinuxKPI.
Hans Petter Selasky [Fri, 21 May 2021 06:52:59 +0000 (08:52 +0200)]
Make sure all tasklets are drained before unloading the LinuxKPI.
Else use-after-free may happen.

This change also partially cherry picks support for the
taskqgroup_drain_all() function.

Sponsored by: Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 209d4919c5270fe9e3c1d809cf91355d222dc2f3)

3 years agoAccessing the epoch structure should happen after the INIT_CHECK().
Hans Petter Selasky [Fri, 21 May 2021 09:06:27 +0000 (11:06 +0200)]
Accessing the epoch structure should happen after the INIT_CHECK().
Else the epoch pointer may be NULL.

Sponsored by: Mellanox Technologies // NVIDIA Networking

(cherry picked from commit c82c200622b5380b8346de29879222538653f663)

3 years agoRework for-loop in EPOCH(9) to reduce indentation level.
Hans Petter Selasky [Fri, 21 May 2021 08:20:34 +0000 (10:20 +0200)]
Rework for-loop in EPOCH(9) to reduce indentation level.

No functional change intended.

Sponsored by: Mellanox Technologies // NVIDIA Networking

(cherry picked from commit cc9bb7a9b863c018a069a71392fa9baea98b5fdb)

3 years agotests/libalias: Test LibAliasIn and redirection
Lutz Donnerhacke [Sun, 23 May 2021 12:43:00 +0000 (14:43 +0200)]
tests/libalias: Test LibAliasIn and redirection

Rework the tests to check the correct layer in a single test. Factor
out tests for reuse in other modules. Extend the test suite for
libalias(3) to incoming connections. Test the various types of
redirections.

gettimeofday(3) is almost as expensive as the calls to libalias.
So the call frequency for this call is reduced by a factor of 1000 in
order to neglect it's influence.

Using NAT entries became more realistic: A communication of a random
length of up to 150 packets (10% outgoing, 90% incoming) is applied
for each entry.

Add port forwardings to the performance tests.  This will cause random
incoming packets to match the random port forwardings opends beforehand.

After a long test run, a lot of ressouces have been allocated.
Measure the time tot free them.

Reviewed by: kp (partially)
Differential Revision: https://reviews.freebsd.org/D30412
Differential Revision: https://reviews.freebsd.org/D30408
Differential Revision: https://reviews.freebsd.org/D30405
Differential Revision: https://reviews.freebsd.org/D30443

(cherry picked from commit f1462ab0512c1a0e59f03a7a145df2889bed2997)
(cherry picked from commit 755bab6d55e6e2df168f352f3e2fbdea87002ed8)
(cherry picked from commit 6e87898a2c7e99937656a0c12d03333a43a10c5e)
(cherry picked from commit d62e1ecba07b2acee37e019778087f0f55d977d1)
(cherry picked from commit 5434ebd256a08e452dec376c1488abdf7ff02af8)

Fix various bugs:
(cherry picked from commit ccac04cae538a625cbce224e4005360fa85e1b9d)
(cherry picked from commit 7b8696bf128754712a24ba98ce2d88eed2ee68dc)
(cherry picked from commit fef99da69f983566de3cb8ad4a1b8decc31348ce)
(cherry picked from commit f4c460dacdda5c6e1896a0c51d6096c4f3417b32)

3 years agoiwn(4): Remove duplicate device entry
Gordon Bergling [Sun, 30 May 2021 13:40:33 +0000 (15:40 +0200)]
iwn(4): Remove duplicate device entry

'Intel Centrino Wireless-N 6250' is listed twice in the description
section of the manual page.

PR: 256257
Reported by: Daniel Cervus <danielthedeer at outlook dot com>

(cherry picked from commit 66e2a5803b0f80fff3bb8e3659ae7411ef94cc35)

3 years agotcsh: update to version 6.22.04.
Dmitry Chagin [Wed, 19 May 2021 21:12:27 +0000 (00:12 +0300)]
tcsh: update to version 6.22.04.

Merge commit '174d8b60324d7e8754709f7155e13ca95220b48c' into main.

(cherry picked from commit 6560ac57ce879857203bc456cdc3849808dc0700)

3 years agotcsh: cleanup source tree to reduce diff size.
Dmitry Chagin [Wed, 19 May 2021 21:08:25 +0000 (00:08 +0300)]
tcsh: cleanup source tree to reduce diff size.

Remove makefiles, configure files and unused at build time files
to reduce the diff size. Otherwise the diff contains a lot of
unnecessary lines what makes reviewing and merging proccess so hard,
especially for re@.

(cherry picked from commit 6190ff6104aed4cd753019325a252c4d66495b5e)

3 years agoFix packet cbs/ebs conversion.
Alexander Motin [Wed, 19 May 2021 15:00:21 +0000 (11:00 -0400)]
Fix packet cbs/ebs conversion.

Each packet is counted as 128 bytes by the code, not 125.  Not sure
what I was thinking about here 14 years ago.  May be just a typo.

Reported by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after: 2 weeks

(cherry picked from commit 4a6830761c6552bfe2c118a73a5a461694cb84c7)

3 years agoelfctl: avoid touching file if no change made
Ed Maste [Tue, 25 May 2021 18:25:18 +0000 (14:25 -0400)]
elfctl: avoid touching file if no change made

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

(cherry picked from commit 3f2508b7f3855102abed99b846e30e728ba3d04d)

3 years agopf: Move nvlist conversion functions to pf_nv
Kristof Provost [Tue, 18 May 2021 07:24:50 +0000 (09:24 +0200)]
pf: Move nvlist conversion functions to pf_nv

Separate the conversion functions (between kernel structs and nvlists)
to pf_nv. This reduces the size of pf_ioctl.c, which is already quite
large and complex, a good bit. It also keeps all the fairly
straightforward conversion code together.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D30359

(cherry picked from commit 3032c353882aa70a461ef251b8aa6c59a0829ec5)

3 years agocontrib/bc: update to version 4.0.2
Stefan Eßer [Wed, 12 May 2021 05:49:19 +0000 (07:49 +0200)]
contrib/bc: update to version 4.0.2

Merge commit '2858419a0ee2b8f5827de72c00618bcd69ebc5fc'

This update fixes the initialization of "scale" to 20 if started with
-l and the initial statement leads to an error (e.g. contains a syntax
error). Scale was initialized to 0 in that case.

Another change is the support of job control in interactive mode with
line editing enabled. The control characters have been interpreted as
editing commands only, prior to this version.

(cherry picked from commit 8c39e25220bb88cd027d0c3b0fe86e52f6abd150)

3 years agocontrib/bc: update to version 4.0.1
Stefan Eßer [Thu, 29 Apr 2021 12:29:04 +0000 (14:29 +0200)]
contrib/bc: update to version 4.0.1

This update adds a flush() of the output buffer to the bc print
command.

(cherry picked from commit 8ea9013512494c9f035afa1ffa1e199b44c7904f)

Synch index of contrib/bc with what is in workdir after cloning.

From a workdir perspective this should be a no-op.
See also:
https://lists.freebsd.org/pipermail/freebsd-current/2021-April/079569.html

(cherry picked from commit a0358e3d5184950b4316f105eb292cbafdea208b)

3 years agorun(4): fix manual after d6fd321ef60d43dce9f437187c94a7de2b91ab69.
Dmitry Chagin [Sun, 23 May 2021 13:35:31 +0000 (16:35 +0300)]
run(4): fix manual after d6fd321ef60d43dce9f437187c94a7de2b91ab69.

PR: 255759

(cherry picked from commit 43f5d5bf01fdf821e8037272c636a9be18323e00)

3 years agorun(4): add support for ASUS USB-N14 wireless adaptor.
Dmitry Chagin [Sat, 22 May 2021 10:52:12 +0000 (13:52 +0300)]
run(4): add support for ASUS USB-N14 wireless adaptor.

PR: 255759
Submitted by: john.lmurdoch at gmail.com

(cherry picked from commit d6fd321ef60d43dce9f437187c94a7de2b91ab69)

3 years agoDRIVER_MODULE(9): Correct the SYNOPSIS of EARLY_DRIVER_MODULE()
J.R. Oldroyd [Mon, 24 May 2021 14:54:45 +0000 (16:54 +0200)]
DRIVER_MODULE(9): Correct the SYNOPSIS of EARLY_DRIVER_MODULE()

The man page SYNOPSIS for EARLY_DRIVER_MODULE() shows that it has
an "enum sysinit_elem_order order" argument.

The actual macro in sys/bus.h does not have an order argument.

PR: 256103
Reported by: J.R. Oldroyd <fbsd at opal dot com>
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D30411

(cherry picked from commit 3fdd5c1e49cbc0a77935eb34e3561c6021b93650)

3 years agonfsd: Add support for CLAIM_DELEG_CUR_FH to the NFSv4.1/4.2 Open
Rick Macklem [Tue, 18 May 2021 22:53:54 +0000 (15:53 -0700)]
nfsd: Add support for CLAIM_DELEG_CUR_FH to the NFSv4.1/4.2 Open

The Linux NFSv4.1/4.2 client now uses the CLAIM_DELEG_CUR_FH
variant of the Open operation when delegations are recalled and
the client has a local open of the file.  This patch adds
support for this variant of Open to the NFSv4.1/4.2 server.

This patch only affects mounts from Linux clients when delegations
are enabled on the server.

(cherry picked from commit b3d4c70dc60f1913f2363751b905b562c39ca126)

3 years agonfsd: Reduce the callback timeout to 800msec
Rick Macklem [Tue, 18 May 2021 23:17:58 +0000 (16:17 -0700)]
nfsd: Reduce the callback timeout to 800msec

Recent discussion on the nfsv4@ietf.org mailing list confirmed
that an NFSv4 server should reply to an RPC in less than 1second.
If an NFSv4 RPC requires a delegation be recalled,
the server will attempt a CB_RECALL callback.
If the client is not responsive, the RPC reply will be delayed
until the callback times out.
Without this patch, the timeout is set to 4 seconds (set in
ticks, but used as seconds), resulting in the RPC reply taking over 4sec.
This patch redefines the constant as being in milliseconds and it
implements that for a value of 800msec, to ensure the RPC
reply is sent in less than 1second.

This patch only affects mounts from clients when delegations
are enabled on the server and the client is unresponsive to callbacks.

(cherry picked from commit fc0dc94029df8150301b925bda690b20d9d0bcbf)

3 years agotaskqueue: Add missing comma to TASKQUEUE_FAST_DEFINE_THREAD
Colin Percival [Tue, 25 May 2021 03:37:55 +0000 (20:37 -0700)]
taskqueue: Add missing comma to TASKQUEUE_FAST_DEFINE_THREAD

Add missing comma to TASKQUEUE_FAST_DEFINE_THREAD arguments to prevent
compilation errors.

Submitted by: ashafer_badland.io

(cherry picked from commit 27f09959d5f507465cc7f202c1b34987f0cdee55)

3 years agoptrace: add an option to not kill debuggees on debugger exit
Konstantin Belousov [Tue, 18 May 2021 16:26:22 +0000 (19:26 +0300)]
ptrace: add an option to not kill debuggees on debugger exit

(cherry picked from commit fd3ac06f452f47332e2f6fec8347579265c96104)

3 years agosys_process.c: extract ptrace_unsuspend()
Konstantin Belousov [Tue, 18 May 2021 16:25:50 +0000 (19:25 +0300)]
sys_process.c: extract ptrace_unsuspend()

(cherry picked from commit d7a7ea5be60753c140a39ec6fa30e5ca4014dbb5)

3 years agoMove mnt_maxsymlinklen into appropriate fs mount data structures
Konstantin Belousov [Tue, 18 May 2021 01:42:03 +0000 (04:42 +0300)]
Move mnt_maxsymlinklen into appropriate fs mount data structures

For MFC, mnt_maxsymlinklen was replaced by padding of type u_int,
to restore KBI after 57d877348b2c.

(cherry picked from commit f784da883fd5a744fcaf4ccfc550ca497ea5d7a6)

3 years agotcp: Use local CC data only in the correct context
Richard Scheffenegger [Wed, 26 May 2021 17:45:06 +0000 (19:45 +0200)]
tcp: Use local CC data only in the correct context

Most CC algos do use local data, and when calling
newreno_cong_signal from there, the latter misinterprets
the data as its own struct, leading to incorrect behavior.

Reported by:  chengc_netapp.com
Reviewed By:  chengc_netapp.com, tuexen, #transport
MFC after:    3 days
Sponsored By: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D30470

(cherry picked from commit c358f1857f0c749ad166fb9e9bef04f4033f3a72)

3 years agoNFSv4 server: Re-establish the delegation recall timeout
Rick Macklem [Sun, 16 May 2021 23:40:01 +0000 (16:40 -0700)]
NFSv4 server: Re-establish the delegation recall timeout

Commit 7a606f280a3e allowed the server to do retries of CB_RECALL
callbacks every couple of seconds.  This was needed to allow the
Linux client to re-establish the back channel.
However this patch broke the delegation timeout check, such that
it would just keep retrying CB_RECALLS.
If the client has crashed or been network patitioned from the
server, this continues until the client TCP reconnects to
the server and re-establishes the back channel.

This patch modifies the code such that it still times out the
delegation recall after some minutes, so that the server will
allow the conflicting client request once the delegation times out.

This patch only affects the NFSv4 server when delegations are
enabled and a NFSv4 client that holds a delegation has crashed
or been network partitioned from the server for at least several
minutes when a delegation needs to be recalled.

(cherry picked from commit 46269d66ed02598c86756d81a7d7b27ec0f0c5cd)

3 years agoktls.h: Guard includes behind _KERNEL
Mark Johnston [Sat, 22 May 2021 16:12:19 +0000 (12:12 -0400)]
ktls.h: Guard includes behind _KERNEL

These are not needed when including ktls.h to get sockopt definitions.

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

(cherry picked from commit 5c7ef43e9625528da93b308a97aab0858f7eaec6)

3 years agoFix handling of embedded symbolic links (and history lesson).
Kirk McKusick [Mon, 17 May 2021 00:02:42 +0000 (17:02 -0700)]
Fix handling of embedded symbolic links (and history lesson).

Sponsored by: Netflix

(cherry picked from commit 9a2fac6ba65fbd14d37ccedbc2aec27a190128ea)

3 years agotests/libalias: Reduce stress
Lutz Donnerhacke [Sun, 23 May 2021 20:41:26 +0000 (22:41 +0200)]
tests/libalias: Reduce stress

Due to the new, external performance test utility, the regular test
suite can reduce the stress test to a fair amount of activity.

(cherry picked from commit a660948b7b2d875591aba3713620424c51330038)

3 years agolibalias: replace placeholder with static constant
Lutz Donnerhacke [Thu, 13 May 2021 21:47:57 +0000 (23:47 +0200)]
libalias: replace placeholder with static constant

The field nullAddress in struct libalias is never set and never used.
It exists as a placeholder for an unused argument only.

Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30253

(cherry picked from commit 189f8eea138a78b09c9f19114b1362b0df1cf87d)
(cherry picked from commit b03a41befeaf17ef25da96fc7bc2dc19c9a6b253)

3 years agoFix a use after free in update_rtm_from_rc().
Alexander V. Chernikov [Fri, 14 May 2021 16:03:08 +0000 (16:03 +0000)]
Fix a use after free in update_rtm_from_rc().

update_rtm_from_rc() calls update_rtm_from_info() internally.
The latter one may update provided prtm pointer with a new rtm.
Reassign rtm from prtm afeter calling update_rtm_from_info() to
 avoid touching the freed rtm.

PR: 255871
Submitted by: lylgood@foxmail.com

3 years agoFix panic when trying to delete non-existent gateway in multipath route.
Alexander V. Chernikov [Fri, 7 May 2021 20:36:50 +0000 (20:36 +0000)]
Fix panic when trying to delete non-existent gateway in multipath route.

IF non-existend gateway was specified, the code responsible for calculating
 an updated nexthop group, returned the same already-used nexthop group.
After the route table update, the operation result contained the same
 old & new nexthop groups. Thus, the code responsible for decomposing
 the notification to the list of simple nexthop-level notifications,
 was not able to find any differences. As a result, it hasn't updated any
  of the "simple" notification fields, resulting in empty rtentry pointer.
This empty pointer was the direct reason of a panic.

Fix the problem by returning ESRCH when the new nexthop group is the same
 as the old one after applying gateway filter.

Reported by: Michael <michael.adm at gmail.com>
PR: 255665

3 years agoAdd support for Gemini Lake LPSS UARTs.
Konstantin Belousov [Sun, 23 May 2021 16:38:54 +0000 (19:38 +0300)]
Add support for Gemini Lake LPSS UARTs.

PR: 256101

(cherry picked from commit eaf00819bcfa90ab7ac8af324826eb985197d8c8)

3 years agotest/libalias: Tests for instantiation and outgoing NAT
Lutz Donnerhacke [Sun, 16 May 2021 21:37:37 +0000 (23:37 +0200)]
test/libalias: Tests for instantiation and outgoing NAT

In order to modify libalias for performance, the existing
functionality must not change.  Enforce this.

Testing LibAliasOut functionality. This concentrates the typical use
case of initiating data transfers from the inside.  Provide a
exhaustive test for the data structure in order to check for
performance improvements.

In order to compare upcoming changes for their effectivness, measure
performance by counting opertions and the runtime of each operation
over the time.  Accumulate all tests in a single instance, so make it
complicated over the time.  If you wait long enough, you will notice
the expiry of old flows.

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D30307
Differential Revision: https://reviews.freebsd.org/D30335
Differential Revision: https://reviews.freebsd.org/D30379

(cherry picked from commit 7fd8baee756efa18b6bbb17cbf3a652eb2058d87)
(cherry picked from commit c1fbb54f4b100d576da7ab065d1887a21f691936)
(cherry picked from commit 33c1bdfc3e098862100bab7a8dc729d8c78ffa7c)

3 years agolibalias: Style cleanup
Lutz Donnerhacke [Fri, 14 May 2021 13:08:08 +0000 (15:08 +0200)]
libalias: Style cleanup

libalias is a convolut of various coding styles modified by a series
of different editors enforcing interesting convetions on spacing and
comments.

This patch is a baseline to start with a perfomance rework of
libalias.  Upcoming patches should be focus on the code, not on the
style.  That's why most annoying style errors should be fixed
beforehand.

Reviewed by: hselasky
Discussed by: emaste
Differential Revision: https://reviews.freebsd.org/D30259

(cherry picked from commit effc8e57fbf03d7f1423c662caf2b63f0d1d21a9)

At some places the ASSERT was inserted before variable declarations are
finished.  This is fixed now.

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

(cherry picked from commit 2e6b07866f9e1520626a1523f6609cc411bdda1c)

3 years agonullfs: dirty v_object must imply the need for inactivation
Konstantin Belousov [Fri, 21 May 2021 07:30:19 +0000 (10:30 +0300)]
nullfs: dirty v_object must imply the need for inactivation

(cherry picked from commit 42881526d401e7a9c09241e392b7ffa18cfe11d6)

3 years agovn_need_pageq_flush(): simplify
Konstantin Belousov [Fri, 21 May 2021 07:34:27 +0000 (10:34 +0300)]
vn_need_pageq_flush(): simplify

(cherry picked from commit d713bf79273ad928f591dee2f8a553487e515e9b)

3 years ago.github: Attempt to un-break Clang 9 action
Jessica Clarke [Sat, 29 May 2021 03:36:36 +0000 (04:36 +0100)]
.github: Attempt to un-break Clang 9 action

GitHub removed Clang 9 from the 20.04 image[1], breaking this build.
Thus, manually add the specific versioned packages we need for the
Ubuntu jobs to ensure they're installed. Note that we don't do the same
for macOS, as Homebrew does not allow multiple llvm@N to co-exist,
giving an error if you attempt to install a second one. In practice we
don't actually use the compiler field here for anything other than the
build name, it's only the cross-bindir that matters, so when it
eventually moves to 12 the name will get confusing but the job will
still work.

MFC after: immediately

[1] https://github.com/actions/virtual-environments/commit/15a610677be406d250c1f6732b03c8b87e693a0a

(cherry picked from commit e5f5b6a75c0aa0f51a399e2002d15b51211630b5)

3 years agolibradius: Fix attribute length validation in rad_get_attr(3)
Mark Johnston [Fri, 28 May 2021 14:41:43 +0000 (10:41 -0400)]
libradius: Fix attribute length validation in rad_get_attr(3)

The length of the attribute header needs to be excluded when comparing
the attribute length against the length of the packet.  Otherwise,
validation may incorrectly fail when fetching the final attribute in a
message.

Fixes: 8d5c78130 ("libradius: Fix input validation bugs")
Reported by: Peter Eriksson
Tested by: Peter Eriksson
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 6bb5699d2b59491097bc21ffa3c097cdd4853f89)

3 years agoFix scripted installs on EFI systems using ZFS root with zfsboot.
Nathan Whitehorn [Fri, 14 May 2021 12:30:41 +0000 (08:30 -0400)]
Fix scripted installs on EFI systems using ZFS root with zfsboot.

Unlike attended installations, scripted installs did not mount non-ZFS
partitions when ZFS root (via zfsboot) was selected. Since this included
the ESP, the EFI loader was not installed. Copy logic from the
attended-install path to make this work.

PR: 255824, 255081
MFC after: 1 week
Obtained from: Mark Huizer

(cherry picked from commit 34766aa8cb514472c571f8b0e90e833833acef51)

3 years agoldconfig(8): update manpage to reality
Konstantin Belousov [Sat, 15 May 2021 05:12:35 +0000 (08:12 +0300)]
ldconfig(8): update manpage to reality

(cherry picked from commit a19e14ca2d36aa9d5bd392881abd85bf9e2e89ad)

3 years agoixgbe: Improve device name strings
Kevin Bowling [Wed, 21 Apr 2021 02:35:14 +0000 (19:35 -0700)]
ixgbe: Improve device name strings

This is just clerical work to ease bug triage and may be used to set
expectations around the ability for anyone in the community to perform
testing and development on older parts.

Approved by: erj
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D29876

(cherry picked from commit fdbcd35a75e596a78b4c0330eaded476eaa14797)

3 years agoe1000: Rework em_msi_link interrupt filter
Kevin Bowling [Sun, 25 Apr 2021 08:22:23 +0000 (01:22 -0700)]
e1000: Rework em_msi_link interrupt filter

* Fix 82574 Link Status Changes, carrying the OTHER mask bit around as
  needed.
* Move igb-class LSC re-arming out of FAST back into the handler.
* Clarify spurious/other interrupt re-arms in FAST.

In MSI-X mode, 82574 and igb-class devices use an interrupt filter to
handle Link Status Changes. We want to do LSC re-arms in the handler
to take advantage of autoclear (EIAC) single shot behavior.

82574 uses 'Other' in ICR and IMS for LSC interrupt types when in MSI-X
mode, so we need to set and re-arm the 'Other' bit during attach and
after ICR reads in the FAST handler if not an LSC or after handling on
LSC due to autoclearing.

This work was primarily done to address the referenced PR, but inspired
some clarification and improvement for igb-class devices once the
intentions of previous bug fix attempts became clearer.

PR: 211219
Reported by: Alexey <aserp3@gmail.com>
Tested by: kbowling (I210 lagg), markj (I210)
Approved by: markj
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D29943

(cherry picked from commit eea55de7b10808b86277d7fdbed2d05d3c6db1b2)

3 years agoe1000: Improve device name strings
Kevin Bowling [Wed, 21 Apr 2021 05:27:48 +0000 (22:27 -0700)]
e1000: Improve device name strings

This is just clerical work to ease bug triage and may be used to set
expectations around the ability for anyone in the community to perform
testing and development on older parts (this driver covers over 20 years
of silicon)

Reviewed by: erj
Approved by: markj
Sponsored by: Pink Floyd - Any Colour You Like (in kind)
Differential Revision: https://reviews.freebsd.org/D29872

(cherry picked from commit 0f6bea61edb4d055fe6e340aab3685054a582020)

3 years agoe1000: Correct promisc multicast filter handling
Kevin Bowling [Fri, 16 Apr 2021 23:15:50 +0000 (16:15 -0700)]
e1000: Correct promisc multicast filter handling

There are a number of issues in the e1000 multicast filter handling
that have been present for a long time. Take the updated approach from
ixgbe(4) which does not have the issues.

The issues are outlined in the PR, in particular this solves crossing
over and under the hardware's filter limit, not programming the
hardware filter when we are above its limit, disabling SBP (show bad
packets) when the tunable is enabled and exiting promiscuous mode, and
an off-by-one error in the em_copy_maddr function.

PR: 140647
Reported by: jtl
Reviewed by: markj
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D29789

(cherry picked from commit 4b38eed76da9c36f09bff33b5cf15687cd99016f)

3 years agoixgbe: Clean up unneeded set in ixgbe_if_multi_set
Kevin Bowling [Mon, 19 Apr 2021 19:22:22 +0000 (12:22 -0700)]
ixgbe: Clean up unneeded set in ixgbe_if_multi_set

We don't need to set the bits here since the if/else if/else statements
fully cover setting these bit pairs.

Reported by: markj
Reviewed by: markj, erj
Approved by: #intel_networking
MFC aftter: 1 week
Differential Revision: https://reviews.freebsd.org/D29827

(cherry picked from commit deecaa144526a5d001aeb99149e2139601388427)

3 years agoscsi(4): fix "NMVe" typo
Mitchell Horne [Fri, 21 May 2021 14:50:15 +0000 (11:50 -0300)]
scsi(4): fix "NMVe" typo

(cherry picked from commit 788401188f950001cd9796cdcea9a7e5f92050ab)

3 years agobuild(7): use a more relevant example for PORTS_MODULES
Mitchell Horne [Sat, 15 May 2021 14:14:52 +0000 (11:14 -0300)]
build(7): use a more relevant example for PORTS_MODULES

emulators/kqemu-kmod no longer exists in the ports tree.

Reviewed by: imp, bcr
Differential Revision: https://reviews.freebsd.org/D30261

(cherry picked from commit 7fbc0c98a8efaef86d72759372ec7746d929302e)

3 years agoufs: Avoid M_WAITOK allocations when building a dirhash
Don Morris [Thu, 20 May 2021 14:54:38 +0000 (10:54 -0400)]
ufs: Avoid M_WAITOK allocations when building a dirhash

At this point the directory's vnode lock is held, so blocking while
waiting for free pages makes the system more susceptible to deadlock in
low memory conditions.  This is particularly problematic on NUMA systems
as UMA currently implements a strict first-touch policy.

ufsdirhash_build() already uses M_NOWAIT for other allocations and
already handled failures for the block array allocation, so just convert
to M_NOWAIT.

PR: 253992
Reviewed by: markj, mckusick, vangyzen

(cherry picked from commit f17a5900850b4d449a91cbe9c61dfb62373c3cd1)

3 years agonetgraph/ng_bridge: Avoid cache thrashing
Lutz Donnerhacke [Thu, 11 Feb 2021 22:59:11 +0000 (23:59 +0100)]
netgraph/ng_bridge: Avoid cache thrashing

Hint the compiler, that this update is needed at most once per second.
Only in this case the memory line needs to be written.  This will
reduce the amount of cache trashing during forward of most frames.

Suggested by: zec
Approved by: zec
Differential Revision: https://reviews.freebsd.org/D28601

(cherry picked from commit 4dfe70fdbda05453e824bc9edfc0d09eab7b2929)

3 years agonetgraph/ng_bridge: become SMP aware
Lutz Donnerhacke [Tue, 12 Jan 2021 21:28:29 +0000 (22:28 +0100)]
netgraph/ng_bridge: become SMP aware

The node ng_bridge underwent a lot of changes in the last few months.
All those steps were necessary to distinguish between structure
modifying and read-only data transport paths.  Now it's done, the node
can perform frame forwarding on multiple cores in parallel.

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

(cherry picked from commit 9674c2e68c613757ddf5a8780743842b5ac4d74f)

3 years agonetgraph/ng_bridge: move MACs via control message
Lutz Donnerhacke [Tue, 9 Feb 2021 13:28:48 +0000 (14:28 +0100)]
netgraph/ng_bridge: move MACs via control message

Use the new control message to move ethernet addresses from a link to
a new link in ng_bridge(4).  Send this message instead of doing the
work directly requires to move the loop detection into the control
message processing.  This will delay the loop detection by a few
frames.

This decouples the read-only activity from the modification under a
more strict writer lock.

Reviewed by: manpages (gbe)
Differential Revision: https://reviews.freebsd.org/D28559

(cherry picked from commit f6e0c471691e0005e450ec968a9fa3b5346a3c45)

3 years agonetgraph/ng_bridge: learn MACs via control message
Lutz Donnerhacke [Tue, 4 May 2021 20:14:59 +0000 (22:14 +0200)]
netgraph/ng_bridge: learn MACs via control message

Add a new control message to move ethernet addresses to a given link
in ng_bridge(4). Send this message instead of doing the work directly.
This decouples the read-only activity from the modification under a
more strict writer lock.

Decoupling the work is a prerequisite for multithreaded operation.

Approved by: manpages (bcr), kp (earlier version)
Differential Revision: https://reviews.freebsd.org/D28516

(cherry picked from commit b1bd44732d8332930dc6a17092f47a201caff1ef)

3 years agopf: fix ioctl() memory leak
Kristof Provost [Mon, 24 May 2021 06:32:16 +0000 (08:32 +0200)]
pf: fix ioctl() memory leak

When we create an nvlist and insert it into another nvlist we must
remember to destroy it. The nvlist_add_nvlist() function makes a copy,
just like nvlist_add_string() makes a copy of the string. If we don't
we're leaking memory on every (nvlist-based) ioctl() call.

While here remove two redundant 'break' statements.

PR: 255971
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 4483fb47735c29408c72045469c9c4b3e549668b)

3 years agopfctl tests: Test fairq configuration
Kristof Provost [Wed, 19 May 2021 07:52:50 +0000 (09:52 +0200)]
pfctl tests: Test fairq configuration

We used to have a bug where pfctl could crash setting fairq queues. Test
this case and ensure it does not crash pfctl.

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

(cherry picked from commit 9938fcaa6565a660c555a0e9c712842ba1a2d31c)

3 years agopfctl: Fix crash on ALTQ configuration
Kristof Provost [Tue, 18 May 2021 13:03:01 +0000 (15:03 +0200)]
pfctl: Fix crash on ALTQ configuration

The following config could crash pfctl:
altq on igb0 fairq bandwidth 1Gb queue { qLink }
queue qLink fairq(default)

That happens because when we're parsing the parent queue (on igb0) it
doesn't have a parent, and the check in eval_pfqueue_fairq() checks
pa->parent rather than parent.

This was changed in eval_pfqueue_hfsc() in
1d34c9dac8624c5c315ae39ad3ae8e5879b23256, but not for fairq.

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

(cherry picked from commit 26705a39e51eaf5b32efa98fb86df2d4ecfbdc61)

3 years agopf tests: Test the ability to kill floating states by interface
Kristof Provost [Thu, 13 May 2021 08:04:20 +0000 (10:04 +0200)]
pf tests: Test the ability to kill floating states by interface

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

(cherry picked from commit 7bd7933f9a4f1757fdefeee2e1ac8b8c4d299fc3)

3 years agopf: Support killing floating states by interface
Kristof Provost [Thu, 13 May 2021 07:51:28 +0000 (09:51 +0200)]
pf: Support killing floating states by interface

Floating states get assigned to interface 'all' (V_pfi_all), so when we
try to flush all states for an interface states originally created
through this interface are not flushed. Only if-bound states can be
flushed in this way.

Given that we track the original interface we can check if the state's
interface is 'all', and if so compare to the orig_if instead.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D30246

(cherry picked from commit b62489cc92edbec318fb6c57cdc02b5e3cfa3a67)

3 years agopf: Track the original kif for floating states
Kristof Provost [Wed, 12 May 2021 11:24:57 +0000 (13:24 +0200)]
pf: Track the original kif for floating states

Track (and display) the interface that created a state, even if it's a
floating state (and thus uses virtual interface 'all').

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D30245

(cherry picked from commit d0fdf2b28f9b981d2cb98e9da8a715e046ef1e92)

3 years agopfctl: Use DIOCGETSTATESNV
Kristof Provost [Mon, 10 May 2021 14:51:38 +0000 (16:51 +0200)]
pfctl: Use DIOCGETSTATESNV

Migrate to using the new nvlist-based DIOCGETSTATESNV call to obtain the
states list.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D30244

(cherry picked from commit bc941291473d8a2164e4ffc3f3e7e6a356cbe747)

3 years agopf: Add DIOCGETSTATESNV
Kristof Provost [Wed, 5 May 2021 19:00:16 +0000 (21:00 +0200)]
pf: Add DIOCGETSTATESNV

Add DIOCGETSTATESNV, an nvlist-based alternative to DIOCGETSTATES.

MFC after:      1 week
Sponsored by:   Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D30243

(cherry picked from commit 0592a4c83d67547644763fb023abd5eb28e57f92)

3 years agopf: Add DIOCGETSTATENV
Kristof Provost [Wed, 5 May 2021 12:33:55 +0000 (14:33 +0200)]
pf: Add DIOCGETSTATENV

Add DIOCGETSTATENV, an nvlist-based alternative to DIOCGETSTATE.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D30242

(cherry picked from commit 1732afaa0dae9d844e341f2c1d6ed4b79c403bfb)

3 years agopfctl: Ensure parent queue is configured for FAIRQ
Kristof Provost [Tue, 18 May 2021 16:22:13 +0000 (18:22 +0200)]
pfctl: Ensure parent queue is configured for FAIRQ

We failed to account for the FAIRQ scheduler in expand_altq(), which led
it to be set up without its parent queue.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D30347

(cherry picked from commit dc784287967d45ab681dc51e9e20b78c8c535834)

3 years agohda: correct comment about Asus laptop digital mics
Philippe Michaud-Boudreault [Wed, 19 May 2021 14:32:25 +0000 (10:32 -0400)]
hda: correct comment about Asus laptop digital mics

Reported in review D30333

MFC after: 1 week

(cherry picked from commit 5d698386fbfe166df72a17712ffde8cefeecefab)

3 years agokldxref: do not error out if specified path is not directory, for -d mode
Konstantin Belousov [Thu, 20 May 2021 19:12:11 +0000 (22:12 +0300)]
kldxref: do not error out if specified path is not directory, for -d mode

(cherry picked from commit d7751071bc41c63c5dadd81ef4b0a26748d8f9b0)

3 years agolibradius: Fix input validation bugs
Mark Johnston [Tue, 25 May 2021 17:59:09 +0000 (13:59 -0400)]
libradius: Fix input validation bugs

Approved by: so
Security: FreeBSD-SA-21:12.libradius
Security: CVE-2021-29629
Sponsored by: The FreeBSD Foundation

(cherry picked from commit e73975dc321a9ccbbbd65b609aa386b187dad2c1)

3 years agoamd64/linux*: add required header to get the constant value
Konstantin Belousov [Tue, 25 May 2021 22:19:44 +0000 (01:19 +0300)]
amd64/linux*: add required header to get the constant value

Otherwise asm silently interpret it as the external global symbol.

Reported by: bz
Sponsored by: The FreeBSD Foundation
Fixes: 91aae953cb80

(cherry picked from commit a59f0285377aa3d61cccda64e9ade126ecb3d2d9)

3 years agoamd64: clear PSL.AC in the right frame
Konstantin Belousov [Sat, 22 May 2021 19:48:36 +0000 (22:48 +0300)]
amd64: clear PSL.AC in the right frame

If copyin family of routines fault, kernel does clear PSL.AC on the
fault entry, but the AC flag of the faulted frame is kept intact.  Since
onfault handler is effectively jump, AC survives until syscall exit.

Reported by: m00nbsd, via Sony
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
admbugs: 975

(cherry picked from commit 91aae953cb807d6fb7a70782b323bf9beb60d7c9)

3 years agoalc(4): add support for Mikrotik 10/25G NIC
Konstantin Belousov [Wed, 19 May 2021 22:14:18 +0000 (01:14 +0300)]
alc(4): add support for Mikrotik 10/25G NIC

PR: 256000

(cherry picked from commit 77b637338a3656d4ccedb9798a3f98ac283962f4)

3 years agoFix mbuf leaks in various pru_send implementations
Mark Johnston [Wed, 12 May 2021 13:39:36 +0000 (09:39 -0400)]
Fix mbuf leaks in various pru_send implementations

The various protocol implementations are not very consistent about
freeing mbufs in error paths.  In general, all protocols must free both
"m" and "control" upon an error, except if PRUS_NOTREADY is specified
(this is only implemented by TCP and unix(4) and requires further work
not handled in this diff), in which case "control" still must be freed.

This diff plugs various leaks in the pru_send implementations.

Reviewed by: tuexen
Sponsored by: The FreeBSD Foundation

(cherry picked from commit d8acd2681bcfb2ff7eb154df82f268b1cb191b4c)

3 years agodummynet: Fix mbuf tag allocation failure handling
Mark Johnston [Tue, 18 May 2021 19:22:21 +0000 (15:22 -0400)]
dummynet: Fix mbuf tag allocation failure handling

PR: 255875, 255878, 255879, 255880
Reviewed by: donner, kp
Sponsored by: The FreeBSD Foundation

(cherry picked from commit c4a6258d70f73c27d8f0c6233edbcc609791806b)

3 years agosocket: Release cred reference later in sodealloc()
Lv Yunlong [Tue, 18 May 2021 19:23:15 +0000 (15:23 -0400)]
socket: Release cred reference later in sodealloc()

We dereference so->so_cred to update the per-uid socket buffer
accounting, so the crfree() call must be deferred until after that
point.

PR: 255869

(cherry picked from commit b295c5ddcef4744ef7044d2327b4258b6ad055f0)

3 years agokern_descrip.c: Style
Konstantin Belousov [Fri, 14 May 2021 23:22:22 +0000 (02:22 +0300)]
kern_descrip.c: Style

(cherry picked from commit 70c05850e276624bb3eb928fa52160712909ec7b)

3 years agottydev_write: prevent stops while terminal is busied
Konstantin Belousov [Thu, 13 May 2021 01:35:06 +0000 (04:35 +0300)]
ttydev_write: prevent stops while terminal is busied

PR: 255816

(cherry picked from commit 8cf912b017a04a2eec01fbaa1f7b9ef556403ede)

3 years agoipfw.8: Fix table example
Lutz Donnerhacke [Mon, 10 May 2021 18:31:52 +0000 (20:31 +0200)]
ipfw.8: Fix table example

Fix some erronous lines in the example section.

PR: 248943
Submitted by: Jose Luis Duran
Reviewers: ae, manpages (gbe)
Differential Revision: https://reviews.freebsd.org/D30191

(cherry picked from commit 802637be06457c7593692bdf79f8466fa5f54d4a)

3 years agodummynet: Remove unused code
Kristof Provost [Mon, 17 May 2021 11:41:39 +0000 (13:41 +0200)]
dummynet: Remove unused code

We never set 'busy' and never dequeue from the pending mq. Remove this
code.

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

(cherry picked from commit 02c44f40f984951fe34a1c5a43f40ff8147c52ca)

3 years agopf tests: More set skip on <ifgroup> tests
Kristof Provost [Sun, 16 May 2021 06:51:54 +0000 (08:51 +0200)]
pf tests: More set skip on <ifgroup> tests

Test the specific case reported in PR 255852. Clearing the skip flag
on groups was broken because pfctl couldn't work out if a kif was a
group or not, because the kernel no longer set the pfik_group pointer.

PR: 255852
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30285

(cherry picked from commit 45db38554517c7e1b0cc0265113c22f92a0eb494)

3 years agopf: Set the pfik_group for userspace
Kristof Provost [Sun, 16 May 2021 06:50:17 +0000 (08:50 +0200)]
pf: Set the pfik_group for userspace

Userspace relies on this pointer to work out if the kif is a group or
not. It can't use it for anything else, because it's a pointer to a
kernel address. Substitute 0xfeedc0de for 'true', so that we don't leak
kernel memory addresses to userspace.

PR: 255852
Reviewed by: donner
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30284

(cherry picked from commit d69cc040147284c414dfd1c9f498dcc7c8291a8b)

3 years agompr/mps(4): Make device mapping some more robust.
Alexander Motin [Sat, 24 Apr 2021 03:18:01 +0000 (23:18 -0400)]
mpr/mps(4): Make device mapping some more robust.

Allow new enclosure to replace previously existing one if there is
no completely unused table entry, same as it is done for devices.

If we can not process DPM due to corruption -- wipe it and restart
from scratch.  Otherwise I don't see a way to recover persistence if
something go wrong and there is no BIOS to recover it for us.

Together this solves a problem that appeared when 9300-8i firmware
update to 16.00.10.00 somehow switched its mapping mode from Device
Persistence to Enclosure/Slot without wiping the DPM table.  It made
HBA completely unusable, since overflowed and conflicting mapping
table was unable to map any of enclosures and so devices.

Also while there make some enclosure mapping errors more informative.

MFC after: 1 month
Sponsored by: iXsystems, Inc.

(cherry picked from commit b99419aee49e2cc53747730be4d0ec4f9b330eb2)

3 years agolinux: Fix a mistake in commit fb58045145
Mark Johnston [Mon, 17 May 2021 02:17:53 +0000 (22:17 -0400)]
linux: Fix a mistake in commit fb58045145

The change to futex_andl_smap() should have ordered stac before the
load from a user address, otherwise it does not fix anything.

Fixes: fb58045145 ("linux: Fix SMAP-enabled futex routines")
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 60cb98a1bd2e4ea8fda532261f7211f5d4eba9c0)

3 years agoiwmbtfw(8): Add support for Intel 7260/7265 bluetooth adapter firmwares
Philippe Michaud-Boudreault [Tue, 4 May 2021 23:48:21 +0000 (02:48 +0300)]
iwmbtfw(8): Add support for Intel 7260/7265 bluetooth adapter firmwares

To use it comms/iwmbt-firmware port should be updated to 20210315 version.

Submitted by: Philippe Michaud-Boudreault <pitwuu@gmail.com>
Tested by: Helge Oldach <freebsd@oldach.net>
Reviewed by: wulf
PR: 228787

3 years agolinux: Fix SMAP-enabled futex routines
Mark Johnston [Sun, 16 May 2021 17:41:41 +0000 (13:41 -0400)]
linux: Fix SMAP-enabled futex routines

Some of them were dereferencing the user pointer before disabling SMAP.

PR: 255591
Reviewed by: kib
Tested by: pitwuu@gmail.com
Sponsored by: The FreeBSD Foundation

(cherry picked from commit fb580451456aa769daa2f4b2f077e39692f80c62)

3 years agorpi_ft5406: Recognize raspberrypi,firmware-ts touchscreen
Juraj Lutter [Fri, 7 May 2021 21:48:21 +0000 (23:48 +0200)]
rpi_ft5406: Recognize raspberrypi,firmware-ts touchscreen

- Recognize raspberrypi,firmware-ts touchscreen
- Move the driver from ofwbus to simplebus

Reviewed by: manu
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D30169

(cherry picked from commit c2c9ef3cedf6d83bdf27308e9e022658cc9b2a08)

3 years agonetgraph/ng_checksum: Fix double free error
Lutz Donnerhacke [Sat, 15 May 2021 09:32:57 +0000 (11:32 +0200)]
netgraph/ng_checksum: Fix double free error

m_pullup(9) frees the mbuf(9) chain in the case of an allocation error.
The mbuf chain must not be freed again in this case.

PR: 255874
Submitted by: <lylgood@foxmail.com>
Approved by: markj
Differential Revision: https://reviews.freebsd.org/D30273

(cherry picked from commit 687e510e5ce32fddf46a9dc1d517ccc8a8e25581)

3 years agoloader: gfx_fb_drawrect should use GfxFbBltVideoFill
Toomas Soome [Tue, 11 May 2021 18:05:12 +0000 (21:05 +0300)]
loader: gfx_fb_drawrect should use GfxFbBltVideoFill

The gfx_fb_drawrect() is drawing rectangle by pixels, this can be very
slow on some systems. Use Blt() video fill primitive instead.

Testing done: Tested on mac mini 2012 where the issue was revealed

(cherry picked from commit 5365af662c78d7bded3bf83c7271d6bff17229a9)

Reviewed by: yuripv

3 years agoFix fsck_ffs Pass 1b error exit "bad inode number 256 to nextinode".
Kirk McKusick [Wed, 19 May 2021 21:38:21 +0000 (14:38 -0700)]
Fix fsck_ffs Pass 1b error exit "bad inode number 256 to nextinode".

(cherry picked from commit fe815b88b553667c40353c46b58f9779efa3570e)

PR:           255979
Sponsored by: Netflix

3 years agozfs: avoid memory allocation in arc_prune_async
Mateusz Guzik [Sun, 11 Apr 2021 05:15:41 +0000 (07:15 +0200)]
zfs: avoid memory allocation in arc_prune_async

(cherry picked from commit 97ed4babb51636d8a4b11bc7b207c3219ffcd0e3)

3 years agozfs: make vnlru_free_vfsops use conditional on version
Mateusz Guzik [Sun, 11 Apr 2021 04:49:24 +0000 (06:49 +0200)]
zfs: make vnlru_free_vfsops use conditional on version

Diff reduction against upstream.

(cherry picked from commit feea35bed0dd7a029b70b700cc3c0d2139e3deb8)

3 years agozfs: change format string in zio_fini to get rid of the cast
Mateusz Guzik [Sat, 10 Apr 2021 19:12:00 +0000 (19:12 +0000)]
zfs: change format string in zio_fini to get rid of the cast

(cherry picked from commit a7fbfdee732bd8728d0e642016bf8b6548cfa1bb)

3 years agozfs: make seqc asserts conditional on replay
Mateusz Guzik [Sat, 13 Mar 2021 09:10:16 +0000 (10:10 +0100)]
zfs: make seqc asserts conditional on replay

Avoids tripping on asserts when doing pool recovery.

(cherry picked from commit 59146a6921d06d5cf4320dc8ed82810363ffe7c4)

3 years agovfs: Fix error handling in vn_fullpath_hardlink()
Mark Johnston [Tue, 11 May 2021 00:18:00 +0000 (20:18 -0400)]
vfs: Fix error handling in vn_fullpath_hardlink()

vn_fullpath_any_smr() will return a positive error number if the
caller-supplied buffer isn't big enough.  In this case the error must be
propagated up, otherwise we may copy out uninitialized bytes.

Reported by: syzkaller+KMSAN
Reviewed by: mjg, kib
MFC aftr: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30198

(cherry picked from commit c8bbb1272c8bc103cfaa42c7a1639f42b62483dd)

3 years agozfs: use vn_seqc_read_notmodify for racing .. lookups
Mateusz Guzik [Thu, 22 Apr 2021 13:18:39 +0000 (13:18 +0000)]
zfs: use vn_seqc_read_notmodify for racing .. lookups

Catching an in-flight unlocked vnode is fine here.

Reported by; pho

(cherry picked from commit 7ea3223c7822d20acfc907683fd0153d623185b3)

3 years agozfs: damage control racing .. lookups in face of mkdir/rmdir
Mateusz Guzik [Thu, 15 Apr 2021 07:54:18 +0000 (09:54 +0200)]
zfs: damage control racing .. lookups in face of mkdir/rmdir

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

(cherry picked from commit 9c651561a2a31fcb08390d37947afc27ec03d87b)

3 years agotmpfs: reimplement the mtime scan to use the lazy list
Mateusz Guzik [Fri, 7 May 2021 14:43:43 +0000 (14:43 +0000)]
tmpfs: reimplement the mtime scan to use the lazy list

Tested by: pho
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D30065

(cherry picked from commit eec2e4ef7f964d18fcec3dc2cdcd7530be490835)

3 years agovm: add another pager private flag
Mateusz Guzik [Fri, 14 May 2021 07:50:10 +0000 (09:50 +0200)]
vm: add another pager private flag

Contrary to what was done in main, skip the following in order to not
disrupt KBI:
Move OBJ_SHADOWLIST around to let pager flags be next to each other.

(cherry picked from commit 128e25842ef510b39815d784e1d2af0d4afd584f)

3 years agofdescfs: allow shared locking of root vnode
Mateusz Guzik [Wed, 19 May 2021 15:59:20 +0000 (17:59 +0200)]
fdescfs: allow shared locking of root vnode

Eliminates fdescfs from lock profile when running poudriere.

(cherry picked from commit 4fe925b81e75b5885ec6d504c6217f848439164a)

3 years agopseudofs: use vget_prep + vget_finish instead of vget + the interlock
Mateusz Guzik [Wed, 19 May 2021 14:20:23 +0000 (14:20 +0000)]
pseudofs: use vget_prep + vget_finish instead of vget + the interlock

(cherry picked from commit 43999a5cba3cfbf0a0f6244c76a3cd548b6925e8)

3 years agovfs: refactor vdrop
Mateusz Guzik [Fri, 14 May 2021 19:01:32 +0000 (21:01 +0200)]
vfs: refactor vdrop

In particular move vunlazy into its own routine.

(cherry picked from commit cc6f46ac2fd5d910e632fced3f21d0b0f53030d8)

3 years agovfs: change vn_freevnodes_* prefix to idiomatic vfs_freevnodes_*
Mateusz Guzik [Fri, 14 May 2021 19:01:56 +0000 (21:01 +0200)]
vfs: change vn_freevnodes_* prefix to idiomatic vfs_freevnodes_*

(cherry picked from commit 715fcc0d342684da5d109a7e4891d30aa38667c9)

3 years agovfs: add missing atomic conversion to writecount adjustment
Mateusz Guzik [Fri, 14 May 2021 15:41:39 +0000 (17:41 +0200)]
vfs: add missing atomic conversion to writecount adjustment

Fixes: ("vfs: lockless writecount adjustment in set/unset text")
(cherry picked from commit 852088f6af6c5cd44542dde72aa5c3f4c4f9353c)

3 years agovfs: add more safety against concurrent forced unmount to vn_write
Mateusz Guzik [Fri, 14 May 2021 11:26:56 +0000 (13:26 +0200)]
vfs: add more safety against concurrent forced unmount to vn_write

1. stop re-reading ->v_mount (can become NULL)
2. stop re-reading ->v_type (can change to VBAD)

(cherry picked from commit ca1ce50b2b5ef11d85841f3aead98b2a9ad18819)

3 years agovfs: lockless writecount adjustment in set/unset text
Mateusz Guzik [Fri, 7 May 2021 14:04:27 +0000 (16:04 +0200)]
vfs: lockless writecount adjustment in set/unset text

... for cases where this is not the first/last exec.

(cherry picked from commit b5fb9ae6872c499f1a02bec41f48b163a73a2aaa)

3 years agocache: remove incomplete lockless lockout support during resize
Mateusz Guzik [Sat, 10 Apr 2021 17:20:28 +0000 (19:20 +0200)]
cache: remove incomplete lockless lockout support during resize

This is already properly handled thanks to 2 step hash replacement.

(cherry picked from commit 074abaccfaadef0da6e2695225ce537cb53bb8de)