Commit graph

288192 commits

Author SHA1 Message Date
Martin Matuska 188408da9f zfs: merge openzfs/zfs@dbda45160
Notable upstream pull request merges:
 #15665 9b1677fb5 dmu: Allow buffer fills to fail

Obtained from:	OpenZFS
OpenZFS commit:	dbda45160f
2023-12-19 23:19:48 +01:00
Dmitry Luhtionov 45835894bd pchtherm(4): Add PCI ID for Wellsburg Thermal Subsystem
MFC after:	2 weeks
2023-12-19 23:32:01 +03:00
Dmitry Luhtionov cb494408d8 ichsmb(4): Add PCI ID for Intel Ice Lake SMBus controller
MFC after:	2 weeks
2023-12-19 23:32:01 +03:00
Gleb Smirnoff 513f2e2e71 tcp: always set tcp_tun_port to a correct value
The tcp_tun_port field that is used to pass port value between UDP
and TCP in case of tunneling is a generic field that used to pass
data between network layers.  It can be contaminated on entry, e.g.
by a VLAN tag set by a NIC driver.  Explicily set it, so that it
is zeroed out in a normal not-tunneled TCP.  If it contains garbage,
tcp_twcheck() later can enter wrong block of code and treat the packet
as incorrectly tunneled one.  On main and stable/14 that will end up
with sending incorrect responses, but on stable/13 with ipfw(8) and
pcb-matching rules it may end up in a panic.

This is a minimal conservative patch to be merged to stable branches.
Later we may redesign this.

PR:			275169
Reviewed by:		tuexen
Differential Revision:	https://reviews.freebsd.org/D43065
2023-12-19 11:24:17 -08:00
Gleb Smirnoff 48b55a7c7b tcp_hpts: make the module unloadable
Although the HPTS subsytem wasn't initially designed as a loadable
module, now it is so.  Make it possible to also unload it, but for
safety reasons hide that under 'kldunload -f'.

Reviewed by:		tuexen
Differential Revision:	https://reviews.freebsd.org/D43092
2023-12-19 10:21:56 -08:00
Gleb Smirnoff 175d4d6988 tcp_hpts: use tcp_pace.cts_last_ran for last ran table
Remove the global cts_last_ran and use already existing unused field of
struct tcp_hptsi, which seems originally planned to hold this table.  This
makes it consistent with other malloc-ed tables, like main array of HPTS
entities and CPU groups.

Reviewed by:		tuexen
Differential Revision:	https://reviews.freebsd.org/D43091
2023-12-19 10:21:56 -08:00
Kristof Provost c2e0b604a3 netinet tests: test that we send IGMP join/leave packets as expected
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-12-19 17:47:41 +01:00
Kristof Provost ec6682ed6c atf.test: fix installation of python test scripts
Python test scripts get processed (to add the `#! /usr/libexec/
atf_pytest_wrapper` shebang line), into a .xtmp file, and installed from
there. However, as there was no dependency of this .xtmp file on the
original file we kept reinstalling the .xtmp file, even if the original
had been edited already.

This could cause great confusion when debugging python test scripts.

Reviewed by:	markj
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D43118
2023-12-19 17:23:54 +01:00
Mike Karels 636592343c tmpfs: increase memory reserve to a percent of available memory + swap
The tmpfs memory reserve defaulted to 4 MB, and other than that,
all of available memory + swap could be allocated to tmpfs files.
This was dangerous, as the page daemon attempts to keep some memory
free, using up swap, and then resulting in processes being killed.
Increase the reserve to a fraction of available memory + swap at
file system startup time.  The limit is expressed as a percentage
of available memory + swap that can be used, and defaults to 95%.
The percentage can be changed via the vfs.tmpfs.memory_percent sysctl,
recomputing the reserve with the new percentage but the initial
available memory + swap.  Note that the reserve can also be set
directly with an existing sysctl, ignoring the percentage.  The
previous behavior can be specified by setting vfs.tmpfs.memory_percent
to 100.

Add sysctl for vfs.tmpfs.memory_percent and the pre-existing
vfs.tmpfs.memory_reserved to tmpfs(5).

PR:		275436
MFC after:	1 month
Reviewed by:	rgrimes
Differential Revision:	https://reviews.freebsd.org/D43011
2023-12-19 09:33:33 -06:00
Mike Karels ed19c0989f tmpfs: enforce size limit on writes when file system size is default
tmpfs enforced the file system size limit on writes for file systems
with a specified size, but not when the size was the default.  Add
enforcement when the size is default: do not allocate additional
pages if the available memory + swap falls to the reserve level.
Note, enforcement is also done when attempting to create a file,
both with and without an explicit file system size.

PR:		275436
MFC after:	1 month
Reviewed by:	cy
Differential Revision:	https://reviews.freebsd.org/D43010
2023-12-19 09:32:58 -06:00
Peter Holm 2134b35e0f stress2: Fix "-Wunused-but-set-variable" warnings. Style fixes, while here 2023-12-19 10:36:41 +01:00
Olivier Certner a540e5ee07 committers-src: Add olce@ with mentors emaste@ and markj@
Approved by:        emaste (mentor)
2023-12-19 09:43:45 +01:00
Mark Johnston d760d74dbe ieee80211: Check for copyout() errors in the SIOCG80211STATS handler
In preparation for annotating copyin() and related functions with
__result_use_check.

Reviewed by:	bz, emaste
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D43095
2023-12-18 22:44:54 -05:00
Bjoern A. Zeeb eac3646fcd LinuxKPI: 802.11: more TXQ implementation and locking
Implement ieee80211_handle_wake_tx_queue() and ieee80211_tx_dequeue_ni()
while looking at the code.  They are needed by various wireless drivers.

Introduce an ltxq lock and protect the skbq by that.
This prevents panics due to a race between a driver upcall and
the net80211 tx downcall.  While the former should be rcu protected we
cannot rely on that.
It remains questionable if we need to protect further fields there
(with a different lock?).

Also introduce a txq_mtx on the lhw which needs to be further deployed
but we need to come up with a good strategy to not end up with 7 different
locks.

Sponsored by:	The FreeBSD Foundation
PR:		274178, 275710
Tested by:	cc
MFC after:	3 days
2023-12-19 00:50:49 +00:00
Robert Wing acd5638e26 tty: delete knotes when TTY is revoked
Do not clear knotes from the TTY until it gets dealloc'ed, unless the
TTY is being revoked, in that case delete the knotes when closed is
called on the TTY.

When knotes are cleared from a knlist, those knotes become detached from
the knlist. And when an event is triggered on a detached knote there
isn't an associated knlist and therefore no lock will be taken when the
event is triggered.

This becomes a problem when a detached knote is triggered on a TTY since
the mutex for a TTY is also used as the lock for its knlists. This
scenario ends up calling the TTY event handlers without the TTY lock
being held and tripping on asserts in the event handlers.

PR:             272151
Reviewed by:	kib, markj
Differential Revision:	https://reviews.freebsd.org/D41605
2023-12-18 15:40:46 -09:00
Mark Johnston d9b7301bb7 nvme: Initialize HMB entries before loading them into the controller
struct nvme_hmb_desc contains a pad field which was not getting
initialized before being synced.  This doesn't have much consequence but
triggers a report from KMSAN, which verifies that host-filled DMA memory
is initialized before it is made visible to the device.  So, let's just
initialize it properly.

Reported by:	KMSAN
Reviewed by:	mav, imp
MFC after:	1 week
Sponsored by:	Klara, Inc.
Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D43090
2023-12-18 17:45:24 -05:00
Brooks Davis 8a1b84f861 arm/SYS.h: align with other arches
Rename SYSTRAP() macro to _SYSCALL() and add _SYSCALL_BODY() which invokes
the syscall via _SYCALL() and then calls cerror as required.  Use to
implement PSEUDO() and RSYSCALL() removing _SYSCALL_NOERROR().

Reviewed by:	imp
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D43061
2023-12-18 22:28:42 +00:00
Brooks Davis d444ef5393 arm/SYS.h: remove unused CURBRK macro
The last use was removed in 2018 as part of a reimplementation of brk()
and sbrk() in commit 9d9fd255d6.

Reviewed by:	imp
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D43060
2023-12-18 22:28:42 +00:00
Brooks Davis 8f465f509b {amd64,i386}/SYS.h: add _SYSCALL and _SYSCALL_BODY
Add a _SYSCALL(name) which calls the SYS_name syscall.  Use it to add a
_SYSCALL_BODY() macro which invokes the syscall and calls cerror as
required.  Use the latter to implement PSEUDO() and RSYSCALL().

Reviewed by:	imp, markj
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D43059
2023-12-18 22:28:42 +00:00
Brooks Davis 300bbb3a43 riscv/SYS.h: implement _SYSCALL_BODY() macro
Add _SYSCALL_BODY() macro which invokes the syscall via _SYCALL() and
calls cerror as required.  Use to implement PSEUDO() and RSYSCALL().

Reviewed by:	imp, markj
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D43057
2023-12-18 22:28:42 +00:00
Mark Johnston 604de40a02 kqueue.9: Update the description of knlist_clear()
knlist_clear() does not free knotes and so does not call fdrop(), so
remove the bit of the function description which claims otherwise.  (The
knote will be dropped by the next queue scan, and it is at that point
that the fd reference will be dropped.)

MFC after:	1 week
2023-12-18 13:16:48 -05:00
Mark Johnston ccf8e1bb38 arm64: Remove an unused global variable
No functional change intended.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Sponsored by:	Juniper Networks, Inc.
2023-12-18 13:13:43 -05:00
Warner Losh e02bee0b3e efibootmgr: Report the path to the device
Report the entire path to the device, rather than the the bit after /dev/
for the --esp command. Nothing in the tree depends on the output
format: Only bsdinstall's bootconfig script calls efibootmgr, and it
doesn't use the --esp/-E flag.

Sponsored by:		Netflix
2023-12-18 10:09:13 -07:00
Warner Losh 6aa1b4332f efibootmgr: Document -e command line switch
-e env will include `env` in the boot loader. Document that the boot
loader appends the `env` to the BootXXXX variable, and will parse it as
a series of a=b values to set in the boot loader's environment.  These
assignments are separated by spaces. The env arg needs to be quoted if
more than one env var is to be set (we parse only the next argument on
the command line).

Sponsored by:		Netflix
2023-12-18 10:01:38 -07:00
Gordon Tetlow 92f58c69a1
Implement "strict key exchange" in ssh and sshd.
This adds a protocol extension to improve the integrity of the SSH
transport protocol, particular in and around the initial key exchange
(KEX) phase.

Full details of the extension are in the PROTOCOL file.

OpenBSD-Commit-ID: 2a66ac962f0a630d7945fee54004ed9e9c439f14

Approved by:	so (implicit)
Obtained from:	https://anongit.mindrot.org/openssh.git/patch/?id=1edb00c58f8a6875fad6a497aa2bacf37f9e6cd5
Security:	CVE-2023-48795
2023-12-18 08:22:22 -08:00
Alan Somers 18e2c4175f Remove _POSIX_PRIORITIZED_IO references from man pages
We don't support it, so there's no need to tell readers what would
happen if we did.  Also, don't remind the user that a certain field is
ignored by aio_read.  Mentioning every ignored field would make the man
pages too verbose.

MFC after:	1 week
Sponsored by:	Axcient
Reviewed by:	Pau Amma <pauamma@gundo.com>
Differential Revision: https://reviews.freebsd.org/D42622
2023-12-18 08:06:55 -07:00
Igor Ostapenko 66d77e0f73 netlink: fix debug text typo in message parser
Signed-off-by: Igor Ostapenko <pm@igoro.pro>
Pull-request: https://github.com/freebsd/freebsd-src/pull/942
2023-12-18 08:34:55 -05:00
Richard Scheffenegger e3b9058e5c tcp: properly unroll sack transmission on tx error with LRD
Reviewed By:           tuexen, #transport
MFC after:             1 week
Sponsored by:          NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D43085
2023-12-18 13:02:22 +01:00
Ram Kishore Vegesna a9504d76cc ocs_fc: Use xpt_path_sbuf() to copy the path to sbuf.
Reported by:	imp
 MFC after:	1 week
2023-12-18 14:22:06 +05:30
Kyle Evans 0a82cd4f10 calendar: correct the search order for files
Include files that don't begin with a '/' are documented to search the
current directory, then /usr/share/calendar.  This hasn't been accurate
for years, since e061f95e7b ("Rework calendar(1) parser") rewrote a
lot of this.

Stash off the cwd before we do any chdir()ing around and use that to
honor the same order we'll follow for the -f flag.  This may result in
an extra lookup that will fail for the initial calendar file, but I
don't think it's worth the complexity to avoid it.

While we're here, fix the documentation to just reference the order
described in FILES so that we only need to keep it up to date in one
place.

Reviewed by:	bapt
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D42278
2023-12-17 23:53:51 -06:00
Peter Eriksson 7aa375dcc6 libc: correct some memory leaks in acl_to_text(3) and acl_to_text_np(3)
PR:	275232
MFC after:	1 week
2023-12-18 00:06:03 +02:00
Richard Scheffenegger 31cf66d755 dummynet: add simple gilbert-elliott channel model
Have a simple Gilbert-Elliott channel model in
dummynet to mimick correlated loss behavior of
realistic environments. This allows simpler testing
of burst-loss environments.

Reviewed By:           tuexen, kp, pauamma_gundo.com, #manpages
Sponsored by:          NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D42980
2023-12-17 13:20:45 +01:00
Gordon Bergling 4fb5eda649 tcp: Remove the documented dependency of TCPHPTS for RACK and BBR
Since TCPHPTS is now included in the GENERIC kernel, remove the
documented dependency of it from the tcp_rack(4) and tcp_bbr(4)
manual pages.

Reviewed by:	tuexen
Differential Revision:	https://reviews.freebsd.org/D43084
2023-12-17 19:31:16 +01:00
Gordon Bergling ada4cd3f77 qat: Fix two typos in source code comments
- s/parmeters/parameters/

MFC after:	3 days
2023-12-17 15:18:57 +01:00
Yu-Hsun Chen 452c3e9514
mt(1): Fix typo
This is from the Advanced UNIX Programming Course (Fall’23) at NTHU.

MFC after:	3 days
Pull Request:	https://github.com/freebsd/freebsd-src/pull/931
2023-12-17 18:49:42 +08:00
Yu-Hsun Chen 1a35ead682
mkimg(1): Fix typo
This is from the Advanced UNIX Programming Course (Fall’23) at NTHU.

MFC after:	3 days
Pull Request:	https://github.com/freebsd/freebsd-src/pull/930
2023-12-17 18:49:28 +08:00
Yu-Hsun Chen 0ba51e3b63
fstat(1): Fix typo
This is from the Advanced UNIX Programming Course (Fall’23) at NTHU.

MFC after:	3 days
Pull Request:	https://github.com/freebsd/freebsd-src/pull/929
2023-12-17 18:41:53 +08:00
Yu-Hsun Chen a2ee3070d8
awk(1): Fix typo
This is from the Advanced UNIX Programming Course (Fall’23) at NTHU.

MFC after:	3 days
Pull Request:	https://github.com/freebsd/freebsd-src/pull/928
2023-12-17 18:40:29 +08:00
Pawel Jakub Dawidek 6f3e9bac4d vm: Plug umtx shm object leak.
Reviewed by:	kib
Approved by:	oshogbo
MFC after:	1 week
Sponsored by:	Fudo Security
Differential Revision:	https://reviews.freebsd.org/D43073
2023-12-16 05:18:36 -08:00
Umer Saleem dbda45160f
Test LWB buffer overflow for block cloning
PR#15634 removes 128K into 2x68K LWB split optimization, since it
was found to cause LWB buffer overflow while trying to write 128KB
TX_CLONE_RANGE record with 1022 block pointers into 68KB buffer,
with multiple VDEVs ZIL.

This commit adds a test for this particular scenario by writing
maximum sizes TX_CLONE_RANE record with 1022 block pointers into
68KB buffer, with two SLOG devices.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by:  Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Ameer Hamza <ahamza@ixsystems.com>
Signed-off-by: Umer Saleem <usaleem@ixsystems.com>
Closes #15672
2023-12-15 14:18:27 -08:00
Konstantin Belousov ca39f23347 ufs: do not leave around empty buffers shadowing disk content
If the ffs_write() operation specified to overwrite the whole buffer,
ffs tries to save the read by not validating allocated buffer. Then
uiommove() might fail with EFAULT, in which case pages are left zeroed
and marked valid but not read from the disk. Then vn_io_fault() logic
retries the write after holding the user pages to avoid EFAULTs. In
erronous case of really faulty buffer, or in contrived case of writing
from file to itself, we are left with zeroed buffer instead of valid
content written back to disk.

Handle the situation by releasing non-cached buffer on fault, instead
of clearing it. Note that buffers with alive dependencies cannot be
released, but also either they cannot have valid content on the disk
because dependency on data buffer means that it was not yet written, or
they were reallocated by fragment extension or ffs_reallocbks(), and are
already fully valid.

Reported by:	kevans
Discussed with:	mav
In collaboration with:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-12-16 00:06:10 +02:00
Brad Davis 863975b684 release/Makefile.vm: Add cloudware overrides
Allow the cloudware *_FLAVOURS and *_FSLIST values to be overridden
at the command line, to assist users who want to e.g. build only one
of the many EC2 AMIs available.
2023-12-15 10:08:50 -08:00
Alexander Motin 9b1677fb5a
dmu: Allow buffer fills to fail
When ZFS overwrites a whole block, it does not bother to read the
old content from disk. It is a good optimization, but if the buffer
fill fails due to page fault or something else, the buffer ends up
corrupted, neither keeping old content, nor getting the new one.

On FreeBSD this is additionally complicated by page faults being
blocked by VFS layer, always returning EFAULT on attempt to write
from mmap()'ed but not yet cached address range.  Normally it is
not a big problem, since after original failure VFS will retry the
write after reading the required data.  The problem becomes worse
in specific case when somebody tries to write into a file its own
mmap()'ed content from the same location.  In that situation the
only copy of the data is getting corrupted on the page fault and
the following retries only fixate the status quo.  Block cloning
makes this issue easier to reproduce, since it does not read the
old data, unlike traditional file copy, that may work by chance.

This patch provides the fill status to dmu_buf_fill_done(), that
in case of error can destroy the corrupted buffer as if no write
happened.  One more complication in case of block cloning is that
if error is possible during fill, dmu_buf_will_fill() must read
the data via fall-back to dmu_buf_will_dirty().  It is required
to allow in case of error restoring the buffer to a state after
the cloning, not not before it, that would happen if we just call
dbuf_undirty().

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Rob Norris <robn@despairlabs.com>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #15665
2023-12-15 09:51:41 -08:00
Elliott Mitchell 4c9e6ad320 xen: add atomic #defines to accomodate differing xen_ulong_t sizes
Alas, ARM declared xen_ulong_t to be 64-bits long, unlike i386 where
it matches the word size.  As a result, compatibility wrappers are
needed for Xen atomic operations.

Reviewed by: royger
2023-12-15 14:59:26 +01:00
Elliott Mitchell ed917e0fae xen/intr: correct type of evtchn_enabled
evtchn_enabled needs to match the type of Xen's evtchn_mask.  As Xen's
headers have a type for this, use Xen's type.

Reviewed by: royger
2023-12-15 14:59:25 +01:00
Elliott Mitchell ea9a9b122d sys/conf: make xen_acpi_cpu.c depend on acpi
Since Xen can function on systems without ACPI, make sure this key
dependency is handled.

Reviewed by: royger
2023-12-15 14:59:25 +01:00
Elliott Mitchell 40e1d9d45f xen: add SPDX license tags to Xen headers
These are in fact GPLv2 when distributed with the Linux kernel, but the
license also allows MIT if distributed separately.  Add the markers to
avoid interference by automated tools.

Differential Revision: https://reviews.freebsd.org/D32796
Reviewed by: royger
2023-12-15 14:59:25 +01:00
Cheng Cui 93b7818226
libexec/rc/rc.initdiskless: make tar's path flexible
Summary:
PR:		274977
Reviewed by: rgrimes,imp
Approved by: rgrimes
MFC after:      1 month
2023-12-15 03:46:44 -05:00
Martin Matuska 5fb307d29b zfs: merge openzfs/zfs@86e115e21
Notable upstream pull request merges:
 #15643 a9b937e06 For db_marker inherit the db pointer for AVL comparision
 #15644 e53e60c0b DMU: Fix lock leak on dbuf_hold() error
 #15653 86063d903 dbuf: Handle arcbuf assignment after block cloning
 #15656 86e115e21 dbuf: Set dr_data when unoverriding after clone

Obtained from:	OpenZFS
OpenZFS commit:	86e115e21e
2023-12-15 14:18:07 +01:00
Kristof Provost c2e340452c mcast: fix leaked igmp packets on multicast cleanup
When we release a multicast address (e.g. on interface shutdown) we may
still have packets queued in inm_scq. We have to free those, or we'll
leak memory.

Reviewed by:	glebius
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D43033
2023-12-14 22:06:01 +01:00