Commit Graph

282226 Commits

Author SHA1 Message Date
Ed Maste
ddf77ec392 etdump: exit on error if section header or entry offset is OOB
PR:		263663
Reported by:	Robert Morris <rtm@lcs.mit.edu>
Reviewed by:	markj
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35868
2023-03-22 09:12:45 -04:00
Peter Holm
bb1f64b200 stress2: Fix syntax error. Remove redundant backup 2023-03-22 10:05:46 +01:00
Peter Holm
e689e7facd stress2: Fix compiler warning 2023-03-22 10:05:04 +01:00
Warner Losh
ed52baf51b _endian.h: Include sys/ctypes.h for visibility macros
BYTE_ORDER, LITTLE_ENDIAN and BIG_ENDIAN will be required by the
forthcoming POSIX Issue 8. In addition, they are provided in the BSD
compilation environments. However, depending on the order includes
happend, sys/cdefs.h may or may not be included when endian.h is
included. Include it here so we can safely test __BSD_VISIBLE.  Add
visibility when we're compiling in the future for issue 8, but since the
date number for issue 8 hasn't been fixed, use strictly greater than the
issue 7 date.of 200809.

This had the side effect of sometimes (in the traditional BSD
compliation environment)
 #if BYTE_ORDER == LITTLE_ENDIAN
and
 #if BYTE_ORDER == BIG_ENDIAN
both being true because none of these were defined. This fixes
that. It also fixes including it after <stdio.h> but not before.

PR:			269249
MFC After:		1d (build related)
Reviewed by:		kib, emaste
Differential Revision:	https://reviews.freebsd.org/D39176

Sponsored by:		Netflix
2023-03-21 20:25:58 -06:00
John Baldwin
1ad3cafcd3 Remove /usr/lib/dtrace/ipfw.d for WITHOUT_DTRACE.
Reviewed by:	brooks
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D39099
2023-03-21 19:06:40 -07:00
Vincenzo Maffione
e2a431a0ff netmap: fix copyin/copyout of nmreq options list
The previous code unsuccesfully attempted to report a precise error for
each option in the user list. Moreover, commit 253b2ec199 broke some
ctrl-api-test (see https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=260547).

With this patch we bail out as soon as an unrecoverable error is detected and
we properly check for copy boundaries. EOPNOTSUPP no longer immediately
returns an error, so that any other option in the list may be examined
by the caller code and a precise report of the (un)supported options can
be returned to the user.

With this patch, all ctrl-api-test unit tests pass again.

PR:			260547
Submitted by:		giuseppe.lettieri@unipi.it
Reviewed by:		vmaffione
MFC after:		14 days
2023-03-21 23:23:18 +00:00
Jean-Sébastien Pédron
83df72e5fb
linuxkpi: Define pat_enabled()
This new <asm/memtype.h> header is included from <linux/pci.h> because
that's how it is included in Linux too. DRM drivers depend on this.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D39052
2023-03-21 23:36:40 +01:00
Ed Maste
899becbfcb tcp_wrappers: Use ANSI (c89) definitions for one more function
Fixes: 14f102eacc ("tcp_wrappers: Use ANSI (c89) function definit...")
Sponsored by: The FreeBSD Foundation
2023-03-21 16:09:13 -04:00
Mark Johnston
b4b33821fa ktls: Fix interlocking between ktls_enable_rx() and listen(2)
The TCP_TXTLS_ENABLE and TCP_RXTLS_ENABLE socket option handlers check
whether the socket is listening socket and fail if so, but this check is
racy.  Since we have to lock the socket buffer later anyway, defer the
check to that point.

ktls_enable_tx() locks the send buffer's I/O lock, which will fail if
the socket is a listening socket, so no explicit checks are needed.  In
ktls_enable_rx(), which does not acquire the I/O lock (see the review
for some discussion on this), use an explicit SOLISTENING() check after
locking the recv socket buffer.

Otherwise, a concurrent solisten_proto() call can trigger crashes and
memory leaks by wiping out socket buffers as ktls_enable_*() is
modifying them.

Also make sure that a KTLS-enabled socket can't be converted to a
listening socket, and use SOCK_(SEND|RECV)BUF_LOCK macros instead of the
old ones while here.

Add some simple regression tests involving listen(2).

Reported by:	syzkaller
MFC after:	2 weeks
Reviewed by:	gallatin, glebius, jhb
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D38504
2023-03-21 16:04:00 -04:00
Jung-uk Kim
e415d255a6 OpenSSL: Regen an assembly file for arm
X-MFC with:	af19988f6c
2023-03-21 15:13:51 -04:00
Kornel Dulęba
19a4869d66 OpenSSL: aes/asm/bsaes-armv7.pl: Replace adrl with add
"adrl" is a pseudo-instruction used to calculate an address relative
to PC. It's not recognized by clang resulting in a compilation error.
I've stumbled upon it when trying to integrate the bsaes-armv7 assmebly
logic into FreeBSD kernel, which uses clang as it's default compiler.
Note that this affect the build only if BSAES_ASM_EXTENDED_KEY is
defined, which is not the default option in OpenSSL.

The solution here is to replace it with an add instruction.
This mimics what has already been done in !BSAES_ASM_EXTENDED_KEY logic.
Because of that I've marked this as trivial CLA.

No objections from: jkim
Obtained from: OpenSSL commit 27093ba73372935fe4ef91d0a45ce6ea90a1ac8e
Differential Revision:	https://reviews.freebsd.org/D39091
2023-03-21 20:04:04 +01:00
Alexander V. Chernikov
a74998f38a netlink: reduce the default debugging levels
Reported by:	kp
MFC after:	2 weeks
2023-03-21 18:55:00 +00:00
Ed Maste
68a930d8ee lorder: add deprecation notice
lorder has not been used by the base system since 0e1e341b48 and
hasn't really been necessary for a very long time.

PR:		259254 [exp-run]
Reviewed by:	arichardson (earlier)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30080
2023-03-21 10:20:42 -04:00
Ed Maste
e9f8723c30 ldd: clarify format options
-f may be specified zero, one, or two times.  Make this clear in the
usage.

Reviewed by:	markj, kib
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34733
2023-03-21 10:14:03 -04:00
Ed Maste
14f102eacc tcp_wrappers: Use ANSI (c89) function definitions
Although this code is in contrib/ there is no active upstream.

Reviewed by:	brooks
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36047
2023-03-21 10:09:34 -04:00
Ed Maste
87bb53cb53 gvinum: correct assertions
Pointer addresses are always >= 0.  Assert that the value is >= 0
instead.

PR:		207855, 207856
Reviewed by:	imp
Reported by:	David Binderman
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D37677
2023-03-21 10:03:12 -04:00
Justin Hibbits
379e14ba6c powerpc/pmap: Account for a potential NULL pmap in pmap_sync_icache
It's apparently possible for pcpu->pc_curpmap to be NULL at some point,
leading to a panic.  Account for this as is done with the other 64-bit
AIM pmap.

Reported by:	pkubaj
Tested by:	pkubaj
Fixes:		6f0b2a235a ("Add pmap_sync_icache() for radix pmap")
MFC after:	3 days
2023-03-21 09:56:26 -04:00
David E. O'Brien
daa0b64a22 pmap_mapdev_attr() doesn't use any of its arguments. 2023-03-20 23:09:34 -07:00
Ihor Antonov
9ee1faeeba daemon: move signal setup into a function
No functional change intended.

Reviewed by:	kevans
2023-03-20 23:40:04 -05:00
Zhenlei Huang
535946ce11 if_re: Drop redundant assignments for ifq_maxlen and ifq_drv_maxlen
Fixes:	4519a073c3 Mechanically convert if_re(4) to DrvAPI
2023-03-21 12:29:24 +08:00
Rick Macklem
9432e798fc mountd.8: Update for mountd running in jails
Mountd can now be run in an appropriately
configured vnet jail.

This man page update adds some information
for this case.

This is a content change.

Reviewed by:	markj
MFC after:	3 months
Differential Revision:	https://reviews.freebsd.org/D39168
2023-03-20 15:16:03 -07:00
Jean-Sébastien Pédron
d780c6a6ab
x86/pci_early_quirks: Support Intel 11th+ gen
Newer Intel CPUs/iGPUs use a new method to determine the base address of
the stolen memory. This code was ported from Linux.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D39057
2023-03-20 21:47:36 +01:00
Jean-Sébastien Pédron
5fbfe9517b
linuxkpi: Define seq_has_overflowed() and single_open_size()
This required non-trivial changes to `linux_seq_file.c` to manage a new
`(struct seq_file)->size` field. This field is read directly by DRM
drivers, so we can't alias it to a call to sbuf_len(9).

`single_open_size()` also depended on the ability to allocate the sbuf
with a specified size instead of relying on `sbuf_new_auto()`.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D39056
2023-03-20 21:47:36 +01:00
Jean-Sébastien Pédron
1b4e08b483
linuxkpi: Support non-NULL zero-size pointers
DRM drivers set some pointers to `ZERO_SIZE_PTR` directly (without
allocating anything), to treat pointers which were "initialized" (set to
`ZERO_SIZE_PTR`) with no memory allocation like really allocated
pointers. NULL isn't used because it represents a third state.

Reviewed by:	emaste, manu
Approved by:	emaste, manu
Differential Revision:	https://reviews.freebsd.org/D39055
2023-03-20 21:47:36 +01:00
Jean-Sébastien Pédron
eef905a859
linuxkpi: Add <linux/iommu.h>
It defines a small part of the IOMMU API of Linux. We don't implement
that yet.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D39054
2023-03-20 21:47:36 +01:00
Jean-Sébastien Pédron
af19988f6c
linuxkpi: Define pcie_aspm_enabled()
This is not the same as querying the PCIE ASPM capability. The function
should return if the feature is actually enabled or not. It always
return false on FreeBSD.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D39053
2023-03-20 21:47:36 +01:00
Jean-Sébastien Pédron
19a355436e
linuxkpi: Add default_groups field to struct kobj_type
We don't use it, but it is set by the DRM drivers.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D39051
2023-03-20 21:47:35 +01:00
Jean-Sébastien Pédron
e91f5814b8
linuxkpi: Define device_iommu_mapped()
For now, it always return false.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D39050
2023-03-20 21:47:35 +01:00
Jean-Sébastien Pédron
0777b000f1
linuxkpi: Define dev_WARN() and dev_WARN_ONCE()
Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D39049
2023-03-20 21:47:28 +01:00
Mitchell Horne
99bd5c1fe3 x86: nexus code tidy-up
Make a pass at the various nexus implementations, fixing some very minor
style issues, obsolete comments, etc.

The method declaration section has become unwieldy in many respects.
Attempt to tame it by:
 - Using generated method typedefs
 - Grouping methods roughly by category, and then alphabetically.

Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D38495
2023-03-20 17:35:47 -03:00
Mitchell Horne
c514686aa0 powerpc: nexus code tidy-up
Make a pass at the various nexus implementations, fixing some very minor
style issues, obsolete comments, etc.

Update the top-level comment to be closer to other nexus
implementations.

The method declaration section has become unwieldy in many respects.
Attempt to tame it by:
 - Using generated method typedefs
 - Grouping methods roughly by category, and then alphabetically.

Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D38495
2023-03-20 17:35:47 -03:00
Mitchell Horne
abe3309e71 riscv: nexus code tidy-up
Make a pass at the various nexus implementations, fixing some very minor
style issues, obsolete comments, etc.

The method declaration section has become unwieldy in many respects.
Attempt to tame it by:
 - Using generated method typedefs
 - Grouping methods roughly by category, and then alphabetically.

Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D38495
2023-03-20 17:35:47 -03:00
Mitchell Horne
e582d4a2b0 arm64: nexus code tidy-up
Make a pass at the various nexus implementations, fixing some very minor
style issues, obsolete comments, etc.

The method declaration section has become unwieldy in many respects.
Attempt to tame it by:
 - Using generated method typedefs
 - Grouping methods roughly by category, and then alphabetically.

Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D38495
2023-03-20 17:35:47 -03:00
Mitchell Horne
c650e19495 arm: nexus code tidy-up
Make a pass at the various nexus implementations, fixing some very minor
style issues, obsolete comments, etc.

The method declaration section has become unwieldy in many respects.
Attempt to tame it by:
 - Using generated method typedefs
 - Grouping methods roughly by category, and then alphabetically.

Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D38495
2023-03-20 17:35:47 -03:00
Mark Johnston
b59f9d03cd vmrun: Expose bhyve's -G option
MFC after:	1 week
2023-03-20 16:26:54 -04:00
Mitchell Horne
c05614ac97 mi_switch(9): fix comma placement
Sponsored by:	The FreeBSD Foundation
Fixes:	175db7b582 ("mi_switch(9): update to current day")
2023-03-20 17:12:12 -03:00
Mitchell Horne
005b7c5790 Cross-reference coretemp(4) and amdtemp(4)
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2023-03-20 17:12:12 -03:00
Mitchell Horne
84a44625a5 printf(9): add MLINKS for vlog(9) and vprintf(9)
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2023-03-20 17:12:12 -03:00
Mitchell Horne
195aa533c7 hardclock(9): small cleanups
- Improve the wording that describes cnt and hz (avoid "the long haul")
 - Use .Fa for function arguments
 - Fix formatting of parenthesis around swi(9) xref
 - removed xref to non-existent options(4)
 - xref polling(4)
 - consistently list xrefs in SEE ALSO
 - xref eventtimers(9) in SEE ALSO

Reviewed by:	mav, rpokala
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39137
2023-03-20 17:12:12 -03:00
Mitchell Horne
8965b3033e callout(9): adopt old references to timeout(9)
timeout(9) was removed a couple of years ago; all consumers now use the
callout(9) interface.

Explicitly do not bump .Dd anywhere, as this is not a content or
semantic change.

Reviewed by:	markj, jhb, Pau Amma <pauamma@gundo.com>
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39136
2023-03-20 17:12:12 -03:00
Mitchell Horne
f6f8cbda8e kern_reboot(9): describe event handlers
Add more details about the execution and purpose of these shutdown
handlers. Make a point to mention the requirement that they can be run
in a normal or panic context. Add some simple examples.

Add a brief comment to the declaration in sys/eventhandler.h.

Reviewed by:	markj
Discussed with:	rpokala, Pau Amma <pauamma@gundo.com>
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39135
2023-03-20 17:12:12 -03:00
Mitchell Horne
b7caa912f9 kern_reboot(9): document shutdown_nice()
Reviewed by:	markj, Pau Amma <pauamma@gundo.com>
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39134
2023-03-20 17:12:12 -03:00
Mitchell Horne
d55c187738 kern_reboot(9): some updates
- This function no longer disables interrupts
 - MLINK to reboot.9
 - The mentions of autoconfiguration is more about shutdown_nice(),
   coming in the next commit.
 - Describe the RB_* flags relevant to this function
 - Describe behaviour when shutdown hooks fail the reset
 - Describe expected execution contexts
 - Add FF copyright
 - xref panic(9)
 - xref this page in reboot(2)

Reviewed by:	markj
Discussed with:	rpokala, Pau Amma <pauamma@gundo.com>
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39133
2023-03-20 17:12:12 -03:00
Mitchell Horne
d5e105bf7e panic(9): some updates
- Better description of what the panic() function does
 - Document KERNEL_PANICKED()
 - Add a section describing panic execution context
 - Add SEE ALSO

Reviewed by:	kib, markj, rpokala
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39132
2023-03-20 17:12:11 -03:00
Mitchell Horne
87132d1dce KASSERT(9): some updates
- Add a little bit of introductory text
 - Improve the existing example: ANSI C, use a better assertion than a
   NULL check (which is discouraged)
 - Document the widely used MPASS macro in this page
 - Drop the cross-reference to config(8)

Reviewed by:	kib, markj, rpokala, Pau Amma <pauamma@gundo.com>
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39131
2023-03-20 17:12:11 -03:00
Mitchell Horne
43db15b16a critical(9): small updates
- Document CRITICAL_ASSERT() in this man page.
 - Clarify that a thread may also handle interrupts in a critical
   section, not only faults/exceptions.
 - Note the negative effects of critical section abuse
 - Some other minor clarifications
 - Add short SEE ALSO

Reviewed by:	kib, markj, rpokala, Pau Amma <pauamma@gundo.com>
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39130
2023-03-20 17:12:11 -03:00
Mitchell Horne
b54391a1f8 vcount.9: remove obsolete man page
These functions, vcount() and count_dev(), no longer exist in the source
tree.

Reviewed by:	rpokala
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39128
2023-03-20 17:12:11 -03:00
Fedor Uporov
bb95e6fa98 Fix compilation issue, when DTRACE is not defined
PR:             270346
Reported by:    Michael Paepcke
MFC after:      2 week
2023-03-20 23:06:57 +03:00
Kyle Evans
822057bfbb pkill: tests: do a pass for case-sensitive conflicts
As in 76b6a59f9d, encode upper-case flag tests with a leading
underbar to avoid collisions (thus, erroneously dirty git repos) on
case-sensitive filesystems.

Sponsored by:	Klara, Inc.
2023-03-20 14:54:54 -05:00
Kyle Evans
3610bffd28 pkill: use an ARG_MAX size buffer for argument matching
Right now pkill/pgrep cut off at _POSIX2_LINE_MAX (2048), but argument
strings can be much larger (ARG_MAX is 256K/512K).  Stop arbitrarily
cutting the search off at 2K, rather than documenting the limit.

Reviewed by:	allanjude (earlier version), des
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D38663
2023-03-20 14:19:36 -05:00