Commit graph

280269 commits

Author SHA1 Message Date
Alexander V. Chernikov 8161b823d7 testing: add python test examples
Simplify the adoption of python tests by proving some examples,
 utilising commonly-used patterns.

Differential Revision: https://reviews.freebsd.org/D37902
Reviewed by:	asomers
MFC after:	2 weeks
2023-01-01 15:29:29 +00:00
Alexander V. Chernikov bb60d265c9 testing: fix tests without cleanup in pytest.
It was broken by 89ffac3b01,
which added "cleanup" method to the base test class,
 resulting in reporting cleanup for all of the tests.
2023-01-01 14:11:18 +00:00
Li-Wen Hsu 6541e7696f
Update the SPDX header to preferred BSD-2-Clause
Discussed with:	imp, bcr
2023-01-01 18:33:40 +08:00
Eugene Grosbein 6ab555cff6 syslog(3): expand a commentary adding a reference to RFC 3164. 2023-01-01 15:28:42 +07:00
Li-Wen Hsu 674627b9b5
Happy New Year 2023!
Sponsored by:	The FreeBSD Foundation
2023-01-01 13:44:43 +08:00
Xin LI 73ed8e77a7 MFV: xz 5.4.0
MFC after:	2 weeks
2022-12-31 20:25:17 -08:00
Xin LI f6a891c2b4 Vendor import of xz 5.4.0 (trimmed) 2022-12-31 20:23:22 -08:00
Konstantin Belousov 231d75568f Move INVLPG to pmap_quick_enter_page() from pmap_quick_remove_page().
If processor prefetches neighboring TLB entries to the one being accessed
(as some have been reported to do), then the spin lock does not prevent
the situation described in the "AMD64 Architecture Programmer's Manual
Volume 2: System Programming" rev. 3.23, "7.3.1 Special Coherency
Considerations".

Reported and reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D37770
2023-01-01 00:09:46 +02:00
Konstantin Belousov cde70e312c amd64: for small cores, use (big hammer) INVPCID_CTXGLOB instead of INVLPG
A hypothetical CPU bug makes invalidation of global PTEs using INVLPG
in pcid mode unreliable, it seems.  The workaround is applied for all
CPUs with small cores, since we do not know the scope of the issue, and
the right fix.

Reviewed by:	alc (previous version)
Discussed with:	emaste, markj
Tested by:	karels
PR:	261169, 266145
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D37770
2023-01-01 00:09:45 +02:00
Konstantin Belousov 45ac7755a7 amd64: identify small cores
Reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D37770
2023-01-01 00:09:45 +02:00
Alexander V. Chernikov 89ffac3b01 testing: allow custom test cleanup handlers in pytest
In order to provide more flexibility for the test writers,
add per-test-method cleanups in addition to the per-class cleanups.

Now the test 'test_one' can perform cleanup by either defining
per-class 'cleanup' method (typically used in VNET classes) and
per-test method 'cleanup_test_one'. The latter has preference.
In order to handle paramatrization, testid is passed as a single
 argument to both of the methods.

MFC after:	2 weeks
2022-12-31 16:27:27 +00:00
Vincenzo Maffione e81ecab4b1 netmap: bridge: fix -Wdate-time compilation issue
MFC after: 3 days
2022-12-31 14:56:02 +00:00
Bjoern A. Zeeb 4052b0e4b2 LinuxKPI: pm.h add pm_sleep_ptr and DEFINE_SIMPLE_DEV_PM_OPS
Extend pm.h by pm_sleep_ptr and DEFINE_SIMPLE_DEV_PM_OPS().
For the moment this duplicates some parts (as can be seen in the earlier
review I tried to simplify bits but given our implementation this
was easier in the end).

While here and cleanup the SIMPLE_DEV_PM_OPS() bits (white-space only).

MFC after:	3 days
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D37527
2022-12-31 02:51:09 +00:00
Bjoern A. Zeeb 55038a6306 LinuxKPI: add simplified vesion of page_frag_cache
For the moment and the currently only consumer (mt76) add a simplified
version of the page_frag_cache.  We will only accept fragement sizes up
to 1 PAGE_SIZE (KASSERT) and we will always return a full page.
Should we add more consumers or small (or large) objects would become a
problem we can always add a more elaborate version.

Discussed with:	markj
Reviewed by:	markj (,hselasky commented as well)
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D37595
2022-12-31 02:45:44 +00:00
Bjoern A. Zeeb 4b0af11437 LinuxKPI: 802.11: move ieee80211_{unregister,restart}_hw out of header
Migrate the two functions from the header into the implementation file
in order to have access to more facilities and not to run into possible
allocation/locking/... problems in the future.

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
2022-12-31 02:24:23 +00:00
Bjoern A. Zeeb c990500bf1 LinuxKPI; 802.11: update mac80211.h structures and fields
Cleanup some fields and structures and add new ones.

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
2022-12-31 02:15:28 +00:00
Bjoern A. Zeeb 3391199496 LinuxKPI: 802.11: implement ieee80211_get_hdrlen_from_skb()
Implement ieee80211_get_hdrlen_from_skb() doing basic sanity checks
on lengths (minimal length or skb data length vs. header length).

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
2022-12-31 02:02:01 +00:00
Bjoern A. Zeeb 13d87d92e4 LinuxKPI: 802.11: implement cfg80211_get_ies_channel_number()
Using the previous changes implement cfg80211_get_ies_channel_number()
either based on DSPARMS (or for the future HTINFO).

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
2022-12-31 01:59:20 +00:00
Bjoern A. Zeeb 5db817d864 LinuxKPI: 802.11: implement some *eleme/ie* lookup functions
Implement cfg80211_find_elem(), ieee80211_bss_get_elem(),
ieee80211_bss_get_ie(), and cfg80211_find_vendor_ie() with the last
one having a short cut always also checking oui_type in the pattern.

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
2022-12-31 01:33:28 +00:00
Bjoern A. Zeeb 5edde07c2a LinuxKPI: 802.11: implement cfg80211_{get,put}_bss
Implement cfg80211_{get,put}_bss currently doing malloc/free bits,
so hopefully the drivers get the calls right.

cfg80211_get_bss() sets up a lookup structure which may also take a
result (first hit wins) and calls ieee80211_scan_iterate() comparing
the various values in the iterator funcion.  Some of the checks are
partially pointless (as it seems the drivers are not interested in
these parts [ANY] but we keep them for documentation purposes should
futher values arise in the future).

We currently only iterate over the first VAP which will do for now.

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
2022-12-31 01:18:16 +00:00
Bjoern A. Zeeb b6b352e4c7 LinuxKPI: 802.11: set sta supported legacy rates
When initializing the sta set the per-band supported legacy rates
as some drivers take the information from there.

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
2022-12-31 00:33:34 +00:00
Alexander V. Chernikov 06e879593a routing: add missed RIB_WUNLOCK in the add_route_flags().
MFC after:	2 weeks
2022-12-30 15:54:06 +00:00
Vladimir Kondratyev 1522062bad hidraw(4): Drop unneeded usb kernel module dependency
HID is not a part of usb subsystem for a while.

MFC after:	2 weeks
2022-12-30 18:24:53 +03:00
Konstantin Belousov a5ff86646e UFSSUSPEND: unbusy mp in EDADLK case
Reported and tested by:	pho
Fixes:	701b36961c
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2022-12-30 11:44:20 +02:00
Konstantin Belousov 701b36961c ufs/suspend: deny suspension if the calling process has a file from mp opened for write
Also deny suspension if we cannot check the above condition race-free
because there is more than one thread in the calling process.

PR:	267628, 267630
Reviewed by:	mckusick
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D37896
2022-12-29 22:55:39 +02:00
Konstantin Belousov 6891270170 ffs_suspend.c: clean up includes
Order includes alphabetically.
Remove unneeded sys/param.h, it is already included by sys/systm.h.

Reviewed by:	mckusick
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D37896
2022-12-29 22:55:39 +02:00
Konstantin Belousov 37b9fb1696 Add descrip_check_write_mp() helper
... which verifies that given file table does not have file descriptors
referencing vnodes on the specified mount point.  It is up to the caller
to ensure that the check is not racy.

Reviewed by:	mckusick
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D37896
2022-12-29 22:55:39 +02:00
Shteryana Shopova 4ac8f40670 Follow the standard object definition from RFC2578
Use mib-2 throughout the files where applicable

PR:		254231
Reported by:	Michael Proto
Reviewed by:	bz (at) FreeBSD (dot) org
2022-12-29 22:02:27 +02:00
Alexander V. Chernikov f63825ff21 testing: improve python vnet wrapper.
* Derive jail name from class name and method name, instead of just
method name. This change reduces the chances of different tests
clashing.
 Old: 'jail_test_one'. New: 'pytest:TestExampleSimplest:test_one'
* Simplify vnetX_handler() method signature by skipping obj_map (unused)
 and pipe. The latter can be accessed as the vnet property.
* Add `send_object()` method as a pair to the `wait_object` inside the
 VnetTestTemplate class.
* Add `test_id` property to the BaseTest method. Previously it was
 provided only for the VnetTestTemplate class. This change makes
 the identifier easily accessible for all users.

MFC after:	2 weeks
2022-12-29 19:59:11 +00:00
John Baldwin 7063b9974f ccr: Retire ccr_softc member in struct adapter.
Prior to Conrad's changes to replace session integer IDs with a
pointer to the driver-specific state in commit 1b0909d51a, the
driver had to find the softc pointer from the adapter before it could
locate the ccr_session structure for a completed request.  Since
Conrad's changes, the ccr_session pointer can now be obtained directly
from the crp.  Add a backpoint from ccr_session back to ccr_softc and
use this in place of the ccr_softc member in cxgbe's struct adapter.

Sponsored by:	Chelsio Communications
2022-12-29 11:39:28 -08:00
David E. O'Brien f3c043bb5f newsyslog.conf: Minor formatting fix 2022-12-28 16:26:51 -08:00
David E. O'Brien bb6266f279 newsyslog.conf: Sort paths 2022-12-28 16:23:41 -08:00
David E. O'Brien 96c6fba6fd rc.subr: Minor formatting fix for ac102a2a6 2022-12-28 16:00:56 -08:00
David E. O'Brien 43dc1409c1 Restricting xargs to '-n1' is much slower and isn't needed for file(1)
Also note that libc.so.6 is an older version of libc (thus why you'd
want to find files linked against it).
2022-12-28 15:54:29 -08:00
Mateusz Guzik f45feecfb2 vfs: add vn_getsize
getattr is very expensive and in important cases only gets called to get
the size. This can be optimized with a dedicated routine which obtains
that statistic.

As a step towards that goal make size-only consumers use a dedicated
routine.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D37885
2022-12-28 22:43:49 +00:00
Simon J. Gerraty e300f328fe Add site.{autodep,gendirdeps}.mk
Allow for site customization to minimize churn in share/mk

Reviewed by:	stevek
Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D37895
2022-12-28 12:39:08 -08:00
John Baldwin d131218534 h_resolv: Fix a buffer overflow in load().
fgetln() returns a pointer to an array of characters that is 'len'
characters long, not 'len + 1'.  While here, overwriting the contents
of the buffer returned by fgetln isn't really safe, so switch to using
getline() instead.

Note that these fixes are a subset of those applied to a
near-identical copy of this function in libc's resolv_test.c in commit
2afeaad315.

Reviewed by:	ngie
Reported by:	CHERI (buffer overflow)
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D37886
2022-12-28 09:39:18 -08:00
Jose Luis Duran 058ac3e806 atf_pytest_wrapper: fix pytest output truncation
Pass `-vv` to pytest in order to always get the full output.
While here, enforce the modeline.

Differential Revision: https://reviews.freebsd.org/D37894
MFC after:	2 weeks
2022-12-28 17:31:14 +00:00
Jose Luis Duran eaeebfcb38 pytest: silence deprecation warning in the pytest atf wrapper
Convert `pytest.mark` decorator to the `pytest.hookimpl()` one,
 as suggested by the
 https://docs.pytest.org/en/latest/deprecations.html#configuring-hook-specs-impls-using-markers

Differential Revision: https://reviews.freebsd.org/D37884
MFC after:	2 weeks
2022-12-28 15:53:48 +00:00
Zhenlei Huang bd5d9037c5 GEOM: Remove redundant NULL pointer check before g_free()
Reviewed by:	melifaro, pjd, imp
Approved by:	kp (mentor)
Differential Revision:	https://reviews.freebsd.org/D37779
2022-12-28 23:34:09 +08:00
Zhenlei Huang f948cb717f wg: Use NET_EPOCH_DRAIN_CALLBACKS macro
Reviewed by:	jhb, kp
Approved by:	kp (mentor)
Differential Revision:	https://reviews.freebsd.org/D37734
2022-12-28 23:28:15 +08:00
Søren Schmidt 79c6e0b31f Improve and make it more general Rockchip USB2PHY driver.
Add support for Rockchip RK3568.
2022-12-28 03:48:48 +00:00
Søren Schmidt 355cb40c3a Set RK3568 specific pin mux for GMAC1. 2022-12-28 03:00:19 +00:00
Ganbold Tsagaankhuu db6407438d Add eqos device to Rockchip specific config. 2022-12-28 02:32:06 +00:00
John Baldwin 07be751727 ktls: Post receive errors on partially closed sockets.
If an error such as an invalid record or one whose decryption fails is
detected on a socket that has received a RST then ktls_drop() could
ignore the error since INP_DROPPED could already be set.  In this case
soreceive_generic hangs since it does not return from a KTLS socket
with pending encrypted data unless there is an error (so_error) (this
behavior is to ensure that soreceive_generic doesn't return a
premature EOF when there is pending data still being decrypted).

Note that this was a bug prior to
69542f2682 as tcp_usr_abort would also
have ignored the error in this case.

Reviewed by:	gallatin
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D37775
2022-12-27 16:00:17 -08:00
John Baldwin 7a8d62cd04 termcap.small: Don't use -o pipefail.
The command to generate termcap.small doesn't use any pipes, so this
option is not needed.  Using it also breaks cross-building on hosts
where /bin/sh does not support pipefail such as Linux hosts where
/bin/sh is dash.

Reviewed by:	sobomax, imp
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D37865
2022-12-27 10:05:10 -08:00
Wolfram Schneider 433c5a8ae4 do not expect mandoc(1) to terminate in finite time
PR:		266868
2022-12-27 17:04:04 +00:00
Kristof Provost b079ca8593 Revert "if_ovpn: allow peer lookup by vpn4/vpn6 address"
This reverts commit 92f0cf77db.

This change was incorrect, at least because it uses ovpn_kpeer's tree
for multipbe RB_TREEs.

This is a performance change, not a functional one, so we can revert
this until it can be fixed.

Reported by:	Gert Doering <gert@greenie.muc.de>
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-12-26 22:38:10 +01:00
Gleb Smirnoff 5e4ae3061f tests/divert: use PF_DIVERT
Now all Python ports has been patched to support PF_DIVERT, and
Python kinda promises to add support in 3.12 [1].

This reverts commit 322b5b7c16.

[1] https://github.com/python/cpython/pull/96536#issuecomment-1303974686
2022-12-26 12:02:45 -08:00
Mateusz Guzik 829f0bcb5f vfs: add the concept of vnode state transitions
To quote from a comment above vput_final:
<quote>
* XXX Some filesystems pass in an exclusively locked vnode and strongly depend
* on the lock being held all the way until VOP_INACTIVE. This in particular
* happens with UFS which adds half-constructed vnodes to the hash, where they
* can be found by other code.
</quote>

As is there is no mechanism which allows filesystems to denote that a
vnode is fully initialized, consequently problems like the above are
only found the hard way(tm).

Add rudimentary support for state transitions, which in particular allow
to assert the vnode is not legally unlocked until its fate is decided
(either construction finishes or vgone is called to abort it).

The new field lands in a 1-byte hole, thus it does not grow the struct.

Bump __FreeBSD_version to 1400077

Reviewed by:	kib (previous version)
Tested by:	pho
Differential Revision:	https://reviews.freebsd.org/D37759
2022-12-26 17:35:12 +00:00