Commit graph

277427 commits

Author SHA1 Message Date
Dimitry Andric 335f7960dc Add two FreeBSD customizations to libc++
This is intended to better support ports usage of older clang versions:
* Add _LIBCPP_ENABLE_COMPILER_VERSION_CHECKS block around compiler
  version checks, to avoid any warnings about support. This makes some
  ports that use -Werror fall over.
* When using clang < 15.0, avoid using a type visibility attribute on
  the std namespace, as older versions of clang do not support this.

PR:		276104
MFC after:	1 month

(cherry picked from commit 412fa3436f)
2024-04-19 23:24:41 +02:00
Dimitry Andric 15ce79bc8b Tentatively merge https://github.com/llvm/llvm-project/pull/77242
[libcxx] Re-include <osreldate.h> in __config for FreeBSD

  In 0a97720d0197 some changes were made to `__config` for assuming that
  `__BYTE_ORDER__` is always present.

  However, this deleted a `<osreldate.h>` include for FreeBSD, which is
  required to get the value of `__FreeBSD_version`, and that is used later
  in the file to determine whether `_LIBCPP_C_HAS_NO_GETS` needs to be
  enabled.

  Include `<osreldate.h>` just after the other includes used for feature
  detection, to fix this.

  Note that when FreeBSD 13 is EOLed, this can be removed, as then all
  supported FreeBSD versions will no longer have `gets()`.

PR:		276104
MFC after:	1 month

(cherry picked from commit 653487bbc8)
2024-04-19 23:24:41 +02:00
Dimitry Andric 0c85e2760f Merge llvm-project main llvmorg-18-init-16003-gfc5f51cf5af4
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project main llvmorg-18-init-16003-gfc5f51cf5af4.

PR:		276104
MFC after:	1 month

(cherry picked from commit 647cbc5de8)
2024-04-19 23:24:24 +02:00
Dimitry Andric 92d4d6f1f6 Revert commit 0e46b49de433 from llvm-project (by Matt Arsenault):
Reapply "RegisterCoalescer: Add implicit-def of super register when coalescing SUBREG_TO_REG"

  This reverts commit c398fa009a47eb24f88383d5e911e59e70f8db86.

  PPC backend was fixed in 2f82662ce901c6666fceb9c6c5e0de216a1c9667

Since it causes an assertion failure building /sys/dev/fb/vga.c:
https://github.com/llvm/llvm-project/issues/76416

PR:		276104
MFC after:	1 month

(cherry picked from commit edc2dc17b1)
2024-04-19 23:23:59 +02:00
Dimitry Andric a205596100 Merge llvm-project main llvmorg-18-init-15692-g007ed0dccd6a
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project main llvmorg-18-init-15692-g007ed0dccd6a.

PR:		276104
MFC after:	1 month

(cherry picked from commit cb14a3fe51)
2024-04-19 23:23:58 +02:00
Dimitry Andric b168c9a3e5 Tentatively apply https://github.com/llvm/llvm-project/pull/76175
This fixes libsa including compiler-rt builtins.

PR:		276104
MFC after:	1 month

(cherry picked from commit 3d68ee6cbd)
2024-04-19 23:23:57 +02:00
Dimitry Andric bdbe302c33 Merge llvm-project main llvmorg-18-init-15088-gd14ee76181fb
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project main llvmorg-18-init-15088-gd14ee76181fb.

PR:		276104
MFC after:	1 month

(cherry picked from commit 5f757f3ff9)
2024-04-19 23:23:40 +02:00
Michael Zhilin e7a1904fe1 snd_hda: fix "duplicated free" on module unloading
This is trivial fix of hdacc_detach to avoid duplicated free on snd_hda
unloading.

The first try of detaching (kldunload) may results into "device busy" error,
but codec->fgs is freed by detach. Second try attempts to free codec->fgs again
and system panicks.

Here is example:

pcm0: unregister: channel pcm0:virtual:dsp0.vp0 busy (pid 3428)
pulseaudio[3428] [oss] module-oss.c: DSP shutdown.
pcm0: detached
hdaa0: detached
panic: Duplicate free of 0xfffff80412ee7d20 from zone 0xfffffe006bc0ba00
(malloc-32) slab 0xfffff80412ee7fc8(105)
cpuid = 6
time = 1712999565
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe0202f859e0
vpanic() at vpanic+0x135/frame 0xfffffe0202f85b10
panic() at panic+0x43/frame 0xfffffe0202f85b70
uma_dbg_free() at uma_dbg_free+0x105/frame 0xfffffe0202f85b90
uma_zfree_arg() at uma_zfree_arg+0x95/frame 0xfffffe0202f85be0
free() at free+0xa1/frame 0xfffffe0202f85c20
hdacc_detach() at hdacc_detach+0x2f/frame 0xfffffe0202f85c40
device_detach() at device_detach+0x197/frame 0xfffffe0202f85c80
devclass_driver_deleted() at devclass_driver_deleted+0x66/frame 0xfffffe0202f85c
devclass_delete_driver() at devclass_delete_driver+0x81/frame 0xfffffe0202f85d00
driver_module_handler() at driver_module_handler+0xff/frame 0xfffffe0202f85d50
module_unload() at module_unload+0x32/frame 0xfffffe0202f85d70
linker_file_unload() at linker_file_unload+0x1eb/frame 0xfffffe0202f85db0
kern_kldunload() at kern_kldunload+0x18e/frame 0xfffffe0202f85e00
amd64_syscall() at amd64_syscall+0x153/frame 0xfffffe0202f85f30
fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe0202f85f30

MFC after:              3 days
Reviewed by:            markj, christos
Differential Revision:  https://reviews.freebsd.org/D44778
Sponsored by:           Postgres Professional

(cherry picked from commit bed0b2146f)
2024-04-19 10:23:36 +03:00
Michael Zhilin 7929371054 snd_hda: Add the full Intel Meteor/Arrow/Lunar Lake HD Audio PCI IDs
This is based off the Linux file sound/hda/intel-dsp-config.c.

Tested on:              Lenovo Thinkbook 16 G6+ IMH
MFC after:              3 days
Reviewed by:            markj, christos
Differential Revision:  https://reviews.freebsd.org/D44777
Sponsored by:           Postgres Professional

(cherry picked from commit 1dd1a696c5)
2024-04-19 10:23:36 +03:00
Scott Long 8ee68ab867 Fix "set but not used" for the sym driver.
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 5045cb8f18)
2024-04-18 21:41:36 +02:00
Marius Strobl 3d1d7c2c16 fib_algo(4): Lower level of algorithm switching messages to LOG_INFO
Otherwise, with the default flm_debug_level of LOG_NOTICE, it's rather
easy to trigger debug messages such as:
[fib_algo] inet.0 (bsearch4#18) rebuild_fd_flm: switching algo to
radix4_lockless

Also, the "severity" of these events generally only justifies LOG_INFO
and not LOG_NOTICE.

Reviewed by:	melifaro

(cherry picked from commit ed81a15517)
2024-04-18 21:41:36 +02:00
Kristof Provost 02ea70eff3 tcpdump: fix build
Apply the change that was supposed to be in bf0700716a
2024-04-18 17:55:34 +02:00
Kristof Provost bf0700716a tcpdump: cope with incorrect packet lengths
It's possible for the capture buffer to be smaller than indicated by the
header length. However, pfsync_print() only took the header length into
account. As a result we could read outside of the buffer.

Check that we have at least the expected amount of data before we start
parsing.

PR:		278034
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D44580

(cherry picked from commit 4848eb3af2)
2024-04-18 09:41:28 +02:00
Gordon Bergling da013f1d5f atrtc(4): Fix a typo in a sysctl description
- s/emtpy/empty/

(cherry picked from commit 38cc6c3d95)
2024-04-18 06:34:52 +02:00
Alexander Motin 4bb54e8ec3 ahc/ahd: Fix target mode operation
After 5e63cdb457 the drivers didn't clear CAM_DIS_DISCONNECT in
ah*_handle_target_cmd() when needed, only set it.

Reported/tested by:	HP van Braam <hp@tmm.cx>
MFC after:	1 week

(cherry picked from commit f1e4c09577)
2024-04-17 09:40:06 -04:00
Konstantin Belousov 7cf0b203f5 Revert "acpidump: dump AMD IVRS table describing IOMMU layout"
and related helping commits on stable/13. This reverts commits
256ee428f5
f95a254aa7
f7fd7f8b88

The acpi-ca version on stable/13 is too old.
2024-04-17 12:40:04 +03:00
Konstantin Belousov 02dc74cc21 pciconf(8): dump AMD IOMMU Base Capability
(cherry picked from commit 1e6db7be69)
2024-04-17 11:13:18 +03:00
Konstantin Belousov 6b771774c5 pcireg.h: Add AMD IOMMU Base Cap definitions
(cherry picked from commit 33adb388c7)
2024-04-17 11:13:18 +03:00
Konstantin Belousov 6f8e8d0723 pcireg.h: add include guard
(cherry picked from commit 1cd9868f04)
2024-04-17 11:13:18 +03:00
Konstantin Belousov 256ee428f5 acpidump: add Foundation copyright
(cherry picked from commit f1519a8229)
2024-04-17 11:13:18 +03:00
Konstantin Belousov f95a254aa7 acpidump: dump AMD IVRS table describing IOMMU layout
(cherry picked from commit 6d789b6126)
2024-04-17 11:13:18 +03:00
Konstantin Belousov f7fd7f8b88 acpidump: add printfield() helper
(cherry picked from commit 969a4b8be5)
2024-04-17 11:13:18 +03:00
Konstantin Belousov 84944bf5e2 acpidump: bump WARNS to 6
(cherry picked from commit 29a6b72775)
2024-04-17 11:13:17 +03:00
Konstantin Belousov 930c76a733 acpidump: the acpi_get_fadt_revision() argument is unused
(cherry picked from commit 4262ad56a0)
2024-04-17 11:13:17 +03:00
Konstantin Belousov f77abc3526 acpidump: silent the warning about unaligned uuid
(cherry picked from commit de937ecb75)
2024-04-17 11:13:17 +03:00
Konstantin Belousov a6caa7bc54 stop_all_proc(): skip traced or signal-stoped processes
(cherry picked from commit 235436d631)
2024-04-17 11:13:17 +03:00
Michael Osipov d596e57311 freebsd-update: Don't provide copiable commands in output
Previously, freebsd-update provided ready-to-go commands for copying and
pasting into the terminal. This causes problems as soon as options are
used and not supplied again by the user, e.g., '-b' or '-d'.
Stop making them copiable and force the user to construct a valid command
line by himself to avoid failures.

PR:		276102
Approved by:	jrm (mentor), emaste
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D43700
2024-04-17 08:51:38 +02:00
Mathieu 1e2be096d4 daemon: fix -R to enable supervision mode
If we're doing restarts, then we must supervise -- the 'R' case simply
got missed.

PR:	278342
Fixes:	f907027b49 ("daemon: set supervise_enabled during [..]")
(cherry picked from commit bbc6e6c5ec)
2024-04-17 00:50:03 -05:00
Mark Johnston 894bf6bd7d wg: Use ENETUNREACH when transmitting to a non-existent peer
The old errno value used is specifically for Capsicum and shouldn't be
co-opted in this way.  It has special handling in the generic syscall
layer (see syscallret()).  OpenBSD returns ENETUNREACH in this case;
let's do the same thing.

PR:		266712
Reviewed by:	kevans, imp
MFC after:	2 weeks
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D44582

(cherry picked from commit 63613e3ba1)
2024-04-16 12:08:54 -04:00
Zhenlei Huang d77e45e29f ng_socket: Treat EEXIST from kern_kldload() as success
EEXIST is possible in a race condition.

Inspired by:	ffc72591b1 (Don't worry if a module is already loaded ...)
Reviewed by:	glebius
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D44633

(cherry picked from commit f6f67f58c1)
(cherry picked from commit 2e8d60c685)
2024-04-16 12:36:16 +08:00
Zhenlei Huang 41e4389a3d debugnet: Fix logging of frame length
MFC after:	1 week

(cherry picked from commit 6fe4d8395b)
(cherry picked from commit 800bd7da4c)
2024-04-15 12:03:06 +08:00
Zhenlei Huang 65212656f8 ethernet: Fix logging of frame length
Both the mbuf length and the total packet length are signed.

While here, update a stall comment to reflect the current practice.

Reviewed by:	kp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42390

(cherry picked from commit e7102929bf)
(cherry picked from commit 4d65728d55)
2024-04-15 12:02:57 +08:00
Rick Macklem c39938ddd3 exports.5: Add RFC number for NFS over TLS
This is a content change.

(cherry picked from commit 401c0f8aa1)
2024-04-13 18:15:46 -07:00
Alexander Motin 330954bdb8
Unify arc_prune_async() code, fix excessive ARC pruning
There is no sense to have separate implementations for FreeBSD and Linux.  Make
Linux code shared as more functional and just register FreeBSD-specific prune
callback with arc_add_prune_callback() API.

Aside of code cleanup this fixes excessive pruning on FreeBSD.

[olce: This code comes from the OpenZFS pull request:
https://github.com/openzfs/zfs/pull/16083, vendor-merged into our tree.  Its
commit message has been slightly adapted to the present context.  The upstream
pull request has been reviewed and merged into 'zfs-2.1.16-staging' as
5b81b1bf5e6d6aeb8a87175dcb12b529185cac2f, which should come into our tree at the
next vendor import.  This is the same code that was merged into stable/14 and
main as part of vendor merges, and released as an EN (FreeBSD-EN-23:18.openzfs)
over releng/14.0 by markj@.]

PR:             275594, 274698
Reported by:    Seigo Tanimura <seigo.tanimura@gmail.com>, markj, and others
Tested by:      olce
Approved by:    emaste (mentor)
Obtained from:  OpenZFS
Sponsored by:   iXsystems, Inc.
Sponsored by:   The FreeBSD Foundation
Signed-off-by:  Alexander Motin <mav@FreeBSD.org>
2024-04-12 15:00:11 +02:00
Zhenlei Huang f0edd08b27 LinuxKPI: Remove the temporary variable fileid from the macro request_module
The variable fileid stores the result from kern_kldload() but never gets
used. Since the third parameter `*fileid` of kern_kldload() can be NULL,
this unused variable can be safely removed.

No functional change intended.

Reviewed by:	emaste, bz, #linuxkpi
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D44583

(cherry picked from commit 317cc829ee)
(cherry picked from commit d4d5aed66a)
2024-04-12 19:27:13 +08:00
Gordon Bergling 15ce8a1cc1 mem.4: Correct the HISTORY section
The history section (added in CSRG) claimed both first appeared in v6.
Looking at the manuals in the TUHS archive, /dev/mem was in v1
and /dev/kmem was introduced in v5.

Reviewed by:	imp
Obtained from:	OpenBSD
Differential Revision:	https://reviews.freebsd.org/D44486

(cherry picked from commit 8a56ef8d75)
2024-04-11 14:10:53 +02:00
Mikael Urankar 54030e8a5d dma.conf: Fix typo
Pull Request: https://github.com/freebsd/freebsd-src/pull/1150

(cherry picked from commit c92400a6f6)
(cherry picked from commit bedc8daace)
2024-04-09 09:37:28 -04:00
a-biardi c525951492 freebsd-update: Fix typo in comment
s/patchname expansion/pathname expansion/

Signed-off-by: a.biardi@tiscali.it
Pull-request: https://github.com/freebsd/freebsd-src/pull/1152
(cherry picked from commit 9181171162)
(cherry picked from commit 507e18dfc3)
2024-04-09 09:37:28 -04:00
Ed Maste 8e8d76571f ccdconfig: reference gpart rather than fdisk and disklabel
fdisk and disklabel are legacy tools for legacy disk partitioning
schemes.

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D43564

(cherry picked from commit 8669e516f0)
(cherry picked from commit 7ced571062)
2024-04-09 09:37:28 -04:00
Ed Maste da7a435018 ccdconfig: remove obsolete references to BSD disklabels
ccd(4) previoulsy had knowledge of BSD disklabels, and relied on their
use on the underlying disks, but this hasn't been the case since 2003
(commit 0f76d6d822).

Remove disklabel references from the man page.

Reviewed by: imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D43574

(cherry picked from commit a3ed434a69)
(cherry picked from commit b5ae8f2171)
2024-04-09 09:37:28 -04:00
Eugene Grosbein 1879f7affb MFC: if_bridge: change MTU for new members
Rather than reject new bridge members because they have the wrong MTU
change it to match the bridge. If that fails, reject the new interface.

PR:	264883
Different Revision:	https://reviews.freebsd.org/D35597

(cherry picked from commit 1865ebfb12)
2024-04-09 17:50:20 +07:00
Eugene Grosbein d3ce1a1b37 MFC: if_bridge: use IF_MINMTU
Replace incorrect constant 576 with IF_MINMTU to check for minimum MTU.
This unbreaks bridging tap interfaces with small mtu.

MFC after:	1 week
2024-04-09 17:22:38 +07:00
Zhenlei Huang a7b2c45550 kern linker: Do not touch userrefs of the kernel file
A nonzero `userrefs` of a linker file indicates that the file, either
loaded from kldload(2) or preloaded, can be unloaded via kldunload(2).
As for the kernel file, it can be unloaded by the loader but should not
be after initialization.

This change fixes regression from d9ce8a41ea which incidentally
increases `userrefs` of the kernel file.

Reviewed by:	dfr, dab, jhb
Fixes:	d9ce8a41ea kern_linker: Handle module-loading failures in preloaded .ko files
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D42530

(cherry picked from commit 39450eba8e)
(cherry picked from commit 7da45efb09)
2024-04-09 12:13:19 +08:00
Zhenlei Huang a2f5765662 kern linker: Do not unload a module if it has dependants
Despite the name, linker_file_unload() will drop a reference and return
success when the module file has dependants, i.e. it has more than one
reference. When user request to unload such modules then the kernel
should reject unambiguously and immediately.

PR:		274986
Reviewed by:	dfr, dab, jhb
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D42527

(cherry picked from commit f43ff3e15c)
(cherry picked from commit f1994d1eb2)
2024-04-09 12:13:08 +08:00
John Baldwin 092dd9545f ddp: Clear active DDP buffer members to NULL to pacify an assertion
Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D43999

(cherry picked from commit 25429e2743)
2024-04-08 11:06:58 -07:00
John Baldwin 257f36a7db kldxref: Properly handle reading strings near the end of an ELF file
If a string is at or near the end of an input file and the amount of
remaining data in the file is smaller than the maximum string size,
the pread(2) system call would return a short read which is treated as
an error.  Instead, add a new helper function for reading a string
which permits short reads so long as the data read from the file
contains a terminated string.

Reported by:	jrtc27
Reviewed by:	jrtc27
Sponsored by:	University of Cambridge, Google, Inc.
Differential Revision:	https://reviews.freebsd.org/D44419

(cherry picked from commit 785600d0fb)
2024-04-08 11:06:41 -07:00
John Baldwin c0ee9e5e41 arm busdma: Fix parameter types to exclusion_bounce_check
These are bus addresses not CPU virtual addresses.

Reviewed by:	andrew
Sponsored by:	University of Cambridge, Google, Inc.
Differential Revision:	https://reviews.freebsd.org/D44343

(cherry picked from commit 66658b0f27)
2024-04-08 11:05:34 -07:00
John Baldwin dcedc7b7f2 .github: Switch to v4 of actions/checkout
GitHub is emitting a warning that v3 is deprecated due to using
Node.js 16.

(cherry picked from commit e6dccf0050)
2024-04-08 11:03:08 -07:00
John Baldwin 661e3d4f15 nvmecontrol: Update the test for a valid firmare revision slot
Reported by:	Coverity Scan
CID:		1539214
Fixes:		7485926e09 nvme: Firmware revisions in the firmware slot info logpage are ASCII strings

(cherry picked from commit 1b38f851d8)
2024-04-08 11:01:32 -07:00
John Baldwin 4329e6ccfa nvme: Firmware revisions in the firmware slot info logpage are ASCII strings
In particular, don't try to byteswap the values as 64-bit integers and
always print a non-empty version as a string.

Reviewed by:	chuck, imp
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D44121

(cherry picked from commit 7485926e09)
2024-04-08 11:01:07 -07:00