compress: split compress_blob() and friends to minimize dlopen dependencies

Previously, even though sd-journal does not support bzip2 and gzip
compression, the dlopen ELF notes for those libraries were still being
attached to libsystemd.so and various journal-handling executables.
This occurred because the unified compression/decompression interfaces
handled all formats unconditionally, causing the compiler and linker to
pull in all associated dlopen notes across the board.

To resolve this, split these functions into generic and journal-specific
variants (e.g., introducing compress_blob_journal() and decompress_blob_journal()).
The journal-specific variants only handle formats actually supported by
the journal (LZ4, XZ, and ZSTD).

By updating sd-journal, journald, journalctl, and related utilities to
use these new `_journal` interfaces and switching them to the narrower
COMPRESS_JOURNAL_NOTE macro, we ensure that unnecessary dlopen notes
(for bzip2 and gzip) are no longer embedded into these binaries.
This commit is contained in:
Yu Watanabe
2026-07-10 16:35:19 +09:00
parent 1a08378534
commit 05bdf4bfa9
12 changed files with 91 additions and 19 deletions
+4 -1
View File
@@ -94,8 +94,11 @@
LIBZSTD_NOTE(priority)
#define COMPRESS_DEFAULT_NOTE \
COMPRESS_JOURNAL_NOTE; \
LIBBZ2_NOTE(suggested); \
LIBZ_NOTE(suggested)
#define COMPRESS_JOURNAL_NOTE \
LIBLZ4_NOTE(COMPRESSION_PRIORITY_LZ4); \
LIBLZMA_NOTE(COMPRESSION_PRIORITY_XZ); \
LIBZ_NOTE(suggested); \
LIBZSTD_NOTE(COMPRESSION_PRIORITY_ZSTD)