Commit graph

289704 commits

Author SHA1 Message Date
Konstantin Belousov 8271d9b99a libsys: remove usage of pthread_once and _once_stub
that existed in auxv.c, use simple bool gate instead. This leaves a
small window if two threads try to call _elf_aux_info(3) simultaneously.
The situation is safe because auxv parsing is really idempotent. The
parsed data is the same, and we store atomic types (int/long/ptr) so
double-init does not matter.

Reviewed by:	brooks, imp
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D43985
2024-02-21 02:26:11 +02:00
Konstantin Belousov af9758deff libsys: internalize memcpy, memset, and strlcpy
Reviewed by:	brooks, imp
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D43985
2024-02-21 02:26:11 +02:00
Konstantin Belousov 180df764c4 rtld: remove pointless "extern"
Reviewed by:	brooks, imp
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D43985
2024-02-21 02:26:10 +02:00
Gleb Smirnoff e53b83a849 tests/sigsys: initialize parameter passed to sysctlbyname() 2024-02-20 14:37:45 -08:00
Gleb Smirnoff 3ac001620e tests/fdgrowtable: remove always true check
We are always the parent in this code path.
2024-02-20 14:31:06 -08:00
Gleb Smirnoff fa6a02f50e tests/fdgrowtable: open more files in the threaded case
This should fix the test failing on some machines/conditions/runs.  This
won't fix failures in standalone run, but should fix kyua(1) runs.
Currently with standalone run it will usually fail because the 40-sized
allocation is skipped (see details below).

This matches what forking test does: open 128 files in the parent and 128
in the child.  There should actually be no difference where and when the
files are open, but let's mimic the forking test, and open more files in
the spawned thread.  Also opening from two different contexts adds a bit
more entropy to the test.

What the test does it checks that fdgrowtable() has been called at least
three tmes for the test process, and the old tables are still on the free
list as long as other execution contexts exist.  Under kyua(1) control the
first call grows the table from 20 to 40, but the original table of 20 is
an embedded one, thus is not put on the free list.  Passing 40 open files
the table grows to 128 and first old table lands on the free list. Passing
128 open file the table grows to 256 and a second old table lands on the
free list.  After that the test would pass.  The threaded test was one
open file off before this fix sometimes.
2024-02-20 14:31:06 -08:00
Dag-Erling Smørgrav 702f133fa1 md5: Untabify declarations.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	imp, allanjude, markj
Differential Revision:	https://reviews.freebsd.org/D43991
2024-02-20 23:04:45 +01:00
Dag-Erling Smørgrav c05533d97a md5: Fix GNU check mode.
Fixes:		9b20849bc5
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	imp, allanjude, markj
Differential Revision:	https://reviews.freebsd.org/D43990
2024-02-20 23:04:40 +01:00
Dag-Erling Smørgrav 4db7ca2447 md5: Fix Perl mode long options.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	imp, allanjude, markj
Differential Revision:	https://reviews.freebsd.org/D43989
2024-02-20 23:04:36 +01:00
Dag-Erling Smørgrav e7308a60a5 md5: Add test case for GNU input modes.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude, markj
Differential Revision:	https://reviews.freebsd.org/D43988
2024-02-20 23:04:32 +01:00
Gleb Smirnoff 1968d71647 tests/arp: test arp -s/-S work
Install permanent entry, try to modify it, check that
net.link.ether.inet.log_arp_permanent_modify works.
2024-02-20 10:32:03 -08:00
Gleb Smirnoff 28bc1822b7 tests/arp: when checking 'arp -d' check that entry is removed
Previous check trusted the "entry was deleted" output of the command.
Improved check does additional request to make sure that entry is not
returned.
2024-02-20 10:32:03 -08:00
Gleb Smirnoff 6a3e87e130 arp: fix arp -s/-S
When setting a permanent ARP entry, the route(4) would use
rtm->rtm_rmx.rmx_expire == 0 as a flag for installing a static entry, but
netlink(4) is looking for explicit NTF_STICKY flag in the request.  The
arp(8) utility was adopted to use netlink(4) by default, but it has lots
of route-era guts internally. Specifically there is global variable 'opts'
that shares configuration for both protocols, and it is still initialized
with route(4) specific RTF_xxx flags.  In set_nl() these flags are
translated to netlink(4) parameters. However, RTF_STATIC is a flag that is
never set by default, so attempt to use it as a proxy flag manifesting
-s/-S results in losing it.  Use zero opts.expire_time as a manifest of
-s/-S operation.  This is a minimal fix.  A better one would be to fully
get rid of route(4) legacy.

The change also corrects the logic to set NUD_PERMANENT flag for
consistency.  This flag is ignored by our kernel (now).

Reviewed by:		melifaro, tuexen, emaste
PR:			277063
Fixes:			6ad73dbf65
Differential Revision:	https://reviews.freebsd.org/D43983
2024-02-20 10:31:05 -08:00
Ed Maste 9dd5023e95 iwm.4: add iwlwifi cross-reference
iwlwifi(4) supports a superset of the devices supported by iwm(4).  The
latter may be retired in the future (if there is no reason to prefer it
for the set of devices supported by both).

Sponsored by:	The FreeBSD Foundation
2024-02-20 11:47:51 -05:00
Stefan Eßer 445d3d227e msdosfs: fix potential inode collision on FAT12 and FAT16
FAT file systems do not use inodes, instead all file meta-information
is stored in directory entries.

FAT12 and FAT16 use a fixed size area for root directories, with
typically 512 entries of 32 bytes each (for a total of 16 KB) on hard
disk formats. The file system data is stored in clusters of typically
512 to 4096 bytes, depending on the size of the file system.

The current code uses the offset of a DOS 8.3 style directory entry as
a pseudo-inode, which leads to inode values of 0 to 16368 for typical
root directories with 512 entries.

Sub-directories use 2 cluster length plus the byte offset of the
directory entry in the data area for the pseudo-inode, which may be
as low as 1024 in case of 512 byte clusters. A sub-directory in
cluster 2 and with 512 byte clusters will therefore lead to a
re-use of inode 1024 when there are at least 32 DOS 8.3 style
filenames in the root directory (or 11 14-character Windows
long file names, each of which takes up 3 directory entries).

FAT32 file systems are not affected by this issue and FAT12/FAT16
file systems with larger cluster sizes are unlikely to have as
many directory entries in the root directory as are required to
cause the collision.

This commit leads to inode numbers that are guaranteed to not collide
for all valid FAT12 and FAT16 file system parameters. It does also
provide a small speed-up due to more efficient use of the vnode cache.

Approved by:	mckusick
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D43978
2024-02-20 13:02:24 +01:00
Joseph Koshy 81dc3a4d3b
tools/net80211/wlanwatch: Remove obsolete code.
The symbol NI_WITHSCOPEID has not been defined by <netdb.h> since
May 2005 (since SVN r146690).
2024-02-20 08:27:30 +00:00
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