Commit Graph

147403 Commits

Author SHA1 Message Date
Jason A. Harmening
0745d837c2 unionfs: prevent upperrootvp from being recycled during mount
If upperrootvp is doomed by a concurrent unmount, unionfs_nodeget()
may return without a reference or lock on it.  unionfs_domount() must
prevent the vnode from being recycled for use by a different file until
it is finished with the vnode, namely once vfs_register_upper_from_vp()
fails.  Accomplish this by holding the reference returned by namei()
a bit longer.

Reviewed by:	kib, markj
Tested by:	pho
Differential Revision:	https://reviews.freebsd.org/D39767
2023-05-07 18:30:43 -05:00
Jason A. Harmening
0809172985 unionfs: fixes to unionfs_nodeget() error handling
If either the lower or upper vnode is found to be doomed after
locking it, the newly-created unionfs node won't be associated
with it and its lock will be dropped.  In that case, clear the
uppervp and lowervp locals as necessary to avoid further use
of the vnode in unionfs_nodeget().  If the upper vnode is doomed
but the lower vnode remains valid, additionally reset the unionfs
node's v_vnlock field to point to the lower vnode lock.

Reviewed by:	kib, markj
Tested by:	pho
Differential Revision:	https://reviews.freebsd.org/D39767
2023-05-07 18:30:43 -05:00
Mitchell Horne
39f92a76a9 hwpmc: pass pmc pointer to more class methods
In many cases this avoids an extra lookup, since the callers always have
pm at hand. We can also eliminate several assertions, mostly for pm !=
NULL. The class methods are an internal interface, and the callers
already handle such a scenario. No functional change intended.

Reviewed by:	jkoshy
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39915
2023-05-06 14:49:19 -03:00
Mitchell Horne
a35453b9c7 hwpmc: unused/diagused annotations in tsc class
These are preferred over casts to void. No functional change.

Reviewed by:	jkoshy
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39914
2023-05-06 14:49:19 -03:00
Mitchell Horne
fa88954fd8 hwpmc: remove stub pmd_switch_{in,out} methods
Most platforms (non-x86) don't require these methods and implement stub
versions. If we initialize the pmc_mdep structure to always point to the
generic versions, then we can purge the duplicate stubs.

Reviewed by:	jkoshy
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39913
2023-05-06 14:49:19 -03:00
Mitchell Horne
772b2dc3ab hwpmc: remove pmd_pcpu_{init,fini} callbacks
These are unused on all platforms.

Reviewed by:	jkoshy, emaste
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39912
2023-05-06 14:49:19 -03:00
Mitchell Horne
3a7c9fc01b hwpmc_logging: less macro magic for type names
Provide the log type names in their entirely, rather than relying on the
macro to prepend the prefix. This improves their searchability; for
example, if I see PMCLOG_TYPE_PMCALLOCATE in libpmc I will now be able
to find where that is emitted in the kernel with a simple grep.

Reviewed by:	jkoshy, emaste
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39911
2023-05-06 14:49:19 -03:00
Mitchell Horne
31610e34b7 hwpmc: don't use deprecated copystr(9)
It is just wrapper around strlcpy(), but results in more complicated
code. Clean this up to use strlcpy() or snprintf() as appropriate.

Reviewed by:	jkoshy
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39910
2023-05-06 14:49:19 -03:00
Mitchell Horne
aba91805aa hwpmc: use kstack_contains()
This existing helper function is preferable to the hand-rolled
calculation of the kstack bounds.

Make some small style improvements while here. Notably, rename every
instance of "r", the return address, to "ra". Tidy the includes in the
affected files.

Reviewed by:	jkoshy
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39909
2023-05-06 14:49:19 -03:00
Mitchell Horne
5387495773 hwpmc: simplify arm64 kernel stack unwinding
Use the unwind_frame() function, which properly validates the frame
pointer and uses ADDR_MAKE_CANONICAL() for the pc, required when PAC is
enabled.

Reviewed by:	andrew, markj, jkoshy
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39934
2023-05-06 14:49:19 -03:00
Mitchell Horne
7253dc57a0 hwpmc: formatting of CPU and class lists
The end result is much more legible in both cases.

Reviewed by:	jkoshy
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39906
2023-05-06 14:49:19 -03:00
Mitchell Horne
3c8b7f49d0 hwpmc: trim MIPS CPU and class defs
MIPS is gone, and this is the last remaining bit in the pmc code.

Reviewed by:	jkoshy, emaste
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39905
2023-05-06 14:49:18 -03:00
Mitchell Horne
ca43b2ae3e hwpmc: trim obsolete Intel CPU and class defs
No functional change.

Reviewed by:	jkoshy
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39904
2023-05-06 14:49:18 -03:00
Mitchell Horne
b6c9d2a3f8 pmc_events.h: event list formatting
Improve the legibility of the list. Bump overall indentation, fix some
whitespace, and sort the IAF block.

Reviewed by:	jkoshy
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39903
2023-05-06 14:49:18 -03:00
Mitchell Horne
6bdf067890 pmc_events.h: update event list comment
This comment is no longer in sync with the contents of __PMC_EVENTS().
Update to reflect the removal of various Intel event definitions from
this list; these event definitions now come from Linux and live in
lib/libpmc/pmu-events/.

Reviewed by:	jkoshy
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39902
2023-05-06 14:49:18 -03:00
Mitchell Horne
d71a439020 hwpmc: remove remaining UCP event definitions
Although this block has remained in __PMC_EVENTS(), there is no handling
of UCP in libpmc/libpmc.c, so it is not possible to select one of these
events. It should therefore be impossible to trigger the code removed
from ucp_start_pmc(). Note that the GQ_SNOOP_MSF MSR exists only for
Nehalem and Westmere architectures, and the related events do not exist
for later generations.

The Uncore support in hwpmc has severely atrophied in general. We have
uncore event definitions in pmu-events, but the kernel support was
written against Intel Performance Measurement Architecture version 2,
and is disabled for processor generations later than Westmere. Nehalem
and Westmere lack uncore event definitions in pmu-events. I'd be
surprised if Uncore support is usable on any machine in its current
state.

Reviewed by:	jkoshy
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39901
2023-05-06 14:49:18 -03:00
Mitchell Horne
1be8ef2679 hwpmc: drop vestigial IAP event definitions
These are maintained elsewhere. No functional change.

Reviewed by:	jkoshy
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39900
2023-05-06 14:49:18 -03:00
Konstantin Belousov
38843fe0f2 amd64: add MINIMALUP config
This is the MINIMAL config with SMP/NUMA options turned off.
Useful to ensure that UP configuration still builds, until it is removed
finally.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-05-06 14:24:07 +03:00
Konstantin Belousov
3a8c69c1ff amd64 MINIMAL config: remove sentence about acpi
On amd64 ACPI is required to boot, it cannot work as a module, and we do
not build the ACPI module for long time.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-05-06 14:24:07 +03:00
Konstantin Belousov
7c8e66ed8d amd64: convert UP code to dynamically allocated pmap->pm_pcid
Reported by:	peterj
Sponsored by:	The FreeBSD Foundation
2023-05-06 14:24:07 +03:00
Michael Tuexen
e044a0bce4 bblog: inherit TCP_LOG option from listener
When the TCP_LOG option is used to enable logging on a listening
socket, inherit this if the listener is not auto selected and does
not have a log id set.

Reviewed by:		cc
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D38436
2023-05-06 11:21:16 +02:00
Michael Tuexen
c2399dd2e2 tcp: improve BBLoging for PRUs
Log all errors for PRUs, except when INP_DROPPED is set. In that case,
don't log it.

Reviewed by:		glebius, rrs
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D39591
2023-05-06 11:12:06 +02:00
Michael Tuexen
113f56ba49 tcp_rack: allow the module to be loaded without TCP_BLACKBOX
PR:			271091
Reviewed by:		cc
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D39860
2023-05-06 11:02:50 +02:00
Rick Macklem
648a208ef3 nfsd: Fix NFSv3 Readdir/ReaddirPlus reply for large i-node numbers
If the i-node number (d_fileno) for a file on the server did
not fit in 32bits, it would be truncated to the low order 32bits
for the NFSv3 Readdir and ReaddirPlus RPC replies.
This is no longer correct, given that ino_t is now 64bits.

This patch fixes this by sending the full 64bits of d_fileno
on the wire in the NFSv3 Readdir/ReaddirPlus RPC reply.

PR:	271174
Reported by:	bmueller@panasas.com
Tested by:	bmueller@panasas.com
MFC after:	2 weeks
2023-05-05 15:43:55 -07:00
Corvin Köhne
b10e100d16
vmm: don't free unallocated memory
If vmx or svm is disabled in BIOS or the device isn't supported by vmm,
modinit won't allocate these state save areas. As kmem_free panics when
passing a NULL pointer to it, loading the vmm kernel module causes a
panic too.

PR:			271251
Reviewed by:		markj
Fixes:			74ac712f72 ("vmm: Dynamically allocate a couple of per-CPU state save areas")
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D39974
2023-05-05 15:34:00 +02:00
Kristof Provost
8216f1a9cc pf: fix a few more prototypes
Fix function prototypes to use the same type for sa_family_t as the
definition.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-05-05 13:41:02 +02:00
Yuri Pankov
6abf81b3d6 pvscsi: maximum target number is one less than number of targets
Fix the number of targets we inquiry to be one less than the maximum
number of targets adapter reports.  This gets rid of the errors reported
on VMware Workstation:

(probe36:pvscsi0:0:65:0): INQUIRY. CDB: 12 00 00 00 24 00
(probe36:pvscsi0:0:65:0): CAM status: CCB request completed with an error

While here, print the maximum number of targets.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D39867
2023-05-05 11:51:44 +02:00
Igor Ostapenko
a1f2b76761 sys/x86/x86/mptable.c: typo (compatiblity)
https://bugs.freebsd.org/269753

PR:                      269753
Reported by:             Igor Ostapenko
Approved by:             doc, src (delphij, imp, zlei)
Differential revision:   https://reviews.freebsd.org/D38741
2023-05-05 01:23:09 +01:00
Igor Ostapenko
6f9f3b726b sys/sys/_endian.h: typo (Compatiblity)
https://bugs.freebsd.org/269753

PR:                      269753
Reported by:             Igor Ostapenko
Approved by:             doc, src (delphij, imp, zlei)
Differential revision:   https://reviews.freebsd.org/D38741
2023-05-05 01:23:09 +01:00
Igor Ostapenko
74081dc2bc sys/netpfil/ipfw/ip_fw2.c: typo (Compatiblity)
https://bugs.freebsd.org/269753

PR:                      269753
Reported by:             Igor Ostapenko
Approved by:             doc, src (delphij, imp, zlei)
Differential revision:   https://reviews.freebsd.org/D38741
2023-05-05 01:23:08 +01:00
Igor Ostapenko
0167b5a793 sys/amd64/conf/FIRECRACKER: typo (compatiblity)
https://bugs.freebsd.org/269753

PR:                      269753
Reported by:             Igor Ostapenko
Approved by:             doc, src (delphij, imp, zlei)
Differential revision:   https://reviews.freebsd.org/D38741
2023-05-05 01:23:08 +01:00
John Baldwin
6cf4b46197 emac(4): Use bool rather than boolean_t.
This was already using true/false rather than TRUE/FALSE.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D39927
2023-05-04 12:34:02 -07:00
John Baldwin
afdb42987c ofw_cpu_early_foreach: Change callback to return bool instead of boolean_t.
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D39926
2023-05-04 12:33:39 -07:00
John Baldwin
2fd903276d dwc(4): Use bool rather than boolean_t.
This was already using true/false rather than TRUE/FALSE.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D39925
2023-05-04 12:33:20 -07:00
John Baldwin
1efae8a24f dpaa2: Replace boolean_t with bool.
This was already using true/false rather than TRUE/FALSE.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D39924
2023-05-04 12:32:57 -07:00
John Baldwin
463edaf441 al: Replace boolean_t with either al_bool or bool.
Use al_bool for interfaces and structures defined in the
OS-independent HAL in sys/contrib, and use plain bool for
FreeBSD-specific APIs and structures in sys/dev/al_eth.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D39923
2023-05-04 12:32:40 -07:00
John Baldwin
65c92e48c4 acpi_button: Replace boolean_t with better types.
- Use an enum for the button type (it is not really a boolean value).

- Use bool for fixed.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D39922
2023-05-04 12:32:09 -07:00
John Baldwin
4961faaacc pmap_{un}map_io_transient: Use bool instead of boolean_t.
Reviewed by:	imp, kib
Differential Revision:	https://reviews.freebsd.org/D39920
2023-05-04 12:29:48 -07:00
John Baldwin
407f675718 imgact_elf: Change header_supported to return bool instead of boolean_t.
Reviewed by:	imp, kib, emaste
Differential Revision:	https://reviews.freebsd.org/D39919
2023-05-04 12:29:29 -07:00
Kristof Provost
bf206a1db2 pf: remove NULL check before uma_zfree()
uma_zfree() can be called on a NULL pointer. Simplify the pf code a
little by removing the redundant checks.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-05-04 18:22:54 +02:00
Konstantin Belousov
3582acbad3 amd64 mp_machdep.c: remove useless comment
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D39945
2023-05-04 18:39:22 +03:00
Konstantin Belousov
af1c6d3f30 amd64: do not leak pcpu pages
Do not preallocate pcpu area backing pages on early startup, only
allocate enough of KVA for pcpu[MAXCPU] and the page for BSP.  Other
pages are allocated after we know the number of cpus and their
assignments to the domains.

PCPUs are not accessed until they are initialized, which happens on AP
startup.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D39945
2023-05-04 18:39:22 +03:00
Konstantin Belousov
e704f88f3d amd64: initialize APs kpmap_store in init_secondary()
The APs pcpu area is zeroed in init_secondary() by pcpu_init(), so the
early initialization in pmap_bootstrap() is nop.

Fixes:	42f722e721cd010ae5759a4b0d3b7b93c2b9cad2ESC
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D39945
2023-05-04 18:39:22 +03:00
Michael Tuexen
04ede3675e sctp: only start shutdown guard timer when sending SHUTDOWN chunk
The intention is to protect a malicious peer not following the
shutdown procedures.

MFC after:	1 week
2023-05-03 20:28:46 +02:00
Mark Johnston
e8f6e5b2d9 unix: Fix locking in uipc_peeraddr()
After the locking protocol changed in commit 75a67bf3d0 ("AF_UNIX:
make unix socket locking finer grained"), uipc_peeraddr() was not
updated accordingly.

The link lock now only protects global socket lists.  The PCB lock is
used to protect the link between connected PCBs, so use that.  Remove an
old comment which appears to be noting that unp_conn is not set for
connected SOCK_DGRAM sockets (in one direction anyway).

Reviewed by:	glebius
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D39855
2023-05-03 11:56:46 -04:00
Michael Tuexen
d9ae4adff2 sctp: improve shutdown(..., SHUT_WR) handling
When shutdown(..., SHUT_WR) is called in the front states, send a
SHUTDOWN chunk when a COOKIE ACK chunk is received and there is
no outstanding data.

MFC after:	1 week
2023-05-03 17:33:49 +02:00
Martin Matuska
d411c1d696 zfs: merge openzfs/zfs@d96e29576
Notable upstream pull request merges:

  #11680 Add support for zpool user properties
  #14145 Storage device expansion "silently" fails on degraded vdev
  #14405 Create zap for root vdev
  #14659 Allow MMP to bypass waiting for other threads
  #14674 Miscellaneous FreBSD compilation bugfixes
  #14692 Fix some signedness issues in arc_evict()
  #14702 Fix typo in check_clones()
  #14715 module: small fixes for FreeBSD/aarch64
  #14716 Trim needless zeroes from checksum events
  #14719 vdev: expose zfs_vdev_max_ms_shift as a module parameter
  #14722 Fix "Detach spare vdev in case if resilvering does not happen"
  #14723 freebsd clone range fixes
  #14728 Fix BLAKE3 aarch64 assembly for FreeBSD and macOS
  #14735 Fix in check_filesystem()
  #14739 Fix data corruption when cloning embedded blocks
  #14758 Fix VERIFY(!zil_replaying(zilog, tx)) panic
  #14761 Revert "ZFS_IOC_COUNT_FILLED does unnecessary txg_wait_synced()"
  #14774 FreeBSD .zfs fixups
  #14776 FreeBSD: make zfs_vfs_held() definition consistent with declaration
  #14779 powerpc64: Support ELFv2 asm on Big Endian
  #14788 FreeBSD: add missing vop_fplookup assignments
  #14789 PAM: support the authentication facility
  #14790 Revert "Fix data race between zil_commit() and zil_suspend()"
  #14795 Fix positive ABD size assertion in abd_verify()
  #14798 Mark TX_COMMIT transaction with TXG_NOTHROTTLE
  #14804 Correct ABD size for split block ZIOs
  #14806 Use correct block pointer in block cloning case.
  #14808 blake3: fix up bogus checksums in face of cpu migration

Obtained from:	OpenZFS
OpenZFS commit:	d96e29576c
2023-05-03 12:04:55 +02:00
Kajetan Staszkiewicz
16303d2ba6 pf: improve source node error handling
Functions manipulating source nodes can fail due to various reasons like
memory allocation errors, hitting configured limits or lack of
redirection targets. Ensure those errors are properly caught and
propagated in the code. Increase the error counters not only when
parsing the main ruleset but the NAT ruleset too.

Cherry-picked from development of D39880

Reviewed by:	kp
Sponsored by:	InnoGames GmbH
Differential Revision:	https://reviews.freebsd.org/D39940
2023-05-03 10:31:05 +02:00
Kristof Provost
7b67669885 pf: simplify structs with anonymous unions
Rather than playing preprocessor hacks use actual anonymous unions.
No functional change.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-05-03 10:24:20 +02:00
Mateusz Guzik
cf0fc64bc2 vfs: reduce audit branching in namei_setup 2023-05-03 06:56:10 +00:00