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)
[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)
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)
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)
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)
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)
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)
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)
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
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)
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)
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)
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)
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>
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)