Commit graph

288121 commits

Author SHA1 Message Date
Konstantin Belousov
eb36277dc9 posix_spawnattr_setflags(3): validate argument
(cherry picked from commit 80ac36c3a2a87a19790eba487466bf70d55f566e)
2024-03-11 02:25:58 +02:00
Xin LI
965f92a282 MFV: xz 5.6.0.
(cherry picked from commit 8db56defa766eacdbaf89a37f25b11a57fd9787a)
2024-03-09 19:57:25 -08:00
Konstantin Belousov
f7d51eb77e getblkx(9): be more tolerant but also strict with the buffer size checks
PR:	277414

(cherry picked from commit 7e4ac11b6076e6a9bf7341ddeae22784284ed733)
2024-03-09 11:05:03 +02:00
Mark Johnston
a0f02252c4 vmm: Expose more registers to VM_GET_REGISTER
In a follow-up revision the gdb stub will support sending an XML target
description to gdb, which lets us send additional registers, including
the ones added in this patch.

Reviewed by:	jhb
MFC after:	1 month
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D43665

(cherry picked from commit f493ea650e6137ba657dfa0627da1e8bb4a985e9)
2024-03-08 23:28:39 -05:00
Daniel Roethlisberger
465fe46da5 arm64: Add netmap(4) to default kernel config
Allows the development, testing and deployment of netmap(4)-based code
on arm64 without having to recompile the kernel.  netmap(4) is already
in the amd64 and powerpc64 default configs, so it does not seem
unreasonable to also provide it on arm64 by default.

Note that netmap(4) is useful even on systems without NIC that fully
support it.

Reviewed by:	vmaffione
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D43702

(cherry picked from commit df64d7c8c82d59958cb546b23ba240ab97dc5033)
2024-03-08 23:28:01 -05:00
Alfredo Mazzinghi
2de742797b Abstract UIO allocation and deallocation.
Introduce the allocuio() and freeuio() functions to allocate and
deallocate struct uio. This hides the actual allocator interface, so it
is easier to modify the sub-allocation layout of struct uio and the
corresponding iovec array.

Obtained from:	CheriBSD
Reviewed by:	kib, markj
MFC after:	2 weeks
Sponsored by:	CHaOS, EPSRC grant EP/V000292/1
Differential Revision:	https://reviews.freebsd.org/D43711

(cherry picked from commit 61cc4830a7b16400efade3d884a59fda6d80d651)
2024-03-08 23:27:20 -05:00
Alfredo Mazzinghi
c3751f89da Fix subr_uio.c style(9) with uses of sizeof.
Obtained from:	CheriBSD
Reviewed by:	jhb, kib, markj
MFC after:	2 weeks
Sponsored by:	CHaOS, EPSRC grant EP/V000292/1
Differential Revision:	https://reviews.freebsd.org/D43710

(cherry picked from commit f82e98237395693d1825243ff7b111aa321d383f)
2024-03-08 23:27:07 -05:00
Mark Johnston
69c4a0ef86 arm64: Add a VM_FREELIST_DMA32 freelist
When booting a KMSAN kernel on an Ampere Altra, I've seen some boot time
hangs when the XHCI controller driver attempts to allocate memory for
32-bit DMA.  The system boots fine with a GENERIC kernel; I believe that
the additional memory requirements of KMSAN push it over the edge.  The
system has a bit less than 2GB of RAM below the 4GB boundary.

Allocate a new freelist to segregate memory below 4GB, as we do on
amd64, so that such memory allocation failures are less likely to occur.

Reviewed by:	alc
MFC after:	1 month
Sponsored by:	Klara, Inc.
Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D43503

(cherry picked from commit 48d5dab7bace6bae938672784ca3aa8733d72eb9)
2024-03-08 23:26:57 -05:00
Gordon Bergling
428e5165fe tcp_rack.4: Remove a mentioned paper
The paper "T-RACKs: A Faster Recovery Mechanism for
TCP in Data Center Networks" has nothing to do with
our TCP RACK implementation, so remove it.

Reported by:	tuexen

(cherry picked from commit 7701b993554321f305ef662a26238f375c4d2dba)
2024-03-08 10:50:06 +01:00
Kristof Provost
14bbf09433 netlink: fix casts
Reviewed by:	melifaro
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D44088

(cherry picked from commit 48f33b55b0148c3c8991e53156f37c42b8bc22e9)
2024-03-08 10:11:15 +01:00
Dimitry Andric
fc31d474c4 Merge commit f800c1f3b207 from llvm-project (by Arthur Eubanks):
[PEI] Don't zero out noreg operands

  A tail call may have $noreg operands.

  Fixes a crash.

  Reviewed By: xgupta

  Differential Revision: https://reviews.llvm.org/D156485

This should fix an assertion failure building qemu, specifically those
parts using -fzero-call-used-regs.

Reported by:	Daniel Berrangé <dan-freebsd@berrange.com>
PR:		277474
MFC after:	3 days

(cherry picked from commit a39b3aa463f3474fabb3aedb5aecf943b54b4357)
2024-03-08 09:15:49 +01:00
Dimitry Andric
c4149abc5d Optionally create full debuginfo for llvm-related executables
Commit de6feefdb7 limited the amount of debuginfo generated for clang
and other llvm-related executables. This was done to save disk space and
memory during building, but it makes debugging any of these executables
much harder.

Add a new src.conf(5) setting, WITH_LLVM_FULL_DEBUGINFO, to generate
full debuginfo instead. This is off by default, but could for example be
enabled for release builds or snapshots, so llvm executables are easier
to debug.

Reviewed by:	emaste
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D43839

(cherry picked from commit 73ff7384e025033abc98fd5437a48beb8077a90b)
2024-03-08 09:15:34 +01:00
Philip Paeps
275aee513b bsdinstall: prefer HTTP
In 2024, users are more likely to have working HTTP than working FTP.
Present http://ftp.FreeBSD.org as the first option in the installer.
Keep ftp://ftp.FreeBSD.org as the second option.

MFC after:	3 weeks

(cherry picked from commit 9c59988175ffd6b42c6927c0939e13abc43f7344)
2024-03-07 10:27:28 +08:00
Konstantin Belousov
3cce838c60 rtld: use generated map file to check for some leaks from libc into rtld
(cherry picked from commit 5db5c6c87a75f8b1871f021726fc4697253ae5cf)
2024-03-07 02:34:34 +02:00
Konstantin Belousov
5a98473132 rtld: unconditionally generate map file during build
(cherry picked from commit 799940154c70597a46627deb4d0b98e174b27b98)
2024-03-07 02:34:34 +02:00
Gordon Bergling
1975c745e3 Revert "md5.1: Fix an example"
This reverts commit 38a5635de9.
2024-03-06 09:33:19 +01:00
Konstantin Belousov
f3a53319f6 sys/mount.h: align values of MNTK_XXX flags
(cherry picked from commit 2496fb72cf37bb9aa0cbd108ded06324ea52bd11)
2024-03-06 09:43:38 +02:00
Kirk McKusick
fdfb8e783c Eliminate unnecessary UFS1 integrity checks.
The UFS1 integrity checks added in FreeBSD 14 were too aggressive
for UFS1 filesystems created in FreeBSD 4 and 9 systems. This patch
removes those tests which can be done safely since they are not
relevant to the current implementation of UFS1.

This is a follow-on report to bug report 264450 (comments 21-28).

Reported by: slb@sonnet.com
Tested by:   slb@sonnet.com
PR:          264450

(cherry picked from commit b241767f8ef38f9ca7c109fe2fccd11ccbfaa4f0)
2024-03-04 16:09:10 -08:00
Jason A. Harmening
5e806288f0 unionfs: cache upper/lower mount objects
Store the upper/lower FS mount objects in unionfs per-mount data and
use these instead of the v_mount field of the upper/lower root
vnodes.  As described in the referenced PR, it is unsafe to access this
field on the unionfs unmount path as ZFS rollback may have obliterated
the v_mount field of the upper or lower root vnode.  Use these stored
objects to slightly simplify other code that needs access to the
upper/lower mount objects as well.

PR:		275870
Reported by:	Karlo Miličević <karlo98.m@gmail.com>
Tested by:	Karlo Miličević <karlo98.m@gmail.com>
Reviewed by:	kib (prior version), olce
Differential Revision: https://reviews.freebsd.org/D43815

(cherry picked from commit cc3ec9f7597882d36ee487fd436d1b90bed0ebfd)
2024-03-04 12:31:49 -06:00
Jason A. Harmening
9c53057875 unionfs: upgrade the vnode lock during fsync() if necessary
If the underlying upper FS supports shared locking for write ops,
as is the case with ZFS, VOP_FSYNC() may only be called with the vnode
lock held shared.  In this case, temporarily upgrade the lock for
those unionfs maintenance operations which require exclusive locking.

While here, make unionfs inherit the upper FS' support for shared
write locking.  Since the upper FS is the target of VOP_GETWRITEMOUNT()
this is what will dictate the locking behavior of any unionfs caller
that uses vn_start_write() + vn_lktype_write(), so unionfs must be
prepared for the caller to only hold a shared vnode lock in these
cases.

Found in local testing of unionfs atop ZFS with DEBUG_VFS_LOCKS.

Reviewed by:	kib, olce
Differential Revision: https://reviews.freebsd.org/D43817

(cherry picked from commit 2656fc29be8b0fc1cd9e64ed52aa0a61fe87744c)
2024-03-04 12:31:44 -06:00
Jason A. Harmening
c18e6a5a5c unionfs: work around underlying FS failing to respect cn_namelen
unionfs_mkshadowdir() may be invoked on a non-leaf pathname component
during lookup, in which case the NUL terminator of the pathname buffer
will be well beyond the end of the current component.  cn_namelen in
this case will still (correctly) indicate the length of only the
current component, but ZFS in particular does not currently respect
cn_namelen, leading to the creation on inacessible files with slashes
in their names.  Work around this behavior by temporarily NUL-
terminating the current pathname component for the call to VOP_MKDIR().

https://github.com/openzfs/zfs/issues/15705 has been filed to track
a proper upstream fix for the issue at hand.

PR:		275871
Reported by:	Karlo Miličević <karlo98.m@gmail.com>
Tested by:	Karlo Miličević <karlo98.m@gmail.com>
Reviewed by:	kib, olce
Differential Revision: https://reviews.freebsd.org/D43818

(cherry picked from commit a2ddbe019d51b35f9da2cb5ddca8c69f0ee422da)
2024-03-04 12:31:25 -06:00
Jason A. Harmening
d0bb255d1f VFS: update VOP_FSYNC() debug check to reflect actual locking policy
Shared vs. exclusive locking is determined not by MNT_EXTENDED_SHARED
but by MNT_SHARED_WRITES (although there are several places that
ignore this and simply always use an exclusive lock).  Also add a
comment on the possible difference between VOP_GETWRITEMOUNT(vp)
and vp->v_mount on this path.

Found by local testing of unionfs atop ZFS with DEBUG_VFS_LOCKS.

Reviewed by:	kib, olce
Differential Revision: https://reviews.freebsd.org/D43816

(cherry picked from commit 9530182e371dee382b76d8594f65633a304b396f)
2024-03-04 12:30:27 -06:00
Florian Walpen
ebe18cb1a5 snd_uaudio(4): Fix sample rate selection after 42fdcd9fd917.
The sample rate selection of snd_uaudio(4) at runtime was implicitly
relying on a specific order in the device config list. In case a default
was set through the hw.usb.uaudio.default_rate sysctl tunable, commit
42fdcd9fd917 removed a duplicate sample rate entry from that list, which
inadvertently broke sample rate selection at runtime. Implement sample
rate selection in a way that works for any order in the device config
list.

Reported by:	Lexi Winter <lexi@le-fay.org>
MFC after:	1 week
Reviewed by:	christos
Differential Revision:	https://reviews.freebsd.org/D44051

(cherry picked from commit a9341f0f0ae01b4d249dbf3bacfa420152c46aef)
2024-03-04 01:38:58 +01:00
Konstantin Belousov
7f387adb69 ipsec esp: avoid dereferencing freed secasindex
(cherry picked from commit 1a56620b7958cac2b9048589cb730c46958ab539)
2024-03-04 02:27:17 +02:00
Stefan Schlosser
38a5635de9 md5.1: Fix an example
The last example in the manpage md5(1) wants to demonstrate
GNU mode (md5sum), but uses BSD mode (md5) instead:

In GNU mode, the -c option does not compare against a hash string
passed as parameter. Instead, it expects a  digest file,
as created under the name digest for /boot/loader.conf in
the example above.

PR:	276560
Reviewed by:	mhorne
Differential Revision:	https://reviews.freebsd.org/D44098

(cherry picked from commit 865baeaf1abeb14327ad6a4a1f8ce722e242ff73)
2024-03-03 18:49:10 +01:00
Stefan Schlosser
ee0ffe0e3e nvmecontrol.8: Fix the SYNOPSIS section
The manpage of nvmecontrol(8) has the following SYNOPSIS:

nvmecontrol format [-f fmt] [-m mset] [-o pi] [-l pil] [-E]
[-C] <device-id | namespace-id>

The correct switch for the pi option is -p according
to sbin/nvmecontrol/format.c:

OPT("pi", 'p', arg_uint32, opt, pi, "Protective information")

So correct the SYNOPSIS section accordingly.

PR:	276554
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D44099

(cherry picked from commit 77f6c0ce92888d047d91e87b931242403764902b)
2024-03-03 18:48:51 +01:00
Gordon Bergling
6cf569e659 carp(4): Fix a typo in a source code comment
- s/successfull/successful/

(cherry picked from commit 6bce41a38e32decbce80bb1586cdd9400c83eb97)
2024-03-03 18:48:32 +01:00
Gordon Bergling
cdadccec76 dumprestore.h: Fix typos in source code comments
- s/dumpped/dumped/

(cherry picked from commit 8f87d402e32178974038212fbf4b1564447df0e0)
2024-03-03 18:48:14 +01:00
Gordon Bergling
4d8cc5b78f bxe(4): Fix two typos in a kernel messages
- s/successfull/successful/

MFC after:	3 days

(cherry picked from commit e2f36496136975d4b591b230a71986f1508629c1)
2024-03-03 18:47:24 +01:00
Gordon Bergling
61408fbd36 vge(4): Fix a typo in a source code comment
- s/opration/operation/

(cherry picked from commit 04d5a8ae04013fd34e3bde5e401b6eaff46ac9c2)
2024-03-03 18:47:06 +01:00
Dmitry Lukhtionov
2d694deca9 snd_hda: Add patches for the Lenovo Ideapad 330-15 and ThinkPad X230
PR:		259640
MFC after:	2 weeks
Reviewed by:	delphij, markj
Differential Revision:	https://reviews.freebsd.org/D43804

(cherry picked from commit 5968e477a560406c480d78ebe438a04f57121119)
2024-03-03 14:18:02 +01:00
Konstantin Belousov
8a7d5d73b8 libc/sys: add errno test
(cherry picked from commit 32fdcff8703da6f2795193acc77ec3c1fb8b723d)
2024-03-02 07:05:05 +02:00
Eugene Grosbein
22f11923c6 mkimg.1: add new PARTITION SPECIFICATION section
The specification follows a commentary to the function parse_part()
in the source code and the code itself.

(cherry picked from commit d1797fb5bbaeb212501a72b916d647fb2e021d50)
2024-03-01 21:47:33 +07:00
Konstantin Belousov
acb407522c sigsys test: correct count of delivered signals
(cherry picked from commit 09dd7240acf1fc50061246013ce318404d70c4e0)
2024-03-01 06:12:02 +02:00
Rick Parrish
e38dee6120 posixmqcontrol(1): manage posix message queues
(cherry picked from commit 0112f8c4a88e75342bdb6b9815fa220c5f645aa0)
2024-03-01 06:12:02 +02:00
Konstantin Belousov
b2c9d403d5 fs/msdosfs fatblock: use ulmin() rather than min()
PR:	277237

(cherry picked from commit 0085afdceb17cb7d4e41f9073299f688372c6a0f)
2024-03-01 06:12:02 +02:00
Wei Hu
dda1c30ffe mana: fix leaking pci resource problem detaching mana deivces
Fixing the error messages when detaching the mana gdma devices
showed in dmesg: "Device leaked memory resources".

Reported by:	NetApp
MFC after:	3 days
Sponsored by:	Microsoft

(cherry picked from commit 47e99e5bc5bcfa621fe6a3e62386f227c47e8cff)
2024-02-29 06:37:23 +00:00
Ed Maste
8d22744f5b kern: fix panic with disabled ttys
PR: 277240, 277329
Reviewed by: kib (earlier version)
Fixes: f1d0a0cbecf2 ("jail: Fix information leak.")
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D44086

(cherry picked from commit 975d7730828a8bde28c2a0092b6e95c4c4e22f34)
2024-02-28 19:29:13 -05:00
Konstantin Belousov
38595c9d73 linux_pwd_onexec: do not abort image activation if emul path does not exist
(cherry picked from commit 99fa799a19abeb70b1034f65407c276b64709bdc)
2024-02-29 02:24:06 +02:00
Konstantin Belousov
11137153ab fdlopen(3): do not create a new object mapping if already loaded
PR:	277169

(cherry picked from commit 452c5e9995ab4cd6c7ea230cffe0c53bfa65c1ab)
2024-02-29 02:24:06 +02:00
Konstantin Belousov
0a246310f7 rtld: remove pointless "extern"
(cherry picked from commit 180df764c4ee570850deb4a910a11780ec3316df)
2024-02-29 02:24:06 +02:00
Gordon Bergling
d197693001 ls.1: Mention CLICOLOR environment variable
Mention CLICOLOR environment variable in the manual page.

PR:	276556
Submitted by:	bsdcode at disroot dot org
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43970

(cherry picked from commit ffea732c5192070a6877409428b0a2cc1728aa16)
2024-02-28 13:48:42 +01:00
Warner Losh
fa399b889f ls: Fix -v and associated test
The cleanup of d854370fa86b7 had a cut and paste error (so f_verssort
was set to 1 and then to 0 rather thame f_timesort being set to 0).

Fixes: d854370fa86b7
Sponsored by: Netflix

(cherry picked from commit ef75877fc2d93199aab2b509089136c433af1f20)
2024-02-28 13:47:33 +01:00
Alexander Ziaee
ff86c97bfa ls: versort incompatible w/ timesort and sizesort
ls.1: versort incompatible w/ timesort and sizesort

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/825

(cherry picked from commit d854370fa86b74527e57145955b1fa3ca75643a2)
2024-02-28 13:47:08 +01:00
Jens Schweikhardt
e6c0ce9e37 Correct the grammo in "will underlined".
(cherry picked from commit 4fc08109fe32264485a54a7ea45f4ec09a8fcf86)
2024-02-28 13:40:51 +01:00
Gordon Bergling
72d897c7f4 tcp_rack.4: Fix a link in the SEE ALSO section
The URL of the paper at arxiv.org has changed so link the
PDF-file directly.

(cherry picked from commit 6e9a71706906b86e627cfdd27bc37b88a796f46e)
2024-02-28 13:37:07 +01:00
Gordon Bergling
e7b055efa7 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

(cherry picked from commit 4fb5eda6493c3dada695efbfad0a44d204b7fc5e)
2024-02-28 13:36:49 +01:00
Richard Scheffenegger
f3f559705a tcp: cubic - restart epoch after RTO
This is a migitation to avoid sudden extreme jumps in
cwnd, as t_epoch can be very out of date after an RTO.
Per RFC9438, sec 4.8, t_epoch is to be reset whenever
cwnd grows beyond ssthresh (CC phase transitions from
slow start to congestion avoidance), to be fixed with
the upcoming cc_cubic changes.

MFC after:		3 days
Reviewed By:		cc, #transport
Sponsored by:		NetApp, Inc
Differential Revision:	https://reviews.freebsd.org/D44023

(cherry picked from commit 038699a8f18a0a651ee06b85fa1dbbee1eab56f1)
2024-02-27 12:00:56 +01:00
Richard Scheffenegger
419848219b tcp: prevent div by zero in cc_htcp
Make sure the divident is at least one. While cwnd should
never be smaller than t_maxseg, this can happen during
Path MTU Discovery, or when TCP options are considered
in other parts of the stack.

PR:			276674
MFC after:		3 days
Reviewed By:		tuexen, #transport
Sponsored by:		NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D43797

(cherry picked from commit 38983d40c18ec5705dcba19ac320b86c5efe8e7e)
2024-02-27 12:00:55 +01:00
Olivier Certner
f54344ec12
kern_racct.c: Don't compile if RACCT undefined
Just skip compiling this file if RACCT isn't defined.  This allows to
skip including headers that no code uses at all, and also to remove the
whole file's #ifdef/#endif bracketing.

Reviewed by:    markj
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit 7fa08d415283c9a0c1e2b57edfbb13d722c25735)

Approved by:        emaste (mentor)
2024-02-27 11:37:33 +01:00