Commit graph

289110 commits

Author SHA1 Message Date
Dimitry Andric ecf4106237 Merge libcxxrt master 03c83f5a57be8c5b1a29a68de5638744f17d28ba
Interesting fixes (* were already cherry-picked):
- 03c83f5 add __cxa_init_primary_exception (#23)
* 5d8a158 Fix two bugs in __cxa_end_cleanup()
* b00c6c5 Insert padding in __cxa_dependent_exception
* 45ca8b1 Insert padding in __cxa_exception struct for compatibility
* f2e5509 Fix unlock in two-word version and add missing comment.
- 6229590 Add an option for disabling emergency buffers. (#14)

MFC after:	2 weeks
2024-01-25 18:43:23 +01:00
Dimitry Andric 156745f575 Import libcxxrt master 03c83f5a57be8c5b1a29a68de5638744f17d28ba
Interesting fixes:
03c83f5 add __cxa_init_primary_exception (#23)
5d8a158 Fix two bugs in __cxa_end_cleanup()
b00c6c5 Insert padding in __cxa_dependent_exception
45ca8b1 Insert padding in __cxa_exception struct for compatibility
f2e5509 Fix unlock in two-word version and add missing comment.
6229590 Add an option for disabling emergency buffers. (#14)
2024-01-25 18:05:41 +01:00
Kristof Provost e95025ed93 pflow: show socket status in verbose mode
Introduce a verbose output mode to pflowctl, and expose the status of
the socket to userspace. This can be helpful in debugging configuration
errors.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-01-25 17:37:51 +01:00
Wolfram Schneider b8a484ec34 man: support special characters in filenames
man.sh needs to handle double quotes and sub shell character
as '`' '$' etc.

PR:		275967
Reviewed by:	bapt

MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D43453
2024-01-25 07:14:06 +00:00
Ed Maste fbd156d78f Revert "nl_types.h: explicitly include cdefs.h"
This isn't the right approach for addressing this cross-build issue.

This reverts commit 820401bf17.
2024-01-24 22:50:49 -05:00
Jessica Clarke 6ec8bf9f3d riscv: Convert local interrupt controller to a newbus PIC
Currently the local interrupt controller implementation is based on
pre-INTRNG arm/arm64 code, using hand-rolled event code rather than
INTRNG. This then interacts weirdly with the PLIC, and other future
interrupt controllers like the APLIC and IMSICs in the upcoming AIA
specification, since they become the root PIC despite not being the
logical root. Instead, use a real newbus device for it and register
it as the root PIC.

This also adapts the IPI code to make use of the newly-added INTRNG
generic IPI handling framework, adding a new sbi_ipi as the PIC. In
future there will be alternative devices for sending IPIs that will
register with higher priorities, such as the proposed AIA IMSIC and
ACLINT SSWI.

Reviewed by:	mhorne
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D35901
2024-01-24 23:49:54 +00:00
Jessica Clarke c55272fdf8 riscv: Create a newbus device for the SBI driver
This approach is based on the Arm PSCI driver, though that makes more
extensive use of its softc than we do here. This will be used to extract
the SBI IPI code as a real PIC.

Reviewed by:	mhorne, imp
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D35900
2024-01-24 23:49:54 +00:00
Jessica Clarke 103d39efe0 intrng: Allow alternative IPI PICs to be registered and used
On RISC-V, the root PIC (whether the PLIC or, as will be the case in
future, the local interrupt controller) cannot send IPIs, relying on
another means to trigger the necessary software interrupts (firmware
calls), but there are upcoming standard devices that will be able to
inject them, so we can't just put the firmware calls in the root PIC
driver.

Thus, split out a new intr_ipi_dev from intr_irq_root_dev to use for
sending IPIs. New devices can be registered with a given priority up
until the first IPI is set up, when the best device seen so far gets
frozen as the IPI device to use.

Reviewed by:	mhorne
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D35899
2024-01-24 23:49:54 +00:00
Jessica Clarke fae8755f16 intrng: Extract arm/arm64 IPI->PIC glue code
The arm and arm64 implementations of dispatching IPIs via PIC_IPI_SEND
are almost identical, and entirely MI with the lone exception of a
single store barrier on arm64 (that is likely either redundant or needed
on arm too). Thus, de-duplicate this code by moving it to INTRNG as a
generic IPI glue framework. The ipi_* functions remain declared in MD
smp.h headers and implemented in MD code, but are trivial wrappers
around intr_ipi_send that could be made MI, at least for INTRNG ports,
at a later date.

Note that, whilst both arm and arm64 had an ii_send member in intr_ipi
to abstract over how to send interrupts,, they were always ultimately
using PIC_IPI_SEND, and so this complexity has been removed. A follow-up
commit will re-introduce the same flexibility by instead allowing a
device other than the root PIC to be registered as the IPI sender.

As part of this, strengthen a MAXCPU assertion that was missed in commit
2f0b059eea ("intrng: switch from MAXCPU to mp_ncpus") (which itself is
mis-titled).

Reviewed by:	mmel, mhorne
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D35898
2024-01-24 23:49:53 +00:00
Jessica Clarke e06afdb285 intrng: Remove irq_root_ipicount and corresponding intr_pic_claim_root arg
The static irq_root_ipicount variable is only ever written to (with the
value passed to irq_root_ipicount), never read. Moreover, the bcm2836
driver, as used by the Raspberry Pi 2B and 3A/B (but not 4, which uses a
GIC-400, though does have the legacy interrupt controller present too)
passes 0 as ipicount, despite implementing IPIs. It's thus inaccurate
and serves no purpose, so should be removed.

Reviewed by:	mmel, imp, mhorne
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D35897
2024-01-24 23:49:53 +00:00
Mark Johnston d56ce5915c mpsutil: Clean up libutil deps
mpsutil doesn't use libutil, so doesn't need to include libutil.h.  See
commit 76103694a0.

No functional change intended.

MFC after:	1 week
2024-01-24 17:10:24 -05:00
Val Packett 820401bf17 nl_types.h: explicitly include cdefs.h
This file uses __BEGIN_DECLS/__END_DECLS. When bootstrapping from
Linux/musl, they were missing.

Sponsored by:	https://www.patreon.com/valpackett
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1066
2024-01-24 16:59:18 -05:00
Ed Maste 54d31cfb27 mount: document atime option
atime is enabled by default, but may be specified explicitly so that any
future change in the default would not have an effect on a given mount.

Reviewed by:	olce, rgrimes
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D43580
2024-01-24 14:55:54 -05:00
Kyle Evans 5738d741fb kern: tty: fix recanonicalization
`ti->ti_begin` is actually the offset within the first block that is
unread, so we must use that for our lower bound.

Moving to the previous block has to be done at the end of the loop in
order to correctly handle the case of ti_begin == TTYINQ_DATASIZE.  At
that point, lastblock is still the last one with data written and the
next write into the queue would advance lastblock.  If we move to the
previous block at the beginning, then we're essentially off by one block
for the entire scan and run the risk of running off the end of the block
queue.

The ti_begin == 0 case is still handled correctly, as we skip the loop
entirely and the linestart gets recorded as the first byte available for
writing.  The bit after the loop about moving to the next block is also
still correct, even with both previous fixes in mind: we skipped moving
to the previous block if we hit ti_begin, and `off + 1` would in-fact be
a member of the next block from where we're reading if it falls on a
block boundary.

Reported by:	dim
Fixes:	522083ffbd ("kern: tty: recanonicalize the buffer on [...]")
2024-01-24 13:48:31 -06:00
Kristof Provost 8b82f36f89 pflowctl: fix usage message
Reported by:	Jim Pingle <jimp@netgate.com>
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-01-24 20:36:32 +01:00
Kristof Provost f1c0030bb0 pf: only check MTU for IPv6 packets when forwarding
When the packets are generated locally (i.e. PFIL_FWD is not set) we
might generate overly large packets and rely on the NIC to fragment it
for us. In that case we'd reject a valid packet.

Reported by:	Herbert J. Skuhra <herbert@gojira.at>
Tested by:	Herbert J. Skuhra <herbert@gojira.at>
Fixes:		54c62e3e5d
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-01-24 19:08:29 +01:00
Ed Maste a3ed434a69 ccdconfig: remove obsolete references to BSD disklabels
ccd(4) previoulsy had knowledge of BSD disklabels, and relied on their
use on the underlying disks, but this hasn't been the case since 2003
(commit 0f76d6d822).

Remove disklabel references from the man page.

Reviewed by: imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D43574
2024-01-24 12:51:45 -05:00
Gleb Smirnoff 5fc3104ae7 callout: retire callout_async_drain()
This function was used only in TCP before 446ccdd08e.  It was born in
pain in 2016 to plug different complex panics in TCP timers.  It wasn't
warmly accepted in phabricator by all of the reviewers and my recollection
of overall agreement was that "if you need this KPI, then you'd better fix
your code to not need it".  However, the function served its duty well all
the way to FreeBSD 14.  But now that TCP doesn't need it anymore, let's
retire it to reduce complexity of callout code and also to avoid its
further use.

Reviewed by:		jhb, markj, kib, rrs
Differential Revision:	https://reviews.freebsd.org/D43546
2024-01-24 09:33:27 -08:00
Richard Scheffenegger c7c325d01d tcp: pass maxseg around instead of calculating locally
Improve slowpath processing (reordering, retransmissions)
slightly by calculating maxseg only once. This typically
saves one of two calls to tcp_maxseg().

Reviewed By:           glebius, tuexen, cc, #transport
Sponsored by:          NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D43536
2024-01-24 16:43:29 +01:00
Mark Johnston af0d437dd3 kcmp: Add a manual page
Reviewed by:	kib, emaste
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D43562
2024-01-24 09:42:15 -05:00
Ed Maste 2e9b8c8c1e release: rework distributions list
Components like base.txz and ports.txz are called distributions in the
installer, and with the introduction of pkgbase we will start dealing
with normal pkg packages in the installer.  Rename EXTRA_PACKAGES to
DISTRIBUTIONS, and move base.txz and kernel.txz to that list.

This introduces no functional change but is a small cleanup in advance
of some pkgbase experimentation.

Reviewed by:	cperciva
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D43544
2024-01-24 09:13:51 -05:00
Ed Maste 1f41c1c1a3 crunch: remove fdisk from examples
It has been deprecated for a long time; gpart should be used instead.
The man page was updated in 2015 to declare it obsolete (b8c19fd719).
2024-01-24 09:12:19 -05:00
Martin Matuska fedf5b965f zfs: merge openzfs/zfs@a4bf6baae
Notable upstream pull request merges:
 #15630 a4bf6baae FreeBSD: Fix file descriptor leak on pool import
 #15780 d9cb42da9 FreeBSD: Fix bootstrapping tools under Linux/musl

Obtained from:	OpenZFS
OpenZFS commit:	a4bf6baaeb
2024-01-24 12:41:51 +01:00
Tijl Coosemans 95bf75895d join(1): Fix ordering in case of missing fields
The comparison function had the ordering reversed causing join(1) to
miss some matching lines.

PR:		232405
Submitted by:	Martijn van Duren <martijn@openbsd.org>
MFC after:	1 week
2024-01-24 10:58:00 +01:00
Peter Holm 7304bd7a52 stress2: Remove fdisk(8) regression test 2024-01-24 09:55:34 +01:00
Peter Holm d7e45d5b90 stress2: remove the usage of fdisk(8) as this is soon to be removed 2024-01-24 09:54:17 +01:00
Konstantin Belousov 120ceebab5 Bump __FreeBSD_version for kern_openatfp(9) and kcmp(2) 2024-01-24 07:13:26 +02:00
Konstantin Belousov c662306e19 Add kern_openatfp(9)
Reviewed by:	markj, pjd
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D43529
2024-01-24 07:13:26 +02:00
Konstantin Belousov 3d59b93b20 kern_openat(): minor style fixes
Reviewed by:	markj, pjd
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D43529
2024-01-24 07:13:25 +02:00
Konstantin Belousov 2a284076ec kern_openat(): rename fd argument to dirfd
Reviewed by:	markj, pjd
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D43529
2024-01-24 07:13:25 +02:00
Konstantin Belousov 38bfddf597 regen 2024-01-24 07:11:27 +02:00
Konstantin Belousov f006524d6d kcmp(2): implement for procdesc
Reviewed by:	brooks, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D43518
2024-01-24 07:11:27 +02:00
Konstantin Belousov 41fb6dc3d4 kcmp(2): implement for linuxkpi cdevs
Reviewed by:	brooks, markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D43518
2024-01-24 07:11:27 +02:00
Konstantin Belousov 5c41d888de kcmp(2): implement for devfs files
Compare not vnodes, which are different between mount points, but
actual cdev referenced by the devfs node.

Reviewed by:	brooks, markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D43518
2024-01-24 07:11:26 +02:00
Konstantin Belousov f04220c1b0 kcmp(2): implement for vnode files
Reviewed by:	brooks, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D43518
2024-01-24 07:11:26 +02:00
Konstantin Belousov f28526e946 kcmp(2): implement for generic file types
Reviewed by:	brooks, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D43518
2024-01-24 07:11:26 +02:00
Konstantin Belousov 211bdd601e Add kcmp(2) userspace bits
Unlike Linux, we do provide libc wrapper.  All definitions and
prototypes are available from <unistd.h>

Tested by:	manu
Reviewed by:	brooks, markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D43518
2024-01-24 07:11:26 +02:00
Konstantin Belousov d8decc9ae3 Add kcmp(2) kernel bits
This is based purely on reading the Linux kcmp(2) man page.
In addition to the Linux set of comparators, I also added KCMP_FILEOBJ to
compare underlying file' objects.

Tested by:	manu
Reviewed by:	brooks, markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D43518
2024-01-24 07:11:26 +02:00
Konstantin Belousov 168c7580c6 file: add fo_cmp method
The method should return 0 if the file' underlying objects are same.  In
other words, if 0 is returned, io from either of file causes
modifications of the same object.

Reviewed by:	brooks, markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D43518
2024-01-24 07:11:26 +02:00
Konstantin Belousov 58d3171698 Add fget_remote()
The function holds and returns struct file for a file descriptor index
in the given process.

Reviewed by:	brooks, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D43518
2024-01-24 07:11:26 +02:00
Konstantin Belousov 24fee9771e sys/file.h: style
Reviewed by:	brooks, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D43518
2024-01-24 07:11:25 +02:00
Kyle Evans 009db0d40c ncurses: serialize the tinfo build a little bit
Move ncurses_dll.h to GENHDRS to start with; it's been generated from
ncurses_dll.h.in for years, so it's not actually in a different category
than all of the other GENHDRS.  Slap an .ORDER on it to ensure that we
build ncurses_dll.h and curses.h before any *.c gets compiled.

This should sufficiently address a build race seen downstream where
ncurses_dll.h is present but not yet populated.

Reviewed by:	bapt
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D43540
2024-01-23 23:00:36 -06:00
Pawel Jakub Dawidek a4bf6baaeb
Fix file descriptor leak on pool import.
Descriptor leak can be easily reproduced by doing:

	# zpool import tank
	# sysctl kern.openfiles
	# zpool export tank; zpool import tank
	# sysctl kern.openfiles

We were leaking four file descriptors on every import.

Similar leak most likely existed when using file-based VDEVs.

External-issue: https://reviews.freebsd.org/D43529
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Pawel Jakub Dawidek <pawel@dawidek.net>
Closes #15630
2024-01-23 15:03:48 -08:00
Gleb Smirnoff 90ad2dc287 tcp: remove 20+ year old disabled code from d912c694ee 2024-01-23 13:16:34 -08:00
Gleb Smirnoff c809435b18 tcp: clear outdated comment mentioning T/TCP 2024-01-23 12:59:21 -08:00
Gleb Smirnoff e21c668719 tcp: pass positive errno to tcp_drop()
Fixes:	446ccdd08e
2024-01-23 12:59:21 -08:00
Mike Karels 2e68c5a44c tmpfs: increase vfs.tmpfs.memory_percent to 100 as workaround
The changes to avoid letting tmpfs use all of memory + swap do not
work well with ZFS ARC.  The ARC can grow quite large, and will shrink
when there is memory pressure, but tmpfs does not allow for that.
Pending investigation of the right way to handle this, change the
default value of the vfs.tmpfs.memory_percent sysctl to 100 as a
workaround.  The sysctl can be set to 95 to get back to the previous
default.
2024-01-23 12:46:31 -06:00
Dimitry Andric 2acd158d4b mtree: stop creating old mixer(8) test directories
The tests themselves were added to ObsoleteFiles.inc in commit
f7c4f49649, but not yet removed from BSD.tests.dist.

PR:		274602
Fixes:		f7c4f49649
2024-01-23 19:40:12 +01:00
John Baldwin a82470212b powerpc: Add RF_LITTLEENDIAN resource flag
If this powerpc-specific flag is set on a resource, then the
little-endian bus tag is always used when mapping that resource.

Make use of this flag in the mpc85xx/fsl_sata driver to avoid setting
the SATA BAR's bus tag after bus_alloc_resource.

Reviewed by:	jhibbits
Differential Revision:	https://reviews.freebsd.org/D43553
2024-01-23 09:38:36 -08:00
John Baldwin 3cf553288b simplebus: Consistently map SYS_RES_IOPORT to SYS_RES_MEMORY
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43442
2024-01-23 09:38:25 -08:00