Commit graph

289980 commits

Author SHA1 Message Date
Brooks Davis 269593dc4a libsys/aarch64: end syscall stubs with newlines
Technically speaking, POSIX text files must end with a newline.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44231
2024-03-07 00:58:29 +00:00
Brooks Davis cec2adb0d3 heimdal: don't try to expose nonexistant symbols
For one reason or another these symbols aren't present so don't try to
make them available for linkage.

In the case of libroken these seem to be compatability bits we don't
need a thus don't compile.  For others it seems to rot upstream, but
I've not investigated deeply.

Reviewed by:	cy
Differential Revision:	https://reviews.freebsd.org/D44246
2024-03-07 00:55:11 +00:00
Brooks Davis de4386d174 heimdal: don't export nonexistant _wind_ucs2read
This symbol table entry came in with the 1.5 import (commit
7c450da7b4), but the only other mention is a commented out entry in
lib/wind/libwind-exports.def.

Reviewed by:	cy
Differential Revision:	https://reviews.freebsd.org/D44245
2024-03-07 00:54:55 +00:00
Brooks Davis 023fa553bf liblzma: don't export lzma_lz_decoder_uncompressed
It was removed in the 5.4.0 import.

Reviewed by:	delphij
Differential Revision:	https://reviews.freebsd.org/D44247
2024-03-07 00:54:22 +00:00
Brooks Davis 8c94ed9927 bsearch_b: fix compilation with gcc
Reported by:	rscheff
Differential Revision:	https://reviews.freebsd.org/D44256
2024-03-06 19:46:12 +00:00
Baptiste Daroussin 0ecf0b26a7 timerfd_create: fix after cf742faa39
Remove the include that crept in by accident
Clang complains about CLOCK_BOOTTIME being the same for now as
CLOCK_UPTIME, so remove CLOCK_BOOTTIME and leave a comment for
what to do when CLOCK_BOOTTIME will be different for real.
2024-03-06 18:28:02 +01:00
Baptiste Daroussin cf742faa39 timerfd_create: accept CLOCK_UPTIME/CLOCK_BOOTTIME
This is a common use case when using timerfd_create to actually use
it with CLOCK_BOOTTIME on linux which is CLOCK_UPTIME for us.

Note that currently on freebsd CLOCK_BOOTTIME is CLOCK_UPTIME, but the
semantic is supposed to be different, this has to be fixed later.

Tested with the fnott notification software

Reviewed by:	des, imp
Differential Revision:	https://reviews.freebsd.org/D44253
2024-03-06 18:13:33 +01:00
Dag-Erling Smørgrav 32b8aac6f9 tarfs: Factor out common test code.
MFC after:	3 days
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D44227
2024-03-06 17:14:05 +01:00
Dag-Erling Smørgrav 0118b0c8e5 tarfs: Fix checksum calculation.
The checksum code assumed that struct ustar_header filled an entire
block and calculcated the checksum based on the size of the structure.
The header is in fact only 500 bytes long while the checksum covers
the entire block (“logical record” in POSIX terms).  Add padding and
an assertion, and clean up the checksum code.

MFC after:	3 days
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D44226
2024-03-06 17:14:01 +01:00
Dag-Erling Smørgrav e212f0c066 tarfs: Remove unnecessary hack and obsolete comment.
MFC after:	3 days
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D44203
2024-03-06 17:13:57 +01:00
Dag-Erling Smørgrav c291b7914e tarfs: Avoid overflow in exthdr calculation.
MFC after:	3 days
PR:		277420
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44202
2024-03-06 17:13:54 +01:00
Dag-Erling Smørgrav 8427d94ce0 tarfs: Improve validation of numeric fields.
MFC after:	3 days
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Reviewed by:	sjg, allanjude
Differential Revision:	https://reviews.freebsd.org/D44166
2024-03-06 17:13:51 +01:00
Dag-Erling Smørgrav 38b3683592 tarfs: Fix two input validation issues.
* Reject hard or soft links with an empty target path.  Currently, a
  debugging kernel will hit an assertion in tarfs_lookup_path() while
  a non-debugging kernel will happily create a link to the mount root.

* Use a temporary variable to store the result of the link target path,
  and copy it to tnp->other only once we have found it to be valid.
  Otherwise we error out after creating a reference to the target but
  before incrementing the target's reference count, which results in a
  use-after-free situation in the cleanup code.

* Correctly return ENOENT from tarfs_lookup_path() if the requested
  path was not found and create_dirs is false.  Luckily, existing
  callers did not rely solely on the return value.

MFC after:	3 days
PR:		277360
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Reviewed by:	sjg
Differential Revision:	https://reviews.freebsd.org/D44161
2024-03-06 17:13:42 +01:00
Michael Galassi d0168b32bc vmm.4: Add verbiage about need to load module from loader.conf
PR:		277530
MFC after:	1 week
Co-authored-by:	Mateusz Piotrowski <0mp@FreeBSD.org>
2024-03-06 16:50:24 +01:00
Sumit Saxena e436cb7966 if_bnxt: Correcting the firmware package version parsing logic
The firmware package version currently appears as "Unknown" through
the sysctl interface. The parsing logic for extracting the firmware
package version from the package log has been modified to ensure
compatibility with all controllers.

Reviewed by:            imp
Approved by:            imp
Differential revision:  https://reviews.freebsd.org/D42950
2024-03-06 12:17:29 +00:00
Gordon Bergling a44658281a Revert "md5.1: Fix an example"
This reverts commit 865baeaf1a.
2024-03-06 09:34:30 +01:00
Konstantin Belousov 2ce23b1f76 libc posix_spawn(): explain why rtld can be used after fork
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2024-03-06 09:25:14 +02:00
Konstantin Belousov f8bbbce458 libthr: remove explicit sys/cdefs.h includes
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2024-03-06 09:25:13 +02:00
Konstantin Belousov ebaf907114 posix_spawn.c: fix typo in comment
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2024-03-06 09:25:02 +02:00
Alan Somers 89f4f91dbf zfsd: Use vdev prop values for fault/degrade thresholds
ZED uses vdev props for setting disk fault/degrade thresholds, this
patch enables zfsd to use the same vdev props for these same tasks.

OpenZFS on Linux is using vdev props for ZED disk fault/degrade
thresholds. Originally the thresholds supported were for io and checksum
events and recently this was updated to process slow io events as
well, see
cbe882298e

This patch enables us to use the same vdev props in zfsd as ZED uses.
After this patch is merged both OSs will use the same vdev props to set
retirement thresholds.

It's probably important to note that the threshold defaults are
different between OS. I've kept the existing defaults inside zfsd and
DID NOT match them to what ZED does.

Differential Revision: https://reviews.freebsd.org/D44043
MFC after:	2 weeks
Relnotes:	yes
Reviewed by:	asomers, allanjude
Sponsored by:	Axcient
Submitted by:	Alek Pinchuk <apinchuk@axcient.com>
2024-03-05 12:11:53 -07:00
Eugene Grosbein e333110d1d diskinfo(8): introduce new option -l
In modes -p or -s, add an option -l to start each line
with a device name separated with a tab. Update the manual page.
Add an example to list names with corresponding serial numbers:

diskinfo -ls /dev/da?

MFC after:	2 weeks
2024-03-06 00:29:04 +07:00
Sergey A. Osokin 885590b4f1 bsd-family-tree: add FreeBSD 13.3
MFC after:	3 days
2024-03-05 08:38:09 -05:00
John Baldwin e6dccf0050 .github: Switch to v4 of actions/checkout
GitHub is emitting a warning that v3 is deprecated due to using
Node.js 16.
2024-03-04 21:52:09 -08:00
Kyle Evans 47ad4f2d45 ktrace: log genio events on failed write
Visibility into the contents of the buffer when a write(2) has failed
can be immensely useful in debugging IPC issues -- pushing this to
discuss the idea, or maybe an alternative where we can set a flag like
KTRFAC_ERRIO to enable it.

When a genio event is potentially raised after an error, currently we'll
just free the uio and return.  However, such data can be useful when
debugging communication between processes to, e.g., understand what the
remote side should have grabbed before closing a pipe.  Tap out the
entire buffer on failure rather than simply discarding it.

Reviewed by:	kib, markj
Differential Revision:	https://reviews.freebsd.org/D43799
2024-03-04 23:44:09 -06:00
Kyle Evans 02c57f7b48 kdump: decode pollfd struct arrays coming from poll(2)
We'll handle these just as we do kevents, one per line with subsequent
lines indented sufficiently to distinguish them from the upcoming
return value.

Sample, with indentation stripped and revents changed to '...' in the
first one to keep the line length down:

CALL  poll(0x820610560,0x3,0)
STRU  struct pollfd[] = { { fd=0, events=0x1<POLLIN>, revents=0x11<...>
 { fd=1, events=0x4<POLLOUT>, revents=0x4<POLLOUT>}
 { fd=-1, events=0x4<POLLOUT>, revents=0} }
RET   poll 2

Reviewed by:	bapt, jhb
Differential Revision:	https://reviews.freebsd.org/D44160
2024-03-04 23:44:09 -06:00
Kyle Evans bd23e71f91 libsysdecode: add a decoder for pollfd events
We'll use this in another change to read pollfd arrays coming from a
successful poll(2) operation.

Reviewed by:	bapt, jhb
Differential Revision:	https://reviews.freebsd.org/D44159
2024-03-04 23:44:09 -06:00
Kyle Evans b5d2165b90 kern: poll: tap out the pollfd array on successful return
We do this in kern_poll() to include freebsd32 but exclude the linux
compat layer.  The ABI should be the same, but the POLL constants are
probably different or should be assumed so.

Reviewed by:	bapt, jhb
Differential Revision:	https://reviews.freebsd.org/D44158
2024-03-04 23:44:08 -06:00
John Baldwin 291079d0eb pci_host_generic: Simplify generic_pcie_translate_resource
Inline generic_pcie_translate_resource_common into its sole caller.
No functional change.

Reviewed by:	tuexen
Differential Revision:	https://reviews.freebsd.org/D44206
2024-03-04 20:53:21 -08:00
John Baldwin 332dbd3a2f pci_host_generic: Pass a valid end address in generic_pcie_translate_resource
The generic_pcie_containing_range helper added in commit d79b6b8ec2
assumed that the passed in (start, end) range used to locate the
containing mapping range was a valid address range (with end >=
start).  The previous version of
generic_pcie_translate_resource_common only used the start address to
locate a mapping range, so the end address of 0 did not matter, but an
end of 0 now causes the first range to match and an incorrect
translation for resources using a later range.

PR:		277211
Reported by:	dch, tuexen
Reviewed by:	tuexen
Fixes:		d79b6b8ec2 pci_host_generic: Don't rewrite resource start address for translation
Differential Revision:	https://reviews.freebsd.org/D44205
2024-03-04 20:52:54 -08:00
John Baldwin 364d1b2f8c imgact_elf: Add const to the checknote parameter to __elfN(parse_notes)
Reviewed by:	imp, kib
Sponsored by:	University of Cambridge, Google, Inc.
Differential Revision:	https://reviews.freebsd.org/D44215
2024-03-04 20:52:21 -08:00
Alex Richardson 169641f7dd imgact_elf: Add const to a few struct image_params pointers
This makes it more obvious which functions modify fields in this struct.

Reviewed by:	imp, kib
Obtained from:	CheriBSD
Differential Revision:	https://reviews.freebsd.org/D44214
2024-03-04 20:51:49 -08:00
Gordon Bergling 7701b99355 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
MFC after:	3 days
2024-03-05 03:03:50 +01:00
Brooks Davis 7e8e73fed5 libc: actually build bsearch_b
Fixes:		46cdc14062 Add support for some block functions ...

Reviewed by:	theraven
Differential Revision:	https://reviews.freebsd.org/D44189
2024-03-05 01:01:56 +00:00
Brooks Davis ec911a4f10 libc/locale: don't expose nonexistant __collate_load_error
The private symbol __collate_load_error was removed in 2015 in commit
2a6abeebef.  While it had previously been accidently removed in 2011
(commit 3c87aa1d3dc1a) and restored in 2012 (commit bb4317bf3c) I
think it's time to write it off after four major releases without it.

Fixes:		2a6abeebef The collate functions within libc have...

Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D44182
2024-03-05 01:00:50 +00:00
Dimitry Andric a39b3aa463 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
2024-03-04 21:31:04 +01:00
Alex Richardson 327ada0b0e imgact_elf: Add const to the header_supported callback arguments
This callback shouldn't be modifying any of the arguments.

Reviewed by:	imp, kib, emaste, jhb
Obtained from:	CheriBSD
Differential Revision:	https://reviews.freebsd.org/D44193
2024-03-04 11:52:21 -08:00
Hartmut Brandt 83550d02fe Add a missing space in a warning. 2024-03-04 20:08:25 +01:00
Mitchell Horne da48ddbf7c riscv: catch up with EARLY_PRINTF changes
On this platform early console access is possible via SBI. Follow recent
changes to EARLY_PRINTF option and give it a named constant.

Update the commented option in GENERIC so that it compiles.

Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D44100
2024-03-04 14:45:17 -04:00
Cy Schubert 84ed86380a hostapd: Work around lack of MLME support
hostap MLME uses Linux data structures and definitions not available
in FreeBSD. The ability for hostapd to select the frequency (channel)
depends Linux MLME, though strictly it's not required. Work around the
Linux MLME requirement to configure device frequency.

The detailed description is: hostapd will only set the channel (frequency)
when Linux MLME is configured. Enabling NEED_AP_MLME will result in
numerous build errors due do Linux data structures and definitions not
available under FreeBSD. The code to set the frequency from the selected
channel is only within the NEED_AP_MLME code path because without MLME,
hostapd_get_hw_features() is an inline that always returns -1 whereas with
MLME hostapd_get_hw_features() will obtain hardware features from the
kernel. Until such time we simply set the frequency as configured.

PR:		276375
MFC after:	1 month
2024-03-04 08:40:58 -08:00
Tom Coldrick d3befb534b LinuxKPI: Queue skbuffs at tail in __skb_queue_tail
Correct skb_queue_tail to queue the buffer at the tail of the skbuff.
The skbuff is a circular doubly-linked list, and we call with a pointer
to the head of the list.  Thus queueing before the head gives us a
queueing at the tail.

As a motivating factor, the current behaviour (queueing at the head) was
causing frequent kernel panics from my RTL8822BE wireless card, which
uses the rtw88 driver.  Interrupts can cause buffers to be added to the
rtwdev c2h_queue while the queue is being drained in rtw_c2h_work.
Queueing at the head would leave the nascent entry in the linked list
pointing to the old, now freed, memory for the buffer being processed.
When rtw_c2h_work is next called, we try reading this and so panic.

Reviewed by:	emaste, bz
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D44192
2024-03-04 09:33:12 -05:00
Konstantin Belousov a725a7a24d posix_spawn(3): document POSIX_SPAWN_DISABLE_ASLR_NP
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2024-03-04 03:00:39 +02:00
Konstantin Belousov 822042fdfc posix_spawn(3): add POSIX_SPAWN_DISABLE_ASLR_NP
similar to Apple _POSIX_SPAWN_DISABLE_ASLR

Reviewed by:	emaste, kevans
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D44195
2024-03-04 03:00:38 +02:00
Konstantin Belousov 80ac36c3a2 posix_spawnattr_setflags(3): validate argument
Reviewed by:	emaste, kevans
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D44195
2024-03-04 03:00:38 +02:00
Gleb Smirnoff 2f5a315b30 linux: require vnet(9) context in ifname_bsd_to_linux_name()
This function is used by netlink(9) only.  The netlink(9) taskqueue thread
runs in the vnet of the socket whose request the thread is processing
right now.  This is a correct vnet and resetting it to vnet0 is incorrect.
If the function is to be used by any other caller in addition to
netlink(9), it would be caller's responsiblity to provide correct vnet(9).

Reviewed by:		melifaro, dchagin
Differential Revision:	https://reviews.freebsd.org/D44191
PR:			277286
2024-03-03 12:56:58 -08:00
Konstantin Belousov 2496fb72cf sys/mount.h: align values of MNTK_XXX flags
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2024-03-03 07:15:12 +02:00
John F. Carr 42b117a4bd gpioevents: Fix build with newer Clang
PR:		277422
2024-03-02 10:38:04 -05:00
Konstantin Belousov 7e4ac11b60 getblkx(9): be more tolerant but also strict with the buffer size checks
It is possible that on-disk filesystem format causes allocation of
buffers of size larger than maxbcachebuf.  Currently, getblkx() and
indirectly bufkva_alloc() panic in that situation.

It is more useful to return an error instead, allowing the system to
continue running.

PR:	277414
Reported by:	Robert Morris <rtm@lcs.mit.edu>
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2024-03-02 07:02:55 +02:00
Warner Losh beadbca67b read(2): Add write cross reference
Add a write cross reference in the SEE ALSO section.

Sponsored by:		Netflix
2024-03-01 20:36:39 -07:00
Christopher Davidson 0d161f7b60 read.2: Use .Fn markup instead of .Xr for read/write calls
Udpate both write / read references from .Xr to .Fn to eliminate
self-reference cross reference.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1128
2024-03-01 20:34:10 -07:00
Brooks Davis 2956f5885c Add an UNDEFINED_VERSION option
When enabled (current default) link with --undefined-version to allow
symbol maps to contain symbols not defined by libraries.  When disabled,
link with --no-undefined-version to disallow these bugs.

WITHOUT_UNDEFINED_VERSION is currently broken.  Once it is fixed it
should be made the default and this option should likely be removed.

Reviewed by:	dim, emaste
Differential Revision:	https://reviews.freebsd.org/D44169
2024-03-01 23:22:11 +00:00