Commit Graph

278675 Commits

Author SHA1 Message Date
Jessica Clarke
f334df7600 release: Remove remnants of pc98 support
The cons25w line was added in c991a64747 for pc98, along with reading
MACHINE in order to determine what terminal type to use for VTYs. Commit
2b375b4edd removed this condition, leaving it as always using xterm
for VTYs, but left behind the now-unused MACHINE variable and the
cons25w list entry. Clean these up to be how they were before pc98
support was added.

Note that anyone who really needs a cons25w terminal can still request
it, it's just not listed as a common option.

Reviewed by:	imp, brooks
Differential Revision:	https://reviews.freebsd.org/D36587
2022-10-03 17:09:16 +01:00
Hans Petter Selasky
0def80f1a5 time(3): Align fast clock times to avoid firing multiple timers.
In non-periodic mode absolute timers fire at exactly the time given.
When specifying a fast clock, align the firing time so that less
timer interrupt events are needed.

Reviewed by:	rrs @
Differential Revision:	https://reviews.freebsd.org/D36858
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-10-03 17:53:17 +02:00
Brad Davis
03d66186f6 bsdinstall: add hooks to allow for easier customizing the install
Approved by:	allanjude
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D36459
2022-10-03 09:50:42 -06:00
Hans Petter Selasky
5e59b2734f cuse(3): Optimise small reads and writes.
When doing small reads and writes use an intermediate buffer to store the
data to save locking the remote process to access data.

Reviewed by:	imp @
Differential Revision:	https://reviews.freebsd.org/D36633
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-10-03 17:35:14 +02:00
Hans Petter Selasky
8f0a3c9c35 cuse(3): Use bool type for boolean value instead of int type.
No functional change intended.

Reviewed by:	imp @
Differential Revision:	https://reviews.freebsd.org/D36633
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-10-03 17:35:14 +02:00
Kristof Provost
8a299958c1 if_epair: fix build with RSS
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-10-03 17:02:55 +02:00
Dag-Erling Smørgrav
d3890a547d sh: when loading profile, skip obvious scratch files.
Differential Revision: https://reviews.freebsd.org/D36856
2022-10-03 14:35:51 +00:00
Michael Tuexen
2515552e62 tcp: improve handling of SYN-ACK segments in TIMEWAIT state
Only consider segments with the SYN bit set and the ACK bit cleared
as "new connection attempts", which result in re-using a connection
being in TIMEWAIT state. This results in consistent handling of
SYN-ACK segments.

Reviewed by:		rscheff@
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D36864
2022-10-03 14:46:47 +02:00
Kirk McKusick
dcdba3460d Updates to UFS/FFS superblock integrity checks when reading a superblock.
Further updates based on ways Peter Holm found to corrupt UFS
superblocks in ways that could cause kernel hangs or crashes.

No legitimate superblocks should fail as a result of these changes.

Reported by:  Peter Holm
Tested by:    Peter Holm
Sponsored by: The FreeBSD Foundation
2022-10-03 05:53:10 -07:00
Alfredo Dal'Ava Junior
db79bf75ac powerpc: cpuset: add local functions for copyin/copyout
Add local functions to workaround an instruction segment trap (panic)
when the indirect functions copyin and copyout are called by an external
loadable kernel module (i.e. pfsync, zfs and linuxulator). The crash
was triggered by change 47a57144af, but
kernel binary linked with LLD 9 works fine. LLVM bisect points that LLD
behavior chaged after dc06b0bc9ad055d06535462d91bfc2a744b2f589.

This is know to affect powerpc targets only and the final fix is still
being discussed with the LLVM community.

PR:	266730
Reviewed by:	luporl, jhibbits (on IRC, previous version)
MFC after:	2 days
Sponsored by:	Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision:	https://reviews.freebsd.org/D36234
2022-10-03 12:03:09 -03:00
Michael Tuexen
f8b5681094 tcp: honor drop_synfin sysctl variable in TIME-WAIT
Reviewed by:		rrs@
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D36862
2022-10-03 12:48:30 +02:00
Doug Moore
ffbc2a58b1 Fix LINT build after 368ee2f86a
Reported by:	jenkins
Fixes:	368ee2f86a
2022-10-03 00:15:21 -05:00
Doug Moore
368ee2f86a rb_tree: let insert search start from next node
When the node to insert in the rb_tree is known to precede or follow a
particular node, new methods RB_INSERT_PREV and RB_INSERT_NEXT,
defined here, allow the search for where to insert the new node begin
with that particular node, rather than at the root, to save a bit of
time.

Using those methods, instead of RB_INSERT, in managing a tree in
iommu_gas.c, saves a little time.

Reviewed by:	kib
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D35516
2022-10-02 22:27:21 -05:00
Konstantin Belousov
a7eac01843 stty(1): provide details about interaction with job control
Describe a shell trick to do non-blocking modification of the terminal
settings, by ignoring job control signals with trap built-in.

PR:	266627
With input from:	jilles
Reviewed by:	pauamma
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D36745
2022-10-02 20:29:53 +03:00
Hans Petter Selasky
aa87aa5232 libusb(3): Implement libusb_interrupt_event_handler() by exposing existing function.
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-10-02 17:32:59 +02:00
Alexander V. Chernikov
356724fc93 netlink: fix non-default builds (no INET, INET6, ROUTE_MPATH). 2022-10-02 13:12:52 +00:00
Jung-uk Kim
fc083c3eb2 netlink: Fix build without VIMAGE 2022-10-01 21:41:54 -04:00
Dag-Erling Smørgrav
0aa2700123 Put OPIE to rest.
Differential Revision: https://reviews.freebsd.org/D36592
2022-10-02 03:37:29 +02:00
Rick Macklem
a82308abab nfs_clvnops.c: Fix access to v_mount when vnode unlocked
Commit ab17854f97 fixed access to v_mount when the
vnode is unlocked for nfs_copy_file_range().

This patch does the same for nfs_advlockasync().

MFC after:	1 week
2022-10-01 16:30:07 -07:00
Dag-Erling Smørgrav
497cdf9673 sh: read more profile files.
Differential Revision: https://reviews.freebsd.org/D36505
MFC after:	1 month
2022-10-01 21:30:56 +00:00
Alexander V. Chernikov
03994c24da netlink: fix build without INVARIANTS
Reported by:	cy
2022-10-01 21:20:50 +00:00
Alexander V. Chernikov
8d9f3e0572 netlink: fix format strings on 32-bit platforms 2022-10-01 21:16:31 +00:00
Alexander V. Chernikov
c90bff3fa7 netlink: fix debugging on 32-bit platforms 2022-10-01 19:03:35 +00:00
Doug Moore
e5f93d1078 show_sysctl_all: reduce copying, please coverity
Modify db_show_sysctl_all so that it does not copy more than once the
data of the input oid, and so that what it passes to db_show_oid does
not alarm coverity.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D36847
2022-10-01 12:20:04 -05:00
Alexander V. Chernikov
dddafa8d25 netlink: make test-includes happy by hiding most of the header
contents under _KERNEL.
2022-10-01 17:01:53 +00:00
Alexander V. Chernikov
11ca01e9aa netlink: add headers installation 2022-10-01 16:31:58 +00:00
Rene Ladan
83578bd40f organization.dot: add pizzamig to portmgr 2022-10-01 18:18:31 +02:00
Rick Macklem
bffb3d947b nfs_clvnops.c: Fix access to v_mount when vnode unlocked
Commit ab17854f97 fixed access to v_mount when the
vnode is unlocked for nfs_copy_file_range().

This patch does the same for nfs_ioctl().

Reviewed by:	kib, markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D36846
2022-10-01 07:43:53 -07:00
Alexander V. Chernikov
7c40e2d5f6 linuxolator: add netlink support
Add the glue code to support netlink in Linuxolator.
linux_common(4) now depends on netlink(4).

All netlink protocol constants are consistent with the Linux version.
However, certain OS-specific constants such as AF_INET6, interface
flags or default routing table id, are different between FreeBSD and
Linux. Thus, it may be needed to rewrite some message parts or even
rewrite the whole message, adding or removing some TLVs. The core
netlink implementation code provides efficient rewriting callbacks
 which Linuxolator now uses.

Reviewed by:	dchagin
Differential Revision: https://reviews.freebsd.org/D36361
MFC after:	2 months
2022-10-01 14:16:45 +00:00
Alexander V. Chernikov
7e5bf68495 netlink: add netlink support
Netlinks is a communication protocol currently used in Linux kernel to modify,
 read and subscribe for nearly all networking state. Interfaces, addresses, routes,
 firewall, fibs, vnets, etc are controlled via netlink.
It is async, TLV-based protocol, providing 1-1 and 1-many communications.

The current implementation supports the subset of NETLINK_ROUTE
family. To be more specific, the following is supported:
* Dumps:
 - routes
 - nexthops / nexthop groups
 - interfaces
 - interface addresses
 - neighbors (arp/ndp)
* Notifications:
 - interface arrival/departure
 - interface address arrival/departure
 - route addition/deletion
* Modifications:
 - adding/deleting routes
 - adding/deleting nexthops/nexthops groups
 - adding/deleting neghbors
 - adding/deleting interfaces (basic support only)
* Rtsock interaction
 - route events are bridged both ways

The implementation also supports the NETLINK_GENERIC family framework.

Implementation notes:
Netlink is implemented via loadable/unloadable kernel module,
 not touching many kernel parts.
Each netlink socket uses dedicated taskqueue to support async operations
 that can sleep, such as interface creation. All message processing is
 performed within these taskqueues.

Compatibility:
Most of the Netlink data models specified above maps to FreeBSD concepts
 nicely. Unmodified ip(8) binary correctly works with
interfaces, addresses, routes, nexthops and nexthop groups. Some
software such as net/bird require header-only modifications to compile
and work with FreeBSD netlink.

Reviewed by:	imp
Differential Revision: https://reviews.freebsd.org/D36002
MFC after:	2 months
2022-10-01 14:15:35 +00:00
Cy Schubert
35d60ac2e5 unbound: Adjust version string
Sync version string with contrib.

Reported by:	"Herbert J. Skuhra" <herbert@gojira.at>
Fixes:		4f5c8956cf
MFC after:	3 days
2022-10-01 06:51:30 -07:00
Mariusz Zaborski
6da5e5d649 seq: fix style nits
MFC after:	2 weeks
2022-10-01 12:05:07 +02:00
Mariusz Zaborski
94c4f663ba seq: fix potential NULL ptr reference
asprintf(3) allocates memory, and there isn't any guarantee of success.

MFC after:	2 weeks
Obtained from:  OpenBSD
2022-10-01 12:05:03 +02:00
Xin LI
c5e957ad4f file: fix test case for gpkg by removing the extra \n.
MFC after:	3 days
2022-09-30 22:45:32 -07:00
Ganbold Tsagaankhuu
8eb94b238f Set denominator to 1 if it is 0 in the init phase.
This prevents panic and also helps when the clocks
become available later.
This is based on comment from manu@ on
https://reviews.freebsd.org/D31299
2022-10-01 02:01:59 +00:00
Warner Losh
f341e9bad3 uart: Remove sbbc reference
sbbc support is for sparc64 only, which was removed in 58aa35d429.

Sponsored by:		Netflix
2022-09-30 18:26:45 -06:00
Warner Losh
881fca442f arm: Catch up with Samsung S3C2xx0 code removal
The code backing these uart_class was removed 7 years ago in
4648ee9525.

Sponsored by:		Netflix
2022-09-30 18:12:10 -06:00
Richard Yao
67395be0c2
Fix userland dereference NULL return value bugs
* `zstream_do_token()` does not handle failures from `libzfs_init()`

 * `ztest_global_vars_to_zdb_args()` does not handle failures from
   `calloc()`.

 * `zfs_snapshot_nvl()` will pass an offset to a NULL pointer as a
   source to `strlcpy()` if the provided nvlist is `NULL`.

We handle these by doing what the existing error handling does for other
errors involving these functions.

Coverity complained about these. It had complained about several more,
but one was fixed by 570ca4441e and
another was a false positive. The remaining complaints labelled
"dereferece null return vaue" involve fetching things stored in
in-kernel data structures via `list_head()/list_next()`,
`AVL_PREV()/AVL_NEXT()` and `zfs_btree_find()`. Most of them occur in
void functions that have no error handling. They are much harder to
analyze than the two fixed in this patch, so they are left for a
follow-up patch.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #13971
2022-09-30 17:02:57 -07:00
Richard Yao
a36b37d4de
Fix potential NULL pointer dereference in dsl_dataset_promote_check()
If the `list_head()` returns NULL, we dereference it, right before we
check to see if it returned NULL.

We have defined two different pointers that both point to the same
thing, which are `origin_head` and `origin_ds`. Almost everything uses
`origin_ds`, so we switch them to use `origin_ds`.

We also promote `origin_ds` to a const pointer so that the compiler
verifies that nothing modifies it.

Coverity complained about this.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Neal Gompa <ngompa@datto.com>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #13967
2022-09-30 16:59:51 -07:00
Tino Reichardt
a2d5643f88
Fix double const qualifier declarations
Some header files define structures like this one:

typedef const struct zio_checksum_info {
	/* ... */
	const char	*ci_name;
} zio_abd_checksum_func_t;

So we can use `zio_abd_checksum_func_t` for const declarations now.
It's not needed that we use the `const` qualifier again like this:
`const zio_abd_checksum_func_t *varname;`

This patch solves the double const qualifiers, which were found by
smatch.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de>
Closes #13961
2022-09-30 15:34:39 -07:00
Xin LI
8a96874eee Bump __FreeBSD_version for qsort_r prototype change. 2022-09-30 15:31:13 -07:00
Richard Yao
55d7afa4ad
Reduce false positives from Static Analyzers
Both Clang's Static Analyzer and Synopsys' Coverity would ignore
assertions. Following Clang's advice, we annotate our assertions:

https://clang-analyzer.llvm.org/annotations.html#custom_assertions

This makes both Clang's Static Analyzer and Coverity properly identify
assertions. This change reduced Clang's reported defects from 246 to
180. It also reduced the false positives reported by Coverityi by 10,
while enabling Coverity to find 9 more defects that previously were
false negatives.

A couple examples of this would be CID-1524417 and CID-1524423. After
submitting a build to coverity with the modified assertions, CID-1524417
disappeared while the report for CID-1524423 no longer claimed that the
assertion tripped.

Coincidentally, it turns out that it is possible to more accurately
annotate our headers than the Coverity modelling file permits in the
case of format strings. Since we can do that and this patch annotates
headers whenever `__coverity_panic__()` would have been used in the
model file, we drop all models that use `__coverity_panic__()` from the
model file.

Upon seeing the success in eliminating false positives involving
assertions, it occurred to me that we could also modify our headers to
eliminate coverity's false positives involving byte swaps. We now have
coverity specific byteswap macros, that do nothing, to disable
Coverity's false positives when we do byte swaps. This allowed us to
also drop the byteswap definitions from the model file.

Lastly, a model file update has been done beyond the mentioned
deletions:

 * The definitions of `umem_alloc_aligned()`, `umem_alloc()` andi
   `umem_zalloc()` were originally implemented in a way that was
   intended to inform coverity that when KM_SLEEP has been passed these
   functions, they do not return NULL. A small error in how this was
   done was found, so we correct it.

 * Definitions for umem_cache_alloc() and umem_cache_free() have been
   added.

In practice, no false positives were avoided by making these changes,
but in the interest of correctness from future coverity builds, we make
them anyway.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #13902
2022-09-30 15:30:12 -07:00
Ed Schouten
af3c78886f Alter the prototype of qsort_r(3) to match POSIX, which adopted the
glibc-based interface.

Unfortunately, the glibc maintainers, despite knowing the existence
of the FreeBSD qsort_r(3) interface in 2004 and refused to add the
same interface to glibc based on grounds of the lack of standardization
and portability concerns, has decided it was a good idea to introduce
their own qsort_r(3) interface in 2007 as a GNU extension with a
slightly different and incompatible interface.

With the adoption of their interface as POSIX standard, let's switch
to the same prototype, there is no need to remain incompatible.

C++ and C applications written for the historical FreeBSD interface
get source level compatibility when building in C++ mode, or when
building with a C compiler with C11 generics support, provided that
the caller passes a fifth parameter of qsort_r() that exactly matches
the historical FreeBSD comparator function pointer type and does not
redefine the historical qsort_r(3) prototype in their source code.

Symbol versioning is used to keep old binaries working.

MFC:			never
Relnotes:		yes
Reviewed by:		cem, imp, hps, pauamma
Differential revision:	https://reviews.freebsd.org/D17083
2022-09-30 15:26:30 -07:00
Gleb Smirnoff
69d79ceb2c tests/unix_passfd: add test case against 636420bde3 2022-09-30 13:43:37 -07:00
Gleb Smirnoff
0421ff5ab1 tests/unix_passfd: factor out sysctl(3) read into separate function 2022-09-30 13:43:08 -07:00
Gleb Smirnoff
636420bde3 unix/dgram: don't leak file descriptors when socket write failed 2022-09-30 13:43:08 -07:00
Alan Cox
1d5ebad06c pmap: optimize MADV_WILLNEED on existing superpages
Specifically, avoid pointless calls to pmap_enter_quick_locked() when
madvise(MADV_WILLNEED) is applied to an existing superpage mapping.

Reported by:	mhorne
Reviewed by:	kib, markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D36801
2022-09-30 12:14:05 -05:00
Zhenlei Huang
8707cb19e6 if_vxlan(4): Check the size of data available in mbuf before using them
PR:		261711
Reviewed by:	kp
Differential Revision:	https://reviews.freebsd.org/D36794
2022-09-30 09:56:15 +02:00
Elliott Mitchell
42dc8696df vmstat: remove processor counting from getcpuinfo()
As `ncpus` was otherwise unused, keeping track was pointless.  Gets rid
of a warning from an unused variable.

Reviewed by:	kib
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D36628
2022-09-30 06:10:27 +03:00
Olivier Cochard
c8b6939dfa renice: Prevent running regression tests in parallel
renice_abs_user and renice_rel_user tests modify global state, so they
are not compatible with parallel execution.

Reviewed by:	asomers
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D36720
2022-09-30 00:28:19 +02:00