Commit graph

288077 commits

Author SHA1 Message Date
Alex Richardson 60e845ceef jevents: fix bootstrapping on Linux with Clang 16
The glibc fts_open() callback type does not have the second const
qualifier and it appears that Clang 16 errors by default for mismatched
function pointer types. Add an ifdef to handle this case.

Reviewed By:	imp, emaste
Differential Revision: https://reviews.freebsd.org/D43000
2023-12-11 21:14:56 -08:00
Alex Richardson 0156465c6d mandoc: fix bootstrapping on Linux with Clang 16
It appears that Clang 16 errors by default for the mismatched function
pointer types that are triggered by the fts callback (since glibc has a
callback type without the second const qualifier).
Fortunately, there is already code to handle glibc inside mandoc, we
just have to edit the checked-in config.h.

Reviewed By:	imp, emaste
Differential Revision: https://reviews.freebsd.org/D42999
2023-12-11 21:14:56 -08:00
Warner Losh 3fbed93203 cam.4: Modernize examples
Use mpr1 instead of ahd1 and ahci1 instead of ahc1. ahc and ahd haven't
been relevant for a while. Also update the transfer size HBAs can do
from from 64k to 1MB.

Sponsored by:		Netflix
2023-12-11 22:12:13 -07:00
Warner Losh 9ab58f9784 cam: Virtual SIMs communicate via the network too
A virutal SIM can also be connected via the network for iSCSI or NVM
over fabrics.

Sponsored by:		Netflix
2023-12-11 22:12:13 -07:00
Konstantin Belousov 0365e5fc90 if_tun: check device name
to avoid panic if the name already exists, which is possible with the
interface renaming.

PR:	266999
Reviewed by:	kevans
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D43001
2023-12-12 06:02:11 +02:00
Mark Johnston d5c6b32a31 socket.9: Catch up with commit cfb1e92912
Fixes:	cfb1e92912 ("sockets: don't malloc/free sockaddr memory on accept(2)")
Reported by:	Mina Galić <freebsd@igalic.co>
2023-12-11 17:15:54 -05:00
Kristof Provost e249f5daa4 pf: fix memory leak on rule add parse failure
Reported by:	Igor Ostapenko <pm@igoro.pro>
Reviewed by:	Igor Ostapenko <pm@igoro.pro>
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-12-11 20:53:00 +01:00
Brooks Davis 8ccd0b876e libc: expose execvpe for Linux compat
We already implemented execvpe internally with an _ prefix in libc so
go ahead and expose it for compatibility with Linux.

This reverts c605eea952.

Bump __FreeBSD_version for the addition and add definitions to supress
compat shims in libzfs (zfs changes were merged from upstream).

PR:		275370 (request and exp-run (thanks antoine!))
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D42846
2023-12-11 19:24:53 +00:00
Raghu Ranganathan 7df526eb10
look(1): Correct the example's description
Remove an extra 'e' in the example command.  It is a prefix, not a typo.

This is from the Advanced UNIX Programming Course (Fall’23) at NTHU.

MFC after:	3 days
Pull Request:	https://github.com/freebsd/freebsd-src/pull/913
2023-12-12 02:19:21 +08:00
Kristof Provost 99bcbef25a libpfctl: remove stray debug printf()
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-12-11 16:53:38 +01:00
Mark Johnston 3c0fb026b2 tty: Avoid a kernel memory discloure via kern.ttys
Four pad bytes at the end of each xtty structure were not being cleared
before being copied out.  Fix this by clearing the whole structure
before populating fields.

MFC after:	3 days
Reported by:	KMSAN
2023-12-11 09:19:09 -05:00
Mark Johnston ce2f34ade8 arm: Disable the VFP during boot
The VFP code expects the kernel to boot with VFP disabled, but some
boards will boot with it enabled.  Make sure that vfp_init() disables
the VFP on each CPU during boot.

PR:		273752
Reviewed by:	andrew
Diagnosed by:	Thomas Skibo <thomas-bsd@skibo.net>
MFC after:	1 week
2023-12-11 09:08:49 -05:00
Mark Johnston 03a07de0d5 arm: Handle VFP exceptions from the kernel
vfp_bounce() is called when handling an undefined instruction exception,
to see if we need to enable the VFP.  Previously it would
unconditionally panic if the exception came from the kernel, which was
simply wrong, and it did not permit lazy initialization of VFP state in
the kernel.  However, this functionality can be useful and is supported
by arm's fpu_kern_enter() implementation.  Thus, relax assertions and
consume the exception if the thread was in an FPU section.

Based on a patch from Stormshield.

Reviewed by:	andrew
MFC after:	2 weeks
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
Differential Revision:	https://reviews.freebsd.org/D42971
2023-12-11 09:08:34 -05:00
Mark Johnston ecc2e6deae arm: Fix handling of undefined instructions in kernel mode
Only panic if no undefined instruction handler matched the exception.
This can arise in practice if the VFP is enabled lazily.

While here, fix the panic string to not include a newline.

Reviewed by:	andrew
Obtained from:	Stormshield
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
Differential Revision:	https://reviews.freebsd.org/D42970
2023-12-11 09:08:08 -05:00
Mark Johnston a6a481eaa2 arm: Add fpu_kern_alloc_ctx()
This enables the use of some out-of-tree crypto libraries on arm.
No functional change intended, there are no callers of this function in
the tree currently.

Reviewed by:	andrew
MFC after:	1 week
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
Differential Revision:	https://reviews.freebsd.org/D42969
2023-12-11 09:07:55 -05:00
Mark Johnston 96465c789a arm: Compile vfp.c conditionally rather than using an ifdef
No functional change intended.

MFC after:	1 week
2023-12-11 09:07:40 -05:00
Mariusz Zaborski a7100ae23a capsicum: introduce cap_rights_is_empty Function
Before this commit, we only had the capability to check if a specific
capability was set (using cap_rights_is_set function). However, there
was no efficient method to determine if a cap_rights_t structure doesn't
contain any capability. The cap_rights_is_empty function addresses
this gap.

PR:		275330
Reported by:	vini.ipsmaker@gmail.com
Reviewed by:	emaste, markj
Differential Revision:	https://reviews.freebsd.org/D42780
2023-12-11 12:15:46 +01:00
Emmanuel Vadot bd0771390e eqos: Call init earlier
Call the subclassed IF_EQOS_INIT before trying to read the mac, clocks
and reset needs to dealt with before we can read the registers.
2023-12-11 11:31:28 +01:00
Emmanuel Vadot 22029445cb eqos: Unbreak fdt support
We need to enable the clocks and deassert the resets for eqos to work
correctly.
2023-12-11 11:31:26 +01:00
Emmanuel Vadot 96812bd10b eqos: Remove extra x in printf
No functional changes intended.
2023-12-11 11:31:24 +01:00
Konstantin Belousov 86e2bcbf47 strfmon.c: Use the restrict keyword directly
libc sources assume C99 or even C11 compiler already, unlike headers.
There is no reason to obfuscate the basic C constructs.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-12-10 23:28:25 +02:00
Jose Luis Duran 56a0d5444d strfmon: style fixes
Check style(9) with checkstyle9.pl and clang-format.
No functional change intended.

MFC after:	1 week
2023-12-10 23:28:16 +02:00
Stéphane Rochoy 4b9d605768 libsecureboot: be more verbose about validation failures
Reviewed by:	imp, sjg
Pull Request:	https://github.com/freebsd/freebsd-src/pull/916
2023-12-10 15:13:56 -05:00
Jose Luis Duran dff3a80f6d endian.h: Remove duplicate words
Reviewed by:	emaste
Pull Request:	https://github.com/freebsd/freebsd-src/pull/920
2023-12-10 12:40:57 -05:00
Peter Holm 41667b04e5 stress2: Only extract the allocation with the exact name "pts" 2023-12-10 09:34:38 +01:00
Mark Johnston ae77041e07 kthread: Set *newtdp earlier in kthread_add1()
syzbot reported a single boot-time crash in g_event_procbody(), a page
fault when dereferencing g_event_td.  g_event_td is initialized by the
kproc_kthread_add() call which creates the GEOM event thread:

  kproc_kthread_add(g_event_procbody, NULL, &g_proc, &g_event_td,
      RFHIGHPID, 0, "geom", "g_event");

I believe that the caller of kproc_kthread_add() was preempted after
adding the new thread to the scheduler, and before setting *newtdp,
which is equal to g_event_td.  Thus, since the first action of the GEOM
event thread is to lock itself, it ended up dereferencing a NULL
pointer.

Fix the problem simply by initializing *newtdp earlier.  I see no harm
in that, and it matches kproc_create1().  The scheduler provides
sufficient synchronization to ensure that the store is visible to the
new thread, wherever it happens to run.

Reported by:	syzbot+5397f4d39219b85a9409@syzkaller.appspotmail.com
Reviewed by:	kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42986
2023-12-09 14:11:33 -05:00
Ed Maste 3b1904d9eb pkgbase: pass --recurse-submodules to git ls-files
When generating source packages.  Although submodules are not used by
FreeBSD itself they may be used by downstream projects.  By default
for submodules `git ls-files` just emits the submodule directory name,
which resulted in:

    pkg: pkg_checksum_hash_sha256_file(read failed): Is a directory

Passing --recurse-submodules lists all of the files in each submodule
(which is desired when submodules are in use), and has no effect when
submodules are not present.

Reviewed by:	bapt, manu
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42983
2023-12-09 11:10:01 -05:00
Mark Johnston 1c376684c7 Cirrus-CI: Use HTTPS to fetch pkg
Discussed with:	Jose Luis Duran <jlduran@gmail.com>
Fixes:	3c097b06a7 ("Cirrus-CI: forcably upgrade pkg to latest")
2023-12-09 10:12:04 -05:00
Michael Tuexen bed7633b10 tcp: tcp: allow SOL_SOCKET-level socket options via sysctl interface
When using the sysctl interface for setting a SOL_SOCKET-level socket
option, the TCP handler refers to the IP handler, which only handles
SO_SETFIB and SO_MAX_PACING_RATE.
So call sosetopt(), which handles all SOL_SOCKET-level options.
Then you can use tcpsso with SOL_SOCKET-level socket options as
expected.

Reported by:		rscheff
Reviewed by:		glebius, rscheff
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D42985
2023-12-09 13:03:51 +01:00
Dimitry Andric 1a4a9a5057 libicp_rescue: unbreak for armv6 after recent OpenZFS import
Similar to fb17dfa0c8, fix libicp_rescue to include asm versions of
sha2 on armv6, to unbreak the build of rescue.

Fixes:		3494f7c019
2023-12-09 12:51:50 +01:00
Emmanuel Vadot 0fb9d5786b pkgbase: Move tr(1) to runtime
Since f7d16a627e ("certctl: Convert line endings before inspecting files.")
certctl is using tr(1). Add it to FreeBSD-runtime so we can have certctl working
without having the bloated FreeBSD-utilities.

Sponsored by:	Beckhoff Automation GmbH & Co. KG
2023-12-09 12:21:02 +01:00
Jose Luis Duran 6abee52e0d strfmon: Silence scan-build warning
The value stored to 'value' is never read.

Reported by:	Jenkins (scan-build)
MFC after:	1 week
2023-12-09 03:06:28 +02:00
Jose Luis Duran 2a163c3649 strfmon.3: Cleanup example code
- xlocale.h would have been required if using strfmon_l().  Here,
  setlocale() just requires locale.h.
- ANSIfy function declaration.
- Add a final return().

MFC after:	1 week
2023-12-09 03:06:13 +02:00
Dimitry Andric fb17dfa0c8 libicp: unbreak for armv6 after recent OpenZFS import
The following upstream commit:
727497ccdf module/icp/asm-arm/sha2: enable non-SIMD asm kernels on armv5/6

does indeed enable sha2 asm for earlier arm CPUs, but since libicp's
Makefile was not updated, this leads to:

  ld: error: undefined reference due to --no-allow-shlib-undefined: zfs_sha256_block_armv7

Fix it by compiling sha256-armv7.S and sha512-armv7.S for armv6 too.

Fixes:		3494f7c019
2023-12-09 00:09:50 +01:00
Kyle Evans e183039f08 loader: lua: assume late ACPI detection if the feature isn't enabled
While we're here, enable the feature in the places we detect ACPI.  This
lets us side-step the existing issues and provide a path forward for
folks upgrading from previous releases that haven't updated their ESP
yet.

Let's also fix core.setACPI: the hint already indicates that the
user's disabled it more consistently than loader.acpi_disabled_by_user.
Even more, the latter is wrong because we set it by default if we did
not detect ACPI.  The ACPI hint remains even when we're setting defaults
because ACPI loaded into the kernel will make some noise if it's not
hinted off, even when we didn't detect it.

imp notes that this will result in some relatively harmless noise on
platforms that don't support ACPI but aren't using the UEFI loader, as
we would enable the ACPI module for loading on them and then loader
would not be able to find it.  These are non-fatal, but should probably
be fixed by just declaring support for EARLY_ACPI in those loaders since
we know they won't have ACPI early on -- punting on this for the time
being, though, in favor of providing a safer upgrade path sooner.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D42727
2023-12-08 15:43:59 -06:00
Kyle Evans 1631382cf2 loader: provide a features table for binary compatibility advertisement
liblua now provides a loader.has_feature() function to probe the loader
binary for features advertised.  name => desc mappings are provided in
loader.features to get a list of all of the features loader *can*
support.  core.hasFeature is provided as a shim to loader.has_feature
so that individual consumers don't need to think about the logic of the
loader module not providing has_feature; we know that means the feature
isn't enabled.

The first consumer of this will be EARLY_ACPI to advertise that the
loader binary probes for ACPI presence before the interpreter has
started, so that we know whether we can trust the presence of acpi.rsdp
as relatively authoritative.  In general, it's intended to be used to
avoid breaking new scripts on older loaders within reason.

This will be used in lua as `core.hasFeature("EARLY_ACPI")`, while the
C bits of loader will `feature_enable(FEATURE_EARLY_ACPI)`.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D42695
2023-12-08 15:43:19 -06:00
Dimitry Andric f959fcafb5 ObsoleteFiles.inc: remove old libufs.so.7 after bump
Fixes:		772430dd67
2023-12-08 22:23:00 +01:00
Dimitry Andric 8e0f416779 ObsoleteFiles.inc: fix dates after llvm 17.0.6 merge.
PR:		273753
MFC after:	1 month
2023-12-08 22:22:12 +01:00
Dimitry Andric c711af7727 Bump __FreeBSD_version for llvm 17.0.6 merge
PR:		273753
MFC after:	1 month
2023-12-08 18:36:40 +01:00
Dimitry Andric feb5b0c76f Merge commit 158f4f30adb4 from llvm git (by Corentin Jabot):
[Clang] Do not change the type of captured vars when checking lambda constraints

  When checking the constraint of a lambda, we need to respect the constness
  of the call operator when establishing the type of capture variables.

  In D124351, this was done by adding const to the captured variable...
  However, that would change the type of the variable outside of the scope
  of the lambda, which is clearly not the desired outcome.

  Instead, to ensure const-correctness, we need to populate
  a LambdaScopeInfo with the capture variables before checking the
  constraints of a generic lambda.

  There is no changelog as I'd like to tentatively propose we backport
  this change to RC3 as it is a regression introduced in the Clang 17
  cycle.

  Fixes #61267

  Reviewed By: aaron.ballman, #clang-language-wg

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

Merge commit 3ed9e9e3ace6 from llvm git (by Corentin Jabot):

  [Clang] Add captures to the instantiation scope of lambda call operators

  Like concepts checking, a trailing return type of a lambda
  in a dependent context may refer to captures in which case
  they may need to be rebuilt, so the map of local decl
  should include captures.

  This patch reveal a pre-existing issue.
  `this` is always recomputed by TreeTransform.

  `*this` (like all captures) only become `const`
  after the parameter list.

  However, if try to recompute the value of `this` (in a parameter)
  during template instantiation while determining the type of the call operator,
  we will determine  it to be const (unless the lambda is mutable).

  There is no good way to know at that point that we are in a parameter
  or not, the easiest/best solution is to transform the type of this.

  Note that doing so break a handful of HLSL tests.
  So this is a prototype at this point.

  Fixes #65067
  Fixes #63675

  Reviewed By: erichkeane

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

This fixes 'Assertion failed: (isa<LabelDecl>(D) && "declaration not
instantiated in this scope"), function findInstantiationOf' error when
building databases/mongodb44.

PR:		273753
MFC after:	1 month
2023-12-08 18:36:06 +01:00
Dimitry Andric 5c16e71d30 Merge llvm-project release/17.x llvmorg-17.0.6-0-g6009708b4367
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-17.0.6-0-g6009708b4367.

PR:		273753
MFC after:	1 month
2023-12-08 18:35:59 +01:00
Dimitry Andric b121cb0095 Merge llvm-project release/17.x llvmorg-17.0.5-0-g98bfdac5ce82
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-17.0.5-0-g98bfdac5ce82.

PR:		273753
MFC after:	1 month
2023-12-08 18:35:50 +01:00
Dimitry Andric bdb86d1a85 Merge llvm-project release/17.x llvmorg-17.0.3-0-g888437e1b600
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-17.0.3-0-g888437e1b600.

PR:		273753
MFC after:	1 month
2023-12-08 18:35:41 +01:00
Dimitry Andric 3bd749dbd9 Merge llvm-project release/17.x llvmorg-17.0.2-0-gb2417f51dbbd
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-17.0.2-0-gb2417f51dbbd.

PR:		273753
MFC after:	1 month
2023-12-08 18:35:33 +01:00
Dimitry Andric 4542f901cb Merge llvm-project release/17.x llvmorg-17.0.1-25-g098e653a5bed
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-17.0.1-25-g098e653a5bed.

PR:		273753
MFC after:	1 month
2023-12-08 18:35:22 +01:00
Dimitry Andric 8a4dda33d6 Merge llvm-project release/17.x llvmorg-17.0.0-rc4-10-g0176e8729ea4
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-17.0.0-rc4-10-g0176e8729ea4.

PR:		273753
MFC after:	1 month
2023-12-08 18:35:11 +01:00
Dimitry Andric 06c3fb2749 Merge llvm-project main llvmorg-17-init-19304-gd0b54bb50e51
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project main llvmorg-17-init-19304-gd0b54bb50e51, the
last commit before the upstream release/17.x branch was created.

PR:		273753
MFC after:	1 month
2023-12-08 18:34:50 +01:00
Alan Somers cf037972ea libcasper: document that most libcasper functions are not thread-safe
And neither are most libcasper services' functions, because internally
they all use cap_xfer_nvlist.  cap_xfer_nvlist sends and then receives
data over a unix domain socket and associated with the cap_channel_t
argument.  So absent synchronization, two threads may not use the same
cap_channel_t argument or they risk receiving the other's reply.

MFC after:	2 weeks
Sponsored by:	Axcient
Reviewed by:	oshogbo
Differential Revision: https://reviews.freebsd.org/D42928
2023-12-08 09:22:39 -07:00
Martin Matuska 3494f7c019 Notable upstream pull request merges:
#15539 687e4d7f9 Extend import_progress kstat with a notes field
 #15544 c7b611926 Allow block cloning across encrypted datasets
 #15553 adcea23cb ZIO: Add overflow checks for linear buffers
 #15593 5f2700eee zpool: flush output before sleeping
 #15609 3e4bef52b Only provide execvpe(3) when needed
 #15610 735ba3a7b Use uint64_t instead of u_int64_t
 #15612 bcd83ccd2 ZIL: Remove TX_CLONE_RANGE replay for ZVOLs
 #15617 55b764e06 ZIL: Do not clone blocks from the future
 #15623 727497ccd module/icp/asm-arm/sha2: enable non-SIMD asm kernels
                  on armv5/6
 #15625 9743d0963 BRT: Limit brt_vdev_dump() to only one vdev
 #15629 f9765b182 zdb: Dump encrypted write and clone ZIL records
 #15634 2aa3a482a ZIL: Remove 128K into 2x68K LWB split optimization
 #15639 11656234b FreeBSD: Ensure that zfs_getattr() initializes the
                  va_rdev field
 #15647 4836d293c zfs_refcount_remove: explictly ignore returns
 #15649 f0cb6482e setproctitle: fix ununitialised variable
 #15650 450f2d0b0 import: ignore return on hostid lookups

Obtained from:	OpenZFS
OpenZFS commit:	450f2d0b08
2023-12-08 10:13:33 +01:00
Alexander Motin 1f36ca5de5 vmstat: Rely on libxo for numbers humanization
This makes code cleaner, plus fixes such nonsense as humanized JSON
and XML, making all numbers raw without quotes, spaces, suffixes, etc.

MFC after:      2 weeks
2023-12-07 21:21:35 -05:00