mirror_zfs/cmd
Rob Norris 4d451bae8a libspl: hide global data objects
Currently libspl is a static archive that is linked into multiple shared
objects, which then re-export its symbols. We intend to fix this soon.

For the moment though, most programs shipped with OpenZFS depend on two
or more of these shared objects, and see the same symbols twice. For
functions this is not a problem, as they do not have any mutable state
and so the linker can simply select the first one and use that for all.

For global data objects however, each shared object will have direct
(non-relocatable) references to its own instance of the symbol, such
that changes on one will not necessarily be seen by the other. While
this shouldn't be a problem in practice as these reexported interfaces
are not supposed to be used, they are technically undefined behaviour in
C (C17 6.9.2) and are reported by ASAN as a violation of C++'s "One
Definition Rule".

To fix this, we hide these globals inside their compilation units, and
add access functions and macros as appropriate to preserve the existing
API (though not ABI).

Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Closes #17861
2025-11-12 10:04:22 -08:00
..
raidz_test libzpool: separate driver-side include 2025-11-12 10:01:04 -08:00
zdb libzpool: separate driver-side include 2025-11-12 10:01:04 -08:00
zed zed: Add synchronous zedlets 2025-09-11 11:34:07 -07:00
zfs Linux 6.17 compat: Fix broken projectquota on 6.17 2025-11-05 16:22:03 -08:00
zinject zinject: Introduce ready delay fault injection 2025-10-01 12:17:13 -07:00
zpool Add BRT support to zpool prefetch command 2025-11-10 16:16:22 -08:00
zpool_influxdb SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
zstream libspl: hide global data objects 2025-11-12 10:04:22 -08:00
dbufstat.in SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
fsck.zfs.in cmd: move single-file binaries up, extract udev programs to udev/ 2022-05-10 10:20:34 -07:00
Makefile.am cmd: rename arcstat to zarcstat 2025-09-10 10:45:21 -07:00
mount_zfs.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
zarcstat.in cmd: rename arcstat to zarcstat 2025-09-10 10:45:21 -07:00
zarcsummary cmd: rename arc_summary to zarcsummary 2025-09-10 10:45:13 -07:00
zfs_ids_to_path.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
zgenhostid.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
zhack.c libzpool: separate driver-side include 2025-11-12 10:01:04 -08:00
zilstat.in ZIL: "crash" the ZIL if the pool suspends during fallback 2025-08-08 16:43:26 -07:00
ztest.c libspl: hide global data objects 2025-11-12 10:04:22 -08:00
zvol_wait zvol_wait logic may terminate prematurely 2022-10-11 12:12:04 -07:00