Commit graph

287473 commits

Author SHA1 Message Date
John Baldwin 9b57e30cf5 abort2: Generate a core dump
Call sigexit rather than exit1 so that a core is generated.

If running the SIGABRT handler is desired, this would need to use
kern_psignal() instead.  In that case a userspace wrapper in libc
would be needed to force an exit if the handler doesn't exit.  Given
that abort2(2)'s intended use case is when userland is in a
sufficiently bad state such that it can't safely call syslog(3) before
abort(3), a userspace abort2(3) wrapper in libc might be dubious.

Reviewed by:	Olivier Certner <olce.freebsd@certner.fr>, emaste
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D42163
2023-11-13 17:00:52 -08:00
Andrew Gallatin ab063ac444 ipmi_ssif: Fix typo in debug print
Fix a typo in a debug print that prevents compilation.

Sponsored by: Netflix
2023-11-13 19:46:56 -05:00
Cy Schubert 6726773431 Unbound: Manually update version strings
This was missed earlier today.

Reported by:	"Herbert J. Skuhra" <herbert@gojira.at>
Fixes:		16fd0b2491
MFC:		2 weeks
2023-11-13 16:46:12 -08:00
Cy Schubert 5aab39b24c Unbound: Remove backup file brought in from upstream
Upstream tarball included config.h~.

This was previously manually removed from vendor where in fact it
should not have been as it would have caused a merge conflict.

Reported by:	"Herbert J. Skuhra" <herbert@gojira.at>
MFC:		2 weeks
2023-11-13 16:46:12 -08:00
John W. O'Brien 99132daf6f rc.d/ldconfig: Prepend rtld stdlib paths to ldconfig(32)_paths
Ensure that ldconfig-managed elf and elf32 hints always include
the standard library paths that are known independently to rtld.

PR:			275031
Reviewed by:		kib
MFC after:		2 weeks
Sponsored by:		Saltant Solutions LLC
Differential Revision:	https://reviews.freebsd.org/D42557
2023-11-14 01:39:17 +02:00
Brooks Davis da8238d6cf libc: fix typo in Makefile comment
MFC after:	1 week
2023-11-13 23:05:11 +00:00
Konstantin Belousov 23210f538a vn_copy_file_range(): busy both in and out mp around call to VOP_COPY_FILE_RANGE()
This is required e.g. for nullfs to ensure liveness of the lower mount
points.

Reviewed by:	jah, rmacklem, Olivier Certner <olce.freebsd@certner.fr>
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D42554
2023-11-14 00:26:34 +02:00
Konstantin Belousov 89188bd6ba vn_copy_file_range(): use local variables for invp/outvp vnodes v_mounts
This avoids possible NULL dereference when checking mnt_vfc names.

Reviewed by:	jah, rmacklem, Olivier Certner <olce.freebsd@certner.fr>
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D42554
2023-11-14 00:26:28 +02:00
Cy Schubert 103ba509e7 unbound: Vendor import 1.19.0
Release notes at
    https://www.nlnetlabs.nl/news/2023/Aug/30/unbound-1.19.0-released/

MFC after:	2 weeks

Merge commit '16fd0b24910488e59ca1941387b9ac7fb646a837' into unbound
2023-11-13 13:38:45 -08:00
Brooks Davis ec4c2adb50 Retire LLD_IS_LD option
The option was added to parallel the CLANG_IS_CC which was removed in
commit 20a66ab4bf.

Reviewed by:	imp, dim, emaste
Differential Revision:	https://reviews.freebsd.org/D42575
2023-11-13 21:34:14 +00:00
Brooks Davis f64a688dfd Remove gratuitous copyouts of unchanged struct mac.
The get operations change the data pointed to by the structure, but do
not update the contents of the struct.

Mark the struct mac arguments of mac_[gs]etsockopt_*label() and
mac_check_structmac_consistent() const to prevent this from changing
in the future.

Reviewed by:	markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D14488
2023-11-13 21:32:15 +00:00
Cy Schubert 16fd0b2491 unbound: Vendor import 1.19.0
Release notes at
    https://www.nlnetlabs.nl/news/2023/Aug/30/unbound-1.19.0-released/
2023-11-13 11:44:16 -08:00
Warner Losh 0e80440647 busdma: Add deferred time measurement to arm and powerpc
Add the forgotten field to these implementations as well.

Pointy hat to: me (make universe vs make tinderbox)
Fixes: 20f8814cd3
Sponsored by: Netflix
2023-11-13 12:25:56 -07:00
Warner Losh 49025a1109 _bus.h: Use standard licnese text
All of these used the 'immediately at beginning' variation of the
BSD-2-Clause license. This wasn't intentional, just what I copied from
from a random file in the tree back in 2005. It was not an intentional
decision.

The different arch bus.h files are a mix of BSD-2-Clause and
BSD-4-Clause that have various copyright holders (Charles M. Hannum,
Christopher G. Demetriou, The NetBSD Foundation and KATO Takenori), and
some of the content of these files were likely copied from there.
However, apart from the uncopyrightable interface lines, there are very
few comments. It's unclear if these comments are 'original material'
here to copyright, but to the extent that there is, license it under the
standard BSD-2-Clause copyright that's the norm for the project today.
In any event, the standard BSD-2-Clause is also closer to those
originals.

In addition, FreeBSD uses different type definitions than the original
NetBSD code in part. The comments that were copied have been copied a
lot, but appear in NetBSD's bus.h files in NetBSD 1.3.

While I'm here, assign the copyright, to the extent any exists from me,
to the FreeBSD Foundation. I just cut and pasted these into _bus.h from
the different machine files and those files have a rich history of
modification from the original imports from NetBSD over more than 25
years so it's tricky to say who, exactly, wrote each bit. Given the size
of the files, this seems like the best compromise.  Also add an
acknowledgement to the NetBSD 1.3 bus.h files and their authors (there
were no additional FreeBSD authors listed in the various
sys/*/include/bus.h files). Finally, use the SPDX identifier instead of
multiple copies of the text.

Differential Revision:	https://reviews.freebsd.org/D42532
Sponsored by:		Netflix
2023-11-13 12:25:30 -07:00
Bojan Novković c6d7be2148 tty: properly check character position when handling IUTF8 backspaces
The tty_rubchar() code handling backspaces for UTF-8 characters didn't
properly check whether the beginning of the current line was reached.
This resulted in a kernel panic in ttyinq_unputchar() when prodded with
certain malformed UTF-8 sequences.

Fixes:		PR 275009
Reviewed by:	christos
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42564
2023-11-13 20:04:11 +02:00
Cy Schubert 7963e41154 sqlite3: Vendor import of sqlite3 3.44.0
Release notes at https://www.sqlite.org/releaselog/3_44_0.html.

Obtained from:  https://www.sqlite.org/2023/sqlite-autoconf-3440000.tar.gz
MFC after:	2 weeks

Merge commit '3a88fe13354325b9f56f07927e654de4f5398707'
2023-11-13 08:50:36 -08:00
Mark Johnston b9c0003f0f arm64: Initialize x18 for APs earlier during boot
When KMSAN is configured, the instrumentation inserts calls to
__msan_get_context_state() into all function prologues.  The
implementation dereferences curthread and thus assumes that x18 points
to the PCPU area.  This applies in particular to init_secondary(), which
currently is responsible for initializing x18 for APs.

Move initialization into locore to avoid this problem.  No functional
change intended.

Reviewed by:	kib, andrew
MFC after:	2 weeks
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D42533
2023-11-13 10:44:45 -05:00
Cy Schubert 3a88fe1335 sqlite3: Vendor import of sqlite3 3.44.0
Release notes at https://www.sqlite.org/releaselog/3_44_0.html.

Obtained from:  https://www.sqlite.org/2023/sqlite-autoconf-3440000.tar.gz
2023-11-13 07:14:55 -08:00
Doug Rabson 21e9018ae1 pkgbase: use <major>.<minor> format for alpha, beta and release package versions
This is consistent with version numbers used in releng/13.2.

PR:		275051
Reviewed by:	bapt
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D42562
2023-11-13 14:46:36 +00:00
Warner Losh 20f8814cd3 busdma: On systmes that use subr_busdma_bounce, measure deferred time
Measure the total deferred time (from the time we decide to defer until
we try again) for busdma_load requests. On systems that don't ever
defer, there is no performnce change. Add new sysctl
hw.busdma.zoneX.total_deferred_time to report this (in
microseconds).

Normally, deferrals don't happen in modern hardware... Except there's a
lot of buggy hardware that can't cope with memory > 4GB or that can't
cross a 4GB boundary (or even more restrictive values), necessitating
bouncing. This will measure the effect on the I/Os of this deferral.

Sponsored by:		Netflix
Reviewed by:		gallatin, mav
Differential Revision:	https://reviews.freebsd.org/D42550
2023-11-13 07:23:53 -07:00
Alexander Leidinger cb57f50e64 defaults: oomprotect sshd and local_unbound
Add sshd and local_unbound to the oom protected services.
syslogd is protected by default already, document it.

This was discussed on arch@, see
    https://lists.freebsd.org/archives/freebsd-arch/2023-November/000543.html

sshd is protected to be able to investigate and fix oom issues on systems
which don't have out-of-band console access.
local_unbound is protected as it may be enabled for local use and without
DNS a lot grinds to a halt (including sshd).

Relnotes:		yes
MFC after:		1 month
Differential Revision:	https://reviews.freebsd.org/D42544
2023-11-13 09:48:51 +01:00
Konstantin Belousov a294b02fbc reboot(8): print syscall error on sysctl failure
Noted by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D42561
2023-11-13 03:46:51 +02:00
Konstantin Belousov 194cc45a81 reboot(8): adapt for vmmeter v_swappgsin expansion to 64bit
Otherwise reboot(8) requires COMPAT_FREEBSD11 kernel config option.

PR:	275048
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D42561
2023-11-13 03:46:36 +02:00
Kristof Provost 4b5634f4e5 netstat: fix missing tab in icmp6 output
PR:		275044
Submitted by:	sigsys@gmail.com
Reviewed by:	kp
MFC after:	1 week
2023-11-12 18:24:39 +01:00
Ceri Davies 19477ee0d9 man/man5/core.5: note that coredump directories need to exist 2023-11-12 11:35:12 +00:00
Benedict Reuschling ba44650a0b ps.1: update regarding -D option and -p x/d interaction
The -p option does not imply -x, it is merely a different mode that ps
uses. Remove that statement from the -p option, effectively rolling back
d6ae056e9d.

pstef@ introduced the -D option in 5c0a1c15ff
which also turns ps into a similar mode. List the -D option along with
the others in the first sentence of the second paragraph of the
DESCRIPTION section for completeness and correctness sake.

Pointed out by:		pstef@
Differential Revision:	https://reviews.freebsd.org/D42552
2023-11-11 19:49:24 +00:00
Andrew Gallatin b2921fdc23 arm64: Implement bus_get_resource and bus_delete_resource.
These devmethods were not defined, leading to the surprising result
of using bus_set_resource(), and then immediately turning around
and getting zeros back from bus_get_resource().   These are now
simply passed through to the generic definitions, since there
is no need for them to be arm64 specific.

Note that jhb plans to replace most of the devmethods with
the generic versions.

Suggested by: jhb
Sponsored by: Netflix
2023-11-11 12:57:39 -05:00
Mark Johnston 4e288572b8 bhyve: Fix the GDB_LOG build
MFC after:	1 week
Fixes:	7d9ef309bd ("libvmmapi: Add a struct vcpu and use it in most APIs.")
2023-11-11 12:15:30 -05:00
Aaron LI dcc4d2939f if_wg: Missing radix unlock can cause deadlock
In function 'wg_aip_add()', the error path of returning ENOMEM when
(node == NULL) is forgetting to unlock the radix tree, and thus may lead
to a deadlock.

PR:		275001
Reviewed by:	kp
MFC after:	1 week
2023-11-11 14:13:08 +01:00
Trond Endrestøl 4b2d944b40 pfsync.4: fix typo
PR:		275025
Reviewed by:	kp
2023-11-11 11:10:41 +01:00
Alexander Motin 105c7c4b8d iostat: Tune formatting for higher disk speeds
MFC after:	2 weeks
2023-11-10 18:35:38 -05:00
Luiz Amaral 81d4c78620 pfsync: Document the transport over IPv6 feature
On D40102 we implemented support for transport over IPv6 but the
documentation was not updated to reflect the new feature.

Clarify what is available and how it can be used.

MFC after:	1 week
Sponsored by:	InnoGames GmbH
Differential Revision:	https://reviews.freebsd.org/D42505
2023-11-10 16:40:02 +01:00
Andrew Turner 5a8417c78f arm64: Check if PSCI before calling SMCCC
As SMCCC depends on PSCI check if the latter is present before calling
the former. This fixes an issue where we may call into SMCCC when there
is no PSCI in the system causing a smccc_version assert to fail.

Reported by:	stevek
Reviewed by:	emaste, imp, stevek
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D42404
2023-11-10 16:01:13 +00:00
Andrew Turner 2ee649c1dd arm64: Add more HWCAP2 values
Update the HWCAP2 values to align with Linux v6.6-rc7

Reviewed by:	manu, imp, emaste
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D42379
2023-11-10 16:01:13 +00:00
Andrew Turner 0f09388009 arm64: Expand HWCAP2 to be 64 bit
There are more than 32 arm64 HWCAP2 values. Expand the macros to
include leading zeros and mark them as unsigned long.

Reviewed by:	manu, imp, emaste
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D42378
2023-11-10 16:01:13 +00:00
Andrew Turner e6dbc99d47 arm64: Create a Linux view of the ID registers
When adding support for new hardware extensions we may not want to
enable support for the FreeBSD and Linux ABIs at the same time. To
support this split the Linux ID register and hwcaps so they can be
configured separately.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D42372
2023-11-10 16:01:13 +00:00
Andrew Turner c9e8b4b279 arm64: Use a hwcap ID rather than pointer
To allow for a different Linux hwcap value store the hwcap ID rather
than a pointer to elf{32,}_hwcap{2,}. This will be needed when creating
a different view of the ID registers for FreeBSD and Linux.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D42371
2023-11-10 16:01:13 +00:00
Andrew Turner c2dc043c97 arm64: Add an is64bit flag to user readable ID regs
To tell if a register is for 32 or 64 bit userspace add a flag to the
user reg struct. This will be used later to rework how the hwcaps are
generated.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D42370
2023-11-10 16:01:13 +00:00
Andrew Turner eb32c1c75a sysent: Add sv_protect
To allow for architecture specific protections add sv_protect to struct
sysent. This can be used to apply these after the executable is loaded
into the new address space.

Reviewed by:	kib
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D42440
2023-11-10 09:57:45 +00:00
Andrew Turner a04633cef8 imgact_elf: Export __elfN(parse_notes)
This is useful to check if a note is present and contains an expected
value, e.g. to read NT_GNU_PROPERTY_TYPE_0 on arm64 to see if we should
enable BTI.

Reviewed by:	kib, markj
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D42439
2023-11-10 09:57:45 +00:00
Andrew Turner 9d2612fc2a imgact_elf: Move GNU_ABI_VENDOR to a common header
Move the definition of GNU_ABI_VENDOR to a common location so it can
be used in multiple files.

Reviewed by:	emaste, kib, imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D42442
2023-11-10 09:57:45 +00:00
Andrew Turner 960b4327f4 bsd.compat.mk: Set MACHINE before including bsd.opts.mk
In bsd.opts.mk we check MACHINE_ARCH and may want to check MACHINE to
decide which options to enable. Unfortunately this is included too
early via bsd.compiler.mk.

Move including bsd.compiler.mk until after we can set MACHINE and
MACHINE_ARCH.

Reviewed by:	imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D42448
2023-11-10 09:57:45 +00:00
Andrew Turner 0b20014167 sys/conf: Move adding kernel.bin earlier
When building with kernel.bin enabled we need to set KERNEL_EXTRA and
KERNEL_EXTRA_INSTALL before they are used otherwise kernel.bin isn't
built.

Reviewed by:	imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D42531
2023-11-10 09:57:44 +00:00
Andrew Turner 83771b1914 llvm: Reduce overlinking with the minimal llvm
We only need to link against libz and libzstd when linking against the
fill libllvm, libllvmminimal doesn't use either library. Move adding
libz and libzstd to the list of libraries to link against to where
we decide to use the full libllvm.

Reported by:	Cristian Marussi <Cristian.Marussi@arm.com>
Reported by:	Colin S. Gordon <csgordon@fastmail.com>
Reviewed by:	dim
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D42528
2023-11-10 09:57:44 +00:00
Kyle Evans 8f2848eafa crunchgen: fix "keep" for an ELF world, break it out
"keep" currently adds a leading underscore, which hasn't been useful or
accurate since a.out days.  Preserve the symbol name as it's given
rather than mangle it to match ELF-style symbol names.

This was partially fixed back in
6cd35234a0 ("Assume ELF-style symbol names now.") for crunchgen, but
the keeplist wasn't changed to match it.

While we're here, break it out to bsd.crunchgen.mk for later use in
bsdbox.

Reviewed by:	adrian, imp
Differential Revision:	https://reviews.freebsd.org/D42499
2023-11-09 22:33:58 -06:00
Alexander Motin f0fa40867d Fix build on powerpc after previous commit. 2023-11-09 21:21:47 -05:00
Alexander Motin a03c23931e uma: Improve memory modified after free panic messages
- Pass zone pointer to trash_ctor() and report zone name in the panic
message.  It may be difficult to figyre out zone just by the item size.
 - Do not pass user arguments to internal trash calls, pass thezone.
 - Report malloc type name in the same unified panic message.
 - Report corruption offset from the beginning of the items instead of
the full pointer.  It makes panic message shorter and more readable.
2023-11-09 19:46:26 -05:00
Tom Jones 14105aae55 nlm: Fix error messages for failed remote rpcbind contact
In case of a remote rpcbind connection timeout,
the NFS kernel lock manager emits an error message
along the lines of:

    NLM: failed to contact remote rpcbind, stat = 5, port = 28416

In the Bugzilla PR, Garrett Wollman identified the following problems
with that error message:

- The error is in decimal, which can only be deciphered by reading the
  source code.
- The port number is byte-swapped.
- The error message does not identify the client the NLM is trying to
  communicate with.

Fix the shortcomings of the current error message by:

- Printing out the port number correctly.
- Mentioning the remote client.

The low-level decimal error remains an outstanding issue though.
It seems like the error strings describing the error codes live outside
of the kernel code currently.

PR:		244698
Reported by:	wollman
Approved by:	allanjude
Sponsored by:	National Bureau of Economic Research
Sponsored by:	Klara, Inc.
Co-authored-by:	Mateusz Piotrowski <0mp@FreeBSD.org>
2023-11-09 21:54:28 +01:00
R. Christian McDonald 6e5b1ff71e libc: enable initial-exec (IE) as default thread-local storage model on arm
As suggested by jrtc27@ in https://reviews.freebsd.org/D42415, this
patch enables IE as default thread-local storage model in libc on arm.

Reviewed by:	kib
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D42445
2023-11-09 21:24:23 +01:00
Konstantin Belousov ede4c412b3 vfs_domount_update(): ensure that 'goto end' works
We need to vfs_op_enter()/vn_seqc_write_start() before jumping to
cleanup.

PR:	274992
Reported by:	trasz
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Fixes:	9ef7a491a4
2023-11-09 22:18:47 +02:00