Commit graph

289688 commits

Author SHA1 Message Date
Gleb Smirnoff 0c3ade2cf1 nextboot: fix nextboot -k on ZFS
zfsbootcfg(1) expects pool name to operate on, not currently mounted
filesystem name.

Fixes:	fd6d47375a
2024-02-19 19:51:22 -08:00
Gleb Smirnoff 3aefe67596 nextboot: fix typo that merged two args into one
Fixes:	fd6d47375a
2024-02-19 19:51:22 -08:00
Kirk McKusick b241767f8e 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
MFC after:   1 week
2024-02-19 16:17:05 -08:00
Xin LI aea57ebcb1 zlib: use more memory for a small deflate speedup.
The LIT_MEM option uses slightly more memory (for base gzip(1),
about 16kiB; according to the author, about 6% for default deflate
settings) for a small speedup.

The performance gain is more noticeable for input data with higher
entropy and less significant for data that is highly compressible,
such as source code and logs.

MFC after:	1 month
2024-02-19 15:01:04 -08:00
Brooks Davis eb90239d08 lib{c,thr}: add DT_RUNPATH for gcc -m32
To allow gcc -m32 to work, link libc and libthr with --rpath-/usr/lib32.
When called with -m32, gcc is currently unable to communicate to
the bfd linker that it should look in /usr/lib32 to resolve needed (as
opposed to explicitly linked) libraries so we need to provide a hint.

See also: https://sourceware.org/bugzilla/show_bug.cgi?id=31395

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D43910
2024-02-19 22:44:08 +00:00
Brooks Davis 99ea675731 lib{c,sys}: move auxargs more firmly into libsys
Continue to filter the public interface (elf_aux_info()), but entierly
relocate the private interfaces (_elf_aux_info(),
__init_elf_aux_vector(), and __elf_aux_vector) to libsys.

This ensures that rtld updates the correct (only) copy of
__elf_aux_vector.  After 968a18975a
updates were confused and __getosreldate was failing, causing
the system to fall back to compat compat12 syscalls in some cases.

Return to explicitly linking libc to libsys and link libthr with libc
and libsys (in that order).

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D43910
2024-02-19 22:44:08 +00:00
Warner Losh ef75877fc2 ls: Fix -v and associated test
The cleanup of d854370fa8 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: d854370fa8
Sponsored by: Netflix
2024-02-19 09:50:04 -07:00
Olivier Certner bcaa0b4c2b
umtxvar.h: Add missing include
Necessary to have the definition of 'struct timespec'.

No functional change.

Approved by:        markj (mentor)
MFC after:          3 days
Sponsored by:       The FreeBSD Foundation
2024-02-19 17:41:34 +01:00
Olivier Certner 6a3c02bc52
sched: sched_switch(): Factorize sleepqueue flags
Avoid duplicating common flags for the preempted and non-preempted
cases, making it clear that they are the same without resorting to
formatting.

No functional change.

Approved by:        markj (mentor)
MFC after:          3 days
Sponsored by:       The FreeBSD Foundation
2024-02-19 17:37:19 +01:00
Bojan Novković 849599e28a committers-src: Add bnovkov@ with markj@ and jhb@ as mentors
Add mentorship information for bnovkov@.

Approved by:  markj (mentor)
Differential Revision: https://reviews.freebsd.org/D43963
2024-02-19 16:55:31 +01:00
Gordon Bergling 94fc800f5b net80211: Fix two typos in kernel messages
- s/defered/deferred/

MFC after:	5 days
2024-02-19 12:08:07 +01:00
Gordon Bergling f24c816daa iov.h: Fix a typo in a source code comment
- s/subystem/subsystem/

MFC after:	3 days
2024-02-19 12:02:57 +01:00
Andriy Gapon 8f374fa528 ugen: fix USB_IFACE_DRIVER_ACTIVE after detaching a driver
Previosuly, USB_IFACE_DRIVER_ACTIVE would report that the driver is
active even after it detached.  That's because a device(9) still
remains.

So, add device_is_alive(9) check for more accurate reporting.

Reviewed by:	markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D43960
2024-02-19 12:44:00 +02:00
Andriy Gapon b7dce5b8e9 scsi_da: add 4K quirks for Samsung SSD 860 and 870
Although the actual flash page size is either 8K or 16K for those
devices (according to different sources of various reliability), they
seem to be optimized for the "industry-standard" emulated 4K block size.

To do: consolidate very similar Samsung SSD entries for 830 - 870
models.

MFC after:	2 weeks
2024-02-19 12:16:47 +02:00
Andriy Gapon c01af41c3c ata_da: add quirk to disable NCQ TRIM for Samsung 860/870 SSDs
NCQ TRIM for Samsung 860/870 SSDs results in data corruption on systems
with some SATA controllers.

This can be easily reproduced using ZFS which uses TRIM and is able to
detect block content changes.

Linux bug report for this issue:
 https://bugzilla.kernel.org/show_bug.cgi?id=201693

Since at present we can not limit a quirk based on the contorller / SIM,
apply the quirk in all cases.

Reviewed by:	imp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D43961
2024-02-19 12:08:12 +02:00
Boris Lytochkin 03cc3489a0 ndp(8): increase buffer size in rtsock mode
On a router with many connected devices (~10k+) `ndp -an` can fail
with ENOMEM because of some additional NDP records were added
between sysctl() buffer size estimate and data fetch calls.

Allocate more space based on size estimate: 1/64 (~2%) of additional
space, but not less that 4 m_rtmsg structures.

Obtained from:	Yandex LLC
MFC after:	2 weeks
Sponsored by:	Yandex LLC
Differential Revision:	https://reviews.freebsd.org/D43956
2024-02-19 10:44:52 +03:00
Warner Losh a6cef61766 ada: Another NCQ Trim instability drive
The Seagate IronWolf 110 SATA SSD drive has been reported to be unstable
with NCQ trim enabled.

PR: 264139
Sponsored by:		Netflix
2024-02-18 22:18:38 -07:00
Muhammad Moinur Rahman da9cd485d0
crontab/crontab.1: Fix crontab path in man
In FreeBSD the crontabs are stored in /var/cron/tabs directory and not
in /var directory.

Approved by:	kevans
Differential Revision:	https://reviews.freebsd.org/D43181
2024-02-19 00:56:16 +01:00
Muhammad Moinur Rahman 65190700cb
release/tools: Add support for building armv7 vm
Currently there is no support for generating armv7 vm images in the
release artifacts. In fact in terms of release artifacts and
architecture there is no good reason to have a vm release artifact for
armv7 as those are mostly used in SOCs or embedded boards. However
considering that developers actually do need an easy way to test armv7
with a vm running this is really important. As part of pre-commit ci for
developers this can be really helpful for the end developers.

Approved by:	cperciva, imp, re
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D43952
2024-02-19 00:49:52 +01:00
Bryan Drewery d0bf8b5aac wc: Fix SIGINFO race with casper init.
If a file is specified then fileargs_init(3) may return [EINTR]. With
the SIGINFO handler not being SA_RESTART this causes an early exit
if a SIGINFO comes in. Rather than checking for [EINTR] or changing the
handler just move it later which resolves the problem.
2024-02-18 10:57:42 -08:00
Bjoern A. Zeeb a890a3a5dd net80211: increase number of spares in struct ieee80211_vap
Turns out MFCing 713db49d06 does not
leave us with enough spares.  Given wireless will likely see more
changes in the near future add more spares.
This is especially necessary given 'struct ieee80211_vap' gets
allocated by drivers.
Bumps size of struct ieee80211_vap to (7 * 512) on 64bit.
2024-02-18 17:55:39 +00:00
Dag-Erling Smørgrav ad7bef8b89 sdiff: Fix binary case.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D43942
2024-02-18 18:39:50 +01:00
Dag-Erling Smørgrav a834edfccd sdiff: Fix --expand-tabs and --tabsize.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D43941
2024-02-18 18:39:50 +01:00
Dag-Erling Smørgrav 3cc86989bf sdiff: Misc cleanup.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D43943
2024-02-18 18:39:50 +01:00
Dmitry Lukhtionov 5968e477a5 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
2024-02-18 19:07:39 +02:00
Andriy Gapon a044cf60bd rk8xx_poweroff: add parentheses missed in 8b408fc6f2
Fixes:		8b408fc6f2
MFC after:	2 weeks
2024-02-18 18:29:00 +02:00
Jason A. Harmening a2ddbe019d 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
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D43818
2024-02-18 09:19:23 -06:00
Jason A. Harmening 2656fc29be 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.

MFC after:	2 weeks
Reviewed by:	kib, olce
Differential Revision: https://reviews.freebsd.org/D43817
2024-02-18 09:18:07 -06:00
Jason A. Harmening 9530182e37 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.

MFC after:	2 weeks
Reviewed by:	kib, olce
Differential Revision: https://reviews.freebsd.org/D43816
2024-02-18 09:16:16 -06:00
Jason A. Harmening cc3ec9f759 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
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D43815
2024-02-18 09:14:05 -06:00
Andriy Gapon 5f7312a0d7 syscon_power: do reboot after shutdown_panic is executed
A syscon_power instance can handle either poweroff or reboot, but not
both.  If the instance handles reboot then set its priority to be after
shutdown_panic.

This is to provide uniform experience with other platforms.

MFC after:	3 weeks
2024-02-18 16:38:27 +02:00
Andriy Gapon 0f354b2b58 psci: split off psci_reboot from psci_shutdown
Priority of psci_reboot set so that it is run after shutdown_panic is
executed.  This is to provide uniform experience with other platforms.

MFC after:	3 weeks
2024-02-18 16:38:27 +02:00
Andriy Gapon 8b408fc6f2 rk8xx_poweroff: enable power-cycling on support hardware
Previously, the function would return early if RB_POWERCYCLE was
specified without RB_POWEROFF.  Those flags are exclusive at the moment,
that is, they are never set together.

Søren Schmidt (sos) uses a similar but extended patch locally.

MFC after:	2 weeks
2024-02-18 16:04:29 +02:00
Andriy Gapon b98558e69b aw_gpio: temporarily switch to input function if read in eint mode
This is needed for gpiokeys driver that needs to read input state after
receiving an interrupt for either edge.

PR:		248138
MFC after:	1 month
2024-02-18 15:55:20 +02:00
Gordon Bergling 2fb174d18a sctp(4): Fix a typo in a source code comment
- s/anthing/anything/

MFC after:	3 days
2024-02-18 13:01:04 +01:00
Dag-Erling Smørgrav 1365bb722a tzcode: Fix overflow handling in TZ parser.
Obtained from:	upstream 9fc11a27
MFC after:	1 week
PR:		276281
2024-02-18 10:51:49 +01:00
Warner Losh 078a31136c boot/universe.sh: Add tests to keep MK_LOADER_BIOS_TEXTONLY working
Sponsored by:		Netflix
2024-02-17 23:29:07 -07:00
Warner Losh bbfc01c2d2 loader: Make MK_LOADER_BIOS_TEXTONLY work
Select between text-only and graphical frame buffer consoles for the
BIOS boot loader. Pull one or the other in with #ifdef in conf.c. Add
gfx_bios.c for the few routines that are needed for the BIOS support of
gfx. These are stubbed out for text-only mode. Move bi_load_vbe_data
here since it's only used for the graphical frame buffer.

Note: This setup also allows us to build multiple BIOS loaders if we
have to, some with text-only and some graphical. We don't do this today.
We may be forced to turn this on in the future if ZFS keeps growing.

The size savings is 41k, which helps a lot with some of our users that
want to enable more options in the BIOS boot loader than are normally
safe to do, and they don't need graphics.

Sponsored by: 		Netflix
Differential Revision:	https://reviews.freebsd.org/D43917
2024-02-17 23:29:07 -07:00
Warner Losh e36afddf11 loader: Add textvidc to build
Add textvidc to the build. And use -DTERM_EMU to build it.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D43915
2024-02-17 23:29:07 -07:00
Warner Losh 63e9c97664 loader: Add new option WITH_LOADER_BIOS_TEXTONLY
This option will omit all the graphics support, the teken terminal
library, video mode support, etc and support a simple, basic, text-only
video console for the x86 BIOS boot loader. It uses the FreeBSD 12
version of vidconsole.c. It defaults to NO.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D43912
2024-02-17 23:29:07 -07:00
Warner Losh 1954e5c1dc loader: bring back old text-only video console
Bring back vidconsole.c as textvidc.c from 2a0e2c88db. This console
does no graphics stuff at all, supports no fancy logos, has known bugs
in the terminal emulation, etc. However, it is small. It will be a
build-time option to select between the two. The BIOS loader is running
out of space when too many options are selected, so this allows people
to select the smaller one to spend the space elsewhere. This is only the
verbatim copy of the old vidconsole.c. It's not yet connected to the
build.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D43911
2024-02-17 23:29:07 -07:00
Xin LI 6255c67c3d MFV: zlib 1.3.1.
MFC after:	1 week
2024-02-17 22:12:51 -08:00
Warner Losh 2546c543fd reboot: Move extern for environ
envorin isn't defined in any header, and gcc is cranky with this inside
a function, so move it to global scope. Both clang and gcc are now happy
with this.

Sponsored by:		Netflix
2024-02-17 21:39:42 -07:00
Warner Losh 4d0be3986c reboot: Remove sys/types.h: it's not needed here... 2024-02-17 21:39:41 -07:00
Xin LI f4695a3026 Vendor import of zlib 1.3.1. 2024-02-17 19:43:52 -08:00
Xin LI 4543ef5166 MFV: expat 2.6.0.
MFC after:	3 days
2024-02-17 14:04:14 -08:00
Xin LI 345cf360f8 Vendor import of expat 2.6.0 2024-02-17 13:54:42 -08:00
Stefan Eßer 8b67c670a4 msdosfs: fix directory corruption after rename operation
The is a bug in MSDOSFS that can be triggered when the target of a
rename operation exists. It is caused by the lack of inodes in the
FAT file system, which are substituted by the location of the DOS 8.3
directory entry in the file system. This causes the "inode" of a file
to change when its directory entry is moved to a different location.

The rename operation wants to re-use the existing directory entry
position of an existing target file name (POS1). But the code does
instead locate the first position in the directory that provides
sufficient free directory slots (POS2) to hold the target file name
and fills it with the directory data.

The rename operation continues and at the end writes directory data to
the initially retrieved location (POS1) of the old target directory.
This leads to 2 directory entries for the target file, but with
inconsistent data in the directory and in the cached file system
state.

The location that should have been re-used (POS1) is marked as deleted
in the directory, and new directory data has been written to a
different location (POS2). But the VFS cache has the newly written
data stored under the inode number that corresponds to the initially
planned position (POS1).

If then a new file is written, it can allocate the deleted directory
entries (POS1) and when it queries the cache, it retrieves data that
is valid for the target of the prior rename operation, leading to a
corrupt directory entry (at POS1) being written (DOS file name of the
earlier rename target combined with the Windows long file name of the
newly written file).

PR:		268005
Reported by:	wbe@psr.com
Approved by:	kib, mckusick
Fixes:	   	2c9cbc2d45
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D43951
2024-02-17 22:04:49 +01:00
Dimitry Andric e368e9b756 Proactively remove /usr/lib/kgdb file that became a directory
This was already handled in ObsoleteFiles.inc (see the 20201215 entry),
but some people never run "make delete-old", or want to upgrade directly
from a revision that still had the file to the most recent revision.

They would then encounter a failure during installworld, similar to:

  install: /usr/libexec/kgdb exists but is not a directory

Therefore, clean it up in the distrib-cleanup phase, similar to the
earlier instances of libc++ header files that became a directory.

MFC after:	3 days
2024-02-17 12:27:33 +01:00
John Baldwin 61d9bd21e9 powerpc psim: Fix infinite recursion in multiple bus methods
Similar to 68a3ff0411, the default case
needs to call bus_generic_* to pass the request up the tree, not bus_*
which will just call this method again.

Fixes:		d7c16b3334 powerpc psim: Use bus_generic_rman_*
2024-02-16 23:19:06 -08:00