Commit graph

270743 commits

Author SHA1 Message Date
Toomas Soome
67f8b6d985 loader: GELI encrypted disk should still use device name disk
geli_probe_and_attach() does pick geli_devsw structure for
encrypted disks, the implementation depends on device
name "disk" when device type is DEVT_DISK, but geli_devsw is
setting name field "gelidisk".

PR:		264282
Submitted by:	yamagi@yamagi.org
Reported by:	yamagi@yamagi.org

(cherry picked from commit e417249016)
2022-07-04 09:14:43 +03:00
Mateusz Piotrowski
2353343b32 Link pwd.db.5 and spwd.db.5 to passwd.5
Let's make it easier to find documentation for those databases.

MFC after:	3 days

(cherry picked from commit 87f49967d3)
2022-07-03 22:16:11 +02:00
Mateusz Piotrowski
dc90922b80 devfs.5: Replace Nm with Xr devfs 8 where appropriate
MFC after:	3 days

(cherry picked from commit 523477f8c5)
2022-07-03 22:15:32 +02:00
Jamie Gritton
cf18a61708 MFC jail: Remove a prison's shared memory when it dies
Add shm_remove_prison(), that removes all POSIX shared memory segments
belonging to a prison.  Call it from prison_cleanup() so a prison
won't be stuck in a dying state due to the resources still held.

PR:		257555
Reported by:	grembo

(cherry picked from commit 7060da62ff)
2022-07-03 12:25:43 -07:00
Jamie Gritton
06dcf1499b MFC jail: add prison_cleanup() to release resources held by a dying jail
Currently, when a jail starts dying, either by losing its last user
reference or by being explicitly killed,
osd_jail_call(...PR_METHOD_REMOVE...) is called.  Encapsulate this
into a function prison_cleanup() that can then do other cleanup.

(cherry picked from commit a9f7455c38)
2022-07-03 12:24:49 -07:00
Juraj Lutter
7c500f98b8 kldload: Bring functionality in line with manual page
Honor -q parameter and do not display any warning messages when -q is
specified.

Approved by:		dfr
MFC after:		2 weeks
Sponsored by:		Resulta, s.r.o.
Differential Revision:	https://reviews.freebsd.org/D35511

(cherry picked from commit ad0a7ea650)
2022-07-01 17:16:22 +02:00
Bjoern A. Zeeb
66754c01ff XHCI: clear warm and port reset
It seems we do not clear UPS_C_BH_PORT_RESET and UPS_C_PORT_RESET
conditions after warm or port reset.  Add that code.

Obtained from:	an old patch mainly debugging other problems
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D35483

(cherry picked from commit 8f892e9bee)
2022-07-01 13:50:19 +00:00
Bjoern A. Zeeb
39cd7aa134 USB: add quirks to XHCI
While XHCI is very generic some revisions of chipsets have problems.
On dwc3 <= 3.00a Port Disable does not seem to work so we need to not
enable it.
For that introduce quirks to xhci so that controllers can steer
certain features.  I would hope that this is and remains the only one.

Obtained from:	an old patch mainly debugging other problems
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D35482

(cherry picked from commit 447c418da0)
2022-07-01 13:50:10 +00:00
Bjoern A. Zeeb
2217448bcc LinuxKPI: 802.11: cleanup lsta better
This changes cleans up lsta from the VIF station list as well as
deals with freeing the lsta itself so it is not leaked.

lkpi_iv_update_bss() makes this more complicated than it should be
as we ties more sta state (incl. drv/fw) to the node that net80211
does not know about.  There is more work to be done detangling this
now that is better understood.

(cherry picked from commit e24e8103e0)
2022-07-01 13:50:03 +00:00
Bjoern A. Zeeb
05b1792754 LinuxKPI: 802.11: remove an early bandaid to make sure queues are allocated
iwlwifi allocates queues on first wakeup.  This takes a lot longer on
FreeBSD's work implementation that it seems to on Linux based on some
discussion.  That meant that we couldn't get non-data frames out quickly
enough initially and failed to associate.
d0d2911035 should have solved most of this
for us with iwlwifi.  None of the other drivers ported to LinuxKPI/802.11
up to today will call a dequeue so we get notified when the queus are
allocated or even need to do so.
Remove the bandaid initilly put in for iwlwifi now and speed up the
overall process of getting us associated.

(cherry picked from commit 841719c08f)
2022-07-01 13:49:55 +00:00
Bjoern A. Zeeb
d4d3ba68b7 LinuxKPI: 802.11: sync sta->addr in lkpi_iv_update_bss()
In lkpi_iv_update_bss() introduced in d9f59799fc we swap lsta and
along with that sta and drv state if ni gets reused and swapped under
us by net80211.  What we did not do was to sync sta->addr which later
(usually in lkpi_sta_assoc_to_run) during a bss_info update cause
problems in drivers (or firmware) as the BSSID and the station address
were not aligned.

If this proves to hold up to fix iwlwifi issues seem on firmware
for older chipsets, multi-assoc runs, and rtw89 (which this fixes)
we should add asserts that lkpi_iv_update_bss() can only happen in
pre-auth stages and/or make sure we factor out synching more state
fields.

Found debugging:	rtw89

(cherry picked from commit ed3ef56b29)
2022-07-01 13:49:42 +00:00
Bjoern A. Zeeb
07bec0d40e net80211 / LinuxKPI: 802.11: add Control Trigger Subframe information
Add definitions related to 802.11ax Control Trigger frame format
needed for rtw89.

(cherry picked from commit 4c3684ef5c)
2022-07-01 13:49:19 +00:00
Bjoern A. Zeeb
f5d0b181f4 LinuxKPI: 802.11: ieee80211_start_tx_ba_session()
For as long as we do not implement the compat code for tx aggregation
return -EINVAL in ieee80211_start_tx_ba_session() as both rtw88 and
rtw89 check for this value and only then disable further attempts.

(cherry picked from commit 799051e2ca)
2022-07-01 13:49:11 +00:00
Bjoern A. Zeeb
54f9ddf4ae rtw88: update Realtek's rtw88 driver
Update rtw88 based on wireless-testing at
4e051428044d5c47cd2c81c3b154788efe07ee11 (tag: wt-2022-06-10).

This is in preparation to apply USB changes to work on these and
LinuxKPI for them over the next weeks, as well to debug a
reported issue, and possibly extract and upstream some local fixes.

(cherry picked from commit 9c951734c2)
2022-07-01 13:49:02 +00:00
Bjoern A. Zeeb
a478f4afd8 LinuxKPI: move pm_message_t from kernel.h to pm.h
Move pm_message_t from kernel.h to pm.h and remove a private define
in usb.h as well as adjust the implementation in linux_usb.c.
This cleans up what I believe to be a historic shortcut and is
needed for future wireless driver updates.

Leave a note in UPDATING that drm-kmod users need to update to the
latest version before re-compiling a new kernel to avoid errors
(see PR).

Sponsored by:	The FreeBSD Foundation
PR:		264449 (drm-kmod port update, thanks wulf)
Obtained from:	bz_git_iwlwifi (Dec 2020) (partly)
Reviewed by:	hselasky, imp
Differential Revision: https://reviews.freebsd.org/D35276

(cherry picked from commit 0e981d79b1)
2022-07-01 13:48:24 +00:00
Bjoern A. Zeeb
74cedb5e90 LinuxKPI: 802.11: rework handling of the special IEEE80211_NUM_TIDS queue
Rework the way we are dealing with the last queue.  If the driver
opts in to STA_MMPDU_TXQ then preferably send all non-data frames
via the last (IEEE80211_NUM_TIDS) queue which otherwise is not used
in station mode.
If we do not have that queue we do individual tx() calls for non-data
frames now.
Everything else goes via the selected queue if possible for as long as
we have a ni (sta) and otherwise resorts to direct tx.

Tested on:	Intel AX200 and AX210
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit d0d2911035)
(cherry picked from commit fb6eaf74e9)
2022-07-01 13:45:09 +00:00
Mateusz Piotrowski
b8aa1e16ab hier.7: Refer to build(7) for details about /usr/obj
MFC after:	3 days

(cherry picked from commit ecd3759719)
2022-07-01 10:46:17 +02:00
Mark Johnston
70fd40edb8 debugnet: Fix an error handling bug in the DDB command tokenizer
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit c262d5e877)
2022-06-30 10:12:15 -04:00
Mark Johnston
533a247fa8 debugnet: Handle batches of packets from if_input
Some drivers will collect multiple mbuf chains, linked by m_nextpkt,
before passing them to upper layers.  debugnet_pkt_in() didn't handle
this and would process only the first packet, typically leading to
retransmits.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 8414331481)
2022-06-30 10:11:52 -04:00
Hans Petter Selasky
973716df6c tcp: Correctly compute the TCP goodput in bits per second by using SEQ_SUB().
TCP sequence number differences should be computed using SEQ_SUB().

Differential Revision:	https://reviews.freebsd.org/D35505
Reviewed by:	rscheff@
Sponsored by:	NVIDIA Networking

(cherry picked from commit f5766992c0)
2022-06-30 11:39:43 +02:00
Hans Petter Selasky
20d3224919 uhid(4): Don't read-ahead from the USB IN endpoint.
This avoids an issue where IN endpoint data received from the device right
before the file handle is closed, gets lost.

PR:		263995
Sponsored by:	NVIDIA Networking

(cherry picked from commit b6f615255d)
2022-06-30 11:39:43 +02:00
Alexander Motin
15183f36e5 amd64: Stop using REP MOVSB for backward memmove()s.
Enhanced REP MOVSB feature of CPUs starting from Ivy Bridge makes
REP MOVSB the fastest way to copy memory in most of cases. However
Intel Optimization Reference Manual says: "setting the DF to force
REP MOVSB to copy bytes from high towards low addresses will expe-
rience significant performance degradation". Measurements on Intel
Cascade Lake and Alder Lake, same as on AMD Zen3 show that it can
drop throughput to as low as 2.5-3.5GB/s, comparing to ~10-30GB/s
of REP MOVSQ or hand-rolled loop, used for non-ERMS CPUs.

This patch keeps ERMS use for forward ordered memory copies, but
removes it for backward overlapped moves where it does not work.

Reviewed by:	mjg
MFC after:	2 weeks

(cherry picked from commit 6210ac95a1)
2022-06-29 21:15:49 -04:00
Alexander Motin
558e8b6adb amd64: Stop using REP MOVSB for backward memmove()s.
Enhanced REP MOVSB feature of CPUs starting from Ivy Bridge makes
REP MOVSB the fastest way to copy memory in most of cases. However
Intel Optimization Reference Manual says: "setting the DF to force
REP MOVSB to copy bytes from high towards low addresses will expe-
rience significant performance degradation". Measurements on Intel
Cascade Lake and Alder Lake, same as on AMD Zen3 show that it can
drop throughput to as low as 2.5-3.5GB/s, comparing to ~10-30GB/s
of REP MOVSQ or hand-rolled loop, used for non-ERMS CPUs.

This patch keeps ERMS use for forward ordered memory copies, but
removes it for backward overlapped moves where it does not work.

This is just a cosmetic sync with kernel, since libc does not use
ERMS at this time.

Reviewed by:    mjg
MFC after:	2 weeks

(cherry picked from commit f22068d91b)
2022-06-29 21:13:51 -04:00
Neel Chauhan
7a8188739a if_ix: Reset on an ECC error
This mirrors the Linux behavior as seen in the kernel commit d773ce2.

Reviewed by:		kbowling
MFH after:		3 days
Differential Revision:	https://reviews.freebsd.org/D35542

(cherry picked from commit 4f1d91e413)
2022-06-29 10:07:50 -07:00
Mark Johnston
f1400b2ecc pmap: Keep PTI page table pages busy
PTI page table pages are allocated from a VM object, so must be
exclusively busied when they are freed, e.g., when a thread loses a race
in pmap_pti_pde().  Simply keep PTPs busy at all times, as was done for
some other kernel allocators in commit
e9ceb9dd11.

Also remove some redundant assertions on "ref_count":
vm_page_unwire_noq() already asserts that the page's reference count is
greater than zero.

Reported by:	syzkaller
Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit c6d092b510)
2022-06-29 10:13:57 -04:00
Mark Johnston
c31c881f7e Fix the test used to wait for AP startup on x86, arm64, riscv
On arm64, testing pc_curpcb != NULL is not correct since pc_curpcb is
set in pmap_switch() while the bootstrap stack is still in use.  As a
result, smp_after_idle_runnable() can free the boot stack prematurely.

Take a different approach: use smp_rendezvous() to wait for all APs to
acknowledge an interrupt.  Since APs must not enable interrupts until
they've entered the scheduler, i.e., switched off the boot stack, this
provides the right guarantee without depending as much on the
implementation of cpu_throw().  And, this approach applies to all
platforms, so convert x86 and riscv as well.

Reported by:	mmel
Tested by:	mmel
Reviewed by:	kib
Fixes:		8db2e8fd16 ("Remove the secondary_stacks array in arm64 and riscv kernels.")
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit f6b799a86b)
2022-06-29 10:13:44 -04:00
Mark Johnston
cc81b8661d vm_fault: Fix a racy copy of page valid bits
We do not hold the object lock or a page busy lock when copying src_m's
validity state.  Prior to commit 45d72c7d7f we marked dst_m as fully
valid.

Use the source object's read lock to ensure that valid bits are not
concurrently cleared.

Reviewed by:	alc, kib
Fixes:		45d72c7d7f ("vm_fault_copy_entry: accept invalid source pages.")
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit d0443e2b98)
2022-06-29 10:12:34 -04:00
Mark Johnston
3fe539651a vm_fault: Avoid unnecessary object relocking in vm_fault_copy_entry()
Suggested by:	alc
Reviewed by:	alc, kib
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 1f88394b7f)
2022-06-29 10:12:34 -04:00
Mark Johnston
3d81c26f92 truss: Make control message header parsing more robust
print_cmsg() was assuming that the control message chain is well-formed,
but that isn't necessarily the case for sendmsg(2).  In particular, if
cmsg_len is zero, print_cmsg() will loop forever.  Check for truncated
headers and try to recover if possible.

Reviewed by:	tuexen
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 4b0c6fa0dc)
2022-06-29 10:12:33 -04:00
Mark Johnston
353aa91c64 mount: Fix an incorrect assertion in kernel_mount()
The pointer to the mount values may be null if an error occurred while
copying them in, so fix the assertion condition to reflect that
possibility.

While here, move some initialization code into the error == 0 block.  No
functional change intended.

Reported by:	syzkaller
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 7565431f30)
2022-06-29 10:12:33 -04:00
Konstantin Belousov
65d8e97c4c UFS: make mkdir() and link() reliable when using SU and reaching nlink limit
PR:	165392

(cherry picked from commit 8db679af66)
2022-06-29 12:38:26 +03:00
Mateusz Piotrowski
2ff5f3e7d1 bhyve.8: Fix a typo
The Li macro is deprecated. Also, the Cm macro should be used here
instead for consistency with the rest of the manual and style.mdoc(5).

Fixes:		e47fe3183e bhyve: add ROM emulation
MFC after:	1 month

(cherry picked from commit 5e19a51853)
2022-06-29 10:23:19 +02:00
Mateusz Piotrowski
c49605d66f usbconfig.8: Sort flags according to style(9)
MFC after:	2 weeks

(cherry picked from commit 75a86e93e6)
2022-06-29 10:22:54 +02:00
Mateusz Piotrowski
6341ffcdeb usbconfig.8: Improve style and fix examples
- Use Ar macros for arguments
- Stylize the argument synopsis to the -d flag
- Change the width of the list to one of the actual tags in the list
- Stylize "ugen" and "/dev/ugen" with Cm as those are constant strings,
  which are usually treated as command modifiers.
- Break long lines to reduce the number of warnings from linters
- Fix examples; the -d flag is now required when specifying the unit and
  the address with the "dot notation".

MFC after:	2 weeks

(cherry picked from commit 5eafaf9e68)
2022-06-29 10:22:49 +02:00
Faraz Vahedi
7e6f5e494a assert.3: Document static_assert and _Static_assert
Reviewed by:	imp, 0mp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D29833

(cherry picked from commit 33f8d79d76)
2022-06-29 10:22:38 +02:00
Mateusz Piotrowski
49dc4b7d77 freebsd-update.8: Note availability of updates for ALPHA, BETA, and RC
While here, restructure the section about the binary updates
availability.

MFC after:	1 week

(cherry picked from commit 460ad988a9)
2022-06-29 10:22:00 +02:00
Mateusz Piotrowski
d33cf7a54f freebsd-update.8: Add --currently-running to synopsis
While here, sort flags in synopsis.

MFC after:	3 days

(cherry picked from commit f69f064483)
2022-06-29 10:21:54 +02:00
Mateusz Piotrowski
938f3df8cc ifconfig.8: Document -g all and -G all
The special group name "all" selects all the interfaces.

MFC after:	3 days

(cherry picked from commit 78d4bd8753)
2022-06-29 10:17:59 +02:00
Mateusz Piotrowski
c154429082 ifconfig.8: Note that -l accepts -g in addition to -d and -u
Fixes:	5533c5046a ifconfig.8: Update -l synopsis
MFC after:	3 days

(cherry picked from commit 632ea8ea98)
2022-06-29 10:15:50 +02:00
Mateusz Piotrowski
aff0be6e66 ifconfig.8: Update -l synopsis
The -g flag can be used together with the -l flag.

MFC after:	2 weeks

(cherry picked from commit 5533c5046a)
2022-06-29 10:15:15 +02:00
Mateusz Piotrowski
b879d2b81a ifconfig.8: Document "ifconfig -g groupname"
"ifconfig -g groupname" prints a list of interface names,
which could be confusing, because it differs from
the behavior of "ifconfig -a -g groupname".

While here, add two examples showing the difference between
"ifconfig -a -g groupname" and "ifconfig -g groupname".

Fixes:	0dad3f0e15 Import interface groups from OpenBSD.
MFC after:	2 weeks

(cherry picked from commit 4d91c53a78)
2022-06-29 10:15:14 +02:00
Mateusz Piotrowski
ab18258233 ifconfig.8: Remove commented-out Xr eon 5
This reference has been present in the manual page since the initial
import of BSD 4.4 Lite sbin Sources. It's time for it to be removed.

MFC after:	2 weeks

(cherry picked from commit e57f6630d9)
2022-06-29 10:15:14 +02:00
Mateusz Piotrowski
0c29dd8c58 ifconfig.8: Remove remaining Xerox Network Systems(tm) bits
Support for Xeros Network Systems seems to be long gone. There is no
reason to keep this in the manual page.

MFC after:	2 weeks

(cherry picked from commit 1969cc7bdc)
2022-06-29 10:15:13 +02:00
Mateusz Piotrowski
a64829040f ifconfig.8: Simplify examples by using canonical parameters
Also, use Bd instead of Dl for multi line examples.

MFC after:	2 weeks

(cherry picked from commit 19ac0bc5c1)
2022-06-29 10:15:12 +02:00
Mateusz Piotrowski
b6bcef4b77 ifconfig.8: Mark address_family as optional in synopsis
Commands like "ifconfig wlan0 up" are valid. There is no need to always
specify the address family.

MFC after:	2 weeks

(cherry picked from commit 2cd28d6f9b)
2022-06-29 10:15:12 +02:00
Mateusz Piotrowski
fb40141d2b ifconfig.8: Improve description of the address argument
- Split paragraphs for clarity.
- Add an example of setting a random MAC address.

MFC after:	2 weeks

(cherry picked from commit 3049aac91b)
2022-06-29 10:15:11 +02:00
Mateusz Piotrowski
233f423174 ifconfig.8: Improve readability of address_family documentation
Also, move the description of the special case of "ifconfig -l ether" to
the description of the -l flag.

MFC after:	2 weeks

(cherry picked from commit ad8cac1229)
2022-06-29 10:15:10 +02:00
Jose Luis Duran
c3bf44b542 ifconfig.8: Fix quoting
Obtained from:	67d77afb0d (r69907135)
Fixes:		67d77afb0d ifconfig.8: Do not use ``'' for quoting
MFC after:	2 weeks

(cherry picked from commit 607eed2f84)
2022-06-29 10:15:10 +02:00
Mateusz Piotrowski
bff1b019e6 ifconfig.8: Clean up markup of "state" parameter
MFC after:	2 weeks

(cherry picked from commit 388c12e3f4)
2022-06-29 10:09:36 +02:00
Mateusz Piotrowski
13ac48d808 ifconfig.8: Make the -f flag description compact
- Remove extraneous examples
- Apply "-compact" to the list macros so that it is possible to fit the
  definitions of the types and formats in one terminal screen.

MFC after:	2 weeks

(cherry picked from commit 39da6db9bc)
2022-06-29 10:09:31 +02:00