Commit Graph

266693 Commits

Author SHA1 Message Date
John-Mark Gurney
3d5104182c ued may be NULL here which will cause a panic... reproducable by
simply doing a usbconfig reset on a device which doesn't reset itself
properly...
2021-06-28 18:09:14 -07:00
Ed Maste
f94360971e Clarify notice for profiled libraries in FreeBSD 14
Reported by:	kevans
Fixes:		175841285e ("Add deprecation notice for...")
Sponsored by:	The FreeBSD Foundation
2021-06-28 19:24:56 -04:00
Warner Losh
a72af82e31 cam: Fix GENERIC-MMCCAM build
Fix forgotten argument and type error. MMCCAM isn't enabled by default,
and I'd mistakenly thought it was, so these went undetected precommit.

Sponsored by:		Netflix
2021-06-28 17:22:35 -06:00
Warner Losh
9f0febd6a4 cam_sim: remove unused sim_doneq member
Its use was removed in 227d67aa54 by mav when locking was revamped.

Reviewed by:		scottl@, mav@
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D30890
2021-06-28 16:13:03 -06:00
Warner Losh
50aa1daf14 cam: change xpt_clone_path to return int
xpt_clone_path originally returned a cam_status, but it doesn't do I/O
and should return an errno instead. I added it last year and it's only
used in one place. It's not yet documented, so no doc changes are
nneeded.

Reviewed by:		scottl@, mav@
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D30884
2021-06-28 16:13:03 -06:00
Warner Losh
2b09870238 cam: Remove CAM_TRUE and CAM_FALSE, they are unused and duplicate bool
These were in the original CAM commit in 3.0, but were not used there,
nor have they been used since then. They also duplicate the now-standard
bool type. Remove them.

Reviewed by:		scottl@
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D30879
2021-06-28 16:13:03 -06:00
Warner Losh
30f8afd027 cam: fix xpt_bus_register and xpt_bus_deregister return errno
xpt_bus_register and xpt_bus_deregister returns a hybrid error that's
neither a cam_status, nor an errno, but a mix of both.  Update
xpt_bus_register and xpt_bus_deregister to return an errno. The vast
majority of current users compare against zero, which can also be
spelled CAM_SUCCESS. Nobody uses CAM_FAILURE, so remove that symbol
to prevent comfusion (nothing returns it either).

Where the return value is saved, ensure that the variable 'error' is
used to store an errno and 'status' is used to store a cam_status where
it makes the code clearer (usually just in functions that already mix
and match). Where the return value isn't used at all, avoid storing it
at all.

Reviewed by:		scottl@, mav@ (earlier version)
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D30860
2021-06-28 16:13:03 -06:00
Warner Losh
dcd5dea965 cam: delete cam_sim_alloc_dev
cam_sim_alloc_dev was only used internally by the MMC system. That has
been convered to using xpt_path_device() and has stopped using this
interface, so this can be retired.

Reviewed by:		scottl@, mav@
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D30858
2021-06-28 16:13:03 -06:00
Warner Losh
aeb04e88f5 sdhci: stop using cam_sim_alloc_dev
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D30857
2021-06-28 16:13:02 -06:00
Warner Losh
bd69852be1 mmc_sim: stop using cam_sim_alloc_dev
Use the vanilla flavor of cam_sim_alloc. Now that sdiob has been
converted to get the device_t from the cam_path, this data is no longer
necessary.

Reviewed by:		scottl@
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D30856
2021-06-28 16:13:02 -06:00
Warner Losh
fdd60a97da sdiob: get the device_t from periph's path
Use the new xpt_path_device to get the device_t using the periph's path.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D30855
2021-06-28 16:13:02 -06:00
Warner Losh
d6e7349254 cam mmc: Assert that the xpt_bus_register registered a device_t
Reviewed by:		scottl@
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D30854
2021-06-28 15:59:04 -06:00
Warner Losh
1ed4016267 cam: add xpt_path_sim_device to return device_t associated with a path
Return the device associated with the sim's bus when it called
xpt_bus_register, if any. Most real SIMs in the tree set this device,
but some virtual ones do not have a device_t assocaited with them.

Reviewed by:		scottl@, mav@ (earlier version)
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D30853
2021-06-28 15:57:51 -06:00
Warner Losh
9f1e411ae8 cam: Group all xpt_path*() functions together in cam_xpt.h
Reviewed by:		scottl@
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D30852
2021-06-28 15:56:55 -06:00
Warner Losh
56e1161b09 cam: fix UB behavior
The trick of subtracting one from the poitner returned from malloc
results in undefined behavior:

>>C89: 3.3.6 Unless both the pointer operand and the result point to a
>>member of the same array object, or one past the last member of the
>>array object, the behavior is undefined.

Instead, allocate 1 extra element and stop adjusting the pointer. While
a little wasteful, the extra is in the noise on today's systems.

Reviewed by:		scottl@
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D30847
2021-06-28 15:56:08 -06:00
Warner Losh
40990d5483 cam: save parent_dev in xpt_bus_register
Reviewed by:		scottl@
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D30846
2021-06-28 15:55:02 -06:00
Warner Losh
c5d3206ac6 cam: kill trailing white space in two spots 2021-06-28 15:36:19 -06:00
Robert Wing
c7a7e547a5 vn_isdisk(9): update after r364372
Reviewed by:	mjg
Differential Revision:	https://reviews.freebsd.org/D30874
2021-06-28 10:27:27 -08:00
Mateusz Guzik
e6dd0e2e8d pf: assert that sizeof(struct pf_state) <= 312
To prevent accidentally going over a threshold which makes UMA fit only
12 objects per page instead of 13.

Reviewed by:	kp
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-06-28 15:49:20 +00:00
Mateusz Guzik
ccb17a2104 pf: factor out state allocation into pf_alloc_state
Reviewed by:	kp
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-06-28 15:49:20 +00:00
Mateusz Guzik
d09388d013 pf: add pf_release_staten and use it in pf_unlink_state
Saves one atomic op.

Reviewed by:	kp
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-06-28 15:49:20 +00:00
Ed Maste
175841285e Add deprecation notice for WITH_PROFILE option
As discussed on freebsd-current [1] and freebsd-arch [2] and review
D30833, FreeBSD 14 will ship without the _p.a libraries built with -pg.
Both upstream and base system (in commit b762974cf4) Clang have been
modified to remove the special case for linking against these libraries.

Clang's -pg support and mcount() remain, so building with -pg can still
be used on code that the user builds; we just do not provide prebuilt
libraries compiled with -pg.  A similar change is still needed for GCC.

[1]  https://lists.freebsd.org/pipermail/freebsd-current/2020-January/075105.html
[2] https://lists.freebsd.org/archives/freebsd-arch/2021-June/000016.html

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2021-06-28 11:36:59 -04:00
Bjoern A. Zeeb
243b95978d net80211: ieee80211_probereq_ie fix length calculation for hw scans
c338cf2c6d split up ieee80211_probereq_ie().
For HW scans we usually do not want to add a SSID to the IEs.
During that split we allocate memory based on the length which will
always include the length of the SSID and only later we reduced the
length but never updated the value passed back to the caller.
Split the SSID handling up and reduce the length before malloc().
This not only makes us not over-allocate in these situatoins but also
fixes the length returned to the caller and with that usually directly
passed to firmware.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	adrian
Differential Revision: https://reviews.freebsd.org/D30813
2021-06-28 12:17:11 +00:00
Bjoern A. Zeeb
399da52fff LinuxKPI: firmware, implement deferred loading for "nowait"
Change linuxkpi_request_firmware_nowait() to deferred firmware loading
scheduling a task.  This changes behaviour in some cases that we
return from loading the driver before the driver is finished
initialising if the driver does not deal with it (wait).
This brings the behaviour one would expect from when this function is
called and I implemented it to see if it would help a specific case.

Sponsored by:	The FreeBSD Foundation
MFC after:	12 days
Reviewed by:	hselasky, imp (earlier version)
Differential Revision: https://reviews.freebsd.org/D30830
2021-06-28 12:13:43 +00:00
Bjoern A. Zeeb
539228d372 LinuxKPI: pci re-add pci_free_irq_vectors()
Re-add pci_free_irq_vectors() accidentally removed in
d4a4960c65 and now needed by drm-kmod v5.5.

Reported by:	wulf
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
X-MFC with:	d4a4960c65
2021-06-28 12:09:16 +00:00
Mateusz Guzik
e0893890eb ipsec: globalize lft zone and zero out buffers at allocation time
Creation of a zone is expensive and there is no need to have one for
every vnet. Moreover, this wastes memory as these separate zones
cannot use the same per-cpu caches. Finally, this is a step towards
replacing the custom zone with pcpu-16.

Two counter_u64_zero calls induce back-to-back IPIs to zero everything
out. Instead, pass the M_ZERO flag to let uma just iterate all buffers.
The counter(9) API abstraction is already violated by not using
counter_u64_alloc.

Reviewed by:	ae
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D30916
2021-06-28 08:14:26 +00:00
Chuck Tuffli
91064841d7 bhyve: Fix NVMe iovec construction for large IOs
The UEFI driver included with Rocky Linux 8.4 uncovered an existing bug
in the NVMe emulation's construction of iovec's.

By default, NVMe data transfer operations use a scatter-gather list in
which all entries point to a fixed size memory region. For example, if
the Memory Page Size is 4KiB, a 2MiB IO requires 512 entries. Lists
themselves are also fixed size (default is 512 entries).

Because the list size is fixed, the last entry is special. If the IO
requires more than 512 entries, the last entry in the list contains the
address of the next list of entries. But if the IO requires exactly 512
entries, the last entry points to data.

The NVMe emulation missed this logic and unconditionally treated the
last entry as a pointer to the next list. Fix is to check if the
remaining data is greater than the page size before using the last entry
as a pointer to the next list.

PR:		256422
Reported by:	dave@syix.com
Tested by:	jason@tubnor.net
MFC after:	5 days
Relnotes:	yes
Reviewed by:	imp, grehan
Differential Revision:	https://reviews.freebsd.org/D30897
2021-06-27 15:14:52 -07:00
Michael Tuexen
c7f048ab35 sctp: initialize sequence numbers for ECN correctly
MFC after:	3 days
Reported by:	Junseok Yang (for the userland stack)
2021-06-27 20:14:48 +02:00
Ed Maste
914b6a0122 src.conf.5: regen after RISC-V OPENMP (aa033e0b14)
Sponsored by:	The FreeBSD Foundation
2021-06-27 13:30:08 -04:00
Ed Maste
b762974cf4 clang: stop linking _p libs for -pg as of FreeBSD 14
In FreeBSD 14 we will stop providing _p libraries (compiled with -pg).

Reviewed by:	dim (upstream)
Obtained from:	LLVM 699d47472c3f
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30861
2021-06-27 13:12:12 -04:00
Edward Tomasz Napierala
61b4c62718 imgact_elf.c: style, remove unnecessary casts
Remove unnecessary type casts and redundant brackets.
No functional changes.

Suggested By:	kib
Reviewed By:	kib
Sponsored By:	EPSRC
Differential Revision:	https://reviews.freebsd.org/D30841
2021-06-27 17:05:59 +01:00
Michael Tuexen
6587a2bd1e sctp: Fix length check for ECNE chunks
MFC after:	3 days
2021-06-27 16:10:39 +02:00
Michael Tuexen
870af3f4dc tcp: tolerate missing timestamps
Some TCP stacks negotiate TS support, but do not send TS at all
or not for keep-alive segments. Since this includes modern widely
deployed stacks, tolerate the violation of RFC 7323 per default.

Reviewed by:		rgrimes, rrs, rscheff
MFC after:		3 days
Differential Revision:	https://reviews.freebsd.org/D30740
Sponsored by:		Netflix, Inc.
2021-06-27 16:03:57 +02:00
Alan Cox
19c288b3a6 arm64: eliminate a duplicated #define 2021-06-27 01:44:58 -05:00
Martin Matuska
2be4a7d508 ObsoleteFiles.inc: fixup after zpool-features.7.gz got re-introduced
PR:		256852
MFC after:	3 days
2021-06-27 02:58:15 +02:00
Rick Macklem
b413b03597 mount_nfs.8: Update the man page for commit a145cf3f73
The NFSv4 client now uses the highest minor version of NFSv4
by default instead of minor version 0, for NFSv4 mounts.
The "minorversion" mount option may be used to override this default.

This patch updates the man page to reflect this change.  While here,
fix nfsstat(8) to be nfsstat(1).

Reviewed by:	otis
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D30768
2021-06-26 14:09:28 -07:00
Ed Maste
bba96bb143 CI: add arm64 support to ci-qemu-test.sh
Reviewed by:	imp (earlier)
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30907
2021-06-26 14:26:41 -04:00
Ed Maste
7d9794b34b CI: use amd64 EDK II firmware included with QEMU
QEMU (now) includes a prebuilt EDK II firmare in edk2-x86_64-code.fd.
Use that instead of requring a standalone uefi-edk2-qemu-x86_64 package.

Reviewed by:	imp
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30915
2021-06-26 14:22:48 -04:00
Mateusz Guzik
9a8e4527f0 amd64: typo fix: memcmpy -> memcmp in a comment
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-06-26 16:24:46 +00:00
Mike Karels
184291b0a5 genet: pullup minimum header amount for IPv4
The genet driver (RPi4 Ethernet) had code to pull headers into the
first mbuf if there was only an Ethernet header there.  This was
originally needed for ICMPv6 replies, then for forwarded IPv6/TCP.
Now a situation has been found where it is needed for IPv4, when
using NAT with IPFW.  Generalize to do this for all protocols.
Rather than using an IPv6-related definition for the length, move
the length to a variable that can be set with sysctl
(hw.genet.tx_hdr_min).  Move an old tunable to a new RDTUN variable
with a better name.

PR:		25607
MFC after:	3 days
Reviewers:	emaste
Differential Revision: https://reviews.freebsd.org/D30831
2021-06-26 11:04:02 -05:00
Michal Vasilek
f20fb199e6
Fix plymouth passphrase prompt with dracut
plymouth --command splits the command on spaces which means
that zfs-load-key was getting the filesystem name enclosed
in single quotes (since 13c59bb76) and failing. This commit
fixes it by piping the password directly to the command
similar to how it's done in other scripts (initramfs,
dracut without plymouth).

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Michal Vasilek <michal@vasilek.cz>
Related-to: #9193
Related-to: #9202
Closes #12147
2021-06-25 22:43:25 -07:00
Rich Ercolani
2084e9f748
Fix build with KASAN
The stock zstd code expects some helpers from ASAN if present.
This works fine in userland, but in kernel, KASAN also gets detected,
and lacks those helpers. So let's make some empty substitutes for
that case.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
Closes #12232
2021-06-25 22:28:12 -07:00
Alan Cox
5dd84e315a arm64: fix a potential KVA leak in pmap_demote_l1()
In the unlikely event that the 1 GB page mapping being demoted is used
to access the L1 page table page containing the 1 GB page mapping and
the vm_page_alloc() to allocate a new L2 page table page fails, we
would leak a page of kernel virtual address space.  Fix this leak.

MFC after:	1 week
2021-06-25 23:01:32 -05:00
Alan Somers
18b19f8c6e fusefs: correctly set lock owner during FUSE_SETLK
During FUSE_SETLK, the owner field should uniquely identify the calling
process.  The fusefs module now sets it to the process's pid.
Previously, it expected the calling process to set it directly, which
was wrong.

libfuse also apparently expects the owner field to be set during
FUSE_GETLK, though I'm not sure why.

PR:		256005
Reported by:	Agata <chogata@moosefs.pro>
MFC after:	2 weeks
Reviewed by:	pfg
Differential Revision: https://reviews.freebsd.org/D30622
2021-06-25 20:40:08 -06:00
John-Mark Gurney
b43d600c83 Add support for link status, media and VLAN MTU (if supported) to if_cdce...
This makes it more usable in that dhclient will autolaunch from devd
now when cdce devices are plugged in..  It also sets the baudrate, but
this isn't exported via tools, and CDCE doesn't have a good way to
specify the media type, so there isn't a good way to tell userland
what the speed is currently...

Reviewed by:		hps
Relnotes:		yes
Differential Revision:	https://reviews.freebsd.org/D30625
2021-06-25 17:57:04 -07:00
Martin Matuska
33b8c039a9 zfs: merge openzfs/zfs@5e2c8338b (master) into main
Notable upstream pull request merges:
  #12183 Optimize small random numbers generation
  #12227 Revert Consolidate arc_buf allocation checks
  #12266 Fix flag copying in resume case
  #12273 zfs_metaslab_mem_limit should be 25 instead of 75
  #12276 Update cache file when setting compatibility property
  #12280 Help compiller optimize out abd_verify()
  #12282 FreeBSD: fix compilation of FreeBSD world after 29274c9f6

Obtained from:	OpenZFS
OpenZFS commit:	5e2c8338bf
2021-06-26 02:21:11 +02:00
Alexander Motin
5e2c8338bf
Help compiller optimize out abd_verify()
While abd_verify() does nothing when built without debug, compiler
can't optimize it out by itself due to calls to external list_*()
and abd_verify_scatter().  This commit makes it explicit.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Adam Moss <c@yotes.com>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored-By: iXsystems, Inc.
Closes #12280
2021-06-25 16:38:31 -07:00
Navdeep Parhar
ec8004dd41 cxgbe(4): Do not configure traffic classes automatically on attach.
The driver used to configure all available classes with some default
parameters on attach and the rest of t4_sched.c was written with the
assumption that all traffic classes are always valid in the hardware.
But this resulted in a lot of informational messages being logged in the
firmware's circular log, crowding out other more useful messages.

This change leaves the tx scheduler alone during attach to reduce the
spam in the devlog.  The state of every class is now tracked separately
from its flags and there is support for an 'uninitialized' state.

MFC after:	2 weeks
Sponsored by:	Chelsio Communications
2021-06-25 16:04:09 -07:00
Navdeep Parhar
6beb67c7e0 cxgbe(4): Get the number of usable traffic classes from the firmware.
Recent firmwares are able to utilize the traffic classes of tx channels
that were previously unused.  This effectively doubles the number of
traffic classes available per port for 2 port cards.  Stop using the raw
per-channel value in the driver and ask the firmware for the number of
usable traffic classes instead.

MFC after:	2 weeks
Sponsored by:	Chelsio Communications
2021-06-25 16:04:09 -07:00
Simon J. Gerraty
68c4481aac Update to bmake-20210621
MFC after:	1 week
2021-06-25 16:02:40 -07:00