]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
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)

3 years agocache: extend mismatch vnode assert print to include the name
Mateusz Guzik [Thu, 15 Apr 2021 07:55:43 +0000 (07:55 +0000)]
cache: extend mismatch vnode assert print to include the name

(cherry picked from commit 4f0279e064bb163dbcc4859e409fc65dcbe8f1bf)

3 years agotmpfs: dynamically register tmpfs pager
Konstantin Belousov [Fri, 7 May 2021 19:42:06 +0000 (22:42 +0300)]
tmpfs: dynamically register tmpfs pager

(cherry picked from commit 28bc23ab92ce7393aab48da7d71ccde63592ff2d)

3 years agovm: Add KPI to dynamically register pagers
Konstantin Belousov [Fri, 7 May 2021 19:06:16 +0000 (22:06 +0300)]
vm: Add KPI to dynamically register pagers

(cherry picked from commit b730fd30b78f502ed5dd08e5285cb2c951495d65)

3 years agosys/vm: remove several other uses of OBJT_SWAP_TMPFS
Konstantin Belousov [Fri, 7 May 2021 18:21:22 +0000 (21:21 +0300)]
sys/vm: remove several other uses of OBJT_SWAP_TMPFS

(cherry picked from commit 7079449b0b56d13b4ae7b4039ac8eb7c45c03fb5)

3 years agovm_object_set_memattr(): handle all object types without listing them explicitly
Konstantin Belousov [Fri, 7 May 2021 18:19:30 +0000 (21:19 +0300)]
vm_object_set_memattr(): handle all object types without listing them explicitly

(cherry picked from commit 3e7a11ca21f3a7948c50f27de5b2159f0bb56672)

3 years agoprocfs_map: switch to use vm_object_kvme_type
Konstantin Belousov [Mon, 10 May 2021 15:20:42 +0000 (18:20 +0300)]
procfs_map: switch to use vm_object_kvme_type

(cherry picked from commit 8b99833ac2538a74d013d101e2b5ec2d9e29d198)

3 years agovm_object_kvme_type(): reimplement by embedding kvme_type into pagerops
Konstantin Belousov [Fri, 7 May 2021 17:46:51 +0000 (20:46 +0300)]
vm_object_kvme_type(): reimplement by embedding kvme_type into pagerops

(cherry picked from commit 00a3fe968b840ee197c32dfe4107dab730bd9915)

3 years agoClose races in vm object chain traversal for unlock
Ryan Libby [Thu, 25 Feb 2021 20:11:19 +0000 (12:11 -0800)]
Close races in vm object chain traversal for unlock

(cherry picked from commit d7671ad8d6ebe205933628466dc0a52d32eea2e8)

3 years agoConstify vm_pager-related virtual tables.
Konstantin Belousov [Mon, 3 May 2021 21:58:07 +0000 (00:58 +0300)]
Constify vm_pager-related virtual tables.

(cherry picked from commit d474440ab33c683b0e3f55e8e854f055615db6ec)

3 years agoAdd OBJT_SWAP_TMPFS pager
Konstantin Belousov [Sat, 1 May 2021 01:18:00 +0000 (04:18 +0300)]
Add OBJT_SWAP_TMPFS pager

(cherry picked from commit 4b8365d752ef48c14f0584d21b719bb386a7be82)

3 years agopagertab: use designated initializers
Konstantin Belousov [Sat, 1 May 2021 17:20:36 +0000 (20:20 +0300)]
pagertab: use designated initializers

(cherry picked from commit 0d2dfc6fed03c36f7c4a9bb2a4223028f3b4431b)

3 years agoStyle enum obj_type
Konstantin Belousov [Sat, 1 May 2021 01:14:24 +0000 (04:14 +0300)]
Style enum obj_type

(cherry picked from commit 838adc533fa11b8c4e7da5603377fdd62c2f1d90)

3 years agoImplement vm_object_vnode() using vm_pager_getvp()
Konstantin Belousov [Sat, 1 May 2021 01:08:28 +0000 (04:08 +0300)]
Implement vm_object_vnode() using vm_pager_getvp()

(cherry picked from commit a7c198a24b12b9e6d83d7718d8d16a5cef48d35f)

3 years agoAdd pgo_freespace method
Konstantin Belousov [Sat, 1 May 2021 17:12:32 +0000 (20:12 +0300)]
Add pgo_freespace method

(cherry picked from commit 1390a5cbeb1828b11584783c53f50b9679379651)

3 years agoAdd pgo_getvp method
Konstantin Belousov [Sat, 1 May 2021 01:04:04 +0000 (04:04 +0300)]
Add pgo_getvp method

(cherry picked from commit 192112b74fed56ca652cf1d70c11ba7e17bc1ce2)

3 years agoAdd pgo_mightbedirty method
Konstantin Belousov [Sat, 1 May 2021 00:43:08 +0000 (03:43 +0300)]
Add pgo_mightbedirty method

(cherry picked from commit c23c555bc15ce1523b95fb8da99ae77c0bb0977e)

3 years agovm_pager: add pgo_set_writeable_dirty method
Konstantin Belousov [Sat, 1 May 2021 00:14:48 +0000 (03:14 +0300)]
vm_pager: add pgo_set_writeable_dirty method

(cherry picked from commit 180bcaa46c5d297d137749258b23593d578d76a5)

3 years agovm_pager: style some wrappers
Konstantin Belousov [Sat, 1 May 2021 00:28:39 +0000 (03:28 +0300)]
vm_pager: style some wrappers

(cherry picked from commit ee4211bca600af48aab95000f39b4797a74eeb85)

3 years agoswappagerops: slightly more style-compliant formatting
Konstantin Belousov [Fri, 30 Apr 2021 23:54:17 +0000 (02:54 +0300)]
swappagerops: slightly more style-compliant formatting

(cherry picked from commit a0850dd0570fcfbb5cf72cb0962a201d39db040e)