Commit graph

136809 commits

Author SHA1 Message Date
Hans Petter Selasky
303bef2a07 cdev_del() should only put it's kernel object in the LinuxKPI.
The destructor takes care of the rest.

Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 67807f5066)
2021-06-02 13:25:20 +02:00
Hans Petter Selasky
ad9d0df7c6 Propagate down USB explore error codes, so that failures to enumerate USB HUBs
behind USB HUBs are detected and the USB reset counter logic will kick in
preventing enumeration of continuously failing ports.

Submitted by:	phk@
Tested by:	bz@
PR:		237666
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit e5ff940a81)
2021-06-02 13:25:20 +02:00
Hans Petter Selasky
ae9aba942b Update usb_timings_sysctl_handler() to accept any value for timings between
0 milliseconds and 2 seconds inclusivly. Some style fixes while at it.

The USB specification has minimum values and maximum values,
and not only minimum values.

Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 00e501d720)
2021-06-02 13:25:20 +02:00
Hans Petter Selasky
5bbf7afe30 Update USB_PORT_RESET_RECOVERY to comply with the USB 2.0 specification which
says it should be max 10 milliseconds.

This may fix some USB enumeration issues:
> usbd_req_re_enumerate: addr=3, set address failed! (USB_ERR_IOERROR, ignored)
> usbd_setup_device_desc: getting device descriptor at addr 3 failed,

Found by:	Zhichao1.Li@dell.com
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 70ffaaa69c)
2021-06-02 13:25:19 +02:00
Hans Petter Selasky
9f98b3ea74 Fix for use-after-free by if_ioctl() calls from user-space in USB drivers by
detaching the ifnet before the miibus.

PR:		252608
Suggested by:	jhb@
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 4eac63af23)
2021-06-02 13:25:19 +02:00
Hans Petter Selasky
71370d8c7f Properly define EPOCH(9) function macro.
No functional change intended.

Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit f33168351b)
2021-06-02 13:25:19 +02:00
Hans Petter Selasky
407b687dfe 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 209d4919c5)
2021-06-02 13:23:19 +02:00
Hans Petter Selasky
623d96f4af 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 c82c200622)
2021-06-02 13:12:41 +02:00
Hans Petter Selasky
8d8bfdf20d Rework for-loop in EPOCH(9) to reduce indentation level.
No functional change intended.

Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit cc9bb7a9b8)
2021-06-02 13:12:34 +02:00
Alexander Motin
6ee59ffb5b 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 4a6830761c)
2021-06-01 23:40:05 -04:00
Kristof Provost
ae23d30247 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 3032c35388)
2021-06-01 16:29:50 +02:00
Dmitry Chagin
9394c3fcdb run(4): add support for ASUS USB-N14 wireless adaptor.
PR:		255759
Submitted by:	john.lmurdoch at gmail.com

(cherry picked from commit d6fd321ef6)
2021-06-01 13:01:53 +03:00
Rick Macklem
628d207646 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 b3d4c70dc6)
2021-05-31 18:34:47 -07:00
Rick Macklem
4ce25ce477 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 fc0dc94029)
2021-05-31 18:29:03 -07:00
Colin Percival
6b6758888f 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 27f09959d5)
2021-05-31 17:54:08 -07:00
Konstantin Belousov
9c74a20681 ptrace: add an option to not kill debuggees on debugger exit
(cherry picked from commit fd3ac06f45)
2021-06-01 03:38:54 +03:00
Konstantin Belousov
b295519173 sys_process.c: extract ptrace_unsuspend()
(cherry picked from commit d7a7ea5be6)
2021-06-01 03:38:53 +03:00
Konstantin Belousov
40b64abff4 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 57d877348b.

(cherry picked from commit f784da883f)
2021-06-01 02:48:16 +03:00
Richard Scheffenegger
9eed9e5c2d 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 c358f1857f)
2021-05-31 08:56:34 +02:00
Rick Macklem
4a4a174959 NFSv4 server: Re-establish the delegation recall timeout
Commit 7a606f280a 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 46269d66ed)
2021-05-30 20:34:03 -07:00
Mark Johnston
5f7ceb78f5 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 5c7ef43e96)
2021-05-30 20:45:19 -04:00
Kirk McKusick
57d877348b Fix handling of embedded symbolic links (and history lesson).
Sponsored by: Netflix

(cherry picked from commit 9a2fac6ba6)
2021-05-30 17:40:44 -07:00
Lutz Donnerhacke
16adf789ba 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 189f8eea13)
(cherry picked from commit b03a41befe)
2021-05-30 15:49:14 +02:00
Alexander V. Chernikov
d40def01a4 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
2021-05-30 10:30:53 +00:00
Alexander V. Chernikov
f279295521 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
2021-05-30 10:30:45 +00:00
Konstantin Belousov
2e170ce65b Add support for Gemini Lake LPSS UARTs.
PR:	256101

(cherry picked from commit eaf00819bc)
2021-05-30 03:44:45 +03:00
Lutz Donnerhacke
738ebfa0f6 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 effc8e57fb)

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 2e6b07866f)
2021-05-29 15:08:02 +02:00
Konstantin Belousov
67e2940b29 nullfs: dirty v_object must imply the need for inactivation
(cherry picked from commit 42881526d4)
2021-05-29 14:48:09 +03:00
Konstantin Belousov
dfdd29b608 vn_need_pageq_flush(): simplify
(cherry picked from commit d713bf7927)
2021-05-29 14:48:09 +03:00
Kevin Bowling
756d096417 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 fdbcd35a75)
2021-05-27 22:53:23 -07:00
Kevin Bowling
1fb96c59b4 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 eea55de7b1)
2021-05-27 22:50:07 -07:00
Kevin Bowling
e09d1b7ec4 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 0f6bea61ed)
2021-05-27 22:45:36 -07:00
Kevin Bowling
938b01476a 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 4b38eed76d)
2021-05-27 22:30:03 -07:00
Kevin Bowling
1567ceeb09 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 deecaa1445)
2021-05-27 22:27:44 -07:00
Don Morris
640c2ff8ae 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 f17a590085)
2021-05-27 09:05:50 -04:00
Lutz Donnerhacke
7fd88ba72e 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 4dfe70fdbd)
2021-05-27 12:55:52 +02:00
Lutz Donnerhacke
fb5e2f4d61 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 9674c2e68c)
2021-05-27 12:55:44 +02:00
Lutz Donnerhacke
cab6109379 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 f6e0c47169)
2021-05-27 12:55:37 +02:00
Lutz Donnerhacke
53ccd92495 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 b1bd44732d)
2021-05-27 12:55:29 +02:00
Kristof Provost
ff4447ac31 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 4483fb4773)
2021-05-27 09:12:03 +02:00
Kristof Provost
f9baaca0f8 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 b62489cc92)
2021-05-27 09:08:29 +02:00
Kristof Provost
48d771e579 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 d0fdf2b28f)
2021-05-27 09:06:14 +02:00
Kristof Provost
def59341c9 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 0592a4c83d)
2021-05-27 09:05:50 +02:00
Kristof Provost
70762ee0f2 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 1732afaa0d)
2021-05-27 09:04:36 +02:00
Philippe Michaud-Boudreault
bdbb0f0565 hda: correct comment about Asus laptop digital mics
Reported in review D30333

MFC after:	1 week

(cherry picked from commit 5d698386fb)
2021-05-26 20:47:14 -04:00
Konstantin Belousov
876ffe2879 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:	91aae953cb

(cherry picked from commit a59f028537)
2021-05-26 15:18:54 -04:00
Konstantin Belousov
6bbde34ae6 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 91aae953cb)
2021-05-26 15:18:41 -04:00
Konstantin Belousov
00ecc35900 alc(4): add support for Mikrotik 10/25G NIC
PR:	256000

(cherry picked from commit 77b637338a)
2021-05-26 14:30:36 +03:00
Mark Johnston
544b5d2482 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 d8acd2681b)
2021-05-25 21:49:53 -04:00
Mark Johnston
b14db362bb 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 c4a6258d70)
2021-05-25 09:26:09 -04:00