Commit Graph

283994 Commits

Author SHA1 Message Date
Enji Cooper
27234ad699 Fix the build post-dcf5d5603b3af8
I didn't compile test the prior code before committing.

MFC after:	1 week
MFC with:	dcf5d5603b
2023-05-27 19:18:43 -07:00
Kirk McKusick
101a9ac071 Fix a bug in fsck_ffs(8) triggered by corrupted filesystems.
Check for valid file size before processing journal entries for it.
Done by extracting the file size check from pass1.c into chkfilesize()
then using it in the journal code in suj.c

Reported-by:  Robert Morris
PR:           271378
MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
2023-05-27 17:12:30 -07:00
Enji Cooper
dcf5d5603b Reduce ifdef soup by adding pre-3.0 compat support
This change creates a static inline function, BN_check_prime, for
pre-3.0 use which is implemented with the previous (1.1) compatible call
under the covers, `BN_is_prime_ex`.

The `nchecks` parameter value is maintained, even though it has no
noticable behavior change, given that the documentation clearly states
that at least 64 or 128 rounds are executed on the backend, depending on
how many bits there are in the given number being factored out.

MFC after:	1 week
Differential Revision:	 https://reviews.freebsd.org/D40305
2023-05-27 17:05:39 -07:00
Kirk McKusick
11ce203e05 Fix a bug in fsck_ffs(8) triggered by corrupted filesystems.
The last valid inode in the filesystem is maxino - 1, not maxino.
Thus validity checks should ino < maxino, not ino <= maxino.

Reported-by:  Robert Morris
PR:           271312
MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
2023-05-27 16:07:09 -07:00
Kirk McKusick
c79a141695 Updates to UFS/FFS superblock integrity checks when reading a superblock.
Verify that the summary information does not extend past the end
of the filesystem.

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

Reported-by:  Robert Morris
PR:           271351
MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
2023-05-27 12:24:11 -07:00
Enji Cooper
537cd76643 factor: support OpenSSL 3
This change ports the BN APIs to an OpenSSL 3 compatible set of APIs.

This removes the need for requesting OpenSSL 1.1 compatible APIs.

MFC after:	1 week
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D40298
2023-05-27 11:11:44 -07:00
Enji Cooper
c60be9ea6b Add simple factor/primes regression tests
This will help ensure that the change following this
one to support OpenSSL 3 is sane.

MFC after:	1 week
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D40297
2023-05-27 11:11:44 -07:00
John Reimer
b498331b03 netgdb: Fix netgdb double ack, print proxy address
- Fixes netgdb's double ack
- Moving ack responsibility to debugnet, decision to ack made by netdump/netgdb.
- Finish responsibility moved to debugnet, new finish handler.
- netgdb now prints the address to connect to in case the user doesn't have
  access to the proxy machine.

Sponsored by:	Dell EMC
Reviewed By:	markj, bdrewery (earlier version)
Differential Revision:	https://reviews.freebsd.org/D40064
2023-05-27 09:34:17 -07:00
Dimitry Andric
1f571f8767 Apply libc++ fix for compiling <type_traits> with clang 16
Merge commit 0e7971154ecb from llvm-project (by Christopher Di Bella):

  [libcxx][NFC] utilises compiler builtins for unary transform type-traits

  Depends on D116203

  Reviewed By: #libc, philnik

  Differential Revision: https://reviews.llvm.org/D131732

Clang 16 got new builtins that are equivalent to hand-written parts of
<type_traits>. When building world with the devel/llvm16 package
installed and CROSS_TOOLCHAIN=llvm16 set, this would lead to -Werror
warnings about those builtins being overridden.

Reported by:	emaste
MFC after:	3 days
2023-05-27 18:19:37 +02:00
Joseph Mingrone
270d20ce91
libpcap: Update PACKAGE_STRING to 1.10.4
Reviewed by:	emaste
Fixes:		6f9cba8f8b (libpcap: Update to 1.10.3)
Fixes:		dd744a896b (libpcap: Update to 1.10.4)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40295
2023-05-27 12:38:38 -03:00
Alexander V. Chernikov
c90901245e netlink: update rta_multipath conditions in arp/ndp after 656a39c1a0 2023-05-27 13:25:16 +00:00
Alexander V. Chernikov
30376771fc netlink: fix build 2023-05-27 12:29:14 +00:00
Alexander V. Chernikov
7ee6b0f125 netlink: add snl(3) support for listing genetlink multicast groups
Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D40282
MFC after:	2 weeks
2023-05-27 11:13:14 +00:00
Alexander V. Chernikov
656a39c1a0 netlink: use newly-added snl(3) array parsing for handling multipath
routes.

MFC after:	2 weeks
2023-05-27 11:13:14 +00:00
Alexander V. Chernikov
5f19f790b3 netlink: add snl(3) support for parsing unknown-size arrays
Reviewed by:	bapt
Differential Review: https://reviews.freebsd.org/D40282
MFC after:	2 weeks
2023-05-27 11:13:14 +00:00
Alexander V. Chernikov
99ea21744b netlink: fix bulding with NOINET6 2023-05-27 10:46:25 +00:00
Alexander V. Chernikov
dfc15e761b netlink: call IPv6 hook after the ifaddr operation when ifp is brought
up.

This change fixes the case when the first address added to the interface
 is IPv6 GU address. Before the change, IPv6 LL addition was not
triggered.

PR: 271661
MFC after:	2 weeks
2023-05-27 10:38:32 +00:00
Peter Holm
750ae32b9e stress2: Initialize variable 2023-05-27 10:34:48 +02:00
Peter Holm
273a89bb14 stress2: Tune to get more slightly broken file systems 2023-05-27 10:31:44 +02:00
Peter Holm
acfb06062a stress2: Fix warnings 2023-05-27 10:31:00 +02:00
Alan Cox
5d1ee799de arm64 pmap: Eliminate an unused global variable
The global variable "pmap_last_pa" was copied from the amd64 pmap as a
part of commit c15085278c "arm64 pmap: implement per-superpage locks"
but it is neither used nor needed by the arm64 pmap.
2023-05-27 01:38:20 -05:00
Kirk McKusick
49943856eb Do not try to adjust a directory depth when its reconnection is declined.
MFC after:    1 week
Sponsored by: The FreeBSD Foundation
2023-05-26 22:55:11 -07:00
Kirk McKusick
03a8680202 Correct two bugs in fsck_ffs(8) triggered by corrupted filesystems.
Always create a directory inode structure when a directory inode is
found in Pass 1 as it is not known whether it will be saved or removed
in later passes. If it is to be saved the directory inode structure
is needed to track its status and fsck_ffs(8) will segment fault if
it does not exist.

Reported-by:  Robert Morris
PR:           271310
PR:           271354
MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
2023-05-26 22:43:21 -07:00
Enji Cooper
52b63df9b6 dumpon: provide diag info when PEM_read_RSA_PUBKEY fails
This change modifies dumpon to print out the last error from OpenSSL
when `PEM_read_RSA_PUBKEY` fails. This allows end-users to diagnose why
reading in RSA pubkey files fails so they can adjust the usage to meet
the needs of the command.

MFC after:	1 week
2023-05-26 18:05:04 -07:00
Mark Johnston
da8c3d2149 tests: Fix format strings
Reported by:	Jenkins
Fixes:		844942888f ("tests: Add a simple regression test for ptrace(PT_SC_REMOTE)")
2023-05-26 17:38:06 -04:00
Mark Johnston
ca4c785900 nexus: Consistently return a pointer in failure paths
No functional change intended.

MFC after:	1 week
2023-05-26 15:38:08 -04:00
Mark Johnston
44866dfb44 bitset: Remove BITSET_FOREACH_ADVANCE
__BITSET_FOREACH_ADVANCE is a helper macro for
__BITSET_FOREACH_IS(SET|CLR) and wasn't meant to be used directly by
consumers.

While here, fix some whitespace and move a comment back to where it
belongs.

Fixes:	5e04571cf3 ("sys/bitset.h: reduce visibility of BIT_* macros")
MFC after:	1 week
2023-05-26 15:38:08 -04:00
Mark Johnston
e96ed17746 top: Use a cpuset_t to represent a CPU mask
The code attempts to detect holes in the CPU ID space, but previously
this would only work for up to sizeof(long)*8 CPUs.

MFC after:	2 weeks
2023-05-26 15:38:08 -04:00
Mark Johnston
14c5cf3a16 makefs/zfs: Avoid generating a GUID of zero 2023-05-26 15:38:08 -04:00
Mark Johnston
844942888f tests: Add a simple regression test for ptrace(PT_SC_REMOTE)
MFC after:	1 week
2023-05-26 15:38:08 -04:00
Dmitry Chagin
c2c9ac88c2 kdump: Add a facility to print numbers in decimal format always
To help grepping kdump output by pid or tid it makes sence to print
some numbers in decimal format always. Eg, process or thread identifier
at least, as they already printed in decimal format.
Switch to print pid/tid arguments of some Linux signal related syscalls
in decimal format.

Reviewed by:		jhb
Differential Revision:	https://reviews.freebsd.org/D40099
MFC after:		1 week
2023-05-26 19:35:08 +03:00
Dmitry Chagin
829f3d7d26 kdump: Decode linux_clone syscall flags
Reviewed by:		emaste
Differential Revision:	https://reviews.freebsd.org/D40151
MFC after:		1 week
2023-05-26 19:34:33 +03:00
Dmitry Chagin
bd35e83bcf libsysdecode: Decode linux_clone syscall flags
Reviewed by:		emaste
Differential Revision:	https://reviews.freebsd.org/D40150
MFC after:		1 week
2023-05-26 19:32:20 +03:00
Dmitry Chagin
3f1bfc136f linux(4): Guard linux_fork.h by _KERNEL for use by libsysdecode
Reviewed by:		emaste
Differential Revision:	https://reviews.freebsd.org/D40149
MFC after:		1 month
2023-05-26 19:31:47 +03:00
Christos Margiolis
5c134fba22 kinst: fix memcpy() tracing crash
Tracing memcpy() would crash the kernel, because we'd also trace the
memcpy() calls from kinst_invop(). To fix this, introduce kinst_memcpy()
whose arguments are 'volatile', so that we avoid having the compiler
replace it with a regular memcpy().

Reviewed by:	markj
Approved by:	markj (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40284
2023-05-26 18:43:37 +03:00
Christos Margiolis
9c80ad6839 kinst: add kinst_excluded()
Exclude functions that are not safe-to-trace.

Reviewed by:	markj
Approved by:	markj (mentor)
Sponsored by:	The FreeBSD Foundation
ifferential Revision:	https://reviews.freebsd.org/D39229
2023-05-26 16:54:08 +03:00
Pierre Pronchery
7409d45ed4 auditdistd: Request the OpenSSL 1.1 API
OPENSSL_API_COMPAT can be used to specify the OpenSSL API version in
use for the purpose of hiding deprecated interfaces and enabling
the appropriate deprecation notices.

This change is a NFC while we're still using OpenSSL 1.1.1 but will
avoid deprecation warnings upon the switch to OpenSSL 3.0.

A future change should migrate to use the OpenSSL 3.0 APIs.

PR:		271615
Reviewed by:	emaste
Event:		Kitchener-Waterloo Hackathon 202305
Sponsored by:	The FreeBSD Foundation
2023-05-26 09:20:27 -04:00
Ed Maste
b01c10d25d auditdistd: Avoid calling deprecated OpenSSL functions
As of OpenSSL 1.1 SSL_library_init() and SSL_load_error_strings() are
deprecated.  There are replacement initialization functions but they do
not need to be called: "As of version 1.1.0 OpenSSL will automatically
allocate all resources that it needs so no explicit initialisation is
required."

Wrap both calls in an OPENSSL_VERSION_NUMBER block.

Upstream pull request submitted at
https://github.com/openbsm/openbsm/pull/82

PR:		271615
Reviewed by:	ngie
Event:		Kitchener-Waterloo Hackathon 202305
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40273
2023-05-26 09:15:25 -04:00
Cheng Cui
f5abdb0311
tcp: fix a bug where unshifting should be put last in tcp_get_srtt()
Reported by: Bhaskar Pardeshi from VMware.
Reviewers: rscheff, tuexen, #transport!
Approved by: tuexen (mentor)
Subscribers: imp, melifaro, glebius
Differential Revision: https://reviews.freebsd.org/D40267
2023-05-26 02:30:52 -04:00
Kirk McKusick
e4a905d1e0 Add the ability to adjust directory depths to background fsck_ffs(8).
Commit fe5e6e2 improved FFS directory placement when creating new
directories. It is done by keeping track of the depth of directories
in the filesystem and placing those lower in the tree closer together
while spreading out those higher in the tree.

Fsck_ffs(8) checks these depths and if incorrect adjusts them to
their correct value. When running in background fsck_ffs(8) needs
to be able to make an adjustment to the depth. This commit adds
the sysctl to make such an adjustment and adds the code to fsck_ffs(8)
to use the new sysctl.

MFC after:    1 week
Sponsored by: The FreeBSD Foundation
2023-05-25 19:27:04 -07:00
Kirk McKusick
4b08a62ed4 When running fsck_ffs(8) in background ensure that a superblock has been read.
Reported by:  Mikhail T.
PR:	      271352
MFC after:    1 week
Sponsored by: The FreeBSD Foundation
2023-05-25 18:59:16 -07:00
Ed Maste
0f2bb40bc7 lldb: dereference stoppcbs based on target kernel version
As of 9fb6718d1b / __FreeBSD_version 1400089 stoppcbs is a pointer to
the pcbs array.  Dereference stoppcbs on sufficiently new kernels.

Reviewed by:	markj (earlier)
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39939
2023-05-25 21:45:52 -04:00
Mark Johnston
db289ababf posixshmcontrol.1: Document posixshmcontrol create -l
Reviewed by:	kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D40270
2023-05-25 18:09:55 -04:00
Mark Johnston
9fb6718d1b smp: Dynamically allocate the stoppcbs array
This avoids bloating the kernel image when MAXCPU is large.

A follow-up patch for kgdb and other kernel debuggers is needed since
the stoppcbs symbol is now a pointer.  Bump __FreeBSD_version so that
debuggers can use osreldate to figure out how to handle stoppcbs.

PR:		269572
MFC after:	never
Reviewed by:	mjg, emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39806
2023-05-25 18:09:55 -04:00
Pierre Pronchery
fed03614bd factor: Request the OpenSSL 1.1 API
OPENSSL_API_COMPAT can be used to specify the OpenSSL API version in
use for the purpose of hiding deprecated interfaces and enabling
the appropriate deprecation notices.

This change is a NFC while we're still using OpenSSL 1.1.1 but will
avoid deprecation warnings upon the switch to OpenSSL 3.0.

A future change should migrate to use the OpenSSL 3.0 APIs.

PR:		271615
Reviewed by:	emaste
Event:		Kitchener-Waterloo Hackathon 202305
Sponsored by:	The FreeBSD Foundation
2023-05-25 16:52:52 -04:00
Christos Margiolis
9105ba0471 ofw: remove redundant calls in ofwbus_attach()
Since commit ecaecbc7d8, calling
ofw_bus_gen_setup_devinfo() is redundant, as the call to
device_set_ivars() now happens inside simplebus_add_device().

Reviewed by:	markj
Approved by:	markj (mentor)
Differential Revision:	https://reviews.freebsd.org/D40271
2023-05-25 23:47:41 +03:00
Christos Margiolis
855ade9e72 kinst: be explicit about trampoline placement
The current implementation and comment was specific to amd64. Even
though in the case of kinst's supported architectures (RISC-V and ARM64)
VM_MIN_KERNEL_ADDRESS is equal to KERNBASE, it's better to be explicit.

Reviewed by:	markj
Approved by:	markj (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40266
2023-05-25 23:40:46 +03:00
Pierre Pronchery
5a7500dab9 libarchive: Request the OpenSSL 1.1 API
OPENSSL_API_COMPAT can be used to specify the OpenSSL API version in
use for the purpose of hiding deprecated interfaces and enabling
the appropriate deprecation notices.

This change is a NFC while we're still using OpenSSL 1.1.1 but will
avoid deprecation warnings upon the switch to OpenSSL 3.0.

A future update should migrate to use the OpenSSL 3.0 APIs.

PR:		271615
Reviewed by:	emaste
Event:		Kitchener-Waterloo Hackathon 202305
Sponsored by:	The FreeBSD Foundation
2023-05-25 15:08:05 -04:00
Dag-Erling Smørgrav
9f35eb8f96 ctags: Recognize __attribute__ in function declarations.
MFC after:	1 week
Obtained from:	NetBSD
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D40264
2023-05-25 18:02:24 +00:00
John Baldwin
98d06eea14 sys: Enable -Wunused-but-set-variable for clang 15+.
It was already enabled for older clang versions and GCC.
2023-05-25 10:44:53 -07:00