Previously zfsd would crash in the presence of a pool with a
top-level-vdev that had previously been removed. The crash happened
because the configuration nvlist of such a TLV contains an empty
ZPOOL_CONFIG_CHILDREN array, which led to a pop_front from an empty
list, which has undefined behavior.
The crash only happened in stable/14 and later, probably do to
differences in libcxx, but the change should be MFCed anyway.
PR: 273663
Reported by: Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
Sponsored by: Axcient
Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D41818
(cherry picked from commit 0b294a386d)
At some point the names of these devd events changed. Probably it
happened when importing OpenZFS. Before that, FreeBSD's sysevent_alloc
method didn't create a "class" nvpair in the event, which led to
log_sysevent using the event's ev_subclass field as its type.
Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D39437
(cherry picked from commit 92642bba4d)
Fix zfsd unittests after 92642bba4d
At the time we ensured that the more important functional tests were
working, but neglected to update the unit tests.
Sponsored by: Axcient
(cherry picked from commit 2a0c0aea42)
Before this change, encodings in the user-defined range were being
sign-extended.
MFC after: 1 week
Sponsored by: Innovate UK
(cherry picked from commit 258a0d760a)
dtrace_instr_size() is needed by the forthcoming RISC-V port of kinst,
as well as by libdtrace in D38825 for both amd64 and RISC-V.
Reviewed by: markj, mhorne
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39489
(cherry picked from commit 080e56a6c9)
The section will contain static relocations which do not need to be
preserved after linking, and moreover these relocations may reference
symbols that end up getting removed.
Do not set SHF_ALLOC and instead let the linker decide what needs to be
done.
PR: 258872
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 27f35b7dd4)
Previoulsy when using NO_ROOT we recorded METALOG entries for dwatch
hard links with different file modes than their link targets, which is
not permitted.
Reviewed by: bapt
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37477
(cherry picked from commit 7543a9c028)
The assembly source files do not contain GNU-stack annotations, so
ld.bfd defaults to using an executable stack.
(cherry picked from commit 7e3e70ce21)
This reverts a portion of 1477dd823ee ("Merge OpenZFS support in to
HEAD."). No functional change intended.
MFC after: 1 week
(cherry picked from commit 49e3972afc)
This drops function `getexecname()` redirection.
Historically `getexecname()` is a compatibility definition. Since
openzfs has its own implementation of function `getexecname()` in libspl
and has been merged into base, the compat header file stdlib.h is
no longer needed and should not be used.
Also without this fix libspl will end up an incompatible version of
`getprogname()` with libc. In particular, if zfs is enabled, programs
such as pgrep in /rescue can be wrongly statically linked with libspl
and will not function properly.
PR: 269738
Reviewed by: markj
Fixes: 9e5787d228 Merge OpenZFS support in to HEAD
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38733
(cherry picked from commit 7f0ebf0876)
This function prototype should have been removed along with the
implementation.
Fixes: 3dd5524264 ctfdump: Use getprogname()
MFC after: 1 day
(cherry picked from commit f8e1aa85fe)
Also remove no longer used function `getpname()`.
Reviewed by: markj
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D38740
(cherry picked from commit 3dd5524264)
It is useful to have zfs utilities and lib in a separate package as
it allow users to create image that can support ZFS (i.e. not with
WITHOUT_ZFS in src.conf set) without bloating the default image with
all zfs tools (for example for jails).
Differential Revision: https://reviews.freebsd.org/D36225
(cherry picked from commit a71ea7bea0)
Otherwise, if multiple object files contain references to the same
probe, newish lld will refuse to link them by default, raising a
duplicate global symbol definition error. Previously, duplicate global
symbols with identical absolute st_values were permitted by both lld and
GNU ld.
Since dtrace has no use for probe function symbols after the relocation
performed by dtrace -G, make the symbols weak as well, following a
suggestion from MaskRay.
Reported by: dim
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
(cherry picked from commit be39466a10)
This allows invop-based providers (i.e., fbt and kinst) to expose the
register file of the CPU at the point where the probe fired. It does
not work for SDT providers because their probes are implemented as plain
function calls and so don't save registers. It's not clear what
semantics "regs" should have for them anyway.
This is akin to "uregs", which nominally provides access to the
userspace registers. In fact, DIF already had a DIF_VAR_REGS variable
defined, it was simply unimplemented.
Usage example: print the contents of %rdi upon each call to
amd64_syscall():
fbt::amd64_syscall:entry {printf("%x", regs[R_RDI]);}
Note that the R_* constants are defined in /usr/lib/dtrace/regs_x86.d.
Currently there are no similar definitions for non-x86 platforms.
Reviewed by: christos
(cherry picked from commit bdd101c4d4)
OpenZFS release 2.1.6
Notable upstream pull requeset merges:
#11733 ICP: Add missing stack frame info to SHA asm files
#12274 Optimize txg_kick() process
#12284 Add Module Parameter Regarding Log Size Limit
#12285 Introduce a tunable to exclude special class buffers from L2ARC
#12287 Remove refcount from spa_config_*()
#12425 Avoid small buffer copying on write
#12516 Fix NFS and large reads on older kernels
#12678 spa.c: Replace VERIFY(nvlist_*(...) == 0) with fnvlist_*
#12789 Improve log spacemap load time
#13022 Add more control/visibility and speedup spa_load_verify()
#13106 add physical device size to SIZE column in 'zpool list -v'
#13388 Improve mg_aliquot math
#13405 Revert "Reduce dbuf_find() lock contention"
#13452 More speculative prefetcher improvements
#13476 Refactor Log Size Limit
#13540 AVL: Remove obsolete branching optimizations
#13553 Reduce ZIO io_lock contention on sorted scrub
#13555 Scrub mirror children without BPs
#13563 FreeBSD: Improve crypto_dispatch() handling
#13576 Several sorted scrub optimizations
#13579 Fix and disable blocks statistics during scrub
#13582 Several B-tree optimizations
#13591 Avoid two 64-bit divisions per scanned block
#13606 Avoid memory copies during mirror scrub
#13613 Avoid memory copy when verifying raidz/draid parity
#13643 Fix scrub resume from newly created hole
#13756 FreeBSD: Mark ZFS_MODULE_PARAM_CALL as MPSAFE
#13767 arcstat: fix -p option
#13781 Importing from cachefile can trip assertion
#13794 Apply arc_shrink_shift to ARC above arc_c_min
#13798 Improve too large physical ashift handling
#13811 Fix column width in 'zpool iostat -v' and 'zpool list -v'
#13842 make DMU_OT_IS_METADATA and DMU_OT_IS_ENCRYPTED return B_TRUE
or B_FALSE
#13855 zfs recv hangs if max recordsize is less than received
recordsize
#13861 Fix use-after-free in btree code
#13865 vdev_draid_lookup_map() should not iterate outside draid_maps
#13878 Delay ZFS_PROP_SHARESMB property to handle it for encrypted
raw receive
#13882 FreeBSD: Fix integer conversion for vnlru_free{,_vfsops}()
#13885 Fix incorrect size given to bqueue_enqueue() call in dmu_redact.c
#13908 FreeBSD: stop passing LK_INTERLOCK to VOP_LOCK
#13930 zpool: Don't print "repairing" on force faulted drives
#13954 Fix bad free in skein code
Obtained from: OpenZFS
OpenZFS tag: zfs-2.1.6
OpenZFS commit: 6a6bd49398
Relnotes: yes
CTF integers have an explicit width and so can be used to represent
bitfields. Bitfield types emitted by ctfconvert(1) share the name of
the base integer type, so a struct field with type "unsigned int : 15"
will have a type named "unsigned int".
To avoid ambiguity when looking up types by name, add a suffix to names
of bitfield types to distinguish them from the base type. Then, if
ctfmerge happens to order bitfield types before the corresponding base
type in a CTF file, a name lookup will return the base type, which is
always going to be the desired behaviour.
PR: 265403
Reported by: cy
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 1165fc9a52)
Passing "0x%p" to sprintf results in double "0x" being printed.
This causes a dtrace script compilation failure when "-d" flag
is specified.
Fix that by removing the extraneous "0x".
Reviewed by: markj
Approved by: mw(mentor)
Obtained from: Semihalf
Sponsored by: Alstom
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D35690
(cherry picked from commit 9dbacce2d4)
The presence of the latter causes a link error when building a
statically linked ctfdump(1) because libc defines the same symbol.
libc's warn() is defined as a weak symbol and so does not cause the same
problem, but let's just use libc's version.
Reported by: stephane rochoy <stephane.rochoy@stormshield.eu>
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 45dd2eaac3)
For some reason I can't reproduce this locally, but Jenkins complains.
Reported by: Jenkins
Fixes: bdf290cd3e ("ctf: Add v3 support to CTF tools, ctf{convert,dump,merge}")
(cherry picked from commit 3fe1f21fb3)
ctfdump handles v2 and v3. ctfconvert now emits only CTFv3, whereas
ctfmerge can merge v2 and v3 containers into v3 containers.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit bdf290cd3e)
In general, the patch adds indirection to minimize the amount of code
that needs to know about differences between v2 and v3. Specifically,
some new ctf_get_ctt_* functions are added, and new LCTF_* macros are
added to use the underlying container's version to do the right thing.
CTF containers can have parent/child relationships, wherein a type ID in
one container refers to a type in the parent. It is permitted for the
parent and child to have different versions.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit a6fb869173)
These are based on definitions added to binutils' libctf. Specifically:
- Type IDs are now encoded in 32 bits rather than 16, changing the
layout of ctf_type_t, ctf_array_t, ctf_member_t and ctf_lmember_t.
- Type info is encoded in 32 bits rather than 16. The type "kind" is
extended from 5 bits to 6, and the type "vlen" is extended from 10
bits to 25.
The main upside is that we remove the current limit, imposed by CTFv2,
of 2^{15} distinct types in the main kernel executable. Other limits,
such as that on the number of elements in an enum, imposed by the vlen
limit, are also raised.
This change adds v2 and v3 flavours of macros and type definitions which
differ between the two versions. Compatibility is preserved for now by
having generic names refer to the v2 definitions, so, e.g., ctf_type_t
is still a v2 type.
No functional change intended.
Reviewed by: Domagoj Stolfa
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 994297b01b)
Use it instead of the existing ctf.h from OpenSolaris. This makes it
easier to use CTF in the core kernel, and to extend the CTF format to
support wider type IDs.
The imported ctf.h is modified to depend only on _types.h, and also to
provide macros which use the "parent" bit of a type ID to refer to types
in a parent CTF container.
No functional change intended.
Reviewed by: Domagoj Stolfa, emaste
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 2d5d2a986c)
Per commit 7db423d692 ("libctf: Rip out CTFv1 support") this support
is obsolete.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 565518046c)
CTFv1 was obsolete before libctf was imported into FreeBSD, and
ctfconvert/ctfmerge can emit only CTFv2. Make ctf.h a bit easier to
maintain by ripping v1 support out. No functional change intended.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 7db423d692)
For consistency with other CTF toolchain code. No functional change
intended.
Fixes: 105fd928b0 ("libctf: Improve check for duplicate SOU definitions in ctf_add_type()")
(cherry picked from commit 2e4311906d)
It is unused on FreeBSD and complicates some efforts to modify the CTF
format to permit wider type IDs, so remove it. No functional change
intended.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 7be9a3b453)
Parts of zstd, used in openzfs and other places, trigger a new clang 14
-Werror warning:
```
sys/contrib/zstd/lib/decompress/huf_decompress.c:889:25: error: use of bitwise '&' with boolean operands [-Werror,-Wbitwise-instead-of-logical]
(BIT_reloadDStreamFast(&bitD1) == BIT_DStream_unfinished)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
While the warning is benign, it should ideally be fixed upstream and
then vendor-imported, but for now silence it selectively.
MFC after: 3 days
(cherry picked from commit 5f2aca8394)
It was set to the start of the buffer and that can be different from the
start of teh first record because of a misalignment.
This change follows the example of dt_realloc_buf().
(cherry picked from commit 256c8c5df2)
Members with such a type will legitimately have a size of zero, so don't
emit a warning.
PR: 260818
Reviewed by: bz
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 963f5dc7a3)