aboutsummaryrefslogtreecommitdiff
path: root/cddl/contrib/opensolaris
Commit message (Collapse)AuthorAgeFilesLines
* ctfdump: Remove definitions of warn() and vwarn()Mark Johnston2022-04-213-31/+2
| | | | | | | | | | | 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> MFC after: 1 week Sponsored by: The FreeBSD Foundation
* libctf: Fix recursive descent into anonymous SOU fieldsMark Johnston2022-04-121-2/+2
| | | | | | | | PR: 262412 Tested by: dhw, gallatin Fixes: a6fb86917362 ("libctf: Handle CTFv3 containers") MFC after: 3 days Sponsored by: The FreeBSD Foundation
* dtrace tests: Fix expected outout for tst.system.dLi-Wen Hsu2022-03-091-6/+6
| | | | | | | This is follow up of d500a85e640d1cd270747c12e17c511b53864436 PR: 262415 Sponsored by: The FreeBSD Foundation
* zfs: merge openzfs/zfs@a86e08941 (master) into mainMartin Matuska2022-03-081-2/+2
| | | | | | | | | | | | | | | | | | | | Notable upstream pull request merges: #9078: log xattr=sa create/remove/update to ZIL #11919: Cross-platform xattr user namespace compatibility #13014: Report dnodes with faulty bonuslen #13016: FreeBSD: Fix zvol_cdev_open locking #13019: spl: Don't check FreeBSD rwlocks for double initialization #13027: Fix clearing set-uid and set-gid bits on a file when replying a write #13031: Add enumerated vdev names to 'zpool iostat -v' and 'zpool list -v' #13074: Enable encrypted raw sending to pools with greater ashift #13076: Receive checks should allow unencrypted child datasets #13098: Avoid dirtying the final TXGs when exporting a pool #13172: Fix ENOSPC when unlinking multiple files from full pool Obtained from: OpenZFS OpenZFS commit: a86e089415679cf1b98eb424a159bb36aa2c19e3
* ctf: Avoid passing a caddr_t to roundup2()Mark Johnston2022-03-071-1/+1
| | | | | | | For some reason I can't reproduce this locally, but Jenkins complains. Reported by: Jenkins Fixes: bdf290cd3e1a ("ctf: Add v3 support to CTF tools, ctf{convert,dump,merge}")
* ctf: Fix a -Wunused-but-set-variable warningMark Johnston2022-03-071-2/+0
| | | | | MFC after: 1 month Sponsored by: The FreeBSD Foundation
* ctf: Add v3 support to CTF tools, ctf{convert,dump,merge}Mark Johnston2022-03-073-271/+472
| | | | | | | | | ctfdump handles v2 and v3. ctfconvert now emits only CTFv3, whereas ctfmerge can merge v2 and v3 containers into v3 containers. MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D34364
* libctf: Handle CTFv3 containersMark Johnston2022-03-078-421/+895
| | | | | | | | | | | | | | | 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. MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D34363
* ctf: Add definitions for CTFv3Mark Johnston2022-03-071-94/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | 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 MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D34360
* ctf: Import ctf.h from OpenBSDMark Johnston2022-03-071-1/+1
| | | | | | | | | | | | | | | | | 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 MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D34358
* libctf: Use const ctf_file_t references in string lookup routinesMark Johnston2022-02-232-5/+5
| | | | | MFC after: 1 week Sponsored by: The FreeBSD Foundation
* libdtrace: Add a missing newline to an error messageMark Johnston2022-02-231-1/+1
| | | | | MFC after: 1 week Sponsored by: The FreeBSD Foundation
* libctf: Remove checks for CTFv1Mark Johnston2022-02-232-13/+8
| | | | | | | | Per commit 7db423d69273 ("libctf: Rip out CTFv1 support") this support is obsolete. MFC after: 1 week Sponsored by: The FreeBSD Foundation
* ctfconvert: Rip out STABS supportMark Johnston2022-02-106-1825/+0
| | | | | | | | | 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. MFC after: 1 week Sponsored by: The FreeBSD Foundation
* libctf: Rip out CTFv1 supportMark Johnston2022-02-101-35/+1
| | | | | | | | | 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. MFC after: 1 week Sponsored by: The FreeBSD Foundation
* libctf: Use ctf_type_t instead of struct ctf_typeMark Johnston2022-02-101-1/+1
| | | | | | | | For consistency with other CTF toolchain code. No functional change intended. Fixes: 105fd928b0b5 ("libctf: Improve check for duplicate SOU definitions in ctf_add_type()") MFC after: 1 week
* dtrace: remove unnecessary fflush()Chuck Silvers2022-02-101-1/+0
| | | | | | | | | | | This call was added back in the early days of dtrace porting and no one knows why anymore. The extra flushing causes lots of unnecessary CPU overhead when a script produces lots of output, as well as easily losing output because the command can't keep up. Sponsored by: Netflix Reviewed by: imp, markj Differential Revision: https://reviews.freebsd.org/D34216
* dt_unring_buf: set dtbd_oldest to the start of the first recordAndriy Gapon2022-01-111-1/+1
| | | | | | | | | | | 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(). Reviewed by: tsoome, markj MFC after: 4 weeks Differential Revision: https://reviews.freebsd.org/D33649
* ctfconvert: Handle arrays of empty structsMark Johnston2021-12-311-2/+10
| | | | | | | | | | | Members with such a type will legitimately have a size of zero, so don't emit a warning. PR: 260818 Reviewed by: bz MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33700
* dtrace: Disable getf() as it is broken on FreeBSDDomagoj Stolfa2021-12-171-1/+1
| | | | | | | | | | | | | | | | | | getf() on FreeBSD calls _sx_slock(), _sx_sunlock() and fget_locked(). Furthermore, it does not set the per-core fault flag, meaning it usually ends up in a double fault panic once getf() does get called, especially from fbt. Reviewing the DTrace Toolkit + a number of other scripts scattered around FreeBSD, I have not been able to find one use of getf(). Given how broken the implementation currently is, we disable it until it can be implemented properly. Also comment out a test in aggs/tst.subr.d for getf(). Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D33378
* libctf: Improve check for duplicate SOU definitions in ctf_add_type()Mark Johnston2021-10-041-27/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When copying a struct or union from one CTF container to another, ctf_add_type() checks whether it matches an existing type in the destination container. It does so by looking for a type with the same name and kind as the new type, and if one exists, it iterates over all members of the source type and checks whether a member with matching name and offset exists in the matched destination type. This can produce false positives, for example because member types are not compared, but this is not expected to arise in practice. If the match fails, ctf_add_type() returns an error. The procedure used for member comparison breaks down in the face of anonymous struct and union members. ctf_member_iter() visits each member in the source definition and looks up the corresponding member in the desination definition by name using ctf_member_info(), but this function will descend into anonymous members and thus fail to match. Fix the problem by introducing a custom comparison routine which does not assume member names are unique. This should also be faster for types with many members; in the previous scheme, membcmp() would perform a linear scan of the desination type's members to perform a lookup by name. The new routine steps through the members of both types in a single loop. PR: 258763 MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
* dtrace.1: Document a couple of preprocessor-related optionsMark Johnston2021-09-071-0/+11
| | | | | | Suggested by: swills MFC after: 1 week Sponsored by: The FreeBSD Foundation
* dtrace.1: Document -x ldpathMark Johnston2021-09-071-1/+9
| | | | | MFC after: 1 week Sponsored by: The FreeBSD Foundation
* dtrace: fix an out of bound read and a NULL pointer incrementDomagoj Stolfa2021-06-172-2/+8
| | | | | | | | | | | | | | In dt_cc.c when the provider is an empty string, accessing strlen(pdp->dtpd_provider) - 1 will result in a pdp->dtpd_provider[-1] access. Similarly, in dt_ident.c, if p2 is a NULL pointer, doing a p2++ on it is undefined behaviour. Reviewed by: markj MFC after: 1 week Sponsored by: Google Differential Revision: https://reviews.freebsd.org/D30778
* dtrace tests: Fix tst.system.d after ping/ping6 unificationMark Johnston2021-04-231-3/+3
| | | | | MFC after: 1 week Sponsored by: The FreeBSD Foundation
* dtrace: Document the libdir, nolibs and syslibdir optionsDomagoj Stolfa2021-04-021-1/+9
| | | | | MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29541
* libctf: Adjust logic to match upstream after 410556f1fMark Johnston2021-03-281-3/+3
| | | | | | | No functional change intended. Suggested by: jrtc27 MFC after: 1 week
* libctf: Fix an out-of-bounds read in ctf_lookup_by_name()Domagoj Stolfa2021-03-271-2/+3
| | | | | | | | | | | | | | | | When prefixes such as struct, union, etc. are compared with the current type (e.g. struct foo), a comparison is made with the prefix. The code currently assumes that every type is a valid C type with a prefix, however at times, garbage ends up in this function causing an unpredictable crash with DTrace due to the isspace(*p) call or subsequent calls. An example that I've seen of this is the letter 's' being passed in, comparing true with struct as the comparison size was (q - p) == 1, but then we increment p with the length of "struct", resulting in an out of bounds read. Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29435
* libdtrace: Trivial style fixes to force dt_lex.c to be regeneratedMark Johnston2021-02-201-9/+10
| | | | | | | | | After commit 8ba333e02e ("libdtrace: Stop relying on lex compatibility"), there have been several reports of incremental buildworlds failing since make does not know that dt_lex.c needs to be regenerated, and I want to avoid this when merging to stable/13. MFC with: 8ba333e02e
* libdtrace: Stop relying on lex compatibilityMark Johnston2021-02-171-1/+1
| | | | | | | | | | It does not appear to be required, and as of commit 6b7e592c215f ("lex: Do not let input() return 0 when end-of-file is reached") it causes input to return 0 instead of EOF when end-of-input is reached. PR: 253440 MFC after: 3 days Sponsored by: The FreeBSD Foundation
* dtrace tests: fix prototypes for gcc buildRyan Libby2021-01-114-6/+9
| | | | | | | | | - quiet -Wstrict-prototypes - provide prototypes for weak aliases Reviewed by: markj Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D28036
* libdtrace: Format USDT symbols correctly based on symbol bindingMark Johnston2021-01-101-4/+10
| | | | | | | | | | | Before we did not handle weak symbols correctly, sometimes resulting in link errors from dtrace -G when processing object files where functions with weak aliases contain USDT probes. Reported by: rlibby Tested by: rlibby MFC after: 1 week Sponsored by: The FreeBSD Foundation
* dtrace: honor LC_NUMERIC for %'d and alike, and LC_TIME for %TAndriy Gapon2020-12-031-0/+9
| | | | | | | | | | | | | Note that the public documentation on dtrace.org fails to mention %T and incorrectly documents %Y. The latter actually uses format "%Y %b %e %T" where %b is always in C locale. Discussed with: markj MFC after: 1 month Sponsored by: Panzura Notes: svn path=/head/; revision=368300
* When copying types from one CTF container to another, ensure that weJonathan T. Looney2020-11-201-2/+2
| | | | | | | | | | | | | | | | | | | | encode 0-length (i.e. "") structure and union member names as offset 0. This ensures that we don't confuse other parts of the CTF code which expect this encoding. This resolves a Dtrace error resolving members of anonymous structs/unions within the (struct mbuf) type which some users were seeing after r366908. While here, update the code in ctf_add_generic() to encode 0-length type names as offset 0. Reviewed by: markj MFC after: 2 weeks Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D27246 Notes: svn path=/head/; revision=367905
* When copying types from one CTF container to another, ensure that weJonathan T. Looney2020-11-171-1/+22
| | | | | | | | | | | | | | | | | | | | always copy intrinsic data types before copying bitfields which are based on those types. This ensures the type ordering in the destination CTF container matches the assumption made elsewhere in the CTF code that instrinsic data types will always appear before bitfields based on those types. This resolves the following error message some users have seen after r366908: "/usr/lib/dtrace/ipfw.d", line 121: failed to copy type of 'ip6p': Conflicting type is already defined Reviewed by: markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D27213 Notes: svn path=/head/; revision=367763
* Address compiler warnings in C code used by the DTrace test suite.Mark Johnston2020-09-1933-112/+105
| | | | | | | | Reported by: Jenkins MFC after: 1 week Notes: svn path=/head/; revision=365907
* Merge OpenZFS support in to HEAD.Matt Macy2020-08-2573-75256/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The primary benefit is maintaining a completely shared code base with the community allowing FreeBSD to receive new features sooner and with less effort. I would advise against doing 'zpool upgrade' or creating indispensable pools using new features until this change has had a month+ to soak. Work on merging FreeBSD support in to what was at the time "ZFS on Linux" began in August 2018. I first publicly proposed transitioning FreeBSD to (new) OpenZFS on December 18th, 2018. FreeBSD support in OpenZFS was finally completed in December 2019. A CFT for downstreaming OpenZFS support in to FreeBSD was first issued on July 8th. All issues that were reported have been addressed or, for a couple of less critical matters there are pull requests in progress with OpenZFS. iXsystems has tested and dogfooded extensively internally. The TrueNAS 12 release is based on OpenZFS with some additional features that have not yet made it upstream. Improvements include: project quotas, encrypted datasets, allocation classes, vectorized raidz, vectorized checksums, various command line improvements, zstd compression. Thanks to those who have helped along the way: Ryan Moeller, Allan Jude, Zack Welch, and many others. Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D25872 Notes: svn path=/head/; revision=364746
* Fix a typo in r364438 affecting 32-bit platforms.Mark Johnston2020-08-221-4/+4
| | | | | | | | Reported by: antoine MFC with: r364438 Notes: svn path=/head/; revision=364483
* Fix a typo in r364438.Mark Johnston2020-08-201-1/+1
| | | | | | | | Reported by: Jenkins MFC with: r364438 Notes: svn path=/head/; revision=364440
* Enable creation of static userspace probes in incremental builds.Mark Johnston2020-08-203-65/+89
| | | | | | | | | | | | | | | | | | To define USDT probes, dtrace -G makes use of relocations for undefined symbols: the target address is overwritten with NOPs and the location is recorded in the DOF section of the output object file. To avoid link errors, the original relocation is destroyed. However, this means that the same input object file cannot be processed multiple times, as happens during incremental rebuilds. Instead, only set the relocation type to NONE, so that all information required to reconstruct USDT probes is preserved. Reported by: bdrewery MFC after: 3 weeks Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=364438
* Remove non-FreeBSD ifdefs from dt_link.c.Mark Johnston2020-08-201-250/+19
| | | | | | | | | | | | This file is too complicated as it is and has diverged a fair bit from illumos due to toolchain differences, so just drop unused code (including SPARC support). MFC after: 1 week Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=364437
* zfs: fix EIO accessing dataset after resuming interrupted receiveAlan Somers2020-08-201-1/+1
| | | | | | | | | | | | | | | | | | | | ZFS unmounts a dataset while receiving into it and remounts it afterwards. But if ZFS is resuming an incomplete receive, it screws up and ends up with a dataset that is mounted, but returns EIO for every access. This commit fixes that condition. While the vulnerable code also exists in OpenZFS, the problem is not reproducible there. Apparently OpenZFS doesn't unmount the destination dataset during receive, like FreeBSD does. PR: 248606 Reviewed by: mmacy MFC after: 2 weeks Sponsored by: Axcient Differential Revision: https://reviews.freebsd.org/D26034 Notes: svn path=/head/; revision=364412
* Fix libdtrace build with zsh as /bin/shAlex Richardson2020-08-114-54/+46
| | | | | | | | | | | | When zsh runs in POSIX sh mode it does not support the -e flag to echo. Use printf instead of echo to avoid the "-e" characters being printed. Obtained from: CheriBSD Reviewed By: markj Differential Revision: https://reviews.freebsd.org/D26026 Notes: svn path=/head/; revision=364124
* Fix -DBUILD_WITH_STRICT_TMPPATH dtrace buildsAlex Richardson2020-08-114-0/+4
| | | | | | | | | | | | | | | | | | | Some of the scripts used for libdtrace invoke nawk instead of awk (for example cddl/contrib/opensolaris/lib/libdtrace/common/mknames.sh). When bootstrapping all tools, we get the nawk -> awk link while building usr.bin/awk, but when linking/copying the dependencies from the host we were only adding awk but not nawk. This was silently generating invalid files when building libdtrace with BUILD_WITH_STRICT_TMPPATH=1 since those scripts invoke nawk instead of awk. In addition to adding the missing link this commit also adds set -e to those scripts to catch errors like this in the future. Reviewed By: markj, emaste Differential Revision: https://reviews.freebsd.org/D26025 Notes: svn path=/head/; revision=364123
* Fix cddl tools bootstrapping on macOS and LinuxAlex Richardson2020-08-072-0/+11
| | | | | | | | Reviewed By: brooks Differential Revision: https://reviews.freebsd.org/D25979 Notes: svn path=/head/; revision=364022
* ctfmerge: Fix missing pthread_cond_init()Alex Richardson2020-08-061-0/+1
| | | | | | | | | | | | | This does not appear to matter on FreeBSD or Linux, but when building an amd64 kernel on macOS I was seeing infinite loops in ctfmerge. It turns out the loop in wip_save_work() was looping forever due to pthread_cond_wait() always returning -EINVAL. Reviewed By: markj, brooks Differential Revision: https://reviews.freebsd.org/D25973 Notes: svn path=/head/; revision=363991
* MFOpenZFS: Add support for boot environment data to be stored in the labelToomas Soome2020-08-055-6/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We are building new bootonce mechanism (previously zfs bootnext) and it is based on this OpenZFS change. Since this patch is nicely self contained, I am commiting it as is, and we can stack our changes. Original patch description follows: Modern bootloaders leverage data stored in the root filesystem to enable some of their powerful features. GRUB specifically has a grubenv file which can store large amounts of configuration data that can be read and written at boot time and during normal operation. This allows sysadmins to configure useful features like automated failover after failed boot attempts. Unfortunately, due to the Copy-on-Write nature of ZFS, the standard behavior of these tools cannot handle writing to ZFS files safely at boot time. We need an alternative way to store data that allows the bootloader to make changes to the data. This work is very similar to work that was done on Illumos to enable similar functionality in the FreeBSD bootloader. This patch is different in that the data being stored is a raw grubenv file; this file can store arbitrary variables and values, and the scripting provided by grub is powerful enough that special structures are not required to implement advanced behavior. We repurpose the second padding area in each label to store the grubenv file, protected by an embedded checksum. We add two ioctls to get and set this data, and libzfs_core and libzfs functions to access them more easily. There are no direct command line interfaces to these functions; these will be added directly to the bootloader utilities. Reviewed-by: Pavel Zakharov <pavel.zakharov@delphix.com> Reviewed-by: Matthew Ahrens <mahrens@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Paul Dagnelie <pcd@delphix.com> Closes #10009 Obtained from: OpenZFS Sponsored by: Netflix, Klara Inc. Notes: svn path=/head/; revision=363911
* MFOpenZFS: Fix zpool history unbounded memory usageMark Johnston2020-07-233-26/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In original implementation, zpool history will read the whole history before printing anything, causing memory usage goes unbounded. We fix this by breaking it into read-print iterations. Reviewed-by: Tom Caputi <tcaputi@datto.com> Reviewed-by: Matt Ahrens <matt@delphix.com> Reviewed-by: Igor Kozhukhov <igor@dilos.org> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Chunwei Chen <david.chen@nutanix.com> Closes #9516 Note, this change changes the libzfs.so ABI by modifying the prototype of zpool_get_history(). Since libzfs is effectively private to the base system it is anticipated that this will not be a problem. PR: 247557 Obtained from: OpenZFS Reported and tested by: Sam Vaughan <samjvaughan@gmail.com> Discussed with: freqlabs MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D25745 openzfs/zfs@7125a109dcc55628336ff3f58e59e503f4d7694d Notes: svn path=/head/; revision=363447
* zpool(8): Fix a few typos regarding 'inverval' -> 'interval'Gordon Bergling2020-07-201-3/+3
| | | | | | | | | | | PR: 248068 Submitted by: PauAmma <pauamma at gundo dot com> Reviewed by: bcr (mentor) Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D25719 Notes: svn path=/head/; revision=363362
* zpool-features(7): Note that the boot loader has support for large_blocksAllan Jude2020-07-151-4/+3
| | | | | | | | | | | | | | Since r304321 (-current: Aug 18, 2016) and r328866 (stable/11: Feb 5, 2018) the FreeBSD loader has supported reading from datasets with the large_blocks feature active. PR: 247992 Reported by: Anton Saietskii <vsasjason@gmail.com> MFC after: 2 weeks Sponsored by: Klara Inc. Notes: svn path=/head/; revision=363224