Commit graph

136783 commits

Author SHA1 Message Date
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
Lv Yunlong
e53b671b4f 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 b295c5ddce)
2021-05-25 09:26:00 -04:00
Konstantin Belousov
b1304759ec kern_descrip.c: Style
(cherry picked from commit 70c05850e2)
2021-05-25 10:15:51 +03:00
Konstantin Belousov
4abc8e0a73 ttydev_write: prevent stops while terminal is busied
PR:	255816

(cherry picked from commit 8cf912b017)
2021-05-25 10:15:51 +03:00
Kristof Provost
137c43e13e 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 02c44f40f9)
2021-05-24 17:38:22 +02:00
Kristof Provost
31424ca0a1 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 d69cc04014)
2021-05-24 17:38:22 +02:00
Alexander Motin
22d8055aa2 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 b99419aee4)
2021-05-24 10:43:39 -04:00
Mark Johnston
f1119657d8 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 60cb98a1bd)
2021-05-24 10:05:43 -04:00
Mark Johnston
14cc132657 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 fb58045145)
2021-05-23 12:43:43 -04:00
Juraj Lutter
e7cd56cfe0 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 c2c9ef3ced)
2021-05-23 15:31:22 +02:00
Lutz Donnerhacke
fa670efa25 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 687e510e5c)
2021-05-23 14:55:20 +02:00
Mateusz Guzik
a6e5d03055 zfs: avoid memory allocation in arc_prune_async
(cherry picked from commit 97ed4babb5)
2021-05-22 18:37:28 +00:00
Mateusz Guzik
8ea3f6a3e4 zfs: make vnlru_free_vfsops use conditional on version
Diff reduction against upstream.

(cherry picked from commit feea35bed0)
2021-05-22 18:37:23 +00:00
Mateusz Guzik
8bb6b6a461 zfs: change format string in zio_fini to get rid of the cast
(cherry picked from commit a7fbfdee73)
2021-05-22 18:37:19 +00:00
Mateusz Guzik
bb3b814b25 zfs: make seqc asserts conditional on replay
Avoids tripping on asserts when doing pool recovery.

(cherry picked from commit 59146a6921)
2021-05-22 18:36:29 +00:00
Mark Johnston
8b59c6af27 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 c8bbb1272c)
2021-05-22 18:33:16 +00:00
Mateusz Guzik
a9d418fbb8 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 7ea3223c78)
2021-05-22 18:30:50 +00:00
Mateusz Guzik
d2e0a3bb21 zfs: damage control racing .. lookups in face of mkdir/rmdir
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D29769

(cherry picked from commit 9c651561a2)
2021-05-22 18:30:44 +00:00
Mateusz Guzik
443baed524 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 eec2e4ef7f)
2021-05-22 18:28:55 +00:00
Mateusz Guzik
90b82ea9a6 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 128e25842e)
2021-05-22 18:28:29 +00:00
Mateusz Guzik
8a0ec6bd40 fdescfs: allow shared locking of root vnode
Eliminates fdescfs from lock profile when running poudriere.

(cherry picked from commit 4fe925b81e)
2021-05-22 18:22:39 +00:00
Mateusz Guzik
af68d00a20 pseudofs: use vget_prep + vget_finish instead of vget + the interlock
(cherry picked from commit 43999a5cba)
2021-05-22 18:22:35 +00:00
Mateusz Guzik
e9757b0c94 vfs: refactor vdrop
In particular move vunlazy into its own routine.

(cherry picked from commit cc6f46ac2f)
2021-05-22 18:22:30 +00:00
Mateusz Guzik
df6533f9b4 vfs: change vn_freevnodes_* prefix to idiomatic vfs_freevnodes_*
(cherry picked from commit 715fcc0d34)
2021-05-22 18:22:25 +00:00
Mateusz Guzik
de1b69aec2 vfs: add missing atomic conversion to writecount adjustment
Fixes:	("vfs: lockless writecount adjustment in set/unset text")
(cherry picked from commit 852088f6af)
2021-05-22 18:22:16 +00:00
Mateusz Guzik
2923b7015f 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 ca1ce50b2b)
2021-05-22 18:22:10 +00:00
Mateusz Guzik
4869c1571f vfs: lockless writecount adjustment in set/unset text
... for cases where this is not the first/last exec.

(cherry picked from commit b5fb9ae687)
2021-05-22 18:22:03 +00:00