Commit Graph

286552 Commits

Author SHA1 Message Date
Mark Johnston a3074ff212 socket tests: Avoid a buffer leak
Reported by:	Coverity
Fixes:		38426b32e1 ("socket tests: Add a regression test for MSG_WAITALL")
2023-09-27 08:30:50 -04:00
Mark Johnston f97a3f6a01 ObsoleteFiles.inc: Fix the latest entry's date
Fixes:	7736786b08 ("Retire old diskless setup scripts")
2023-09-27 08:29:34 -04:00
Mark Johnston 61a14ddfe0 unix: Fix a lock order reveral
Running the test suite yields:

lock order reversal:
 1st 0xfffff80004bc6700 unp (unp, sleep mutex) @ sys/kern/uipc_usrreq.c:390
 2nd 0xffffffff81a94b30 unp_link_rwlock (unp_link_rwlock, rw) @ sys/kern/uipc_usrreq.c:2934
lock order unp -> unp_link_rwlock attempted at:
0xffffffff80bc216e at witness_checkorder+0xbbe
0xffffffff80b493a5 at _rw_wlock_cookie+0x65
0xffffffff80c0a8e2 at unp_discard+0x22
0xffffffff80c0a888 at unp_freerights+0x38
0xffffffff80c09fdd at unp_scan+0x9d
0xffffffff80c0f9a7 at uipc_sosend_dgram+0x727
0xffffffff80c00a79 at sousrsend+0x79
0xffffffff80c072d0 at kern_sendit+0x1c0
0xffffffff80c074d7 at sendit+0xb7
0xffffffff80c076f3 at sys_sendmsg+0x63
0xffffffff8104d957 at amd64_syscall+0x6b7
0xffffffff8101f9eb at fast_syscall_common+0xf8

This happens when uipc_sosend_dgram() discards a control message because
the receive socket buffer is full.  The overflow handling frees
internalized file references in the socket buffer before freeing mbufs.
It does this with socket PCBs locked, leading to the LOR.  Defer
handling of file references until the PCBs are unlocked.

Reviewed by:	glebius
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D41884
2023-09-27 08:29:34 -04:00
Mark Johnston 015daf5221 hdac: Defer interrupt allocation in hdac_attach()
hdac_attach() registers an interrupt handler before allocating various
driver resources which are accessed by the interrupt handler.  On some
platforms we observe what appear to be spurious interrupts upon a cold
boot, resulting in panics.

Partially work around the problem by deferring irq allocation until
after other resources are allocated.  I think this is not a complete
solution, but is correct and sufficient to work around the problems
reported in the PR.

PR:		268393
Tested by:	Alexander Sherikov <asherikov@yandex.com>
Tested by:	Oleh Hushchenkov <o.hushchenkov@gmail.com>
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D41883
2023-09-27 08:28:27 -04:00
Peter Holm 2b716e00cf stress2: Extent timeout limit to avoid false positive errors 2023-09-27 13:01:00 +02:00
Peter Holm 0f35fd3347 stress2: Remove tests from the exclude list 2023-09-27 13:00:01 +02:00
Peter Holm 0ec1bbe579 stress2: Cap total runtime 2023-09-27 12:58:39 +02:00
Ed Maste d06328c37b arch.7: fix final 12.x release as 12.4
arm (pre-v6/v7) and sparc64 listed 12.x as the final release.  12.4 is
the final 12.x release so we can fix the version number.
2023-09-26 18:00:42 -04:00
Dag-Erling Smørgrav c7dd4601ae libc: Add a rudimentary test for quick_exit(3).
Sponsored by:	Klara, Inc.
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D41937
2023-09-26 22:07:10 +02:00
Dag-Erling Smørgrav 1dc3abb052 libc: Rewrite quick_exit() and at_quick_exit() using C11 atomics.
Compiler memory barriers do not prevent the CPU from executing the code
out of order.  Switch to C11 atomics.  This also lets us get rid of the
mutex; instead, loop until the compare_exchange succeeds.

While here, change the return value of at_quick_exit() on failure to
the more traditional -1, matching atexit().

Sponsored by:	Klara, Inc.
Reviewed by:	Olivier Certner, kevans, kib
Differential Revision:	https://reviews.freebsd.org/D41936
2023-09-26 22:07:10 +02:00
Jens Schweikhardt e8a7cee673 Add paragraph about kern.mqueue sysctls and their defaults. 2023-09-26 21:41:29 +02:00
Alan Cox 902ed64fec i386 pmap: Adapt recent amd64/arm64 superpage improvements
Don't recompute mpte during promotion.

Optimize MADV_WILLNEED on existing superpages.

Standardize promotion conditions across amd64, arm64, and i386.

Stop requiring the accessed bit for superpage promotion.

Tidy up pmap_promote_pde() calls.

Retire PMAP_INLINE.  It's no longer used.

Note: Some of these changes are a prerequisite to fixing a panic that
arises when attempting to create a wired superpage mapping by
pmap_enter(psind=1) (as opposed to promotion).

Reviewed by:	kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D41944
2023-09-26 12:41:20 -05:00
Jose Luis Duran 29a55fd09b dtc: Sync with upstream commit 26a0fe5
- 0206c0f ("Handle top-level /delete-node/ directives.")
- d612a9e ("Remove C++11 standard constrain")
- Remove extra white lines after the $FreeBSD$ tag removal

Reviewed by:	kevans (earlier), theraven, emaste
Differential Revision: https://reviews.freebsd.org/D41482
2023-09-26 12:59:17 -04:00
Mateusz Guzik e6dc6a2723 sys/conf/newvers.sh: whack sccs tag
In the same spirit as removing cvs $FreeBSD$ tags.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-09-26 14:36:51 +00:00
Ed Maste 5b732ae833 kernel: remove unused HWPMC_MIPS_BACKTRACE option
MIPS was removed before FreeBSD 13.

Reported by:	andrew
2023-09-26 09:29:18 -04:00
Greg Lehey 915af88322 Explain the -d option. 2023-09-26 15:05:16 +10:00
Warner Losh 1d6021cd72 nvme: Supress noise messages
When we're suspending, we get messages about waiting for the controller
to reset. These are in error: we're not waiting for it to reset. We put
the recovery state as part of suspending, so we should suppress these as
a false positive.

Also remove a stray debug that's left over from earlier versions of
the recovery code that no longer makes sense.

Sponsored by:		Netflix
2023-09-25 22:21:58 -06:00
Zhenlei Huang 1117b32048 pf.4: Bump .Dd
Missed in c531c1d146 (pf: Convert PF_DEFAULT_TO_DROP into a vnet loader
tunable 'net.pf.default_to_drop') .

MFC after:	10 days
MFC with:	c531c1d146
2023-09-26 12:01:01 +08:00
Christos Zoulas 3fb80f1476 regcomp: use unsigned char when testing for escapes
- cast GETNEXT to unsigned where it is being promoted to int to prevent
  sign-extension (really it would have been better for PEEK*() and
  GETNEXT() to return unsigned char; this would have removed a ton of
  (uch) casts, but it is too intrusive for now).
- fix an isalpha that should have been iswalpha

PR:		264275, 274032
Reviewed by:	kevans, eugen (previous version)
Obtained from:	NetBSD
Differential Revision:	https://reviews.freebsd.org/D41947
2023-09-26 00:49:14 +02:00
Ed Maste 61f8df6a13 mfc-candidates: search by committer only, not author
When both --author and --committer are specified, `git log` requires
both to match.  Search only by committer, as it is typically the FreeBSD
committer who will perform the MFC.

Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41964
2023-09-25 16:11:28 -04:00
Bjoern A. Zeeb 673d62fc35 LinuxKPI: 802.11: fill regulatory_hint() with some life
Start implementing regulatory_hint() using a .c file based allocation
helper function so we could change structures in the future with
better chances to keep compatibility.
This sets wiphy->regd needed by various LinuxKPI based WiFi drivers.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2023-09-25 17:57:40 +00:00
Bjoern A. Zeeb c5e2579850 LiunxKPI: 802.11: move ieee80211_chanctx_conf into lkpi private struct
Factor out ieee80211_chanctx_conf into struct lkpi_chanctx in order to
keep local state as well.  In first instance that is added_to_drv
only.  For now we stay single-chanctx only but this paves the path
to make it a list.
Use the new information to implement ieee80211_iter_chan_contexts_atomic().

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2023-09-25 17:44:10 +00:00
Bjoern A. Zeeb fb3c249ed9 LinuxKPI: 802.11: avoid symbol clash on UP to AC mapping
tid_to_mac80211_ac is an exported symbol in and likely based on iwlwifi,
which leads to a symbol clash in NetBSD.  Rename our local LinuxKPI copy
to a better name and add a comment where to find a copy of the mapping
table.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reported by:	Phil Nelson (phil netbsd org)
2023-09-25 17:41:30 +00:00
Wang-Yan-Hao c989957f28 printenv: Add test for printenv.
Reviewed by:	asomers
Differential Revision: https://reviews.freebsd.org/D41468
2023-09-25 10:10:20 -06:00
Pierre Pronchery 6a770c0498 openssl: document the update process
This is directly inspired from the equivalent document for OpenSSH.

Sponsored by: The FreeBSD Foundation
2023-09-25 11:43:58 -04:00
John Baldwin 3aaa7724d6 sendmail: Drop $FreeBSD$ from .mc files
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D41960
2023-09-25 07:56:02 -07:00
John Baldwin c4e2333cb2 Update a few tools to not embed $FreeBSD$ in generated files
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D41959
2023-09-25 07:55:43 -07:00
John Baldwin 5919ab2991 powerpc/generate-hfs.sh: Don't include $FreeBSD$ in prefix to uuencoded image
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D41958
2023-09-25 07:55:18 -07:00
John Baldwin eba230afba Purge more stray embedded $FreeBSD$ strings
These do not use __FBSDID but instead use bare char arrays.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D41957
2023-09-25 07:54:56 -07:00
John Baldwin e4c68414d0 lpr: Remove now unused fallback definition for __FBSDID
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D41956
2023-09-25 07:50:33 -07:00
John Baldwin 99159b076a Update a couple of tools to not embed __FBSDID in generated files
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D41955
2023-09-25 07:50:11 -07:00
John Baldwin 16837d353c Remove a few more stray __FBSDID uses
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D41954
2023-09-25 07:49:52 -07:00
John Baldwin fc3cc652e5 videomode: Regenerate files
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D41953
2023-09-25 07:49:30 -07:00
John Baldwin bd524e2ddb videomode/devlist2h.awk: Don't include $FreeBSD$ in generated files
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D41952
2023-09-25 07:46:53 -07:00
John Baldwin 7736786b08 Retire old diskless setup scripts
These scripts predate /etc/rc.diskless* and use a different scheme.  A
comment was added to them back in 2002 noting they were 3 years old at
that point.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D41951
2023-09-25 07:46:21 -07:00
John Baldwin 97232e04ca make_*_driver.sh: Don't include $FreeBSD$ in generated files
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D41950
2023-09-25 07:46:09 -07:00
Andrew Turner 82ddab0e8f arm: Don't advertise the virtual timer on arm
It may not be usable on all SoCs.

Sponsored by:	Arm Ltd
2023-09-25 15:19:33 +01:00
Zhenlei Huang 49197c391b ipfw: Add sysctl flag CTLFLAG_TUN to loader tunables
The following sysctl variables are actually loader tunables. Add sysctl
flag CTLFLAG_TUN to them so that `sysctl -T` will report them correctly.

 1. net.inet.ip.fw.enable
 2. net.inet6.ip6.fw.enable
 3. net.link.ether.ipfw

No functional change intended.

Reviewed by:	glebius
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D41928
2023-09-25 18:10:47 +08:00
Zhenlei Huang 03dac3e379 netinet6: Add sysctl flag CTLFLAG_TUN to loader tunables
The following sysctl variables are actually loader tunables. Add sysctl
flag CTLFLAG_TUN to them so that `sysctl -T` will report them correctly.

 1. net.inet6.ip6.auto_linklocal
 2. net.inet6.ip6.accept_rtadv
 3. net.inet6.ip6.no_radr

No functional change intended.

Reviewed by:	glebius
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D41928
2023-09-25 18:10:47 +08:00
Zhenlei Huang 21a722d959 rtsock: Add sysctl flag CTLFLAG_TUN to loader tunable
The sysctl variable `net.route.netisr_maxqlen` is actually a loader
tunable. Add sysctl flag CTLFLAG_TUN to it so that `sysctl -T` will
report it correctly.

No functional change intended.

Reviewed by:	glebius
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D41928
2023-09-25 18:10:46 +08:00
Dmitry Chagin 28035f675b linux(4): Regen
MFC after:		1 week
2023-09-25 12:26:34 +03:00
Dmitry Chagin 0a16d3d14d linux(4): Update syscalls.master to 6.5
MFC after:		1 week
2023-09-25 12:24:58 +03:00
Jamie Gritton a2440348ee jail: avoid a clash with /etc/jail.conf.d between rc and jail(8)
Since 13.1, /etc/rc.d/jail has looked for a per-jail config file in
/etc/jail.conf.d. For RELENG 14, the ".include" directive was added to
jail(8), with a sample line in the jail.conf(5) man page that includes
"/etc/jail.conf.d/*.conf".

These two use cases don't work together. When the jail.conf.d files
are included from a master jail.conf, the files in jail.conf.d are
likely to hold only partial configurations, and shouldn't be directly
loaded by rc.d/jail. But there are existing configurations that depend
on the current rc.d behavior. While users could be advised not to
include from /etc/jail.conf.d, it's the natural choice even if not
mentioned in jail.conf.5.

The workaround is for rc.d/jail to continue to load the individual
files, but only when /etc/jail.conf doesn't include from that
directory (via a simple grep test), This allows the current use
while not breaking the previous use.
Reported by:	antranigv at freebsd.am
Differential Revision:	https://reviews.freebsd.org/D41962
2023-09-24 17:03:09 -07:00
Haoyu Gu 5e29272bf5 syscalls.master: Fix SAL annotation for getdirentires basep argument
getdirentires last argument "off_t *basep" is an optional output
argument.  It returns the value only when the passed-in value(pointer)
is non-NULL.

This is a part of the research work at RCSLab, University of Waterloo.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D41969
2023-09-24 18:37:58 -04:00
Martin Matuska abcdc1b9ae zfs: merge openzfs/zfs@2e2a46e0a
Notable upstream pull request merges:
 #15243 b53077a9e Add zfs_prepare_disk script for disk firmware install
 #15298 2e2a46e0a Invoke zdb by guid to avoid import errors
 #15301 e5d70f467 ZIL: Avoid dbuf_read() in ztest_get_data()

Obtained from:	OpenZFS
OpenZFS commit:	2e2a46e0a5
2023-09-24 23:58:34 +02:00
Priit Trees 0a5d2802b4 vge: correct pause_frames sysctl description
Reviewed by:	emaste
Pull Request:	https://github.com/freebsd/freebsd-src/pull/806
2023-09-24 13:34:36 -04:00
Warner Losh da8324a925 nvme: Fix locking protocol violation to fix suspend / resume
Currently, when we suspend, we need to tear down all the qpairs. We call
nvme_admin_qpair_abort_aers with the admin qpair lock held, but the
tracker it will call for the pending AER also locks it (recursively)
hitting an assert. This routine is called without the qpair lock held
when we destroy the device entirely in a number of places. Add an assert
to this effect and drop the qpair lock before calling it.
nvme_admin_qpair_abort_aers then locks the qpair lock to traverse the
list, dropping it around calls to nvme_qpair_complete_tracker, and
restarting the list scan after picking it back up.

Note: If interrupts are still running, there's a tiny window for these
AERs: If one fires just an instant after we manually complete it, then
we'll be fine: we set the state of the queue to 'waiting' and we ignore
interrupts while 'waiting'. We know we'll destroy all the queue state
with these pending interrupts before looking at them again and we know
all the TRs will have been completed or rescheduled. So either way we're
covered.

Also, tidy up the failure case as well: failing a queue is a superset of
disabling it, so no need to call disable first. This solves solves some
locking issues with recursion since we don't need to recurse.. Set the
qpair state of failed queues to RECOVERY_FAILED and stop scheduling the
watchdog. Assert we're not failed when we're enabling a qpair, since
failure currently is one-way. Make failure a little less verbose.

Next, kill the pre/post reset stuff. It's completely bogus since we
disable the qparis, we don't need to also hold the lock through the
reset: disabling will cause the ISR to return early. This keeps us from
recursing on the recovery lock when resuming. We only need the recovery
lock to avoid a specific race between the timer and the ISR.

Finally, kill NVME_RESET_2X. It'S been a major release since we put it
in and nobody has used it as far as I can tell. And it was a motivator
for the pre/post uglification.

These are all interrelated, so need to be done at the same time.

Sponsored by:		Netflix
Reviewed by:		jhb
Tested by:		jhb (made sure suspend / resume worked)
MFC After:		3 days
Differential Revision:	https://reviews.freebsd.org/D41866
2023-09-24 07:17:18 -06:00
Alexander Motin 2373e704aa Untie strchrnul() from gdb.
MFC after:	10 days
2023-09-23 23:18:20 -04:00
Li-Wen Hsu 855e045739 ports(7): Update the default setting of MASTER_SITE_INDEX
MFC after:	3 days
2023-09-24 10:59:34 +08:00
Simon J. Gerraty f174619c38 Guard CROSS_TARGET_FLAGS from buildworld
Until a better arrangment is worked out, guard the setting of
CROSS_TARGET_FLAGS in local.sys.mk with check for DIRDEPS_BUILD.

Using a separate flag for CROSS_TARGET that can be reset by
bsd.compat.mk is probably the right thing.
2023-09-23 15:58:13 -07:00