Commit Graph

283973 Commits

Author SHA1 Message Date
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
John Baldwin
73cc3dbce1 riscv pmap: Add an __unused wrapper for a variable only used under PV_STATS. 2023-05-25 10:44:53 -07:00
John Baldwin
61fab1341a powerpc booke: Add an __unused wrapper for a variable only used under DEBUG. 2023-05-25 10:44:53 -07:00
Pierre Pronchery
07523f1d4f libradius: specify OpenSSL 1.1 APIs
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.

Future work 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 13:15:45 -04:00
Pierre Pronchery
77d788e23d libfetch: specify OpenSSL 1.1 APIs
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.

Future work 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 13:15:45 -04:00
Mitchell Horne
cadaabcc72 riscv timer: use stimecmp CSR when available
The Sstc extension defines a new stimecmp CSR, allowing supervisor
software to set the timer, rather than just read it. When supported,
using this avoids the frequent trips through the SBI every time the
CPU's timer expires.

Reviewed by:	jhb
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40241
2023-05-25 14:07:49 -03:00
Mitchell Horne
8bebb78682 riscv: S-mode extension parsing
There are now several Supervisor-mode extensions that have entered the
'ratified' status, so begin parsing and reporting a few of these.

Recognize the following extensions:
 - Sstc: stimecmp/vstimecmp CSR
 - Svnapot: NAPOT* translation contiguity
 - Svpbmt: page-based memory types
 - Svinval: fine-grained TLB invalidation instructions
 - Sscofpmf: performance counter overflow

*i.e. "naturally aligned power-of-2" page granularity

For now, provide globals for Sstc and Sscofpmf, as we will make use of
these in the near future.

Plus, update the copyright statement after my recent work on this file.

Reviewed by:	jhb
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40240
2023-05-25 14:07:26 -03:00
Alfredo Mazzinghi
ef0a711fd5 riscv: Use PMAP_MAPDEV_EARLY_SIZE in locore and pmap_bootstrap
Use PMAP_MAPDEV_EARLY_SIZE instead of assuming that its value is always
L2_SIZE. Add compile-time assertions to check that the size matches the
expectations in locore.

Reviewed by:	mhorne
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D40110
2023-05-25 14:06:16 -03:00
Mykola Hohsadze
ffa75b573f arm64/disassem.c: Add shifted register instruction definitions
Add disassembly support for the following shifted register instructions:
 * adds
 * subs
 * sub
 * neg
 * negs
 * cmp
 * cmn

The 'Mandatory Tokens' checks are relaxed to allow for the alias
instructions (e.g. cmp) which hard-code one or more registers as xzr.

Reviewed by:	mhorne
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D40006
2023-05-25 14:06:15 -03:00
Mykola Hohsadze
8a852d3e9f arm64/disassem.c: Make output lowercase
Update the few uppercase fields fields to be consistent with others.

Reviewed by:	mhorne
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D39820
2023-05-25 14:06:15 -03:00
Ed Maste
01aee8c92d libfetch: do not call 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.

PR:		271615
Reviewed by:	Pierre Pronchery <pierre@freebsdfoundation.org>
Event:		Kitchener-Waterloo Hackathon 202305
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40265
2023-05-25 12:20:15 -04:00
John Baldwin
555b62e1c8 less: Re-enable -Wdeprecated-non-prototype warnings.
These were fixed in the most recent update to contrib/less.
2023-05-25 09:16:20 -07:00
Stefan Eßer
76238846ad contrib/bc: upgrade to version 6.6.0
This update removes printing of a leading zero in scientific or
engineering output modes (which are an extended feature of this
implementation).

(cherry-picked from commit 8b83ef067441f6d3a4a55e92d1738724954a057c)

MFC after:	2 weeks
2023-05-25 17:55:31 +02:00
Johannes Totz
5804b7ab37 superio: Add device ID for ITE IT8613
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D39969
2023-05-25 11:06:51 -04:00
Alexander V. Chernikov
6d204407ec ifconfig: fix ifconfig IFX inet[6] ADDR -alias
Internally, inet and inet6 family handlers store state for
 address addition and deletion separately, as, for example,
 "ifconfig lo0 inet 127.0.0.2/32" triggers a) deletion of the
 first interface address and b) addition of a new one.
The current logic behind handling "-alias" being the last argument
 is to copy the address from "addition" state to the "deletion"
 state. It is done by the generic ifconfig code, which explicitly
 typecasts opaque handler state pointers to "struct ifreq", which
 doesn't work in the Netlink case.

Fix this by introducing family-specific "af_copyaddr" handler,
 which removes the peeking & typecasting logic from the generic code.

Reported by:	otis
Tested by:	otis
2023-05-25 15:03:35 +00:00
John Baldwin
6c08fd3dc8 Enable -Wstrict-prototypes by default in the kernel for clang 15+.
PR:		271072 (exp-run)
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D39734
2023-05-25 07:11:38 -07:00
John Baldwin
3dad1c6696 Enable -Wstrict-prototypes for all clang versions at WARNS >= 3.
Previously clang 15+ only enabled it for WARNS >= 5.

PR:		271072 (exp-run)
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D39732
2023-05-25 07:11:38 -07:00
John Baldwin
4ef3b0c138 ldns: Silence -Wstrict-prototypes warnings.
Hopefully upstream will fix the function declaration of
ldns_edns_option_list_new in the future.
2023-05-25 07:11:38 -07:00
John Baldwin
48f52d9179 zfs: Fix build on 32-bit platforms after most recent import.
unsigned long is not a uint64_t on 32-bit platforms.  The zfs.4
manpage documents this variable as a uint, and it is only compared
with other variables of type int, so uint_t makes more sense than
unsigned long.

(I also wasn't sure if ULONG would work as a ZFS_MODULE_PARAM type
on other OS's)
2023-05-25 07:11:38 -07:00
Andrew Gallatin
fd96685a4a Revert "When stopping powerd, set the CPU frequency back to its maximum value"
This reverts commit 1dcb6ad173.

As of "8cb16fdbea6b Restore original frequency on exit.", powerd
restores the original frequency itself.

Further, if the original frequency is not the same as the
first frequency found in the frequency list, then the restoration
done by the powerd_poststop will restore the wrong frequency.
This can happen on Intel machines where Turbo is not enabled,
but the turbo frequency is first in the list of frequencies.
In this case, turbo will be enabled when the user did not want
it to be.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D40197
Reviewed by: imp, mav
2023-05-25 09:40:26 -04:00
Dag-Erling Smørgrav
430d064ba5 ctags: Support writing to stdout instead of a file.
* Understand "-" to mean stdout as per convention.
* Check that the output is a regular file and ignore -u if not, otherwise we might try to rm /dev/stdout.
* As a bonus, if -u was specified but the output file does not exist, proceed as if -u had not been specified instead of erroring out.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	cracauer, debdrup
Differential Revision:	https://reviews.freebsd.org/D40237
2023-05-25 13:22:18 +00:00
Alexander V. Chernikov
4bf44dd73b ifconfig: switch IPv4/IPv6 address manipulations to Netlink.
Differential Revision: https://reviews.freebsd.org/D40182
2023-05-25 12:22:18 +00:00