Commit Graph

276333 Commits

Author SHA1 Message Date
Alexander V. Chernikov
9c42645a1e testing: workaround pytest parser bug in pytest-atf-wrapper.
Reviewed by:	lwhsu, kp
Differential Revision: https://reviews.freebsd.org/D35614
MFC after:	2 weeks
2022-06-27 17:30:53 +00:00
Alexander V. Chernikov
8010b7a78a routing: simplify decompose_change_notification().
The function's goal is to compare old/new nhop/nexthop group for the route
 and decompose it into the series of RTM_ADD/RTM_DELETE single-nhop
 events, calling specified callback for each event.
Simplify it by properly leveraging the fact that both old/new groups
 are sorted nhop-# ascending.

Tested by:	Claudio Jeker<claudio.jeker@klarasystems.com>
Differential Revision: https://reviews.freebsd.org/D35598
MFC after: 2 weeks
2022-06-27 17:30:52 +00:00
Alexander V. Chernikov
76f1ab8eff routing: actually sort nexthops in nhgs by their index
Nexthops in the nexthop groups needs to be deterministically sorted
 by some their property to simplify reporting cost when changing
 large nexthop groups.

Fix reporting by actually sorting next hops by their indices (`wn_cmp_idx()`).
As calc_min_mpath_slots_fast() has an assumption that next hops are sorted
using their relative weight in the nexthop groups, it needs to be
addressed as well. The latter sorting is required to quickly determine the
layout of the next hops in the actual forwarding group. For example,
what's the best way to split the traffic between nhops with weights
19,31 and 47 if the maximum nexthop group width is 64?
It is worth mentioning that such sorting is only required during nexthop
group creation and is not used elsewhere. Lastly, normally all nexthop
are of the same weight. With that in mind, (a) use spare 32 bytes inside
`struct weightened_nexthop` to avoid another memory allocation and
(b) use insertion sort to sort the nexthop weights.

Reported by:	thj
Tested by:	Claudio Jeker<claudio.jeker@klarasystems.com>
Differential Revision: https://reviews.freebsd.org/D35599
MFC after:	2 weeks
2022-06-27 17:30:52 +00:00
Yuri
f4497b9f77 smartpqi: Allocate DMA memory NOWAIT
We're not allowed to wait in this allocation path, so allocate the
memory NOWAIT instead of WAITOK. The code already copes with the
failures that may result, so no additional code is needed.

PR: 263008
Reviewed by: markj, Scott Benesh at Microsemi, imp
Differential Revision: https://reviews.freebsd.org/D35601
2022-06-27 11:06:31 -06:00
Michael Tuexen
121ecca0d8 sctp: add KASSERTs to ensure correct handling of listeners
This was suggested by markj@.

MFC after:	3 days
2022-06-27 19:04:45 +02:00
Gleb Smirnoff
bafe71fd27 sctp: do not clobber listening socket with sockbuf operations
The problem was here since 779f106aa1, but a4fc41423f turned it
into a panic.

Reviewed by:	tuexen
Reported by:	syzcaller
2022-06-27 09:24:49 -07:00
Fernando Apesteguía
4a3c598f35 Bump .Dd for recently modified manual pages
During the removal of named(8) references, some pages were modified but their
.Dd where not updated accordingly.

Reported by:	lwhsu@
Fixes:	942e234d86
2022-06-27 18:20:03 +02:00
Ed Maste
7927452ac4 Fix cross-builds from macOS
The macOS linker does not support -zrelro/-znorelro.  Since it is only
used to for build tools that run on the host, and WITH_RELRO or
WITHOUT_RELRO does not matter there, just skip the option.

Reviewed by:	markj
Fixes:		2f3a961487 ("Add RELRO build knob, default to enabled")
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35589
2022-06-27 10:22:12 -04:00
Kristof Provost
1e824ee84f if_bridge tests: test adding interfaces with different MTU
We now allow new bridge members to be added with a different MTU from
the bridge. We change the interface MTU to match the bridge.
Test this.

PR:	264883
2022-06-27 08:27:28 +02:00
Kristof Provost
1865ebfb12 if_bridge: change MTU for new members
Rather than reject new bridge members because they have the wrong MTU
change it to match the bridge. If that fails, reject the new interface.

PR:	264883
Different Revision:	https://reviews.freebsd.org/D35597
2022-06-27 08:27:27 +02:00
Hans Petter Selasky
9971e6aff1 vt: Improve multi lingual word separation.
Suggested by:	Tomoaki AOKI <junchoon@dec.sakura.ne.jp>
Differential Revision:	https://reviews.freebsd.org/D35552
PR:		263084
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-06-27 10:17:16 +02:00
Hans Petter Selasky
5fe0a82501 vt: Fix contents of paste buffer for newcons.
Trim all word separators from end of line, except for last line and
only use '\r' to terminate the pasted lines as expected by TTY.

Submitted by:	Ivan Quitschal <tezeka@hotmail.com>
Differential Revision:	https://reviews.freebsd.org/D35552
PR:		263084
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-06-27 10:17:16 +02:00
Mateusz Guzik
7388fb714a cache: drop the vfs.cache_rename_add tunable
The functionality has been in use since Jan 2021 -- long enough(tm).
2022-06-27 09:56:20 +02:00
Bjoern A. Zeeb
d78bef0ebe hwpmc: further fix build (__diagused/debug/missing files entries)
Fix builds after 1459a22787 and
59191f3573 by using __diagused
for variables only used in KASSERT().
In addition remove two debug lines that look like a copy and paste error
from dmc620 to cmn600.
Further add the newly introduced files to sys/confg/files.arm64 as well
so that LINT compiles without missing symbols.
2022-06-27 01:36:52 +00:00
Bjoern A. Zeeb
af8317c31a pmc: unhide struct pmc_md_dmc620_pmu_op_pmcallocate
Fix build after e3572eb654 as
struct pmc_md_dmc620_pmu_op_pmcallocate is needed when building
libpmc/pmclog.c as it is partof the public API via machine/pmc_mdep.h.
2022-06-27 00:37:23 +00:00
Bjoern A. Zeeb
dd2fd62184 libpmc: attempt to fix the build
Try to fix the build (blindly) after e3572eb654.
I had missed the missing #ifdef in the review.  Hope that's all it takes.
2022-06-26 23:14:56 +00:00
Aleksandr Rybalko
59191f3573 Add support of ARM CMN-600 controller, PMU access functions only. Add support of PMU counters of ARM CMN-600 controller.
Add support of ARM CMN-600 controller, PMU access functions only.
Add support of PMU counters of ARM CMN-600 controller.

Reviewed by: mhorne
Sponsored By: ARM
Differential Revision: https://reviews.freebsd.org/D32321
2022-06-26 22:03:04 +03:00
Aleksandr Rybalko
1459a22787 The Arm CoreLink DMC-620 Dynamic Memory Controller PMU driver
Add the Arm CoreLink DMC-620 Dynamic Memory Controller PMU driver
Add DMC-620 support to hwpmc(4)

Reviewed by: mhorne
Sponsored By: Ampere Computing
Differential Revision: https://reviews.freebsd.org/D32670
2022-06-26 21:57:56 +03:00
Aleksandr Rybalko
e3572eb654 Allocate event for DMC-620 and CMN-600 controllers PMU. Add events supported by DMC-620 and CMN-600 controllers PMU.
Allocate event for DMC-620 and CMN-600 controllers PMU.
Add events supported by DMC-620 and CMN-600 controllers PMU.

Reviewed by: bz
Sponsored By: ARM
Sponsored By: Ampere Computing
Differential Revision: https://reviews.freebsd.org/D35609
2022-06-26 21:52:26 +03:00
Alan Cox
7b39a9bc1d iommu_gas: Fix a recent regression with IOMMU_MF_CANSPLIT
As of 19bb5a7244, the IOMMU_MF_CANSPLIT case in iommu_gas_match_one()
must take into account the specified offset.  Otherwise, the recently
changed end calculation in iommu_gas_match_insert() could produce an
end address that crosses the specified boundary by one page.

Reviewed by:	dougm
MFC with:	19bb5a7244
2022-06-26 16:31:54 -05:00
Bjoern A. Zeeb
841719c08f 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.

MFC after:	3 days
2022-06-26 19:17:04 +00:00
Bjoern A. Zeeb
e24e8103e0 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.

MFC after:	3 days
2022-06-26 19:13:00 +00:00
Bjoern A. Zeeb
ed3ef56b29 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
MFC after:		3 days
2022-06-26 19:04:16 +00:00
Bjoern A. Zeeb
9597f7cb99 Revert "LinuxKPI: 802.11: fix iwlwifi fw assert with older chipsets"
This reverts commit 013e516dc9.
2022-06-26 18:50:36 +00:00
Fernando Apesteguía
942e234d86 Remove references to named(8)
named(8) hasn't been in base for some time. Remove all references to it in
manual pages.

Approved by:	manpages (Pau Amma)
Differential Revision:	https://reviews.freebsd.org/D35586
2022-06-26 18:53:08 +02:00
Alexander V. Chernikov
924226fba1 testing: move atf-pytest-wrapper to /usr/libexec
Move pytest wrapper to the collection of the other atf wrappers
 in libexec. It solves the problem of combining bits & pieces from
 bsd.test.mk and bgs.prog.mk to address "test binary, but not the
 suite binary".

Reviewed by:	kp
Differential Revision: https://reviews.freebsd.org/D35604
MFC after:	2 weeks
2022-06-26 13:25:47 +00:00
Aleksandr Rybalko
fdfeaa66b5 Support of optional PMC classes.
Reviewed by:		mhorne
Differential Revision:	https://reviews.freebsd.org/D32316
2022-06-26 08:55:09 +03:00
Aleksandr Rybalko
b6e28991bf System wide and NUMA domain wide counters support. PMC classes for ARM DMC-620 and CMN-600.
Add support for system wide and NUMA domain wide counters support.
Add 3 new PMC classes for ARM DMC-620 and CMN-600 controllers PMU.

Reviewed by:	mhorne
Sponsored By:	ARM
Sponsored By:	Ampere Computing
Differential Revision: https://reviews.freebsd.org/D35342
2022-06-26 08:31:03 +03:00
Alexander V. Chernikov
33a0803f00 routing: fix debug headers added in 6fa8ed43ee #2.
Move debug declaration out of COMPAT_FREEBSD32 in rtsock.c

MFC after: 2 weeks
2022-06-26 07:28:15 +00:00
Alan Cox
da33f6d76b iommu_gas: Tidy up
Move a comment to the code that it describes.  Improve the wording.

Style fixes.

MFC after:	2 weeks
2022-06-26 01:01:49 -05:00
Alexander V. Chernikov
0e87bab6b4 routing: fix debug headers added in 6fa8ed43ee.
- move debug headers out of COMPAT_FREEBSD32 in rtsock.c
- remove accidentally-added LOG_ defines from syslog.h

MFC after:	2 weeks
2022-06-25 23:05:25 +00:00
Alexander V. Chernikov
76179e400a routing: fix syslog include for rtsock.c
MFC after:	2 weeks
2022-06-25 22:08:10 +00:00
Alexander V. Chernikov
9a75209d2b routing: add tests/sys/net/routing to mtree
MFC after:	2 weeks
2022-06-25 21:16:14 +00:00
Alexander V. Chernikov
6fa8ed43ee routing: improve debugging.
Use unified guidelines for the severity across the routing subsystem.
Update severity for some of the already-used messages to adhere the
guidelines.
Convert rtsock logging to the new FIB_ reporting format.

MFC after:	2 weeks
2022-06-25 19:53:31 +00:00
Alexander V. Chernikov
c260d5cd8e routing: fix crash when RTM_CHANGE results in no-op for the multipath
route.

Reporting logic assumed there is always some nhop change for every
 successful modification operation. Explicitly check that the changed
 nexthop indeed exists when reporting back to userland.

MFC after:	2 weeks
Reported by:	Claudio Jeker <claudio.jeker@klarasystems.com>
Tested by:	Claudio Jeker <claudio.jeker@klarasystems.com>
2022-06-25 19:35:09 +00:00
Alexander V. Chernikov
bd03f10a60 routing: add multipath pytest tests
Differential Revision:	https://reviews.freebsd.org/D31084
2022-06-25 19:29:11 +00:00
Alexander V. Chernikov
8eb2bee6c0 testing: Add basic atf support to pytest.
Implementation consists of the pytest plugin implementing ATF format and
a simple C++ wrapper, which reorders the provided arguments from ATF format
to the format understandable by pytest. Each test has this wrapper specified
after the shebang. When kyua executes the test, wrapper calls pytest, which
loads atf plugin, does the work and returns the result. Additionally, a
separate python "package", `/usr/tests/atf_python` has been added to collect
code that may be useful across different tests.

Current limitations:
* Opaque metadata passing via X-Name properties. Require some fixtures to write
* `-s srcdir` parameter passed by the runner is ignored.
* No `atf-c-api(3)` or similar - relying on pytest framework & existing python libraries
* No support for `atf_tc_<get|has>_config_var()` & `atf_tc_set_md_var()`.
 Can be probably implemented with env variables & autoload fixtures

Differential Revision: https://reviews.freebsd.org/D31084
Reviewed by:	kp, ngie
2022-06-25 19:25:15 +00:00
Alexander V. Chernikov
c38da70c28 routing: fix RTM_CHANGE nhgroup updates.
RTM_CHANGE operates on a single component of the multipath route (e.g. on a single nexthop).
Search of this nexthop is peformed by iterating over each component from multipath (nexthop)
 group, using check_info_match_nhop. The problem with the current code that it incorrectly
 assumes that `check_info_match_nhop()` returns true value on match, while in reality it
 returns an error code on failure). Fix this by properly comparing the result with 0.
Additionally, the followup code modified original necthop group instead of a new one.
Fix this by targetting new nexthop group instead.

Reported by:	thj
Tested by:	Claudio Jeker <claudio.jeker@klarasystems.com>
Differential Revision: https://reviews.freebsd.org/D35526
MFC after: 2 weeks
2022-06-25 18:54:57 +00:00
Hans Petter Selasky
2c28cd09d9 cuse(3): Remove PAGE_SIZE from libcuse.
To allow for a dynamic page size on arm64 remove the static value from libcuse.

Differential Revision:	https://reviews.freebsd.org/D35585
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-06-25 12:01:59 +02:00
Hans Petter Selasky
6c4b6f55f7 busdma: Protect ARM busdma bounce page counters using the bounce page lock.
In bus_dmamap_unload() on ARM, the counters for free_bpages and reserved_bpages
appear to be vulnerable to unprotected read-modify-write operations that result
in accounting that looks like a page leak.

This was noticed on a 2GB quad core i.MX6 system that has more than one device
attached via FTDI based USB serial connection.

Submitted by:	John Hein <jcfyecrayz@liamekaens.com>
Differential Revision:	https://reviews.freebsd.org/D35553
PR:		264836
MFC after:	3 days
Sponsored by:	NVIDIA Networking
2022-06-25 12:01:59 +02:00
Doug Moore
61c74fb66f rb_tree: optimize tree rotation
The RB_ROTATE macros begin with fetching a field via a pointer. In
most cases, that value is one that has already been pulled into a
register, and the compiler cannot infer that. So, to eliminate those
needless fetches, have the caller of the RB_ROTATE macros present the
data in the third macro parameter, rather than having the macro fetch
it.

Differential Revision:	https://reviews.freebsd.org/D35520
2022-06-25 02:40:16 -05:00
Peter Holm
e3b31e23ff stress2: Added two syzkaller reproducers 2022-06-25 08:40:20 +02:00
Peter Holm
25a1b1f30c stress2: Added reagression tests
PR:	165392
2022-06-25 08:21:30 +02:00
Alan Cox
eeb46578c2 busdma_iommu: Fine-grained locking for the dmamap's map list
Introduce fine-grained locking on the dmamap's list of map entries,
replacing the use of the domain lock.  This is not the most significant
source of lock contention, but it is the easiest to address.

Reviewed by:	kib
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D35557
2022-06-25 00:59:23 -05:00
Rick Macklem
c11e64ce51 nfscommon: Clean up the code by removing the vnode_vtype() macro
The vnode_vtype() macro was used to make the code compatible
with Mac OSX, for the Mac OSX port.
For FreeBSD, this macro just obscured the code and, therefore,
use of the macro has been deleted by previous commits.
This commit deletes the, now unused, macro.

This commit should not result in a semantics change.
2022-06-24 13:56:35 -07:00
Rick Macklem
1ebc14c900 nfscommon: Clean up the code by not using the vnode_vtype() macro
The vnode_vtype() macro was used to make the code compatible
with Mac OSX, for the Mac OSX port.
For FreeBSD, this macro just obscured the code, so
avoid using it to clean up the code.

This commit should not result in a semantics change.
2022-06-24 13:47:57 -07:00
Gleb Smirnoff
235d960aae tests/unix_passfd: compile SOCK_STREAM and SOCK_DGRAM versions
Most test pass identically on different kinds of sockets. However,
few edge cases work differently on stream and datagram sockets. We
want to exercise this and document.

Differential revision:	https://reviews.freebsd.org/D35420
2022-06-24 09:09:11 -07:00
Gleb Smirnoff
ddc6890519 libc/syslog: deprecate use of "/var/run/logpriv"
This additional socket was created in 2e89951b6f and 240d5a9b1c
to try workaround problems with classic PF_UNIX/SOCK_DGRAM sockets.

With recent changes in kernel this trick is no longer needed, so the
trick can be reverted.

In syslogd(8) we would still create the socket for the next several
major releases for compatibility.

Differential revision:	https://reviews.freebsd.org/D35305
2022-06-24 09:09:11 -07:00
Gleb Smirnoff
f9e62cbacc libc/syslog: fully deprecate and don't try to open "/dev/log"
The "/dev/log" socket existed in pre-FreeBSD times.  Later it was
substituted to a compatibility symlink.  The symlink creation was
deprecated in FreeBSD 10.2 and 9-STABLE.

Reviewed by:		markj
Differential revision:	https://reviews.freebsd.org/D35304
2022-06-24 09:09:11 -07:00
Gleb Smirnoff
458f475df8 unix/dgram: smart socket buffers for one-to-many sockets
A one-to-many unix/dgram socket is a socket that has been bound
with bind(2) and can get multiple connections.  A typical example
is /var/run/log bound by syslogd(8) and receiving multiple
connections from libc syslog(3) API.  Until now all of these
connections shared the same receive socket buffer of the bound
socket.  This made the socket vulnerable to overflow attack.
See 240d5a9b1c for a historical attempt to workaround the problem.

This commit creates a per-connection socket buffer for every single
connected socket and eliminates the problem.  The new behavior will
optimize seldom writers over frequent writers.  See added test case
scenarios and code comments for more detailed description of the
new behavior.

Reviewed by:		markj
Differential revision:	https://reviews.freebsd.org/D35303
2022-06-24 09:09:11 -07:00