Commit Graph

276542 Commits

Author SHA1 Message Date
Warner Losh
5c19fabbe3 devinfo: xref devctl
devctl has ways to get the different locator's paths to devices, while
devinfo does not. xref devctl in devinfo(8) as a hint.

Sponsored by:		Netflix
2022-07-05 15:15:08 -06:00
Kristof Provost
6ba6c05cb2 if_ovpn: deal with short packets
If we receive a UDP packet (directed towards an active OpenVPN socket)
which is too short to contain an OpenVPN header ('struct
ovpn_wire_header') we wound up making m_copydata() read outside the
mbuf, and panicking the machine.

Explicitly check that the packet is long enough to copy the data we're
interested in. If it's not we will pass the packet to userspace, just
like we'd do for an unknown peer.

Extend a test case to provoke this situation.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-07-05 19:27:00 +02:00
Kristof Provost
cbb019b831 dummynet: fix ip_dn_vnet_init() / dummynet_task() race
If dummynet_task() is run on a vnet where dummynet is still initialising
(i.e. still running ip_dn_vnet_init()) we can attempt to use an
uninitialised mutex.

We can use the existing init_done field to check if the per-vnet
V_dn_cfg is fully set up, if we ensure that it's only set to 1 when
we've done all of the init work.

Reported by:	Alfredo Dal'Ava Júnior <alfredo@freebsd.org>
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D35716
2022-07-05 18:59:00 +02:00
Jung-uk Kim
9576bca583 OpenSSL: Regen assembly file for OpenSSSL 1.1.1q 2022-07-05 12:06:50 -04:00
Jung-uk Kim
25fb251592 OpenSSL: Regen manual pages for OpenSSL 1.1.1q 2022-07-05 12:01:07 -04:00
Jung-uk Kim
64cbf7cebc OpenSSL: Merge OpenSSL 1.1.1q
Merge commit 'f874e59ffcd8b5ecd018ad8311d78e866340f3e9'
2022-07-05 11:47:01 -04:00
Jung-uk Kim
f874e59ffc Import OpenSSL 1.1.1q 2022-07-05 11:27:51 -04:00
Tom Jones
1e692b938e xargs: fix description of strnsubst return value
Reported by:	oshogbo
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D35574
2022-07-05 16:27:15 +01:00
Tom Jones
f058359ba5 xargs: terminate if line replacement cannot be constructed
If the line with replacement cannot be constructed xargs should
terminate as documented in the man page

We encounter this error, but gnu/xargs doesn't because they have a much
larger limit for created outputs (~10000 lines).

Reviewed by:	oshogbo
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D35574
2022-07-05 16:18:05 +01:00
Mitchell Horne
62bca9c4df DB_COMMAND(9): fix a typo
Fixes:	b83d53cb68
2022-07-05 12:15:30 -03:00
Mitchell Horne
b83d53cb68 DB_COMMAND(9): update to mention additional macros
Document the existing alias definitions, and augment the example with
one of these. Also, describe the purpose of the newly added _FLAGS
variations of these command definitions.

Make some small style improvements to appease mandoc -Tlint.

Reviewed by:	markj
MFC after:	3 days
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D35664
2022-07-05 11:56:55 -03:00
Mitchell Horne
258958b3c7 ddb: use _FLAGS command macros where appropriate
Some command definitions were forced to use DB_FUNC in order to specify
their required flags, CS_OWN or CS_MORE. Use the new macros to simplify
these.

Reviewed by:	markj, jhb
MFC after:	3 days
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D35582
2022-07-05 11:56:55 -03:00
Mitchell Horne
7ce58d4e8c ddb: add _FLAGS command variants
Provide _FLAGS variants of the various command definition macros, in
anticipation of adding a new flag. This can also be used for some
existing commands which require special flag values.

Reviewed by:	markj
MFC after:	3 days
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D35581
2022-07-05 11:56:42 -03:00
Mitchell Horne
8a09948233 db_command.c: use designated initializers
Provide separate helper macros for regular commands and next-level table
commands as they are mutually exclusive. This ensures proper
initialization of each element and allows us to exclude some redundant
fields, such as specifying .more = NULL for every regular command.

Reviewed by:	markj, jhb
MFC after:	3 days
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D35580
2022-07-05 11:51:31 -03:00
Mitchell Horne
4f2ad6243f db_command.c: style
Reviewed by:	jhb
MFC after:	3 days
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D35368
2022-07-05 11:51:31 -03:00
Mitchell Horne
4fffc56c6e riscv: implement db_show_mdpcpu()
This prints the machine-dependent members of struct pcpu when executing
the 'show pcpu' or 'show all pcpu' ddb(4) commands.

MFC after:	3 days
2022-07-05 11:51:14 -03:00
Mateusz Piotrowski
4e3dc91e4c sesutil.8: Polish
- Use right mdoc macros
- Fix synopsis. Some of the optional command modifiers were not optional
  after all.
- Sort options

MFC after:	1 week
2022-07-05 16:39:01 +02:00
Mateusz Piotrowski
604bc078a5 rc.8: Reference the article about rc scripting
MFC after:	3 days
2022-07-05 16:39:00 +02:00
Alexander V. Chernikov
0ed7253785 netinet6: perform out-of-bounds check for loX multicast statistics
Currently, some per-mbuf multicast statistics is stored in
 the per-interface ip6stat.ip6s_m2m[] array of size 32 (IP6S_M2MMAX).
Check that loopback ifindex falls within 0.. IP6S_M2MMAX-1 range to
 avoid silent data corruption. The latter cat happen with large
 number of VNETs.

Reviewed by:	glebius
Differential Revision: https://reviews.freebsd.org/D35715
MFC after:	2 weeks
2022-07-05 11:44:30 +00:00
Tom Jones
d458eb8de1 diff3: make the eflag logic easier to follow
Discussed with:	dim
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D35324
2022-07-05 12:36:11 +01:00
KUROSAWA Takahiro
d80d734937 arp(8): use getifaddrs(3) instead of ioctl(SIOCGIFCONF)
The original code had used a fixed-size buffer for ioctl(SIOCGIFCONF),
that might cause the target ifreq spilled from the buffer.  Use the handy
getifaddrs(3) to fix the problem.

Reviewed by:		glebius
Differential revision:	https://reviews.freebsd.org/D35536
2022-07-04 20:56:29 -07:00
Bjoern A. Zeeb
ec32fc2af5 dwc3: fix from not working
During the review of 09cdf4878c we
switched from cached registers to reading them as needed.
One read of the two reads was moved after the softreset got triggered
and as a result returned 0 rather than the proper register value.
Moving the read before the softreset gets initiated seems to make
things work again and xhci.c no longer complains about
"Controller does not support 4K page size.".

MFC after:	10 days
X-MFC with:	09cdf4878c
Pointy hat to:	bz
2022-07-05 00:53:42 +00:00
Dmitry Chagin
03473e8ec8 linux(4): Use saved cpu feature bits
MFC after:		3 days
2022-07-04 23:42:07 +03:00
Dmitry Chagin
42317e6426 linux(4): Implement __vdso_time
PR:		240769
MFC after:	3 days
2022-07-04 23:41:32 +03:00
Gleb Smirnoff
d8596171c5 sockets: use only soref()/sorele() as socket reference count
o Retire SS_FDREF as it is basically a debug flag on top of already
  existing soref()/sorele().
o Convert SS_PROTOREF into soref()/sorele().
o Change reference model for the listen queues, see below.
o Make sofree() private.  The correct KPI to use is only sorele().
o Make soabort() respect the model and sorele() instead of sofree().

Note on listening queues.  Until now the sockets on a queue had zero
reference count.  And the reference were given only upon accept(2).  The
assumption was that there is no way to see the queued socket from anywhere
except its head.  This is not true, since queued sockets already have pcbs,
which are linked at least into the global pcb lists.  With this change we
put the reference right in the sonewconn() and on accept(2) path we just
hand the existing reference to the file descriptor.

Differential revision:	https://reviews.freebsd.org/D35679
2022-07-04 12:40:51 -07:00
Gleb Smirnoff
bc7605647c sockets: use positive flag for file descriptor socket reference
Rename SS_NOFDREF to SS_FDREF and flip all bitwise operations.
Mark sockets created by socreate() with SS_FDREF.

This change is mostly illustrative. With it we see that SS_FDREF
is a debugging flag, since:
* socreate() takes a reference with soref().
* on accept path solisten_dequeue() takes a reference
  with soref() and then soaccept() sets SS_FDREF.
* soclose() checks SS_FDREF, removes it and does sorele().

Reviewed by:		tuexen
Differential revision:	https://reviews.freebsd.org/D35678
2022-07-04 12:40:51 -07:00
Gleb Smirnoff
74703901d8 tcp: use a TCP flag to check if connection has been close(2)d
The flag SS_NOFDREF is a private flag of the socket layer.  It also
is supposed to be read with SOCK_LOCK(), which we don't own here.

Reviewed by:		rrs, tuexen
Differential revision:	https://reviews.freebsd.org/D35663
2022-07-04 12:40:51 -07:00
Bjoern A. Zeeb
97dbd37753 pca954x: harmonize pca9547 and pca954x and add pca9540 support
The two implementations for the pca9548 switch and the pca9547 mux
seemed close enough so we can put them together and with a bit more
abstraction add pca9540 support.

While here apply a bit of consistency in variable and driver naming and
use device_has_property instead of the FDT-only OF_ variant.

This disconnects pca9547 from the build but does not yet delete it.

MFC after:	2 weeks
Reviewed by:	mmel (earlier version), avg
Differential Revision: https://reviews.freebsd.org/D35701
2022-07-04 19:12:01 +00:00
Doug Moore
2120d7f57a rb_tree: fine-tune rebalancing code
Change parts of RB_INSERT_COLOR and RB_REMOVE_COLOR to reduce the
number of operations, by, in some cases, flipping two color bits at a
time instead of flipping each individually, in separate operations,
and by using a switch statement to replace a sequence of if-elses.
Rewrite RB_SET_PARENT to generate fewer instructions.  These changes
reduce the code size by over 100 bytes on some architectures.

Also, allow RB users to define a preprocessor symbol to generate
RB_REMOVE_COLOR code that matches the implementation described in the
original weak-AVL paper in one particular case, instead of the still
correct, but slightly more efficient implementation of that case
currently implemented.

Reviewed by:	alc
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D35524
2022-07-04 12:28:35 -05:00
Andrew Gallatin
0aa1507751 pmcstat: fix log analysis
pmcstat has been broken for analyzing logs since D35342 / b6e28991bf.

This is because the pmc for the first CPU is not added when reading logs
because unlike its clones, its event id is not invalid. That causes us
to fail the assertion at lib/libpmcstat/libpmcstat_logging.c:293
when encountering samples from cpu0.

Fix this by removing the check that the PMC is invalid

Reviewed by: tsoome
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D35709
2022-07-04 12:42:39 -04:00
Andrew Turner
ee2324aaf6 Add Rockchip PCIe cleanup on attach faulure
We should clean up on failure as it may panic the kernel later, e.g.
if we crate the rman, but fail to destroy it on attach faulure.

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35682
2022-07-04 15:27:01 +01:00
Andrew Turner
b1e9313274 Fix ofw pcib when it rman_init fails
rman_fini assumes rman_init has been called successfully. Clean up
init faulure by only calling rman_fini when rman_init has succeeded.

While here add ofw_pcib_fini that can be used by a sub-class to clean
up.

Reviewed by:	bz, imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35681
2022-07-04 15:27:00 +01:00
Andrew Turner
1c799a6f29 Support decoding mem32 memory in the rk pcie driver
This is needed with some dtb files.

While here use a switch statement as the two options are mutually
exclusive in any iteration of the loop.

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35680
2022-07-04 15:27:00 +01:00
Kornel Dulęba
6654825907 e6000sw: Fix direct register write logic
When accessing a register directly from etherswitchcfg one must specify
a register group(e.g. registers of portN) and the register offset within
the group. The latter is passed as the 5 least significant bits.
Extract the former by dividing the register address by 32, not by 5.

Approved by:	mw(mentor)
Obtained from:	Semihalf
Sponsored by:	Stormshield
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D35672
2022-07-04 16:22:22 +02:00
Kornel Dulęba
9dbacce2d4 lockstat: Fix construction of comparision predicates
Passing "0x%p" to sprintf results in double "0x" being printed.
This causes a dtrace script compilation failure when "-d" flag
is specified.
Fix that by removing the extraneous "0x".

Reviewed by:	markj
Approved by:	mw(mentor)
Obtained from:	Semihalf
Sponsored by:	Alstom
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D35690
2022-07-04 16:22:22 +02:00
Mike Karels
1cf8e6339e mountd startup: enable NFSv4 if needed on restart
The mountd script in rc.d sets vfs.nfsd.server_max_nfsvers correctly
when it is run at system startup, relying on the kernel default.
However, if NFSv4 was enabled in /etc/rc.conf later, and the script
was re-run to restart mountd, the sysctl was still set to 3.
Set the sysctl to the right value in all cases.

Reviewed by:	rmacklem
MFC after:	1 week
2022-07-04 08:00:10 -05:00
Mateusz Guzik
db4b40213a routing: hide notify_add and notify_del behind ROUTE_MPATH
Fixes a warn about unused routines without the option.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-07-04 08:38:13 +00:00
Yuri
177f8b3294 ipmi: do not omit lun in BMC addresses
Some systems put sensors on non-0 lun, so we should not omit it.  This
was the only difference with the Linux driver, where DIMM sensors could
be queried, but not on FreeBSD.

See this report[1] on the FreeBSD forums:
https://forums.freebsd.org/threads/freebsd-cannot-get-dimm-temperature-sensor-value.85166/

Reviewed by:	philip
Tested by:	Andrey Lanin[1]
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D35612
2022-07-04 14:30:39 +08:00
Yuri
18db96dbfd ipmi: correctly handle ipmb requests
Handle IPMB requests using SEND_MSG (sent as driver request as we do not
need to return anything back to userland for this) and GET_MSG (sent as
usual request so we can return the data for RECEIVE_MSG ioctl) pair.

This fixes fetching complete sensor data from boards (e.g. HP ProLiant
DL380 Gen10).

Reviewed by:	philip
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D35605
2022-07-04 13:00:42 +08:00
Xin LI
a4d6d3b891 file: upgrade to 5.42.
MFC after:	2 weeks
2022-07-03 17:11:09 -07:00
Xin LI
ba49e6371b Vendor import of file 5.42. 2022-07-03 17:05:11 -07:00
Bjoern A. Zeeb
11a7d5e5d9 dwc3: improve debugging
Rather than hiding behind #if 0, hide the debugging behind DWC3_DEBUG
so it can be turned on with a single define.  Require bootverbose
to print anything so we can still avoid spamming the console if DWC3_DEBUG
is on.
Harmonize the format string in snsp_dwc3_dump_regs() to always print the
full register and also print the XHCI quirks.
Call snsp_dwc3_dump_regs() twice, before and after generic XHCI attachment
and initialisation as this may have an effect on the confirgumation state.

Obtained from:	an old debug patch
MFC after:	2 weeks
Reviewed by:	mw
Differential Revision: https://reviews.freebsd.org/D35700
2022-07-03 22:19:40 +00:00
Bjoern A. Zeeb
09cdf4878c dwc3: add more quirks and checks
Rather than just printing the Global SNPS ID Register store it as well
so we can do a version check later.
In addition, for debugging purposes, read the Global Hardware Parameters
Registers and print them.

Based on the snpsid disable an XHCI feature using a quirk prepared
in 447c418da0.
Add the "snps,dis_u3_susphy_quirk" quirk and handle Suspend USB3.0 SS PHY
after power-on-reset/during core initialization (suggested to be cleared)
based on the DWC3_GHWPARAMS0 register.

MFC after:	2 weeks
Obtained from:	an old debugging patch
Reviewed by:	mw (earlier version), mmel
Differential Revision: https://reviews.freebsd.org/D35699
2022-07-03 22:17:35 +00:00
Bjoern A. Zeeb
cec0a5ec6b dwc3: uncondinationally enable Host IN Auto Retry
Enable dwc3's auto retry feature. For IN transfers with crc errors
or internal overruns this will make the host reply with a
non-terminating retry ACK.  I believe the hope was to improve
reliability after seeing occasional hiccups.

Obtained from:	an old debugging patch
MFC after:	2 weeks
Reviewed by:	mw
Differential Revision: https://reviews.freebsd.org/D35698
2022-07-03 22:15:12 +00:00
Bjoern A. Zeeb
0084212bfd dwc3: fix snps,dis-del-phy-power-chg-quirk
If snps,dis-del-phy-power-chg-quirk is set, the register bit should be
cleared not ored on (it's the "dis" version).

MFC after:	2 weeks
Reviewed by:	mw
Differential Revision: https://reviews.freebsd.org/D35697
2022-07-03 22:13:28 +00:00
Bjoern A. Zeeb
c4b98101c5 tca6416: add support for tca9539
Programming-wise tca6416 and tca9539 seem identical so all we have to
do is add the extra ofw_compat_data line.

MFC after:	2 weeks
Reviewed by:	mw
Differential Revision: https://reviews.freebsd.org/D35702
2022-07-03 22:11:30 +00:00
J.R. Oldroyd
775611ea11 wpa_supplicant: Resolve secondary VAP association issue
Association will fail on a secondary open unprotected VAP when the
primary VAP is configured for WPA. Examples of secondary VAPs are,
hotels, universities, and commodity routers' guest networks.

A broadly similar bug was discussed on Red Hat's bugzilla affecting
association to a D-Link DIR-842.

This suggests that as IEs were added to the 802.11 protocol the old code
was increasingly inadaquate to handle the additional IEs, not only a
secondary VAP.

PR:		264238
Reported by:	Jaskie <jiangjun12321@gmail.com>
		"J.R. Oldroyd" <fbsd@opal.com>
Submitted by:	"J.R. Oldroyd" <fbsd@opal.com>
MFC after:	3 days
2022-07-03 14:19:38 -07:00
Cy Schubert
7999a7f2a8 wpa: Enable WEP by default
As of hostap 2.10, WEP is disabled by default. This of course is not a
bad thing but requires some planning and an announcment to remove WEP
support by default. A possible src.conf knob or letting users know they
should use the port instead might different options.

MFC after:	3 days
2022-07-03 14:19:38 -07:00
Rick Macklem
aba7a81ab7 mount_nfs.8: Update BUGS section for NFSv4.1/4.2
If the "intr" and/or "soft" mount options are used for
NFSv4 mounts, the protocol can be broken when the
operation returns without waiting for the RPC reply.
The likelyhood of failure increases for NFSv4.1/4.2
mounts, since the session slot will be broken when
an RPC reply is not processed.

This is mentioned in the BUGS section of "man mount_nfs",
but there was no specific mention of the session slot
problem.  This patch adds a sentence for this case.

PR: 260011
Reviewed by:	gbe
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D35693
2022-07-03 13:37:23 -07:00
Dimitry Andric
3b7f365e4d Apply clang fix for assertion building llvm with libc++ 15
Merge commit f1b0a4fc540f from llvm git (by Richard Smith):

  An expression should only contain an unexpanded parameter pack if it
  lexically contains a mention of the pack.

  Systematically distinguish between syntactic and semantic references to
  packs, especially when propagating dependence from a type into an
  expression. We should consult the type-as-written when computing
  syntactic dependence and should consult the semantic type when computing
  semantic dependence.

  Fixes #54402.

MFC after:	3 days
2022-07-03 21:33:22 +02:00