From 48324b579e825a30110abac0369e9d544350ead1 Mon Sep 17 00:00:00 2001 From: Steffen Eiden Date: Wed, 14 Dec 2022 14:25:21 +0100 Subject: [PATCH 1/4] zdump: replace atomic refcount with atomic int (Atomic) refcounting was introduced in glib2.58. We want to support v2.56 as well, so replace it with int and the atomic operations introduced in glib 2.4. Fixes: https://github.com/ibm-s390-linux/s390-tools/issues/146 Reviewed-by: Jan Hoeppner Signed-off-by: Steffen Eiden --- zdump/pv_utils.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/zdump/pv_utils.c b/zdump/pv_utils.c index 6d9f0bb..a39bfc5 100644 --- a/zdump/pv_utils.c +++ b/zdump/pv_utils.c @@ -674,7 +674,7 @@ struct _storage_state_mmap { size_t mapped_size; pv_tweak_component_t *tweak_components; size_t num_tweaks; - gatomicrefcount ref_count; + int ref_count; }; storage_state_mmap_t *storage_state_mmap_new(const int fd, const size_t file_size, const u64 offset, @@ -733,14 +733,14 @@ storage_state_mmap_t *storage_state_mmap_new(const int fd, const size_t file_siz ret->tweak_components = (pv_tweak_component_t *)(ptr + in_page_offset); ret->num_tweaks = tweak_components_cnt; ret->mapped_size = mmapped_size; - g_atomic_ref_count_init(&ret->ref_count); + ret->ref_count = 1; return g_steal_pointer(&ret); } storage_state_mmap_t *storage_state_mmap_ref(storage_state_mmap_t *storage_state) { g_assert(storage_state); - g_atomic_ref_count_inc(&storage_state->ref_count); + g_atomic_int_inc(&storage_state->ref_count); return storage_state; } @@ -748,7 +748,7 @@ void storage_state_mmap_unref(storage_state_mmap_t *storage_state) { if (!storage_state) return; - if (storage_state->ref_count && !g_atomic_ref_count_dec(&storage_state->ref_count)) + if (storage_state->ref_count && !g_atomic_int_dec_and_test(&storage_state->ref_count)) return; if (storage_state->first_page_ptr) { int rc = munmap(storage_state->first_page_ptr, storage_state->mapped_size); -- 2.39.1 From 4007220d35a9e33186fdfe3a4b5c22cd2eea9bb9 Mon Sep 17 00:00:00 2001 From: Steffen Eiden Date: Wed, 14 Dec 2022 13:53:29 +0100 Subject: [PATCH 2/4] libpv: disallow glib features from after 2.56 Enforce that the first glib.h include is done via glib-helper.h for libpv so that glib version checks are in place. Change zdump and pvattest such that they never include glibstuff before libpv/glib-helper.h Reviewed-by: Jan Hoeppner Signed-off-by: Steffen Eiden --- include/libpv/glib-helper.h | 6 ++++++ pvattest/src/common.h | 2 +- zdump/dfi_pv_elf.c | 1 - 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/libpv/glib-helper.h b/include/libpv/glib-helper.h index 5d3df50..9f90b28 100644 --- a/include/libpv/glib-helper.h +++ b/include/libpv/glib-helper.h @@ -18,6 +18,12 @@ #define GLIB_VERSION_MIN_REQUIRED GLIB_VERSION_2_56 #endif +#define GLIB_VERSION_MAX_ALLOWED GLIB_VERSION_2_56 + +#ifdef __G_LIB_H__ +#error "glib.h must be included via libpv/glib-helper.h" +#endif + #include #include #include diff --git a/pvattest/src/common.h b/pvattest/src/common.h index e2e3ef1..43d2ab9 100644 --- a/pvattest/src/common.h +++ b/pvattest/src/common.h @@ -11,10 +11,10 @@ /* Must be included before any other header */ #include "config.h" -#include #include #include "libpv/glib-helper.h" +#include #include "libpv/macros.h" #include "lib/zt_common.h" diff --git a/zdump/dfi_pv_elf.c b/zdump/dfi_pv_elf.c index 8d1021e..9d33e8f 100644 --- a/zdump/dfi_pv_elf.c +++ b/zdump/dfi_pv_elf.c @@ -21,7 +21,6 @@ #include #include -#include #include #include -- 2.39.1 From fb01fb45bb6a9e62313e9cdb79ad5ed39471cfe7 Mon Sep 17 00:00:00 2001 From: Marc Hartmayer Date: Mon, 19 Dec 2022 09:51:51 +0000 Subject: [PATCH 3/4] zgetdump/Makefile: don't use `.check_dep_zgetdump` as linker input The `.check_dep_zgetdump` file is used to cache the result of the dependency checks and should not be used as input for linking or anything else. Let's add it as dependency for the objects file. This shouldn't cause any problems since the Makefile rule for object files is defined in `common.mak` as follows: %.o: %.c $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -c $< -o $@ Fixes: https://github.com/ibm-s390-linux/s390-tools/issues/147 Fixes: 8d8d5e9746a4 ("zdump: Fix Makefile dependencies") Signed-off-by: Marc Hartmayer Reviewed-by: Jan Hoeppner Signed-off-by: Jan Hoeppner --- zdump/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zdump/Makefile b/zdump/Makefile index ca8aadc..934dc47 100644 --- a/zdump/Makefile +++ b/zdump/Makefile @@ -119,7 +119,9 @@ libs = $(rootdir)/libutil/libutil.a $(LIBPV) all: $(BUILD_TARGETS) -zgetdump: .check_dep_zgetdump $(OBJECTS) $(libs) +$(OBJECTS): .check_dep_zgetdump + +zgetdump: $(OBJECTS) $(libs) skip-zgetdump: echo " SKIP zgetdump due to unresolved dependencies" -- 2.39.1 From 1ad208c17a0edc65e6abd47b68a7d9c206faf2a6 Mon Sep 17 00:00:00 2001 From: Ingo Franzki Date: Fri, 20 Jan 2023 11:04:18 +0100 Subject: [PATCH 4/4] zkey: Support EP11 host library version 4 (#2165811) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Try to load libep11.so.4 if available, but fallback to older library versions if not. Reviewed-by: Jörg Schmidbauer Signed-off-by: Ingo Franzki Signed-off-by: Steffen Eiden (cherry picked from commit 6222c384958729bc4b5bad61ad38967647cc3248) --- zkey/ep11.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zkey/ep11.c b/zkey/ep11.c index 58dc3c5..8359929 100644 --- a/zkey/ep11.c +++ b/zkey/ep11.c @@ -35,7 +35,7 @@ * Definitions for the EP11 library */ #define EP11_LIBRARY_NAME "libep11.so" -#define EP11_LIBRARY_VERSION 3 +#define EP11_LIBRARY_VERSION 4 #define EP11_WEB_PAGE "http://www.ibm.com/security/cryptocards" /** -- 2.39.1