Commit graph

290096 commits

Author SHA1 Message Date
John Baldwin d77f2092ce new-bus: Remove the 'type' argument from BUS_MAP/UNMAP_RESOURCE
The public bus_map/unmap_resource() API still accepts both forms, but
the internal kobj methods no longer pass the argument.
Implementations which need the type now use rman_get_type() to fetch
the value from the allocated resource.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D44129
2024-03-13 15:05:54 -07:00
John Baldwin fef01f0498 new-bus: Remove the 'type' argument from BUS_ADJUST_RESOURCE
The public bus_adjust_resource() API still accepts both forms, but the
internal kobj method no longer passes the argument.  Implementations
which need the type now use rman_get_type() to fetch the value from
the allocated resource.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D44128
2024-03-13 15:05:54 -07:00
John Baldwin 582b84cd25 pcib: Use rman_get_type in internal functions
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D44127
2024-03-13 15:05:54 -07:00
John Baldwin 3351964c5e bhnd: Use rman_get_type in bhndb_find_resource_limits
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D44126
2024-03-13 15:05:53 -07:00
John Baldwin 0ecee1602e acpi: Use rman_get_type in acpi_is_resource_managed
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D44125
2024-03-13 15:05:53 -07:00
John Baldwin 9edb8d0aed new-bus: Introduce a simpler bus API for managing resources
Remove the 'type' and 'rid' arguments from the wrapper bus API
functions (e.g. bus_release_resource) that accept a struct resource.
The "new" versions extract the 'type' and/or 'rid' from the passed in
resource object via rman_get_type and rman_get_rid.

This commit adds the new API as functions with a _new suffix.  Wrapper
macros choose between the old and new functions based on the number of
arguments provided to the macro.  This commit does not change the ABI
but can be safely MFCd to older branches so long as older kernels use
rman_set_type when allocating resources.

Future commits will push the removal of these extraneous arguments
through the bus implementation.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D44124
2024-03-13 15:05:53 -07:00
John Baldwin 1b9bcffff3 sys: Set the type of allocated bus resources
Use rman_set_type to set the type of allocated resources everywhere
rman_set_rid is currently called.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D44123
2024-03-13 15:05:53 -07:00
John Baldwin b30a80b655 rman: Add rman_get/set_type
This permits associating a resource type (e.g. SYS_RES_MEMORY) with a
struct resource.

I considered adding a new field to struct rman to store the type and
only providing rman_get_type as an accessor.  However, changing
'struct rman' is an ABI breakage.  I might revisit this in main, but
the current approach is MFC'able.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D44122
2024-03-13 15:05:53 -07:00
Richard Scheffenegger 85df11a1de ktls: deep copy tls_enable struct for in-kernel tcp consumers
Doing a deep copy of the keys early allows users of the
tls_enable structure to assume kernel memory.
This enables the socket options to be set by kernel threads.

Reviewed By:	#transport, tuexen, jhb, rrs
Sponsored by:	NetApp, Inc.
X-NetApp-PR:	#79
Differential Revision:	https://reviews.freebsd.org/D44250
2024-03-13 13:23:13 +01:00
Brooks Davis bf8a3a816d libc/softfloat: we don't export _fp[gs]et* symbols
Remove attempts to use NetBSD __weak_alias macros to export _-prefixed
versions of various fp[sg]et* symbols under softfloat.  __weak_alias
isn't defined so we didn't export them and thus the Symbol.map entries
were wrong.

Reviewed by:	jhibbits
Differential Revision:	https://reviews.freebsd.org/D44327
2024-03-13 20:35:41 +00:00
John Baldwin f980f48f13 Revert "new-bus: Disable assertions for rman mismatches for activate/deactivate"
With recent fixes to the ACPI and pcib drivers to translate mapping
requests of child resources into mappings of sub-ranges of parent
resources these assertions should now be true.

This reverts commit ed88eef140.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43691
2024-03-13 13:19:10 -07:00
Brooks Davis ccf4d5eed2 lib{c,sys}: fix powerpcspe build
libsys/powerpc/Symbol.sys.map was removed due to all symbols moving to
libc.

Fixes:		d7847a8d35 lib{c,sys}: return wrapped syscall APIs to libc
2024-03-13 20:09:41 +00:00
Gleb Smirnoff e4315bbc85 tcp: move struct tcp_ifcap declaration under _KERNEL
Reviewed by:		rscheff, tuexen, kib
Differential Revision:	https://reviews.freebsd.org/D44340
2024-03-13 12:14:18 -07:00
Brooks Davis d7847a8d35 lib{c,sys}: return wrapped syscall APIs to libc
These provide standard APIs, but are implemented using another system
call (e.g., pipe implemented in terms of pipe2) or are interposed by the
threading library to support cancelation.

After discussion with kib (see D44111), I've concluded that it is
better to keep most public interfaces in libc with as little
as possible in libsys.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44241
2024-03-13 18:36:02 +00:00
Brooks Davis ef5fddd344 libsys: make __libsys_interposing static
Access __libsys_interposing with __libc_interposing_slot() in all
cases to support a move of these wrappers back to libc.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44239
2024-03-13 17:31:48 +00:00
Brooks Davis f7dbbbd176 libsys: don't expose sigwait wrapper
Long ago (e129c18a83) __sys_sigwait was wrapped to prevent sigwait()
from returning with EINTR.  Through a series of changes this wrapper
become __libc_sigwait which was internal to libc and used solely in the
interposing table.  To support a move of sigwait back to libc, move this
wrapper into libsys and rename it with an __libsys_ prefix.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44238
2024-03-13 17:04:07 +00:00
Brooks Davis a3a4bea49c libc: remove remnants of __fcntl_compat
Reviewed by:	kib
Fixes:		60b2e2d3ee libc: stop exposing __fcntl_compat
Differential Revision:	https://reviews.freebsd.org/D44326
2024-03-13 16:52:49 +00:00
Bjoern A. Zeeb 906521f817 LinuxKPI: 802.11: return proper value for IEEE80211_CRYPTO_AES_CCM
In case of LKPI_80211_HW_CRYPTO we convert from LinuxKPI cipher_suites
to net80211 ic_cryptocaps fields. For WLAN_CIPHER_SUITE_CCMP we
accidentally returned the bit number instead of the shifted value
which leads to ieee80211_crypto_newkey() setting IEEE80211_KEY_SWCRYPT,
which in turned lead to us trying to decode the frame again despite
HW had already done it.  This was found out of a discussion in D43634.

MFC after:	3 days
Reviewed by:	cc, adrian
Differential Revision: https://reviews.freebsd.org/D44208
2024-03-12 22:59:11 +00:00
Bjoern A. Zeeb f254aad33d ath_hal/ar9300: allow JUPITER cards to read eeprom
Summary:
In ar9300_eeprom_read_word() also allow JUPITER cards read the eeprom
instead of returning an error.  While this will not help all the
9462, 9485, 9565 OEM cards to work, it will make debugging of the
next steps a lot easier.

While here fix a typo in the error message if we do not get CAL.

PR:		255337
Tested by:	John Nielsen (john jnielsen net)
Reviewed by:	adrian
Differential Revision: https://reviews.freebsd.org/D44328
2024-03-12 21:56:56 +00:00
Brooks Davis 8f86c10821 libthr: restore _pthread_cond_timedwait
The function was renamed to _thr_cond_timedwait in commit 0ab1bfc7b2
and for some reason did not get the same __weak_reference treatment as
other _pthread_cond symbols.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44244
2024-03-12 21:03:14 +00:00
Dag-Erling Smørgrav b53ae8a833 ping: Fix protocol selection with NOINET6 kernel.
A missing else caused the correct resolver hint (AF_INET) to be
overwritten with AF_UNSPEC when the kernel supports IPv4 but not
IPv6.

MFC after:	3 days
PR:		277592
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D44304
2024-03-12 20:40:36 +01:00
Cy Schubert 937a005585 sqlite3: Vendor import of sqlite3 3.45.1
Release notes at https://www.sqlite.org/releaselog/3_45_1.html.

Obtained from:  https://www.sqlite.org/2024/sqlite-autoconf-3450100.tar.gz
MFC after:	1 week

Merge commit '1e59a00476c9801952e7319719fcdb095a0cd007' into main
2024-03-12 10:06:50 -06:00
Eugene Grosbein 7f0dc6e2cd mkimg(1): process non-seekable output gracefully
mkimg may make severe load only to fail in the end
if output is non-seekable pipe, socket or FIFO
unless output format is raw disk image.

Check it out and fail early. Make it clear in the manual.

MFC after:	1 week
2024-03-12 23:00:21 +07:00
Warner Losh 5b35479e3e RELNOTES: Add awk update from 2 weeks ago.
Sponsored by:		Netflix
2024-03-12 09:24:39 -06:00
Gordon Bergling f3343fe4a6 md5.1: Fix the GNU mode example when using a digest file
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, des
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D44098
2024-03-12 15:44:48 +01:00
Cy Schubert 1e59a00476 sqlite3: Vendor import of sqlite3 3.45.1
Release notes at https://www.sqlite.org/releaselog/3_45_1.html.

Obtained from:  https://www.sqlite.org/2024/sqlite-autoconf-3450100.tar.gz
2024-03-12 07:54:12 -06:00
Randall Stewart e18b97bd63 Update to bring the rack stack with all its fixes in.
This brings the rack stack up to the current level used at NF. Many fixes
and improvements have been added. I also add in a fix to BBR to deal with
the changes that have been in hpts for a while i.e. only one call no matter
if mbuf queue or tcp_output.

It basically does little except BBlogs and is a placemark for future work on
doing path capacity measurements.

With a bit of a struggle with git I finally got rack_pcm.c into place (apologies
for not noticing this error). The LINT kernel is running on my box now .. sigh.

Reviewed by: tuexen, glebius
Sponsored by: Netflix Inc.
Differential Revision:https://reviews.freebsd.org/D43986
2024-03-12 07:55:02 -04:00
Sumit Saxena 835b12a5f9 mrsas: don't reference the removed physical disk of RAID1 during IO submission
When a physical disk(PD) [belonging to a RAID1 Virtual disk(VD)] is
removed, driver may still use the reference to the removed PD while submitting
IO to the controller. Controller firmware faults upon receipt of such IO.
This patch fixes this issue by not using any reference to the removed PD.

Reviewed by:	imp
Approved by:	imp
Sponsored by:	Broadcom Inc
Differential Revision:	https://reviews.freebsd.org/D44282
2024-03-12 09:51:48 +00:00
Warner Losh 7a0a6b276c libc: Move tzset.3 to stdtime
This really belongs in stddime, since it documents interfaces
implemented in stdtime.

Suggested by:	brooks
Sponsored by:	Netflix
2024-03-11 22:19:31 -06:00
Warner Losh a34940a975 timezone: Move to the XSI/POSIX definition for timezone.
The old timezone(3) function has long since been obsolete and has a
fatally flawed interface. Retain this function for compatibility
purposes, but shift to providing the offset from UTC in the timezone
variable, whether or not the timezone observes summer time in the
'daylight' variable. Document the tzname variable that's already been
set. Also make _tztab() static. It's not used in libc (or anywhere in
the tree) and it's not exported as a public dynamic symbol.

Sponsored by:		Netflix
Reviewed by:		brooks, kib
Differential Revision:	https://reviews.freebsd.org/D44281
2024-03-11 22:19:31 -06:00
Gleb Smirnoff 7b133b34f8 vmm: fix standalone module build 2024-03-11 17:59:03 -07:00
Warner Losh 462af7676b kboot: kbootfdt: fix error handling
If we are able to open /sys/firmware/fdt, but aren't able to read it,
fall back to /proc/device-tree. Remove comment that's not really true,
it turns out.

Sponsored by:		Netflix
2024-03-11 15:21:52 -06:00
Warner Losh d75524b3fe kboot: Use is_linux_error to check mmap return error
Rather than checking against the (incorrect) -511, use the
is_linux_error() function to check to see if host_mmap failed.

Sponsored by:		Netflix
2024-03-11 15:21:52 -06:00
Warner Losh a9cd3b675e kboot: Print UEFI memory map
If we can read the UEFI memory map, go ahead and print the memory map.
While the kernel prints this with bootverbose, having it at this stage
is useful for debugging other problems.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D44287
2024-03-11 15:21:52 -06:00
Warner Losh d650c3efb6 kboot: hostfs -- check for llseek failure correctly
The host_* syscalls are all raw Linux system calls, not the POSIX
wrappers that glibc / musl create. So we have to ranage change the
return value of host_llseek correctly to use the negative value hack
that all Linux system calls use.

This fixes a false positive error detection when we do something like
lseek(fd, 0xf1234567, ...); This returns 0xf1234567, which is a negative
value which used to trigger the error path.  Instead, we check using the
is_linux_error() and store the return value in a long. Translate that
errno to a host errno and set the global errno to that and return
-1. lseek can't otherwise return a negative number, since it's the
offset after seeking into the file, which by definition is positive.

This kept the 'read the UEFI memory map out of physical memory' from
working on aarch64 (whose boot loader falls back to reading it since
there are restrictive kernel options that can also prevent it), since
the physical address the memory map was at on my platform was like
0xfa008018.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D44286
2024-03-11 15:21:51 -06:00
Warner Losh 8b1925f29c kboot: Avoid UB in signed shift
offset is signed. Copy it to the unsigned res before shifting. This
avoids any possible undefined behavior for right shifting signed
numbers. No functional change intended (and the code generated is the
nearly same for aarch64).

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D44285
2024-03-11 15:21:51 -06:00
Warner Losh 3ae18fdfbc kboot: Create function for error checking.
Linux has the convention of returning -ERRNO to flag errors from its
system calls. Sometimes other negative values are returned that are
success...  However, only values -1 to -4096 (inclusive) are really
errors. The rest are either truncated values that only look negative (so
use long instead of int), or are things like addresses or legal unsigned
file offsets or similar that are successful returns. Filter out the
latter.

Sponsored by:		Netflix
2024-03-11 15:21:51 -06:00
Brooks Davis c112243f6b Revert "Update to bring the rack stack with all its fixes in."
This commit was incomplete and breaks LINT kernels.  The tree has been
broken for 8+ hours.

This reverts commit f6d489f402.
2024-03-11 20:28:24 +00:00
Marek Zarychta 16f8d88294 netlink: fix route protocol constant values to match Linux
Although these particular constants aren't supported, the incorrect
values break bird 2.15 operation.

PR:		277618
Reported by:	Ondrej Zajicek <santiago@crfreenet.org>
2024-03-11 08:50:46 -07:00
Gleb Smirnoff 55951611e4 tests/unix_seqpacket: mk_pair_of_sockets() requires a valid argument
All callers do it right.  Don't be overprotective against a stupid
caller and thus don't look like a code that leaks a resource.

Reported by:	Coverity Scan
CID:		1539210
2024-03-11 07:50:29 -07:00
Dag-Erling Smørgrav 59c8e88e72 Add 'contrib/libdiff/' from commit '9eb461aa4b61ab47855b2cee9e5b626a76888b5e'
git-subtree-dir: contrib/libdiff
git-subtree-mainline: f6d489f402
git-subtree-split: 9eb461aa4b

Reviewed by:	imp
Sponsored by:	Klara, Inc.
2024-03-11 14:48:08 +01:00
Randall Stewart f6d489f402 Update to bring the rack stack with all its fixes in.
This brings the rack stack up to the current level used at NF. Many fixes
and improvements have been added. I also add in a fix to BBR to deal with
the changes that have been in hpts for a while i.e. only one call no matter
if mbuf queue or tcp_output.

Note there is a new file that I can't figure out how to get in rack_pcm.c

It basically does little except BBlogs and is a placemark for future work on
doing path capacity measurements.

Reviewed by: tuexen, glebius
Sponsored by: Netflix Inc.
Differential Revision:https://reviews.freebsd.org/D43986
2024-03-11 07:36:54 -04:00
Dimitry Andric 96c567f972 Add space before 20240211 entry in ObsoleteFiles.inc 2024-03-10 12:36:28 +01:00
Jason A. Harmening 6c8ded0015 unionfs: accommodate underlying FS calls that may re-lock
Since non-doomed unionfs vnodes always share their primary lock with
either the lower or upper vnode, any forwarded call to the base FS
which transiently drops that upper or lower vnode lock may result in
the unionfs vnode becoming completely unlocked during that transient
window.  The unionfs vnode may then become doomed by a concurrent
forced unmount, which can lead to either or both of the following:

--Complete loss of the unionfs lock: in the process of being
  doomed, the unionfs vnode switches back to the default vnode lock,
  so even if the base FS VOP reacquires the upper/lower vnode lock,
  that no longer translates into the unionfs vnode being relocked.
  This will then violate that caller's locking assumptions as well
  as various assertions that are enabled with DEBUG_VFS_LOCKS.

--Complete less of reference on the upper/lower vnode: the caller
  normally holds a reference on the unionfs vnode, while the unionfs
  vnode in turn holds references on the upper/lower vnodes.  But in
  the course of being doomed, the unionfs vnode will drop the latter
  set of references, which can effectively lead to the base FS VOP
  executing with no references at all on its vnode, violating the
  assumption that vnodes can't be recycled during these calls and
  (if lucky) violating various assertions in the base FS.

Fix this by adding two new functions, unionfs_forward_vop_start_pair()
and unionfs_forward_vop_finish_pair(), which are intended to bookend
any forwarded VOP which may transiently unlock the relevant vnode(s).
These functions are currently only applied to VOPs that modify file
state (and require vnode reference and lock state to be identical at
call entry and exit), as the common reason for transiently dropping
locks is to update filesystem metadata.

Reviewed by:	olce
Tested by:	pho
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D44076
2024-03-09 19:54:04 -06:00
Jason A. Harmening d56c175ac9 uipc_bindat(): Explicitly specify exclusive locking for the new vnode
When calling VOP_CREATE(), uipc_bindat() reuses the componentname
object from the preceding lookup operation, which is likely to specify
LK_SHARED.  Furthermore, the VOP_CREATE() interface technically only
requires the newly-created vnode to be returned with a shared lock.
However, the socket layer requires the new vnode to be locked exclusive
and asserts to that effect.

In most cases, this is not a practical concern because most if not
all base-layer filesystems (certainly FFS, ZFS, and msdosfs at least)
always return the vnode locked exclusive regardless of the lock flags.
However, it is an issue for unionfs which uses cn_lkflags to determine
how the new unionfs wrapper vnode should be locked.  While it would
be easy enough to work around this issue within unionfs itself, it
seems better for the socket layer to be explicit about its locking
requirements when issuing VOP_CREATE().

Reviewed by:		kib, olce
MFC after:		2 weeks
Differential Revision:	https://reviews.freebsd.org/D44047
2024-03-09 19:48:02 -06:00
Jason A. Harmening fa26f46dc2 vn_lock_pair(): allow lkflags1/lkflags2 to be 0 if vp1/vp2 is NULL
It's a bit strange to require the caller to pass contrived lock flags
if the corresponding vnode is NULL, simply to appease the assertion
that exactly one of LK_SHARED or LK_EXCLUSIVE must be set.  On the
other hand, we still want to catch cases in which completely bogus
or corrupt flags are passed even if the corresponding vnode is NULL.
Therefore, specifically allow empty flags for lkflags1/lkflags2 iff
the respective vp1/vp2 param is NULL.

Reviewed by:		kib, olce
MFC after:		2 weeks
Differential Revision:	https://reviews.freebsd.org/D44046
2024-03-09 19:41:45 -06:00
Konstantin Belousov bdf1587a49 mount_nullfs(8): fix typo
Reported by:	mckusick
2024-03-09 23:18:39 +02:00
Mark Johnston a58813fd70 ktrace: Fix the build when options KTRACE is not configured
MFC after:	1 week
Reported by:	John Nielsen <lists@jnielsen.net>
2024-03-09 00:33:55 -05:00
Mark Johnston cce4979133 ktrace: Add __ktrace_used
This suppresses warnings about write-only variables when the KTRACE
option is disabled, akin __diagused and __witness_used.

MFC after:	1 week
2024-03-09 00:33:55 -05:00
Kyle Evans 6e2cfb24ee crunchgen: slap a dependency on the generated makefile for .lo
crunchgen generates a foo.lo for each binary it will end up crunching
into the final product.  While they have a dependency on the libs that
are used to link them, nothing will force relinking if the set of libs
needed to link them is changed.  Because of this, incremental builds may
not be possible if one builds a version of, e.g., rescue/ with a broken
set of libs specified for a project -- a subsequent fix won't be rolled
in cleanly, it will require purging the rescue/ objdir.

This is a bit crude, but the foo.mk we generate doesn't actually get
regenerated all that often in practice, so a spurious relink for the
vast majority of crunched objects won't actually happen all that often.

Reviewed by:	bapt, emaste, imp
Differential Revision:	https://reviews.freebsd.org/D43869
2024-03-08 20:01:25 -06:00