From d3f733b60a709e77c06cec6e54ddf9cd5fde4b0d Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 10 May 2022 03:21:30 -0400 Subject: [PATCH] import s390utils-2.19.0-1.el8 --- .gitignore | 2 +- .s390utils.metadata | 2 +- .../s390-tools-zipl-blscfg-rpm-nvr-sort.patch | 4 +- SOURCES/s390utils-2.16.0-rhel.patch | 3522 ----------------- SOURCES/s390utils-2.19.0-rhel.patch | 0 SPECS/s390utils.spec | 82 +- 6 files changed, 78 insertions(+), 3534 deletions(-) delete mode 100644 SOURCES/s390utils-2.16.0-rhel.patch create mode 100644 SOURCES/s390utils-2.19.0-rhel.patch diff --git a/.gitignore b/.gitignore index 1a0a2e7..77f3f66 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ SOURCES/cmsfs-1.1.8c.tar.gz -SOURCES/s390-tools-2.16.0.tar.gz +SOURCES/s390-tools-2.19.0.tar.gz SOURCES/src_vipa-2.1.0.tar.gz diff --git a/.s390utils.metadata b/.s390utils.metadata index 95db57d..db21295 100644 --- a/.s390utils.metadata +++ b/.s390utils.metadata @@ -1,3 +1,3 @@ 9c9a4e89bddb2b4e6e09ef6fc7c2e6f2ad6316de SOURCES/cmsfs-1.1.8c.tar.gz -faf04b6d0bca264a65107d063674b06c9b4c03bf SOURCES/s390-tools-2.16.0.tar.gz +5b4eeed3868297ca65b7d5720484786172dc11d1 SOURCES/s390-tools-2.19.0.tar.gz 8ed8592a0a9370ce8422df9231ccb17f6cf49bed SOURCES/src_vipa-2.1.0.tar.gz diff --git a/SOURCES/s390-tools-zipl-blscfg-rpm-nvr-sort.patch b/SOURCES/s390-tools-zipl-blscfg-rpm-nvr-sort.patch index bb8117d..93e5566 100644 --- a/SOURCES/s390-tools-zipl-blscfg-rpm-nvr-sort.patch +++ b/SOURCES/s390-tools-zipl-blscfg-rpm-nvr-sort.patch @@ -8,8 +8,8 @@ diff -up s390-tools-2.9.0/zipl/src/Makefile.blscfg-rpm-nvr-sort s390-tools-2.9.0 -libs = $(rootdir)/libutil/libutil.a +libs = $(rootdir)/libutil/libutil.a -lrpm - objects = misc.o error.o scan.o job.o boot.o bootmap.o disk.o \ - install.o zipl.o $(rootdir)/zipl/boot/data.o + objects = misc.o error.o scan.o job.o boot.o bootmap.o fs-map.o disk.o \ + bootmap_header.o envblk.o install.o zipl.o $(rootdir)/zipl/boot/data.o diff -up s390-tools-2.9.0/zipl/src/scan.c.blscfg-rpm-nvr-sort s390-tools-2.9.0/zipl/src/scan.c --- s390-tools-2.9.0/zipl/src/scan.c.blscfg-rpm-nvr-sort 2019-05-21 09:13:36.000000000 -0400 +++ s390-tools-2.9.0/zipl/src/scan.c 2019-05-22 08:16:17.317273801 -0400 diff --git a/SOURCES/s390utils-2.16.0-rhel.patch b/SOURCES/s390utils-2.16.0-rhel.patch deleted file mode 100644 index cf95fbe..0000000 --- a/SOURCES/s390utils-2.16.0-rhel.patch +++ /dev/null @@ -1,3522 +0,0 @@ -From 02fb523c7cf1619cb53803a52ca73a56bd43f7e2 Mon Sep 17 00:00:00 2001 -From: Ingo Franzki -Date: Tue, 23 Feb 2021 08:52:26 +0100 -Subject: [PATCH 1/7] zkey: Fix build error when the compiler flags are - overridden -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -When the compiler flags are overridden, the build of zkey may fail with: - -kms.c:44:2: error: #error KMS_PLUGIN_LOCATION must be defined - 44 | #error KMS_PLUGIN_LOCATION must be defined - | ^~~~~ - -The Makefile uses CFLAGS variable for defining the KMS_PLUGIN_LOCATION, -but it should rather use ALL_CFLAGS. - -Also use ALL_CPPFLAGS for defining HAVE_LUKS2_SUPPORT. - -Fixes: https://github.com/ibm-s390-linux/s390-tools/issues/108 - -Signed-off-by: Ingo Franzki -Reviewed-by: Jan Hoeppner -Signed-off-by: Jan Höppner -(cherry picked from commit 3f3f063c98278f53ad3b34e68b70fca62eaea8fb) ---- - zkey/Makefile | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/zkey/Makefile b/zkey/Makefile -index 41129bc..f74e209 100644 ---- a/zkey/Makefile -+++ b/zkey/Makefile -@@ -18,7 +18,7 @@ ifneq (${HAVE_CRYPTSETUP2},0) - ifneq (${HAVE_OPENSSL},0) - BUILD_TARGETS += zkey-cryptsetup - INSTALL_TARGETS += install-zkey-cryptsetup -- CPPFLAGS += -DHAVE_LUKS2_SUPPORT -+ ALL_CPPFLAGS += -DHAVE_LUKS2_SUPPORT - else - BUILD_TARGETS += zkey-cryptsetup-skip-openssl - INSTALL_TARGETS += zkey-cryptsetup-skip-openssl -@@ -34,7 +34,7 @@ endif - - libs = $(rootdir)/libutil/libutil.a - --CFLAGS += -DKMS_PLUGIN_LOCATION=\"$(ZKEYKMSPLUGINDIR)\" -+ALL_CFLAGS += -DKMS_PLUGIN_LOCATION=\"$(ZKEYKMSPLUGINDIR)\" - - detect-libcryptsetup.dep: - echo "#include " > detect-libcryptsetup.dep --- -2.31.1 - - -From ea06d53a2d775bd1ad54482202ea021aaa93a1d8 Mon Sep 17 00:00:00 2001 -From: Marc Hartmayer -Date: Wed, 24 Feb 2021 15:04:11 +0000 -Subject: [PATCH 2/7] genprotimg: use `pv_` namespace for our Buffer - implementation -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Use `pv_` namespace for our Buffer implementation so a symbol clash with other -libraries is less likely. - -Fixes: https://github.com/ibm-s390-linux/s390-tools/issues/109 -Reviewed-by: Jan Hoeppner -Signed-off-by: Marc Hartmayer -Signed-off-by: Jan Höppner -(cherry picked from commit b6bdd7744aba06d82f30b0c84012f0b06ccb01de) ---- - genprotimg/src/pv/pv_comp.c | 26 +++++------ - genprotimg/src/pv/pv_comp.h | 4 +- - genprotimg/src/pv/pv_comps.c | 10 ++--- - genprotimg/src/pv/pv_comps.h | 4 +- - genprotimg/src/pv/pv_hdr.c | 24 +++++------ - genprotimg/src/pv/pv_hdr.h | 4 +- - genprotimg/src/pv/pv_image.c | 70 +++++++++++++++--------------- - genprotimg/src/pv/pv_image.h | 14 +++--- - genprotimg/src/pv/pv_ipib.c | 4 +- - genprotimg/src/pv/pv_ipib.h | 2 +- - genprotimg/src/pv/pv_stage3.c | 26 +++++------ - genprotimg/src/pv/pv_stage3.h | 10 ++--- - genprotimg/src/utils/buffer.c | 18 ++++---- - genprotimg/src/utils/buffer.h | 16 +++---- - genprotimg/src/utils/crypto.c | 72 +++++++++++++++---------------- - genprotimg/src/utils/crypto.h | 28 ++++++------ - genprotimg/src/utils/file_utils.c | 4 +- - genprotimg/src/utils/file_utils.h | 2 +- - 18 files changed, 169 insertions(+), 169 deletions(-) - -diff --git a/genprotimg/src/pv/pv_comp.c b/genprotimg/src/pv/pv_comp.c -index 1f64eea..21879ae 100644 ---- a/genprotimg/src/pv/pv_comp.c -+++ b/genprotimg/src/pv/pv_comp.c -@@ -73,12 +73,12 @@ PvComponent *pv_component_new_file(PvComponentType type, const gchar *path, - return pv_component_new(type, size, DATA_FILE, (void **)&file, err); - } - --PvComponent *pv_component_new_buf(PvComponentType type, const Buffer *buf, -+PvComponent *pv_component_new_buf(PvComponentType type, const PvBuffer *buf, - GError **err) - { - g_assert(buf); - -- g_autoptr(Buffer) dup_buf = buffer_dup(buf, FALSE); -+ g_autoptr(PvBuffer) dup_buf = pv_buffer_dup(buf, FALSE); - return pv_component_new(type, buf->size, DATA_BUFFER, (void **)&dup_buf, - err); - } -@@ -90,7 +90,7 @@ void pv_component_free(PvComponent *component) - - switch ((PvComponentDataType)component->d_type) { - case DATA_BUFFER: -- buffer_clear(&component->buf); -+ pv_buffer_clear(&component->buf); - break; - case DATA_FILE: - comp_file_free(component->file); -@@ -162,21 +162,21 @@ gint pv_component_align_and_encrypt(PvComponent *component, const gchar *tmp_pat - - switch ((PvComponentDataType)component->d_type) { - case DATA_BUFFER: { -- g_autoptr(Buffer) enc_buf = NULL; -+ g_autoptr(PvBuffer) enc_buf = NULL; - - if (!(IS_PAGE_ALIGNED(pv_component_size(component)))) { -- g_autoptr(Buffer) new = NULL; -+ g_autoptr(PvBuffer) new = NULL; - - /* create a page aligned copy */ -- new = buffer_dup(component->buf, TRUE); -- buffer_clear(&component->buf); -+ new = pv_buffer_dup(component->buf, TRUE); -+ pv_buffer_clear(&component->buf); - component->buf = g_steal_pointer(&new); - } - enc_buf = encrypt_buf(parms, component->buf, err); - if (!enc_buf) - return -1; - -- buffer_clear(&component->buf); -+ pv_buffer_clear(&component->buf); - component->buf = g_steal_pointer(&enc_buf); - return 0; - } -@@ -220,10 +220,10 @@ gint pv_component_align(PvComponent *component, const gchar *tmp_path, - - switch (component->d_type) { - case DATA_BUFFER: { -- g_autoptr(Buffer) buf = NULL; -+ g_autoptr(PvBuffer) buf = NULL; - -- buf = buffer_dup(component->buf, TRUE); -- buffer_clear(&component->buf); -+ buf = pv_buffer_dup(component->buf, TRUE); -+ pv_buffer_clear(&component->buf); - component->buf = g_steal_pointer(&buf); - return 0; - } break; -@@ -301,7 +301,7 @@ int64_t pv_component_update_pld(const PvComponent *comp, EVP_MD_CTX *ctx, - - switch (comp->d_type) { - case DATA_BUFFER: { -- const Buffer *buf = comp->buf; -+ const PvBuffer *buf = comp->buf; - - g_assert(buf->size <= INT64_MAX); - g_assert(buf->size == size); -@@ -425,7 +425,7 @@ gint pv_component_write(const PvComponent *component, FILE *f, GError **err) - - switch (component->d_type) { - case DATA_BUFFER: { -- const Buffer *buf = component->buf; -+ const PvBuffer *buf = component->buf; - - if (seek_and_write_buffer(f, buf, offset, err) < 0) - return -1; -diff --git a/genprotimg/src/pv/pv_comp.h b/genprotimg/src/pv/pv_comp.h -index aa1b5ae..a4ffae8 100644 ---- a/genprotimg/src/pv/pv_comp.h -+++ b/genprotimg/src/pv/pv_comp.h -@@ -41,7 +41,7 @@ typedef struct { - gint d_type; /* PvComponentDataType */ - union { - struct comp_file *file; -- Buffer *buf; -+ PvBuffer *buf; - void *data; - }; - uint64_t src_addr; -@@ -51,7 +51,7 @@ typedef struct { - - PvComponent *pv_component_new_file(PvComponentType type, const gchar *path, - GError **err); --PvComponent *pv_component_new_buf(PvComponentType type, const Buffer *buf, -+PvComponent *pv_component_new_buf(PvComponentType type, const PvBuffer *buf, - GError **err); - void pv_component_free(PvComponent *component); - gint pv_component_type(const PvComponent *component); -diff --git a/genprotimg/src/pv/pv_comps.c b/genprotimg/src/pv/pv_comps.c -index 15d32f0..2d364fd 100644 ---- a/genprotimg/src/pv/pv_comps.c -+++ b/genprotimg/src/pv/pv_comps.c -@@ -210,13 +210,13 @@ GSList *pv_img_comps_get_comps(const PvImgComps *comps) - return comps->comps; - } - --gint pv_img_comps_finalize(PvImgComps *comps, Buffer **pld_digest, -- Buffer **ald_digest, Buffer **tld_digest, -+gint pv_img_comps_finalize(PvImgComps *comps, PvBuffer **pld_digest, -+ PvBuffer **ald_digest, PvBuffer **tld_digest, - uint64_t *nep, GError **err) - { -- g_autoptr(Buffer) tmp_pld_digest = NULL; -- g_autoptr(Buffer) tmp_ald_digest = NULL; -- g_autoptr(Buffer) tmp_tld_digest = NULL; -+ g_autoptr(PvBuffer) tmp_pld_digest = NULL; -+ g_autoptr(PvBuffer) tmp_ald_digest = NULL; -+ g_autoptr(PvBuffer) tmp_tld_digest = NULL; - - comps->finalized = TRUE; - for (GSList *iterator = comps->comps; iterator; iterator = iterator->next) { -diff --git a/genprotimg/src/pv/pv_comps.h b/genprotimg/src/pv/pv_comps.h -index d555e36..891ecdf 100644 ---- a/genprotimg/src/pv/pv_comps.h -+++ b/genprotimg/src/pv/pv_comps.h -@@ -32,8 +32,8 @@ gint pv_img_comps_add_component(PvImgComps *comps, PvComponent **comp, - GError **err); - PvComponent *pv_img_comps_get_nth_comp(PvImgComps *comps, guint n); - gint pv_img_comps_set_offset(PvImgComps *comps, gsize offset, GError **err); --gint pv_img_comps_finalize(PvImgComps *comps, Buffer **pld_digest, -- Buffer **ald_digest, Buffer **tld_digest, -+gint pv_img_comps_finalize(PvImgComps *comps, PvBuffer **pld_digest, -+ PvBuffer **ald_digest, PvBuffer **tld_digest, - uint64_t *nep, GError **err); - void pv_img_comps_free(PvImgComps *comps); - -diff --git a/genprotimg/src/pv/pv_hdr.c b/genprotimg/src/pv/pv_hdr.c -index 45e721d..e46e176 100644 ---- a/genprotimg/src/pv/pv_hdr.c -+++ b/genprotimg/src/pv/pv_hdr.c -@@ -76,17 +76,17 @@ uint64_t pv_hdr_get_nks(const PvHdr *hdr) - } - - /* In-place modification of ``buf`` */ --static gint pv_hdr_encrypt(const PvHdr *hdr, const PvImage *img, Buffer *buf, -+static gint pv_hdr_encrypt(const PvHdr *hdr, const PvImage *img, PvBuffer *buf, - GError **err) - { - uint32_t hdr_len = pv_hdr_size(hdr); - uint32_t aad_len = pv_hdr_aad_size(hdr); - guint tag_len = pv_hdr_tag_size(hdr); - uint32_t enc_len = pv_hdr_enc_size_casted(hdr); -- const Buffer aad_part = { .data = buf->data, .size = aad_len }; -- Buffer enc_part = { .data = (uint8_t *)buf->data + aad_len, -+ const PvBuffer aad_part = { .data = buf->data, .size = aad_len }; -+ PvBuffer enc_part = { .data = (uint8_t *)buf->data + aad_len, - .size = enc_len }; -- Buffer tag_part = { .data = (uint8_t *)buf->data + hdr_len - tag_len, -+ PvBuffer tag_part = { .data = (uint8_t *)buf->data + hdr_len - tag_len, - .size = tag_len }; - struct cipher_parms parms; - int64_t c_len; -@@ -119,9 +119,9 @@ static gint pv_hdr_aad_init(PvHdr *hdr, const PvImage *img, GError **err) - g_autofree union ecdh_pub_key *cust_pub_key = NULL; - struct pv_hdr_key_slot *hdr_slot = hdr->slots; - struct pv_hdr_head *head = &hdr->head; -- g_autoptr(Buffer) pld = NULL; -- g_autoptr(Buffer) ald = NULL; -- g_autoptr(Buffer) tld = NULL; -+ g_autoptr(PvBuffer) pld = NULL; -+ g_autoptr(PvBuffer) ald = NULL; -+ g_autoptr(PvBuffer) tld = NULL; - uint64_t nep = 0; - - g_assert(sizeof(head->iv) == img->gcm_iv->size); -@@ -250,7 +250,7 @@ PvHdr *pv_hdr_new(const PvImage *img, GError **err) - return g_steal_pointer(&ret); - } - --static void pv_hdr_memcpy(const PvHdr *hdr, const Buffer *dst) -+static void pv_hdr_memcpy(const PvHdr *hdr, const PvBuffer *dst) - { - uint64_t nks = pv_hdr_get_nks(hdr); - uint8_t *data; -@@ -270,13 +270,13 @@ static void pv_hdr_memcpy(const PvHdr *hdr, const Buffer *dst) - } - } - --Buffer *pv_hdr_serialize(const PvHdr *hdr, const PvImage *img, -- enum PvCryptoMode mode, GError **err) -+PvBuffer *pv_hdr_serialize(const PvHdr *hdr, const PvImage *img, -+ enum PvCryptoMode mode, GError **err) - { - uint32_t hdr_size = pv_hdr_size(hdr); -- g_autoptr(Buffer) ret = NULL; -+ g_autoptr(PvBuffer) ret = NULL; - -- ret = buffer_alloc(hdr_size); -+ ret = pv_buffer_alloc(hdr_size); - pv_hdr_memcpy(hdr, ret); - - if (mode == PV_ENCRYPT) { -diff --git a/genprotimg/src/pv/pv_hdr.h b/genprotimg/src/pv/pv_hdr.h -index 8df7a6f..fbcc9e9 100644 ---- a/genprotimg/src/pv/pv_hdr.h -+++ b/genprotimg/src/pv/pv_hdr.h -@@ -23,8 +23,8 @@ - PvHdr *pv_hdr_new(const PvImage *img, GError **err); - void pv_hdr_free(PvHdr *hdr); - G_GNUC_UNUSED gboolean pv_hdr_uses_encryption(const PvHdr *hdr); --Buffer *pv_hdr_serialize(const PvHdr *hdr, const PvImage *img, -- enum PvCryptoMode mode, GError **err); -+PvBuffer *pv_hdr_serialize(const PvHdr *hdr, const PvImage *img, -+ enum PvCryptoMode mode, GError **err); - uint32_t pv_hdr_size(const PvHdr *hdr); - uint32_t pv_hdr_aad_size(const PvHdr *hdr); - uint64_t pv_hdr_enc_size(const PvHdr *hdr); -diff --git a/genprotimg/src/pv/pv_image.c b/genprotimg/src/pv/pv_image.c -index 59eca5e..375e40f 100644 ---- a/genprotimg/src/pv/pv_image.c -+++ b/genprotimg/src/pv/pv_image.c -@@ -56,7 +56,7 @@ static gint pv_img_prepare_component(const PvImage *img, PvComponent *comp, - GError **err) - { - struct cipher_parms parms = { 0 }; -- g_autoptr(Buffer) tweak = NULL; -+ g_autoptr(PvBuffer) tweak = NULL; - prepare_func func = NULL; - void *opaque = NULL; - gint rc; -@@ -76,7 +76,7 @@ static gint pv_img_prepare_component(const PvImage *img, PvComponent *comp, - EVP_CIPHER_iv_length(cipher)); - g_assert(img->xts_key->size <= UINT_MAX); - -- tweak = buffer_alloc(sizeof(comp->tweak.data)); -+ tweak = pv_buffer_alloc(sizeof(comp->tweak.data)); - memcpy(tweak->data, comp->tweak.data, tweak->size); - func = pv_component_align_and_encrypt; - parms.cipher = cipher; -@@ -93,11 +93,11 @@ static gint pv_img_prepare_component(const PvImage *img, PvComponent *comp, - return 0; - } - --static Buffer *pv_img_read_key(const gchar *path, guint key_size, -- GError **err) -+static PvBuffer *pv_img_read_key(const gchar *path, guint key_size, -+ GError **err) - { -- g_autoptr(Buffer) tmp_ret = NULL; -- Buffer *ret = NULL; -+ g_autoptr(PvBuffer) tmp_ret = NULL; -+ PvBuffer *ret = NULL; - gsize bytes_read; - FILE *f = NULL; - gsize size; -@@ -116,7 +116,7 @@ static Buffer *pv_img_read_key(const gchar *path, guint key_size, - if (!f) - return NULL; - -- tmp_ret = buffer_alloc(size); -+ tmp_ret = pv_buffer_alloc(size); - if (file_read(f, tmp_ret->data, 1, tmp_ret->size, &bytes_read, err) < 0) - goto err; - -@@ -160,8 +160,8 @@ static HostKeyList *pv_img_get_host_keys(GSList *host_keys_with_path, gint nid, - return g_steal_pointer(&ret); - } - --static Buffer *pv_img_get_key(const EVP_CIPHER *cipher, const gchar *path, -- GError **err) -+static PvBuffer *pv_img_get_key(const EVP_CIPHER *cipher, const gchar *path, -+ GError **err) - { - gint key_len = EVP_CIPHER_key_length(cipher); - -@@ -173,8 +173,8 @@ static Buffer *pv_img_get_key(const EVP_CIPHER *cipher, const gchar *path, - return generate_aes_key((guint)key_len, err); - } - --static Buffer *pv_img_get_iv(const EVP_CIPHER *cipher, const gchar *path, -- GError **err) -+static PvBuffer *pv_img_get_iv(const EVP_CIPHER *cipher, const gchar *path, -+ GError **err) - { - gint iv_len = EVP_CIPHER_iv_length(cipher); - -@@ -485,23 +485,23 @@ static void pv_hdr_key_slot_free(PvHdrKeySlot *slot) - WRAPPED_G_DEFINE_AUTOPTR_CLEANUP_FUNC(PvHdrKeySlot, pv_hdr_key_slot_free) - - static PvHdrKeySlot *pv_hdr_key_slot_new(const EVP_CIPHER *gcm_cipher, -- const Buffer *cust_root_key, -+ const PvBuffer *cust_root_key, - EVP_PKEY *cust_key, EVP_PKEY *host_key, - GError **err) - { - g_autoptr(PvHdrKeySlot) ret = g_new0(PvHdrKeySlot, 1); - g_autofree union ecdh_pub_key *pub = NULL; -- g_autoptr(Buffer) exchange_key = NULL; -- g_autoptr(Buffer) digest_key = NULL; -- g_autoptr(Buffer) iv = NULL; -- Buffer pub_buf; -+ g_autoptr(PvBuffer) exchange_key = NULL; -+ g_autoptr(PvBuffer) digest_key = NULL; -+ g_autoptr(PvBuffer) iv = NULL; -+ PvBuffer pub_buf; - /* No AAD data is used */ -- Buffer aad = { .data = NULL, .size = 0 }; -+ PvBuffer aad = { .data = NULL, .size = 0 }; - /* Set the output buffers for the encrypted data and the - * generated GCM tag - */ -- Buffer enc = { .data = ret->wrapped_key, .size = sizeof(ret->wrapped_key) }; -- Buffer tag = { .data = ret->tag, .size = sizeof(ret->tag) }; -+ PvBuffer enc = { .data = ret->wrapped_key, .size = sizeof(ret->wrapped_key) }; -+ PvBuffer tag = { .data = ret->tag, .size = sizeof(ret->tag) }; - struct cipher_parms parms; - int64_t c_len = 0; - -@@ -530,7 +530,7 @@ static PvHdrKeySlot *pv_hdr_key_slot_new(const EVP_CIPHER *gcm_cipher, - g_assert(exchange_key->size == (guint)EVP_CIPHER_key_length(gcm_cipher)); - - /* create zero IV */ -- iv = buffer_alloc((guint)EVP_CIPHER_iv_length(gcm_cipher)); -+ iv = pv_buffer_alloc((guint)EVP_CIPHER_iv_length(gcm_cipher)); - parms.iv_or_tweak = iv; - parms.key = exchange_key; - parms.cipher = gcm_cipher; -@@ -637,13 +637,13 @@ void pv_img_free(PvImage *img) - g_slist_free_full(img->key_slots, (GDestroyNotify)pv_hdr_key_slot_free); - g_slist_free_full(img->host_pub_keys, (GDestroyNotify)EVP_PKEY_free); - EVP_PKEY_free(img->cust_pub_priv_key); -- buffer_clear(&img->stage3a); -+ pv_buffer_clear(&img->stage3a); - pv_img_comps_free(img->comps); - g_free(img->tmp_dir); -- buffer_free(img->xts_key); -- buffer_free(img->cust_root_key); -- buffer_free(img->gcm_iv); -- buffer_free(img->cust_comm_key); -+ pv_buffer_free(img->xts_key); -+ pv_buffer_free(img->cust_root_key); -+ pv_buffer_free(img->gcm_iv); -+ pv_buffer_free(img->cust_comm_key); - g_free(img); - } - -@@ -684,13 +684,13 @@ gint pv_img_add_component(PvImage *img, const PvArg *arg, GError **err) - return 0; - } - --gint pv_img_calc_pld_ald_tld_nep(const PvImage *img, Buffer **pld, Buffer **ald, -- Buffer **tld, uint64_t *nep, GError **err) -+gint pv_img_calc_pld_ald_tld_nep(const PvImage *img, PvBuffer **pld, PvBuffer **ald, -+ PvBuffer **tld, uint64_t *nep, GError **err) - { - return pv_img_comps_finalize(img->comps, pld, ald, tld, nep, err); - } - --static gint pv_img_build_stage3b(PvImage *img, Buffer *stage3b, GError **err) -+static gint pv_img_build_stage3b(PvImage *img, PvBuffer *stage3b, GError **err) - { - g_autofree struct stage3b_args *args = NULL; - -@@ -708,7 +708,7 @@ static gint pv_img_build_stage3b(PvImage *img, Buffer *stage3b, GError **err) - gint pv_img_add_stage3b_comp(PvImage *img, const gchar *path, GError **err) - { - g_autoptr(PvComponent) comp = NULL; -- g_autoptr(Buffer) stage3b = NULL; -+ g_autoptr(PvBuffer) stage3b = NULL; - - stage3b = stage3b_getblob(path, err); - if (!stage3b) -@@ -825,7 +825,7 @@ static gint get_stage3a_data_size(const PvImage *img, gsize *data_size, - - gint pv_img_load_and_set_stage3a(PvImage *img, const gchar *path, GError **err) - { -- g_autoptr(Buffer) stage3a = NULL; -+ g_autoptr(PvBuffer) stage3a = NULL; - gsize bin_size, data_size = 0; - - if (get_stage3a_data_size(img, &data_size, err) < 0) -@@ -845,8 +845,8 @@ gint pv_img_load_and_set_stage3a(PvImage *img, const gchar *path, GError **err) - } - - /* Creates the PV IPIB and sets the stage3a arguments */ --static gint pv_img_build_stage3a(Buffer *stage3a, gsize stage3a_bin_size, -- GSList *comps, const Buffer *hdr, GError **err) -+static gint pv_img_build_stage3a(PvBuffer *stage3a, gsize stage3a_bin_size, -+ GSList *comps, const PvBuffer *hdr, GError **err) - { - g_autofree struct ipl_parameter_block *ipib = NULL; - -@@ -866,9 +866,9 @@ static gint pv_img_build_stage3a(Buffer *stage3a, gsize stage3a_bin_size, - } - - /* Creates the actual PV header (serialized and AES-GCM encrypted) */ --static Buffer *pv_img_create_pv_hdr(PvImage *img, GError **err) -+static PvBuffer *pv_img_create_pv_hdr(PvImage *img, GError **err) - { -- g_autoptr(Buffer) hdr_buf = NULL; -+ g_autoptr(PvBuffer) hdr_buf = NULL; - g_autoptr(PvHdr) hdr = NULL; - - hdr = pv_hdr_new(img, err); -@@ -887,7 +887,7 @@ static Buffer *pv_img_create_pv_hdr(PvImage *img, GError **err) - */ - gint pv_img_finalize(PvImage *pv, const gchar *stage3b_path, GError **err) - { -- g_autoptr(Buffer) hdr = NULL; -+ g_autoptr(PvBuffer) hdr = NULL; - - /* load stage3b template into memory and add it to the list of - * components. This must be done before calling -diff --git a/genprotimg/src/pv/pv_image.h b/genprotimg/src/pv/pv_image.h -index 7c624e2..116fb1a 100644 ---- a/genprotimg/src/pv/pv_image.h -+++ b/genprotimg/src/pv/pv_image.h -@@ -25,7 +25,7 @@ - - typedef struct { - gchar *tmp_dir; /* directory used for temporary files */ -- Buffer *stage3a; /* stage3a containing IPIB and PV header */ -+ PvBuffer *stage3a; /* stage3a containing IPIB and PV header */ - gsize stage3a_bin_size; /* size of stage3a.bin */ - struct psw_t stage3a_psw; /* (short) PSW that is written to - * location 0 of the created image -@@ -35,15 +35,15 @@ typedef struct { - GSList *host_pub_keys; /* public host keys */ - gint nid; /* Elliptic Curve used for the key derivation */ - /* keys and cipher used for the AES-GCM encryption */ -- Buffer *cust_root_key; -- Buffer *gcm_iv; -+ PvBuffer *cust_root_key; -+ PvBuffer *gcm_iv; - const EVP_CIPHER *gcm_cipher; - /* Information for the IPIB and PV header */ - uint64_t pcf; - uint64_t scf; -- Buffer *cust_comm_key; -+ PvBuffer *cust_comm_key; - const EVP_CIPHER *cust_comm_cipher; -- Buffer *xts_key; -+ PvBuffer *xts_key; - const EVP_CIPHER *xts_cipher; - GSList *key_slots; - GSList *optional_items; -@@ -54,8 +54,8 @@ PvImage *pv_img_new(PvArgs *args, const gchar *stage3a_path, GError **err); - void pv_img_free(PvImage *img); - gint pv_img_add_component(PvImage *img, const PvArg *arg, GError **err); - gint pv_img_finalize(PvImage *img, const gchar *stage3b_path, GError **err); --gint pv_img_calc_pld_ald_tld_nep(const PvImage *img, Buffer **pld, Buffer **ald, -- Buffer **tld, uint64_t *nep, GError **err); -+gint pv_img_calc_pld_ald_tld_nep(const PvImage *img, PvBuffer **pld, PvBuffer **ald, -+ PvBuffer **tld, uint64_t *nep, GError **err); - gint pv_img_load_and_set_stage3a(PvImage *img, const gchar *path, GError **err); - const PvComponent *pv_img_get_stage3b_comp(const PvImage *img, GError **err); - gint pv_img_add_stage3b_comp(PvImage *img, const gchar *path, GError **err); -diff --git a/genprotimg/src/pv/pv_ipib.c b/genprotimg/src/pv/pv_ipib.c -index 2517e54..59fe008 100644 ---- a/genprotimg/src/pv/pv_ipib.c -+++ b/genprotimg/src/pv/pv_ipib.c -@@ -35,7 +35,7 @@ uint64_t pv_ipib_get_size(uint32_t num_comp) - } - - static gint pv_ipib_init(IplParameterBlock *ipib, GSList *comps, -- const Buffer *hdr) -+ const PvBuffer *hdr) - { - g_assert(sizeof(struct ipl_pl_hdr) <= UINT32_MAX); - g_assert(sizeof(struct ipl_pb0_pv_comp) <= UINT32_MAX); -@@ -100,7 +100,7 @@ static gint pv_ipib_init(IplParameterBlock *ipib, GSList *comps, - return 0; - } - --IplParameterBlock *pv_ipib_new(GSList *comps, const Buffer *hdr, GError **err) -+IplParameterBlock *pv_ipib_new(GSList *comps, const PvBuffer *hdr, GError **err) - { - uint64_t ipib_size = pv_ipib_get_size(g_slist_length(comps)); - g_autoptr(IplParameterBlock) ret = NULL; -diff --git a/genprotimg/src/pv/pv_ipib.h b/genprotimg/src/pv/pv_ipib.h -index 9331790..4b66643 100644 ---- a/genprotimg/src/pv/pv_ipib.h -+++ b/genprotimg/src/pv/pv_ipib.h -@@ -19,7 +19,7 @@ - typedef struct ipl_parameter_block IplParameterBlock; - - uint64_t pv_ipib_get_size(uint32_t num_comp); --IplParameterBlock *pv_ipib_new(GSList *comps, const Buffer *hdr, GError **err); -+IplParameterBlock *pv_ipib_new(GSList *comps, const PvBuffer *hdr, GError **err); - void pv_ipib_free(IplParameterBlock *ipib); - - WRAPPED_G_DEFINE_AUTOPTR_CLEANUP_FUNC(IplParameterBlock, pv_ipib_free) -diff --git a/genprotimg/src/pv/pv_stage3.c b/genprotimg/src/pv/pv_stage3.c -index a1e5b16..bff9db7 100644 ---- a/genprotimg/src/pv/pv_stage3.c -+++ b/genprotimg/src/pv/pv_stage3.c -@@ -24,12 +24,12 @@ - ((struct stage3a_args *)((uint64_t)data_ptr + loader_size - \ - sizeof(struct stage3a_args))) - --static Buffer *loader_getblob(const gchar *filename, gsize *loader_size, -- gsize args_size, gsize data_size, -- gboolean data_aligned, GError **err) -+static PvBuffer *loader_getblob(const gchar *filename, gsize *loader_size, -+ gsize args_size, gsize data_size, -+ gboolean data_aligned, GError **err) - { - g_autoptr(GMappedFile) mapped_file = NULL; -- g_autoptr(Buffer) ret = NULL; -+ g_autoptr(PvBuffer) ret = NULL; - gsize size, tmp_loader_size; - gchar *loader_data; - -@@ -60,7 +60,7 @@ static Buffer *loader_getblob(const gchar *filename, gsize *loader_size, - size = (data_aligned ? PAGE_ALIGN(tmp_loader_size) : tmp_loader_size) + - data_size; - -- ret = buffer_alloc(size); -+ ret = pv_buffer_alloc(size); - - /* copy the loader "template" */ - memcpy(ret->data, loader_data, tmp_loader_size); -@@ -71,8 +71,8 @@ static Buffer *loader_getblob(const gchar *filename, gsize *loader_size, - return g_steal_pointer(&ret); - } - --Buffer *stage3a_getblob(const gchar *filename, gsize *loader_size, -- gsize data_size, GError **err) -+PvBuffer *stage3a_getblob(const gchar *filename, gsize *loader_size, -+ gsize data_size, GError **err) - { - return loader_getblob(filename, loader_size, - sizeof(struct stage3a_args), data_size, TRUE, -@@ -83,8 +83,8 @@ Buffer *stage3a_getblob(const gchar *filename, gsize *loader_size, - /* Set the right offsets and sizes in the stage3a template + add - * the IPIB block with the PV header - */ --static gint stage3a_set_data(Buffer *loader, gsize loader_size, -- const Buffer *hdr, struct ipl_parameter_block *ipib, -+static gint stage3a_set_data(PvBuffer *loader, gsize loader_size, -+ const PvBuffer *hdr, struct ipl_parameter_block *ipib, - GError **err) - { - uint32_t ipib_size = GUINT32_FROM_BE(ipib->hdr.len); -@@ -126,15 +126,15 @@ static gint stage3a_set_data(Buffer *loader, gsize loader_size, - return 0; - } - --gint build_stage3a(Buffer *loader, gsize loader_size, const Buffer *hdr, -+gint build_stage3a(PvBuffer *loader, gsize loader_size, const PvBuffer *hdr, - struct ipl_parameter_block *ipib, GError **err) - { - return stage3a_set_data(loader, loader_size, hdr, ipib, err); - } - --Buffer *stage3b_getblob(const gchar *filename, GError **err) -+PvBuffer *stage3b_getblob(const gchar *filename, GError **err) - { -- g_autoptr(Buffer) ret = NULL; -+ g_autoptr(PvBuffer) ret = NULL; - gsize rb_size; - - ret = loader_getblob(filename, &rb_size, sizeof(struct stage3b_args), 0, -@@ -146,7 +146,7 @@ Buffer *stage3b_getblob(const gchar *filename, GError **err) - return g_steal_pointer(&ret); - } - --void build_stage3b(Buffer *stage3b, const struct stage3b_args *args) -+void build_stage3b(PvBuffer *stage3b, const struct stage3b_args *args) - { - g_assert(stage3b->size > sizeof(*args)); - -diff --git a/genprotimg/src/pv/pv_stage3.h b/genprotimg/src/pv/pv_stage3.h -index baaf921..364408e 100644 ---- a/genprotimg/src/pv/pv_stage3.h -+++ b/genprotimg/src/pv/pv_stage3.h -@@ -19,12 +19,12 @@ - #include "boot/stage3b.h" - #include "utils/buffer.h" - --Buffer *stage3a_getblob(const gchar *filename, gsize *loader_size, -- gsize data_size, GError **err); --gint build_stage3a(Buffer *dc, gsize dc_size, const Buffer *hdr, -+PvBuffer *stage3a_getblob(const gchar *filename, gsize *loader_size, -+ gsize data_size, GError **err); -+gint build_stage3a(PvBuffer *dc, gsize dc_size, const PvBuffer *hdr, - struct ipl_parameter_block *ipib, GError **err); --Buffer *stage3b_getblob(const gchar *filename, GError **err); --void build_stage3b(Buffer *stage3b, const struct stage3b_args *args); -+PvBuffer *stage3b_getblob(const gchar *filename, GError **err); -+void build_stage3b(PvBuffer *stage3b, const struct stage3b_args *args); - void memblob_init(struct memblob *arg, uint64_t src, uint64_t size); - - #endif -diff --git a/genprotimg/src/utils/buffer.c b/genprotimg/src/utils/buffer.c -index 35aed74..509dc0d 100644 ---- a/genprotimg/src/utils/buffer.c -+++ b/genprotimg/src/utils/buffer.c -@@ -17,18 +17,18 @@ - #include "common.h" - #include "file_utils.h" - --Buffer *buffer_alloc(gsize size) -+PvBuffer *pv_buffer_alloc(gsize size) - { -- Buffer *ret = g_new0(Buffer, 1); -+ PvBuffer *ret = g_new0(PvBuffer, 1); - - ret->data = g_malloc0(size); - ret->size = size; - return ret; - } - --Buffer *buffer_dup(const Buffer *buf, gboolean page_aligned) -+PvBuffer *pv_buffer_dup(const PvBuffer *buf, gboolean page_aligned) - { -- Buffer *ret; -+ PvBuffer *ret; - gsize size; - - if (!buf) -@@ -38,19 +38,19 @@ Buffer *buffer_dup(const Buffer *buf, gboolean page_aligned) - if (page_aligned) - size = PAGE_ALIGN(size); - -- ret = buffer_alloc(size); -+ ret = pv_buffer_alloc(size); - - /* content will be 0-right-padded */ - memcpy(ret->data, buf->data, buf->size); - return ret; - } - --gint buffer_write(const Buffer *buf, FILE *file, GError **err) -+gint pv_buffer_write(const PvBuffer *buf, FILE *file, GError **err) - { - return file_write(file, buf->data, buf->size, 1, NULL, err); - } - --void buffer_free(Buffer *buf) -+void pv_buffer_free(PvBuffer *buf) - { - if (!buf) - return; -@@ -59,11 +59,11 @@ void buffer_free(Buffer *buf) - g_free(buf); - } - --void buffer_clear(Buffer **buf) -+void pv_buffer_clear(PvBuffer **buf) - { - if (!buf || !*buf) - return; - -- buffer_free(*buf); -+ pv_buffer_free(*buf); - *buf = NULL; - } -diff --git a/genprotimg/src/utils/buffer.h b/genprotimg/src/utils/buffer.h -index 7239d5c..824b72c 100644 ---- a/genprotimg/src/utils/buffer.h -+++ b/genprotimg/src/utils/buffer.h -@@ -15,17 +15,17 @@ - - #include "common.h" - --typedef struct Buffer { -+typedef struct PvBuffer { - void *data; - gsize size; /* in bytes */ --} Buffer; -+} PvBuffer; - --Buffer *buffer_alloc(gsize size); --void buffer_free(Buffer *buf); --void buffer_clear(Buffer **buf); --gint buffer_write(const Buffer *buf, FILE *file, GError **err); --Buffer *buffer_dup(const Buffer *buf, gboolean page_aligned); -+PvBuffer *pv_buffer_alloc(gsize size); -+void pv_buffer_free(PvBuffer *buf); -+void pv_buffer_clear(PvBuffer **buf); -+gint pv_buffer_write(const PvBuffer *buf, FILE *file, GError **err); -+PvBuffer *pv_buffer_dup(const PvBuffer *buf, gboolean page_aligned); - --WRAPPED_G_DEFINE_AUTOPTR_CLEANUP_FUNC(Buffer, buffer_free) -+WRAPPED_G_DEFINE_AUTOPTR_CLEANUP_FUNC(PvBuffer, pv_buffer_free) - - #endif -diff --git a/genprotimg/src/utils/crypto.c b/genprotimg/src/utils/crypto.c -index 44facc2..05c3e83 100644 ---- a/genprotimg/src/utils/crypto.c -+++ b/genprotimg/src/utils/crypto.c -@@ -89,15 +89,15 @@ EVP_MD_CTX *digest_ctx_new(const EVP_MD *md, GError **err) - return g_steal_pointer(&ctx); - } - --Buffer *digest_ctx_finalize(EVP_MD_CTX *ctx, GError **err) -+PvBuffer *digest_ctx_finalize(EVP_MD_CTX *ctx, GError **err) - { - gint md_size = EVP_MD_size(EVP_MD_CTX_md(ctx)); -- g_autoptr(Buffer) ret = NULL; -+ g_autoptr(PvBuffer) ret = NULL; - guint digest_size; - - g_assert(md_size > 0); - -- ret = buffer_alloc((guint)md_size); -+ ret = pv_buffer_alloc((guint)md_size); - if (EVP_DigestFinal_ex(ctx, ret->data, &digest_size) != 1) { - g_set_error(err, PV_CRYPTO_ERROR, PV_CRYPTO_ERROR_INTERNAL, - _("EVP_DigestFinal_ex failed")); -@@ -110,10 +110,10 @@ Buffer *digest_ctx_finalize(EVP_MD_CTX *ctx, GError **err) - } - - /* Returns the digest of @buf using the hash algorithm @md */ --static Buffer *digest_buffer(const EVP_MD *md, const Buffer *buf, GError **err) -+static PvBuffer *digest_buffer(const EVP_MD *md, const PvBuffer *buf, GError **err) - { - g_autoptr(EVP_MD_CTX) md_ctx = NULL; -- g_autoptr(Buffer) ret = NULL; -+ g_autoptr(PvBuffer) ret = NULL; - g_assert(buf); - - md_ctx = digest_ctx_new(md, err); -@@ -134,9 +134,9 @@ static Buffer *digest_buffer(const EVP_MD *md, const Buffer *buf, GError **err) - } - - /* Returns the SHA256 digest of @buf */ --Buffer *sha256_buffer(const Buffer *buf, GError **err) -+PvBuffer *sha256_buffer(const PvBuffer *buf, GError **err) - { -- g_autoptr(Buffer) ret = NULL; -+ g_autoptr(PvBuffer) ret = NULL; - - ret = digest_buffer(EVP_sha256(), buf, err); - if (!ret) -@@ -207,10 +207,10 @@ union ecdh_pub_key *evp_pkey_to_ecdh_pub_key(EVP_PKEY *key, GError **err) - return g_steal_pointer(&ret); - } - --static Buffer *derive_key(EVP_PKEY *cust, EVP_PKEY *host, GError **err) -+static PvBuffer *derive_key(EVP_PKEY *cust, EVP_PKEY *host, GError **err) - { - g_autoptr(EVP_PKEY_CTX) ctx = NULL; -- g_autoptr(Buffer) ret = NULL; -+ g_autoptr(PvBuffer) ret = NULL; - gsize key_size; - - ctx = EVP_PKEY_CTX_new(cust, NULL); -@@ -236,7 +236,7 @@ static Buffer *derive_key(EVP_PKEY *cust, EVP_PKEY *host, GError **err) - return NULL; - } - -- ret = buffer_alloc(key_size); -+ ret = pv_buffer_alloc(key_size); - if (EVP_PKEY_derive(ctx, ret->data, &key_size) != 1) { - g_set_error(err, PV_CRYPTO_ERROR, PV_CRYPTO_ERROR_DERIVE, - _("Key derivation failed")); -@@ -247,11 +247,11 @@ static Buffer *derive_key(EVP_PKEY *cust, EVP_PKEY *host, GError **err) - return g_steal_pointer(&ret); - } - --Buffer *compute_exchange_key(EVP_PKEY *cust, EVP_PKEY *host, GError **err) -+PvBuffer *compute_exchange_key(EVP_PKEY *cust, EVP_PKEY *host, GError **err) - { -- g_autoptr(Buffer) raw = buffer_alloc(70); -- g_autoptr(Buffer) ret = NULL; -- g_autoptr(Buffer) key = NULL; -+ g_autoptr(PvBuffer) raw = pv_buffer_alloc(70); -+ g_autoptr(PvBuffer) ret = NULL; -+ g_autoptr(PvBuffer) key = NULL; - guchar *data; - - key = derive_key(cust, host, err); -@@ -290,10 +290,10 @@ gint generate_tweak(union tweak *tweak, uint16_t i, GError **err) - return 0; - } - --static Buffer *generate_rand_data(guint size, const gchar *err_msg, -- GError **err) -+static PvBuffer *generate_rand_data(guint size, const gchar *err_msg, -+ GError **err) - { -- g_autoptr(Buffer) buf = buffer_alloc(size); -+ g_autoptr(PvBuffer) buf = pv_buffer_alloc(size); - - g_assert(size <= INT_MAX); - -@@ -307,14 +307,14 @@ static Buffer *generate_rand_data(guint size, const gchar *err_msg, - return g_steal_pointer(&buf); - } - --Buffer *generate_aes_iv(guint size, GError **err) -+PvBuffer *generate_aes_iv(guint size, GError **err) - { - return generate_rand_data(size, - _("Generating a IV failed because the required amount of random data is not available"), - err); - } - --Buffer *generate_aes_key(guint size, GError **err) -+PvBuffer *generate_aes_key(guint size, GError **err) - { - return generate_rand_data(size, - _("Generating a key failed because the required amount of random data is not available"), -@@ -1756,8 +1756,8 @@ static gint __encrypt_decrypt_bio(const struct cipher_parms *parms, BIO *b_in, - gint cipher_block_size = EVP_CIPHER_block_size(cipher); - guchar in_buf[PAGE_SIZE], - out_buf[PAGE_SIZE + (guint)cipher_block_size]; -- const Buffer *key = parms->key; -- const Buffer *tweak = parms->iv_or_tweak; -+ const PvBuffer *key = parms->key; -+ const PvBuffer *tweak = parms->iv_or_tweak; - g_autofree guchar *tmp_tweak = NULL; - gint out_len, tweak_size; - gsize tmp_size_in = 0, tmp_size_out = 0; -@@ -1895,11 +1895,11 @@ static gint __encrypt_decrypt_bio(const struct cipher_parms *parms, BIO *b_in, - return 0; - } - --static Buffer *__encrypt_decrypt_buffer(const struct cipher_parms *parms, -- const Buffer *in, gboolean encrypt, -- GError **err) -+static PvBuffer *__encrypt_decrypt_buffer(const struct cipher_parms *parms, -+ const PvBuffer *in, gboolean encrypt, -+ GError **err) - { -- g_autoptr(Buffer) ret = NULL; -+ g_autoptr(PvBuffer) ret = NULL; - g_autoptr(BIO) b_out = NULL; - g_autoptr(BIO) b_in = NULL; - gsize in_size, out_size; -@@ -1927,19 +1927,19 @@ static Buffer *__encrypt_decrypt_buffer(const struct cipher_parms *parms, - return NULL; - } - -- ret = buffer_alloc((unsigned long)data_size); -+ ret = pv_buffer_alloc((unsigned long)data_size); - memcpy(ret->data, data, ret->size); - return g_steal_pointer(&ret); - } - --Buffer *encrypt_buf(const struct cipher_parms *parms, const Buffer *in, -- GError **err) -+PvBuffer *encrypt_buf(const struct cipher_parms *parms, const PvBuffer *in, -+ GError **err) - { - return __encrypt_decrypt_buffer(parms, in, TRUE, err); - } - --Buffer *decrypt_buf(const struct cipher_parms *parms, const Buffer *in, -- GError **err) -+PvBuffer *decrypt_buf(const struct cipher_parms *parms, const PvBuffer *in, -+ GError **err) - { - return __encrypt_decrypt_buffer(parms, in, FALSE, err); - } -@@ -1993,16 +1993,16 @@ G_GNUC_UNUSED static gint decrypt_file(const struct cipher_parms *parms, - } - - /* GCM mode uses (zero-)padding */ --static int64_t gcm_encrypt_decrypt(const Buffer *in, const Buffer *aad, -+static int64_t gcm_encrypt_decrypt(const PvBuffer *in, const PvBuffer *aad, - const struct cipher_parms *parms, -- Buffer *out, Buffer *tag, -+ PvBuffer *out, PvBuffer *tag, - enum PvCryptoMode mode, GError **err) - { - g_autoptr(EVP_CIPHER_CTX) ctx = NULL; - const EVP_CIPHER *cipher = parms->cipher; -- const Buffer *iv = parms->iv_or_tweak; -+ const PvBuffer *iv = parms->iv_or_tweak; - gboolean encrypt = mode == PV_ENCRYPT; -- const Buffer *key = parms->key; -+ const PvBuffer *key = parms->key; - int64_t ret = -1; - gint len = -1; - -@@ -2097,8 +2097,8 @@ static int64_t gcm_encrypt_decrypt(const Buffer *in, const Buffer *aad, - return ret; - } - --int64_t gcm_encrypt(const Buffer *in, const Buffer *aad, -- const struct cipher_parms *parms, Buffer *out, Buffer *tag, -+int64_t gcm_encrypt(const PvBuffer *in, const PvBuffer *aad, -+ const struct cipher_parms *parms, PvBuffer *out, PvBuffer *tag, - GError **err) - { - return gcm_encrypt_decrypt(in, aad, parms, out, tag, PV_ENCRYPT, err); -diff --git a/genprotimg/src/utils/crypto.h b/genprotimg/src/utils/crypto.h -index 286cf45..3cda450 100644 ---- a/genprotimg/src/utils/crypto.h -+++ b/genprotimg/src/utils/crypto.h -@@ -117,8 +117,8 @@ union tweak { - - struct cipher_parms { - const EVP_CIPHER *cipher; -- const Buffer *key; -- const Buffer *iv_or_tweak; -+ const PvBuffer *key; -+ const PvBuffer *iv_or_tweak; - }; - - int check_crl_valid_for_cert(X509_CRL *crl, X509 *cert, -@@ -152,24 +152,24 @@ X509_CRL *get_first_valid_crl(X509_STORE_CTX *ctx, X509 *cert, GError **err); - void store_setup_crl_download(X509_STORE *st); - EVP_PKEY *read_ec_pubkey_cert(X509 *cert, gint nid, GError **err); - --Buffer *compute_exchange_key(EVP_PKEY *cust, EVP_PKEY *host, GError **err); --Buffer *generate_aes_key(guint size, GError **err); --Buffer *generate_aes_iv(guint size, GError **err); -+PvBuffer *compute_exchange_key(EVP_PKEY *cust, EVP_PKEY *host, GError **err); -+PvBuffer *generate_aes_key(guint size, GError **err); -+PvBuffer *generate_aes_iv(guint size, GError **err); - EVP_PKEY *generate_ec_key(gint nid, GError **err); - gint generate_tweak(union tweak *tweak, uint16_t i, GError **err); - union ecdh_pub_key *evp_pkey_to_ecdh_pub_key(EVP_PKEY *key, GError **err); - EVP_MD_CTX *digest_ctx_new(const EVP_MD *md, GError **err); --Buffer *digest_ctx_finalize(EVP_MD_CTX *ctx, GError **err); --Buffer *sha256_buffer(const Buffer *buf, GError **err); --int64_t gcm_encrypt(const Buffer *in, const Buffer *aad, -- const struct cipher_parms *parms, Buffer *out, -- Buffer *tag, GError **err); -+PvBuffer *digest_ctx_finalize(EVP_MD_CTX *ctx, GError **err); -+PvBuffer *sha256_buffer(const PvBuffer *buf, GError **err); -+int64_t gcm_encrypt(const PvBuffer *in, const PvBuffer *aad, -+ const struct cipher_parms *parms, PvBuffer *out, -+ PvBuffer *tag, GError **err); - gint encrypt_file(const struct cipher_parms *parms, const gchar *in_path, - const gchar *path_out, gsize *in_size, gsize *out_size, - GError **err); --Buffer *encrypt_buf(const struct cipher_parms *parms, const Buffer *in, -- GError **err); --G_GNUC_UNUSED Buffer *decrypt_buf(const struct cipher_parms *parms, -- const Buffer *in, GError **err); -+PvBuffer *encrypt_buf(const struct cipher_parms *parms, const PvBuffer *in, -+ GError **err); -+G_GNUC_UNUSED PvBuffer *decrypt_buf(const struct cipher_parms *parms, -+ const PvBuffer *in, GError **err); - - #endif -diff --git a/genprotimg/src/utils/file_utils.c b/genprotimg/src/utils/file_utils.c -index 1d6fc37..ba33400 100644 ---- a/genprotimg/src/utils/file_utils.c -+++ b/genprotimg/src/utils/file_utils.c -@@ -171,13 +171,13 @@ err: - return ret; - } - --gint seek_and_write_buffer(FILE *o, const Buffer *buf, uint64_t offset, -+gint seek_and_write_buffer(FILE *o, const PvBuffer *buf, uint64_t offset, - GError **err) - { - if (file_seek(o, offset, err) < 0) - return -1; - -- if (buffer_write(buf, o, err) < 0) -+ if (pv_buffer_write(buf, o, err) < 0) - return -1; - - return 0; -diff --git a/genprotimg/src/utils/file_utils.h b/genprotimg/src/utils/file_utils.h -index 47df114..456e7ac 100644 ---- a/genprotimg/src/utils/file_utils.h -+++ b/genprotimg/src/utils/file_utils.h -@@ -26,7 +26,7 @@ gint file_write(FILE *out, const void *ptr, gsize size, gsize count, - gsize *count_written, GError **err); - gint pad_file_right(const gchar *path_out, const gchar *path_in, - gsize *size_out, guint padding, GError **err); --gint seek_and_write_buffer(FILE *out, const Buffer *buf, uint64_t offset, -+gint seek_and_write_buffer(FILE *out, const PvBuffer *buf, uint64_t offset, - GError **err); - gint seek_and_write_file(FILE *o, const CompFile *ifile, uint64_t offset, - GError **err); --- -2.31.1 - - -From 5997d2b96e05fd8d228bd05a8b56850822747944 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jan=20H=C3=B6ppner?= -Date: Fri, 26 Feb 2021 16:47:23 +0100 -Subject: [PATCH 3/7] ttyrun-getty: Avoid conflicts with serial-getty@ - (#1907781) -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Starting ttyrun-getty@ will fail as it conflicts with the serial-getty@ -service. Add Conflicts= option to avoid any conflicts. - -Fixes: https://github.com/ibm-s390-linux/s390-tools/issues/105 -Suggested-by: Dan Horák -Signed-off-by: Jan Höppner -(cherry picked from commit d23558f1d1b8268f1ebcb4c05c692a89f2a433c0) ---- - systemd/ttyrun-getty@.service.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/systemd/ttyrun-getty@.service.in b/systemd/ttyrun-getty@.service.in -index eb4299b..37554b4 100644 ---- a/systemd/ttyrun-getty@.service.in -+++ b/systemd/ttyrun-getty@.service.in -@@ -16,7 +16,7 @@ After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service - After=rc-local.service - Before=getty.target - IgnoreOnIsolate=yes -- -+Conflicts=serial-getty@%i.service - - [Service] - Environment=TERM=linux --- -2.31.1 - - -From 3040c1e6c8962b1aca1291586de304ba3ee6d67f Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Dan=20Hor=C3=A1k?= -Date: Fri, 2 Jul 2021 11:46:33 +0200 -Subject: [PATCH 4/7] zdsfs: transparent dataset conversion (#1919238) - -Summary: zdsfs: transparent dataset conversion -Description: The zdsfs tool is used to access z/OS data sets from - Linux. Many text based data sets in z/OS are EBCDIC - encoded. To perform actual work in Linux those data sets - usually have to be converted to ASCII. This is currently - done by first copying the data set to Linux using zdsfs - and run a separate conversion tool afterwards. - This item aims to improve the user experience by allowing - the user to do the conversion while the data is - transferred using zdsfs. -Upstream-ID: 4b0403a9630dd64d93efcf443d2e5231458a812e -Upstream-ID: cdf716a7a92b33c6bb64e66da2a4914fc2bd80f9 -Upstream-ID: 7244785279ddcf66cf1da92f6167a824e2ee119c -Upstream-ID: 0fafbcf3bb44a49a7eea41011d60049f61063c00 -Upstream-ID: 2ece47ee1ac3d5b448680264d948f6c50a76af56 - -Problem-ID: IO1811 ---- - include/lib/libzds.h | 7 +- - libzds/libzds.c | 186 +++++++++++++++++++- - zdsfs/zdsfs.1 | 167 ++++++++++++------ - zdsfs/zdsfs.c | 399 ++++++++++++++++++++++++++++++++++++++++++- - 4 files changed, 697 insertions(+), 62 deletions(-) - -diff --git a/include/lib/libzds.h b/include/lib/libzds.h -index 9135485..2647107 100644 ---- a/include/lib/libzds.h -+++ b/include/lib/libzds.h -@@ -115,7 +115,7 @@ - #include "lib/util_base.h" - #include "lib/util_list.h" - #include "vtoc.h" -- -+#include - - - /** -@@ -834,6 +834,11 @@ void lzds_dshandle_get_errorlog(struct dshandle *dsh, struct errorlog **log); - int lzds_dshandle_set_seekbuffer(struct dshandle *dsh, - unsigned long long seek_buffer_size); - -+/** -+ * @brief Set iconv handle for codepage conversion. -+ */ -+int lzds_dshandle_set_iconv(struct dshandle *dsh, iconv_t *iconv); -+ - /** - * @brief Get the size of the data set in number of tracks (sum of all extents). - */ -diff --git a/libzds/libzds.c b/libzds/libzds.c -index a6c6912..dbf810d 100644 ---- a/libzds/libzds.c -+++ b/libzds/libzds.c -@@ -61,6 +61,9 @@ struct errorlog { - - #define BUSIDSIZE 8 - -+#define EBCDIC_SP 0x40 -+#define EBCDIC_LF 0x25 -+ - /** - * @brief An internal structure that represents an entry in the error log. - */ -@@ -307,6 +310,8 @@ struct dshandle { - struct errorlog *log; - - char *session_ref; -+ iconv_t *iconv; -+ char *convbuffer; - }; - - /** @endcond */ -@@ -2812,6 +2817,38 @@ int lzds_dshandle_set_keepRDW(struct dshandle *dsh, int keepRDW) - return 0; - } - -+/** -+ * @pre The dsh must not be open when this function is called. -+ * -+ * @param[in] dsh The dshandle we want to modify. -+ * @param[in] iconv_t The iconv handle for codepage conversion. -+ * -+ * @return 0 on success, otherwise one of the following error codes: -+ * - EBUSY The handle is already open. -+ */ -+int lzds_dshandle_set_iconv(struct dshandle *dsh, iconv_t *iconv) -+{ -+ errorlog_clear(dsh->log); -+ if (dsh->is_open) -+ return errorlog_add_message( -+ &dsh->log, NULL, EBUSY, -+ "dshandle: cannot set iconv while handle is open\n"); -+ -+ /* -+ * if conversion is enabled the returned data might in worst case -+ * be 4 times the size of the input buffer. So realloc the buffer. -+ * If for whatever very unlikely reason the converted size is still -+ * larger the conversion will fail. -+ */ -+ if (iconv) { -+ dsh->databufmax *= 4; -+ dsh->databuffer = util_realloc(dsh->databuffer, -+ dsh->databufmax); -+ } -+ dsh->iconv = iconv; -+ return 0; -+} -+ - /** - * @param[in] dsh The dshandle that we want to know the member of. - * @param[out] keepRDW Reference to a variable in which the previously -@@ -2946,6 +2983,8 @@ void lzds_dshandle_close(struct dshandle *dsh) - for (i = 0; i < MAXVOLUMESPERDS; ++i) - if (dsh->dasdhandle[i]) - lzds_dasdhandle_close(dsh->dasdhandle[i]); -+ free(dsh->convbuffer); -+ free(dsh->iconv); - dsh->is_open = 0; - } - -@@ -3280,10 +3319,130 @@ int lzds_dshandle_open(struct dshandle *dsh) - return rc; - } - } -+ if (dsh->iconv) -+ dsh->convbuffer = util_zalloc(dsh->databufmax); -+ - dsh->is_open = 1; - return 0; - } - -+/** -+ * @brief subroutine of parse_fixed_record for codepage conversion -+ * -+ * Converts the provided data from one codepage to another using iconv. -+ * Stores converted data directly in the target buffer. -+ * Adds a linebreak at the end of each record to end the line. -+ * Also remove trailing spaces. -+ * -+ * @param[in] dsh The dshandle that keeps track of the I/O operations. -+ * @param[in] rec Pointer to the record buffer. -+ * @param[in] targetdata Pointer to the data buffer. -+ * @return Number of copied data bytes on success, -+ * otherwise one of the following (negative) error codes: -+ * - -EPROTO The record is malformed. -+ */ -+static ssize_t convert_fixed_record(struct dshandle *dsh, -+ char *rec, char *targetdata) -+{ -+ struct eckd_count *ecount = (struct eckd_count *)rec; -+ size_t in_count, out_count, max_count; -+ int reclen, blocksize, reccount; -+ char *inbuf, *outbuf; -+ char *src, *target; -+ size_t rc; -+ int i; -+ -+ blocksize = ecount->dl; -+ reclen = dsh->ds->dsp[0]->f1->DS1LRECL; -+ reccount = blocksize / reclen; -+ -+ outbuf = targetdata; -+ out_count = max_count = -+ (unsigned long)dsh->databuffer + dsh->databufmax - -+ (unsigned long)targetdata; -+ in_count = 0; -+ inbuf = dsh->convbuffer; -+ -+ /* skip block header */ -+ src = (rec + sizeof(*ecount) + ecount->kl); -+ target = inbuf; -+ /* for each record aka line */ -+ for (i = 0; i < reccount; i++) { -+ /* remove trailing spaces */ -+ while (reclen && (*(src + reclen - 1) == EBCDIC_SP)) -+ reclen--; -+ /* move remaining data and add linebreak at end of record */ -+ memcpy(target, src, reclen); -+ target += reclen; -+ *target = EBCDIC_LF; -+ target++; -+ /* count how much chars remain after whitespace cleanup */ -+ in_count += reclen + 1; -+ -+ /* reset for next line */ -+ reclen = dsh->ds->dsp[0]->f1->DS1LRECL; -+ src += reclen; -+ } -+ /* convert directly into target buffer */ -+ rc = iconv(*(dsh->iconv), &inbuf, &in_count, &outbuf, &out_count); -+ if ((rc == (size_t) -1) || (in_count != 0)) -+ return -errorlog_add_message( -+ &dsh->log, NULL, EPROTO, -+ "fixed record parser: codepage conversion failed\n"); -+ /* return how much was written in the target buffer */ -+ return max_count - out_count; -+} -+ -+/** -+ * @brief subroutine of parse_variable_record for codepage conversion -+ * -+ * Converts the record data from one codepage to another using iconv. -+ * Stores converted data directly in the target buffer -+ * -+ * @param[in] dsh The dshandle that keeps track of the I/O operations. -+ * @param[in] reclen Length of the record. -+ * @param[in] rec Pointer to the record buffer. -+ * @param[in] targetdata Pointer to the data buffer. -+ * @return Number of copied data bytes on success, -+ * otherwise one of the following (negative) error codes: -+ * - -EPROTO The record is malformed. -+ */ -+static ssize_t convert_variable_record(struct dshandle *dsh, int reclen, -+ char *rec, char *targetdata) -+{ -+ size_t in_count, out_count, max_count; -+ char *inbuf, *outbuf; -+ size_t rc; -+ -+ inbuf = rec; -+ outbuf = targetdata; -+ in_count = reclen + 1; -+ out_count = max_count = -+ (unsigned long)dsh->databuffer + dsh->databufmax - -+ (unsigned long)targetdata; -+ /* -+ * we can not overwrite the track end marker since it is still used -+ * for this case we have to make a copy of the source data to add the -+ * linebreak -+ */ -+ if (inbuf[reclen] == 0xFF) { -+ inbuf = dsh->convbuffer; -+ memcpy(inbuf, rec, reclen); -+ } -+ -+ /* add linebreak */ -+ inbuf[reclen] = 0x25; -+ -+ rc = iconv(*(dsh->iconv), &inbuf, &in_count, &outbuf, &out_count); -+ if ((rc == (size_t) -1) || (in_count != 0)) -+ return -errorlog_add_message( -+ &dsh->log, NULL, EPROTO, -+ "variable record parser: codepage conversion failed\n"); -+ -+ /* return how much was written in the target buffer */ -+ return max_count - out_count; -+} -+ - /** - * @brief subroutine of dshandle_extract_data_from_trackbuffer - * -@@ -3298,6 +3457,7 @@ static ssize_t parse_fixed_record(struct dshandle *dsh, - char *rec, char *targetdata) - { - struct eckd_count *ecount; -+ int count; - - ecount = (struct eckd_count *)rec; - /* Make sure that we do not copy data beyond the end of -@@ -3308,8 +3468,13 @@ static ssize_t parse_fixed_record(struct dshandle *dsh, - return - errorlog_add_message( - &dsh->log, NULL, EPROTO, - "fixed record to long for target buffer\n"); -- memcpy(targetdata, (rec + sizeof(*ecount) + ecount->kl), ecount->dl); -- return ecount->dl; -+ if (dsh->iconv) { -+ count = convert_fixed_record(dsh, rec, targetdata); -+ } else { -+ memcpy(targetdata, (rec + sizeof(*ecount) + ecount->kl), ecount->dl); -+ count = ecount->dl; -+ } -+ return count; - } - - /** -@@ -3333,6 +3498,7 @@ static ssize_t parse_variable_record(struct dshandle *dsh, char *rec, - struct segment_header *blockhead; - struct segment_header *seghead; - size_t totaldatalength; -+ int count; - - /* We must not rely on the data in rec, as it was read from disk and - * may be broken. Wherever we interprete the data we must have sanity -@@ -3398,9 +3564,19 @@ static ssize_t parse_variable_record(struct dshandle *dsh, char *rec, - &dsh->log, NULL, EPROTO, - "variable record parser: " - "record to long for target buffer\n"); -- memcpy(targetdata, data, segmentlength); -- targetdata += segmentlength; -- totaldatalength += segmentlength; -+ if (dsh->iconv) { -+ count = convert_variable_record(dsh, segmentlength, -+ data, targetdata); -+ if (count < 0) -+ return count; -+ -+ totaldatalength += count; -+ targetdata += count; -+ } else { -+ memcpy(targetdata, data, segmentlength); -+ totaldatalength += segmentlength; -+ targetdata += segmentlength; -+ } - data += segmentlength; - } - return totaldatalength; -diff --git a/zdsfs/zdsfs.1 b/zdsfs/zdsfs.1 -index 677bea5..21acb70 100644 ---- a/zdsfs/zdsfs.1 -+++ b/zdsfs/zdsfs.1 -@@ -32,29 +32,23 @@ Only read access is supported. - - Data sets on tape devices are not supported. - --To maintain data consistency, a DASD must not be modified while it is --in use by zdsfs. This can be assured by varying the device offline --in z/OS before setting it online in Linux or by using z/OSMF REST --services to notify z/OS about access to data sets. -- --Device access by Linux is not subject to RACF or other --z/OS auditing mechanisms unless the z/OSMF REST services are used for --a coordinated read access. --The safety of the data on the device must be established by --therespective Linux mechanisms. By default, zdsfs grants access to the --files in the fuse file system only to the user who started the --tool. This behavior can be changed by using the options `allow_other', --`default_permissions', `umask', `uid', and `gid'. -- --When using the z/OSMF REST services for coordinated read access, a --connection is established for every opened file. The z/OSMF REST --services confirm that the z/OS userid that is specified in the .netrc --configuration file has the required access rights for the data set. --Using this mechanism also an exclusive ENQ is obtained to mark the --data set as in use to z/OS. The ENQ prevents z/OS applications from --modifying the data set during zdsfs access. --If the ENQ cannot be obtained, the access from Linux fails with an --error. -+If the z/OSMF REST services are not used for a coordinated-read -+access, access to the device by Linux is not subject to RACF or any -+other z/OS auditing mechanism. Ensure the security of the data on the -+device by using the well-known Linux methods. By default, zdsfs grants -+access to the files in the fuse file system only to the user who -+started the tool. Configure file access behavior by using the -+‘allow_other’, ‘default_permissions’, ‘umask’, ‘uid’, and ‘gid’ -+options. -+ -+When using the z/OSMF REST services for coordinated read access, every -+file open establishes a connection to the z/OSMF REST server. This -+checks that the accessing z/OS user ID has the appropriate access -+rights for the data set. Using this mechanism, an exclusive ENQ is -+obtained that marks the data set as in-use to z/OS. An ENQ is a z/OS -+method to control a serially reusable resource. While the ENQ is held, -+no z/OS application can modify the data set. If the ENQ cannot be -+obtained, the access attempt from Linux fails. - - Only physical sequential (PS) and partitioned data sets (PDS) are - supported. Supported record formats are: V, F, U, B, S, A, and M. -@@ -171,20 +165,50 @@ instance. - - .TP - \fB\-c\fR \fI\fR --zdsfs configuration file. The default is /etc/zdsfs.conf. -+Provide a configuration file for zdsfs. The default is /etc/zdsfs.conf. - - .TP - \fB\-o\fR restapi --Make zdsfs use z/OSMF REST services for coordinated read access to --data sets. The user credentials are taken from .netrc file in the --user's home directory or where the NETRC environment variable points -+Use z/OSMF REST services for coordinated read-access to data sets. The -+user credentials are read from the .netrc file in the user's home -+directory, or from the location the NETRC environment variable points - to. - - .TP - \fB\-o\fR restserver= --Specify up to 3 server URLs to z/OSMF REST services. --For multiple specifications, the URLs are tried sequentially, and the --first functioning URL is used. -+Specify up to three server URLs to z/OSMF REST services. If more than -+one server is specified, the first that responds is used. If a server -+does not respond any longer during operation all specified server are probed again. -+ -+.TP -+\fB\-x\fR \fI\fR -+Use a config file with code-page conversion options for -+specific data sets. -+ -+.TP -+\fB\-o\fR codepage_convert -+Enable code-page conversion for all data sets. Unless specified -+otherwise, the source code-page is EBCDIC CP1047 and the target -+code-page is UTF-8. -+ -+You can change the default for the source code-page with the -o -+codepage_from option and for the target code-page with the -o -+codepage_to option. To specify source and target code-pages for -+individual data sets use a data set config file. -+ -+.TP -+\fB\-o\fR codepage_from=\fI\fR -+Override EBCDIC CP1047 as the default code-page for the source. Must -+be combined with \fB\-o\fR codepage_to=\fI\fR. Overrides settings -+in a data set config file. Issue iconv -l for a list of valid -+specifications for . -+ -+.TP -+\fB\-o\fR codepage_to=\fI\fR -+Override UTF-8 as the default code-page for the target. Must be -+combined with \fB\-o\fR codepage_from=\fI\fR. Overrides settings -+in a data set configu file. Issue iconv -l for a list of valid -+specifications for . - - .SS "Applicable FUSE options (version 2.8):" - This is a selected subset of all FUSE options. Use the zdsfs -@@ -273,44 +297,81 @@ directory: - - \fBuser.dsorg\fR: The data set organization of a file. - --.SH zdsfs configuration file -- --The default search path is /etc/zdsfs.conf. --Use the \fB\-c\fR \fI\fR option to specify other zdsfs --configuration file locations. -+.SH zdsfs config file - -+The default path is /etc/zdsfs.conf. Specify a different zdsfs config -+file location with the \fB\-c\fR \fI\fR option. - .br -- --The configuration file can contain the following options: -+The config file may contain the following options: - .PP - - .B restapi - = - .IR 0 / 1 - .IP --Setting this option to 1 enables the z/OSMF REST services. --The z/OSMF REST services require a valid URL specification for a REST --server, and a .netrc file with a valid z/OS user ID and password. -+Determines whether the z/OSMF REST services should be used. If -+enabled, a valid REST server must be specified, as well as a .netrc -+file with a valid z/OS user ID and password. - .PP - - .B restserver - = - .IR URL - .IP --Specifies the URL of the z/OSMF REST server that is --used for coordinated read access. For failover, up to 3 different --server addresses can be provided. -+Specifies the address of the z/OSMF REST server that is used for -+coordinating read-access. For failover scenarios, provide up to three -+different server addresses. These will be tried in the specified order -+when one of the servers cannot be reached during mount or operation. - .PP - - .B keepalive - = --.I timeout --(in seconds) -+.I timeout (in seconds) -+.IP -+Optionally change the keepalive timer for ENQs. By default the -+keepalive refreshes the access after 540 seconds (9 minutes).The 9 -+minutes are chosen to prevent a timeout by z/OS after 10 minutes. -+ -+.SH data-set config file -+Provides code-page conversion settings for individual data sets. -+The default config file is /etc/zdsfs-dataset.conf. Use the \fB\-x\fR -+\fI\fR option to specify a different file. -+.br -+Each config-file entry must contain the following options: -+.PP -+ -+.B -+DATASET.TITLE -+.IP -+Specifies the data-set title or a pattern of titles to which the entry -+applies. The title can have a trailing asterisk to match all titles -+that begin with the leading characters. -+.PP -+ -+.B conv -+= -+.IR 0 / 1 / , -+.IP -+\fI0\fR disables code-page conversion. -+.br -+\fI1\fR performs conversion with the default conversion table. -+.br -+An explicit specification of source and target code-page overrides the default conversion tables -+The code-page specifications must be separated by a comma. -+Issue iconv -l for a list of valid code-page specifications. -+ -+.PP -+ -+.B rdw -+= -+.I 0 / 1 - .IP --Specifies the keepalive timer for ENQs. --By default the timer is set to 540 seconds to prevent the ENQ from a --timeout after 10 minutes in case access to the data set takes longer --than this. -+\fI0\fR omits the record descriptor word from the data stream. -+.br -+\fI1\fR keeps the record descriptor word from the data stream. -+.br -+Code-page conversion can render data unreadable if the record descriptor word is kept. -+ - - .SH EXAMPLES - To mount the z/OS disk with the name dasde enter: -@@ -341,9 +402,15 @@ assuming the z/OS disk was mounted on /mnt: - - To mount the z/OS disk using the z/OSMF REST services for coordinated - read access: -+ -+ # ./zdsfs -o restapi -o restserver=zos1.server.tld/zosmf /dev/dasde /mnt/ -+ - .br -+To mount the z/OS disk and enable code-page conversion for all data -+sets using a custom source and target code page: -+ -+ # ./zdsfs -o codepage_from=CP037 -o codepage_to=ISO-8859-1 /dev/dasde /mnt/ - -- # ./zdsfs -o restapi -o restserver=zos1.server.tld/zosmf /dev/dasde /mnt/ - - .SH SEE ALSO - getfattr(1), fuse(8), z/OS DFSMS Using Data Sets, -diff --git a/zdsfs/zdsfs.c b/zdsfs/zdsfs.c -index 87c1bea..ceadd34 100644 ---- a/zdsfs/zdsfs.c -+++ b/zdsfs/zdsfs.c -@@ -25,6 +25,8 @@ - #include - #include - -+#include -+ - #ifdef HAVE_SETXATTR - #include - #endif -@@ -34,6 +36,7 @@ - #include "lib/zt_common.h" - - #define COMP "zdsfs: " -+ - #define METADATAFILE "metadata.txt" - - /* defaults for file and directory permissions (octal) */ -@@ -42,6 +45,10 @@ - /* default timer interval 9 minutes, enq times out after 10 minutes */ - #define DEFAULT_KEEPALIVE_SEC 540 - -+#define SECTION_ENTRIES 3 -+static char CODEPAGE_EDF[] = "CP1047"; -+static char CODEPAGE_LINUX[] = "UTF-8"; -+ - struct zdsfs_info { - int devcount; - int allow_inclomplete_multi_volume; -@@ -61,6 +68,12 @@ struct zdsfs_info { - int active_server; - char *server[MAX_SERVER]; - long keepalive; -+ int codepage_convert; -+ char *codepage_from; -+ char *codepage_to; -+ iconv_t iconv; -+ struct util_list *dsclist; -+ char *dsfile; - }; - - static struct zdsfs_info zdsfsinfo; -@@ -82,6 +95,18 @@ struct zdsfs_file_info { - size_t metaread; /* how many bytes have already been read */ - }; - -+struct dsconvert { -+ char *name; -+ char *codepage_from; -+ char *codepage_to; -+ bool keeprdw; -+}; -+ -+struct dsc_node { -+ struct util_list_node node; -+ struct dsconvert *dsc; -+}; -+ - /* Allocate and initialize a new list of struct dsh_node. */ - static struct util_list *dshlist_alloc(void) - { -@@ -144,6 +169,65 @@ void dshlist_remove(struct util_list *list, struct dshandle *dsh) - } - } - -+/* Allocate and initialize a new list of struct dsc_node. */ -+static struct util_list *dsclist_alloc(void) -+{ -+ struct util_list *list; -+ -+ list = util_malloc(sizeof(struct util_list)); -+ util_list_init(list, struct dsc_node, node); -+ -+ return list; -+} -+ -+/* free struct dsconvert. */ -+static void dsc_free(struct dsconvert *dsc) -+{ -+ free(dsc->name); -+ free(dsc->codepage_from); -+ free(dsc->codepage_to); -+ free(dsc); -+} -+ -+/* free list of struct dsc_node. */ -+static void dsclist_free(struct util_list *list) -+{ -+ struct dsc_node *s, *n; -+ -+ if (!list) -+ return; -+ -+ util_list_iterate_safe(list, s, n) { -+ util_list_remove(list, s); -+ dsc_free(s->dsc); -+ free(s); -+ } -+ -+ free(list); -+} -+ -+/* add dsc to list */ -+static void dsclist_add(struct util_list *list, struct dsconvert *dsc) -+{ -+ struct dsc_node *s; -+ -+ s = util_malloc(sizeof(struct dsc_node)); -+ s->dsc = dsc; -+ util_list_add_tail(list, s); -+} -+ -+/* Find a dsc_node by name. */ -+static struct dsc_node *dsclist_find_by_name(struct util_list *list, char *name) -+{ -+ struct dsc_node *s; -+ -+ util_list_iterate(list, s) { -+ if (strcmp(s->dsc->name, name) == 0) -+ return s; -+ } -+ -+ return NULL; -+} - - /* normalize the given path name to a dataset name - * so that we can compare it to the names in the vtoc. This means: -@@ -176,6 +260,16 @@ static void path_to_member_name(const char *path, char *normds, size_t size) - } - } - -+static int setup_iconv(iconv_t *conv, const char *from, const char *to) -+{ -+ *conv = iconv_open(to, from); -+ if (*conv == ((iconv_t) -1)) { -+ fprintf(stderr, "error when setting up iconv\n"); -+ return -1; -+ } -+ return 0; -+} -+ - static void setup_timer(long sec) - { - static struct itimerval timer; -@@ -531,6 +625,102 @@ static int zdsfs_test_restserver(void) - return 0; - } - -+/* -+ * check if a dsconvert entry exists that match the given DS name -+ * if the dsconvert entry ends in an asterisk only match the prefix -+ * otherwise look for an exact match -+ */ -+static struct dsconvert *zdsfs_get_matching_dsc(char *name) -+{ -+ struct dsconvert *dsc; -+ unsigned int length; -+ struct dsc_node *n; -+ char *match; -+ -+ util_list_iterate(zdsfsinfo.dsclist, n) { -+ dsc = n->dsc; -+ match = dsc->name; -+ length = strlen(match); -+ if (strcmp(&match[length - 1], "*") == 0) -+ length--; -+ else if (strlen(name) != length) -+ continue; -+ -+ if (strncmp(name, match, length) == 0) -+ return dsc; -+ } -+ return NULL; -+} -+ -+/* -+ * Setup iconv conversion for a given dataset. -+ * The codepage settings can be obtained from (in descending priority) -+ * - globally set codepage settings -+ * - a dsconvert entry matching the DS name -+ * - default codepage settings. -+ */ -+static int zdsfs_setup_conversion(struct dshandle *dsh, struct dataset *ds) -+{ -+ struct dsconvert *dsc; -+ const char *from, *to; -+ struct errorlog *log; -+ iconv_t *iconv; -+ char *dsname; -+ int rc; -+ -+ from = to = NULL; -+ lzds_dataset_get_name(ds, &dsname); -+ dsc = zdsfs_get_matching_dsc(dsname); -+ /* the DS matches a dsconvert entry */ -+ if (dsc) { -+ from = dsc->codepage_from; -+ to = dsc->codepage_to; -+ } -+ -+ /* globally set conversion overwriting possible config file settings */ -+ if (zdsfsinfo.codepage_from && zdsfsinfo.codepage_to) { -+ from = zdsfsinfo.codepage_from; -+ to = zdsfsinfo.codepage_to; -+ } -+ -+ /* -+ * globally set conversion using defaults -+ * if not specified otherwise already -+ */ -+ if (zdsfsinfo.codepage_convert) { -+ if (!from) -+ from = CODEPAGE_EDF; -+ if (!to) -+ to = CODEPAGE_LINUX; -+ } -+ -+ /* no conversion */ -+ if (!from || !to) -+ return 0; -+ -+ iconv = util_malloc(sizeof(*iconv)); -+ rc = setup_iconv(iconv, from, to); -+ if (rc) { -+ fprintf(stderr, "Error when preparing iconv setting:\n"); -+ lzds_dshandle_get_errorlog(dsh, &log); -+ lzds_errorlog_fprint(log, stderr); -+ rc = -rc; -+ goto out; -+ } -+ rc = lzds_dshandle_set_iconv(dsh, iconv); -+ if (rc) { -+ fprintf(stderr, "Error when setting iconv handle:\n"); -+ lzds_dshandle_get_errorlog(dsh, &log); -+ lzds_errorlog_fprint(log, stderr); -+ rc = -rc; -+ goto out; -+ } -+ return 0; -+out: -+ free(iconv); -+ return rc; -+} -+ - - static int zdsfs_open(const char *path, struct fuse_file_info *fi) - { -@@ -620,6 +810,7 @@ static int zdsfs_open(const char *path, struct fuse_file_info *fi) - rc = -rc; - goto error2; - } -+ zdsfs_setup_conversion(dsh, ds); - - retry: - if (zdsfsinfo.restapi && zdsfsinfo.active_server >= 0) { -@@ -660,7 +851,6 @@ error2: - error1: - free(zfi); - return rc; -- - } - - static int zdsfs_release(const char *UNUSED(path), struct fuse_file_info *fi) -@@ -1012,7 +1202,10 @@ enum { - KEY_TRACKS, - KEY_SEEKBUFFER, - KEY_CONFIG, -+ KEY_DSCONFIG, - KEY_SERVER, -+ KEY_CODE_FROM, -+ KEY_CODE_TO, - }; - - #define ZDSFS_OPT(t, p, v) { t, offsetof(struct zdsfs_info, p), v } -@@ -1026,11 +1219,15 @@ static const struct fuse_opt zdsfs_opts[] = { - FUSE_OPT_KEY("tracks=", KEY_TRACKS), - FUSE_OPT_KEY("seekbuffer=", KEY_SEEKBUFFER), - FUSE_OPT_KEY("-c %s", KEY_CONFIG), -+ FUSE_OPT_KEY("-x %s", KEY_DSCONFIG), - FUSE_OPT_KEY("restserver=", KEY_SERVER), -+ FUSE_OPT_KEY("codepage_from=", KEY_CODE_FROM), -+ FUSE_OPT_KEY("codepage_to=", KEY_CODE_TO), - ZDSFS_OPT("rdw", keepRDW, 1), - ZDSFS_OPT("ignore_incomplete", allow_inclomplete_multi_volume, 1), - ZDSFS_OPT("check_host_count", host_count, 1), - ZDSFS_OPT("restapi", restapi, 1), -+ ZDSFS_OPT("codepage_convert", codepage_convert, 1), - FUSE_OPT_END - }; - -@@ -1052,6 +1249,8 @@ static void usage(const char *progname) - " nodes\n" - " -c config_file Text file that contains configuration options\n" - " for zdsfs\n" -+" -x ds_config_file Text file that contains conversion options\n" -+" for specific datasets\n" - " -o rdw Keep record descriptor words in byte stream\n" - " -o ignore_incomplete Continue processing even if parts of a multi" - " volume\n" -@@ -1065,6 +1264,10 @@ static void usage(const char *progname) - " access to datasets\n" - " -o restserver=URL The URL of the z/OSMF REST server to be used for\n" - " coordinated access to datasets\n" -+" -o codepage_convert Enable codepage conversion using default codepages\n" -+" from 'CP1047' to 'UTF-8'\n" -+" -o codepage_from=from Set codepage for source. See 'iconv -l' for a list\n" -+" -o codepage_to=to Set codepage for target. See 'iconv -l' for a list\n" - , progname); - } - -@@ -1167,7 +1370,7 @@ static void zdsfs_process_device_file(const char *devfile) - void remove_whitespace(const char *s, char *t) - { - while (*s != '\0') { -- if (!isspace(*s)) { -+ if (!isblank(*s)) { - *t = *s; - t++; - } -@@ -1176,7 +1379,6 @@ void remove_whitespace(const char *s, char *t) - *t = '\0'; - } - -- - static void zdsfs_process_config_file(const char *config) - { - char line[MAX_LINE_LENGTH]; -@@ -1198,7 +1400,7 @@ static void zdsfs_process_config_file(const char *config) - continue; - - /* remove all whitespaces */ -- tmp = util_malloc(strlen(line)); -+ tmp = util_malloc(strlen(line) + 1); - remove_whitespace(line, tmp); - - key = strtok(tmp, delimiter); -@@ -1225,6 +1427,163 @@ static void zdsfs_process_config_file(const char *config) - fclose(fd); - } - -+static struct dsconvert *zdsfs_allocate_dsc(char *name, const char *config) -+{ -+ struct dsconvert *dsc; -+ -+ /* check for duplicate entries */ -+ if (dsclist_find_by_name(zdsfsinfo.dsclist, name)) { -+ fprintf(stderr, -+ "Error in config file %s. Duplicate entry found: %s\n", -+ config, name); -+ return NULL; -+ } -+ dsc = util_zalloc(sizeof(*dsc)); -+ dsc->name = util_strdup(name); -+ -+ return dsc; -+} -+ -+static int zdsfs_check_codepage_setting(char *from, char *to) -+{ -+ iconv_t iconv; -+ -+ /* no conversion is OK */ -+ if (!from && !to) -+ return 0; -+ -+ /* partial setup is not OK */ -+ if ((from && !to) || (to && !from)) -+ return 1; -+ -+ /* return if the codepages are valid */ -+ return setup_iconv(&iconv, from, to); -+} -+ -+/* -+ * process a dataset configuration file that specifies conversion on a per dataset basis -+ * -+ * expect a section title each 3 lines -+ * the section should contain a rdw= and conv= line -+ * valid values for rdw= are 0/1 -+ * valid values for conv= are 0/1 or a comma separated list -+ * of codepage_from and codepage_to arguments -+ */ -+static int zdsfs_process_dataset_conf(const char *config) -+{ -+ char line[MAX_LINE_LENGTH]; -+ char delimiter[] = " =#\n"; -+ char *tmp, *key, *value; -+ int linecount, in_section; -+ unsigned long enabled; -+ struct dsconvert *dsc; -+ int rc = 1; -+ FILE *fd; -+ -+ fd = fopen(config, "r"); -+ if (!fd) { -+ fprintf(stderr, "could not open file %s: %s\n", -+ config, strerror(errno)); -+ return 0; -+ } -+ in_section = 0; -+ linecount = 0; -+ dsc = NULL; -+ tmp = NULL; -+ while (fgets(line, sizeof(line), fd)) { -+ linecount++; -+ /* remove all whitespaces */ -+ tmp = util_malloc(strlen(line) + 1); -+ remove_whitespace(line, tmp); -+ /* skip empty lines */ -+ if (*tmp == '\n' || *tmp == '#') { -+ free(tmp); -+ tmp = NULL; -+ continue; -+ } -+ if (!in_section) { -+ /* the section title should not contain a '=' */ -+ if (strchr(line, '=') != NULL) { -+ fprintf(stderr, -+ "Error in config file %s line %d. Expected section title instead of %s\n", -+ config, linecount, line); -+ goto out; -+ } -+ } -+ key = strtok(tmp, delimiter); -+ if (!in_section) { -+ dsc = zdsfs_allocate_dsc(key, config); -+ if (!dsc) -+ goto out; -+ in_section = SECTION_ENTRIES; -+ } else if (strcmp(key, "rdw") == 0) { -+ value = strtok(NULL, delimiter); -+ enabled = strtoul(value, NULL, 0); -+ if (enabled == 1) -+ dsc->keeprdw = true; -+ else -+ dsc->keeprdw = false; -+ } else if (strcmp(key, "conv") == 0) { -+ value = strtok(NULL, delimiter); -+ if (strchr(value, ',') != NULL) { -+ /* use provided codepages */ -+ value = strtok(value, ","); -+ dsc->codepage_from = util_strdup(value); -+ value = strtok(NULL, delimiter); -+ dsc->codepage_to = util_strdup(value); -+ } else if (strcmp(value, "1") == 0) { -+ /* use default codepages */ -+ dsc->codepage_from = CODEPAGE_EDF; -+ dsc->codepage_to = CODEPAGE_LINUX; -+ } else if (strcmp(value, "0") == 0) { -+ /* disable conversion */ -+ dsc->codepage_from = NULL; -+ dsc->codepage_to = NULL; -+ } else { -+ fprintf(stderr, -+ "Error in config file %s line %d. Invalid 'conv' statement: %s.\n", -+ config, linecount, value); -+ goto out; -+ } -+ } else { -+ fprintf(stderr, -+ "Error in config file %s line %d. Missing 'rdw' or 'conv' statement.\n", -+ config, linecount); -+ goto out; -+ } -+ in_section--; -+ /* if the section was parsed completely, add the dsc to the list */ -+ if (!in_section) { -+ if (zdsfs_check_codepage_setting(dsc->codepage_from, -+ dsc->codepage_to)) { -+ fprintf(stderr, -+ "Error in config file %s. Invalid codepage setting: %s %s.\n", -+ config, dsc->codepage_from, -+ dsc->codepage_to); -+ goto out; -+ } -+ dsclist_add(zdsfsinfo.dsclist, dsc); -+ dsc = NULL; -+ } -+ free(tmp); -+ tmp = NULL; -+ } -+ /* find incomplete last section */ -+ if (in_section) -+ fprintf(stderr, -+ "Error in config file %s. Missing 'rdw' or 'conv' statement.\n", -+ config); -+ else -+ rc = 0; -+ -+out: -+ fclose(fd); -+ free(tmp); -+ dsc_free(dsc); -+ -+ return rc; -+} -+ - static int zdsfs_process_args(void *UNUSED(data), const char *arg, int key, - struct fuse_args *outargs) - { -@@ -1313,6 +1672,10 @@ static int zdsfs_process_args(void *UNUSED(data), const char *arg, int key, - /* note that arg starts with "-c" */ - zdsfsinfo.configfile = util_strdup(arg + 2); - return 0; -+ case KEY_DSCONFIG: -+ /* note that arg starts with "-x" */ -+ zdsfsinfo.dsfile = util_strdup(arg + 2); -+ return 0; - case KEY_SERVER: - if (zdsfsinfo.nr_server >= MAX_SERVER) - return 0; -@@ -1321,6 +1684,16 @@ static int zdsfs_process_args(void *UNUSED(data), const char *arg, int key, - util_strdup(value); - zdsfsinfo.nr_server++; - return 0; -+ case KEY_CODE_FROM: -+ value = arg + strlen("codepage_from="); -+ zdsfsinfo.codepage_from = -+ util_strdup(value); -+ return 0; -+ case KEY_CODE_TO: -+ value = arg + strlen("codepage_to="); -+ zdsfsinfo.codepage_to = -+ util_strdup(value); -+ return 0; - default: - fprintf(stderr, "Unknown argument key %x\n", key); - exit(1); -@@ -1340,11 +1713,14 @@ int main(int argc, char *argv[]) - zdsfsinfo.tracks_per_frame = 128; - zdsfsinfo.seek_buffer_size = 1048576; - zdsfsinfo.configfile = "/etc/zdsfs.conf"; -+ zdsfsinfo.dsfile = "/etc/zdsfs-dataset.conf"; - zdsfsinfo.keepalive = DEFAULT_KEEPALIVE_SEC; - zdsfsinfo.active_server = -1; - - rc = lzds_zdsroot_alloc(&zdsfsinfo.zdsroot); - open_dsh = dshlist_alloc(); -+ zdsfsinfo.dsclist = dsclist_alloc(); -+ - if (rc) { - fprintf(stderr, "Could not allocate internal structures\n"); - exit(1); -@@ -1354,8 +1730,19 @@ int main(int argc, char *argv[]) - fprintf(stderr, "Failed to parse option\n"); - exit(1); - } -+ if (zdsfs_check_codepage_setting(zdsfsinfo.codepage_from, -+ zdsfsinfo.codepage_to)) { -+ fprintf(stderr, "Ivalid codepage setting from '%s' to '%s'\n", -+ zdsfsinfo.codepage_from, -+ zdsfsinfo.codepage_to); -+ rc = -EINVAL; -+ goto cleanup; -+ } - zdsfs_process_config_file(zdsfsinfo.configfile); -- -+ if (zdsfs_process_dataset_conf(zdsfsinfo.dsfile)) { -+ rc = -EACCES; -+ goto cleanup; -+ } - if (!zdsfsinfo.devcount) { - fprintf(stderr, "Please specify a block device\n"); - fprintf(stderr, "Try '%s --help' for more information\n", -@@ -1390,12 +1777,12 @@ int main(int argc, char *argv[]) - goto cleanup; - } - } -- - rc = fuse_main(args.argc, args.argv, &rdf_oper, NULL); - - cleanup: - curl_global_cleanup(); - dshlist_free(open_dsh); -+ dsclist_free(zdsfsinfo.dsclist); - lzds_zdsroot_free(zdsfsinfo.zdsroot); - - fuse_opt_free_args(&args); --- -2.31.1 - - -From 994e280ae9292821f77d49138f0f17827965e5a6 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Dan=20Hor=C3=A1k?= -Date: Fri, 2 Jul 2021 11:49:28 +0200 -Subject: [PATCH 5/7] dasd: change default scheduler to reduce CPU consumption - (#1972038) - -Description: dasd: change default scheduler to reduce CPU consumption -Symptom: CPU consumption up to 20% higher for mq-deadline - compared to none scheduler for DASD devices with no - difference in throughput. -Problem: Performance analysis showed that with recent DASD - device drivers using multi-queue block queuing the - throughput of mq-deadline and none scheduler is nearly - identical but the CPU consumption of mq-deadline - scheduler due to its optimizations is up to 20% higher - compared to none scheduler. -Solution: Set none scheduler as default in the DASD udev rule. -Reproduction: Use DASD devices with mq-deadline scheduler. -Upstream-ID: a65bc51cf4e5c1fe628bb182cc1a02ee83eb102d -Problem-ID: 192049 ---- - etc/udev/rules.d/59-dasd.rules | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/etc/udev/rules.d/59-dasd.rules b/etc/udev/rules.d/59-dasd.rules -index 98fbd18..06c1bf2 100644 ---- a/etc/udev/rules.d/59-dasd.rules -+++ b/etc/udev/rules.d/59-dasd.rules -@@ -26,10 +26,10 @@ KERNEL=="dasd*[0-9]", ENV{ID_XUID}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env - - LABEL="dasd_symlinks_end" - --# on device add set request queue scheduler to deadline -+# on device add set request queue scheduler to none - SUBSYSTEM!="block", GOTO="sched_end" - - ACTION!="change", GOTO="sched_end" --KERNEL=="dasd*[!0-9]", TEST=="queue/scheduler", ATTR{queue/scheduler}="deadline" -+KERNEL=="dasd*[!0-9]", TEST=="queue/scheduler", ATTR{queue/scheduler}="none" - - LABEL="sched_end" --- -2.31.1 - - -From 6141192f0487ce450106dfc32a8d6f3d7a89908b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Dan=20Hor=C3=A1k?= -Date: Fri, 2 Jul 2021 11:50:35 +0200 -Subject: [PATCH 6/7] dbginfo.sh: Collect /proc/kallsyms, issue additional - commands (#1972041) - -Description: dbginfo.sh: Collect /proc/kallsyms, issue additional commands -Symptom: - Required data gets not collected during run of dbginfo.sh - - vmcp q cache command always fails -Problem: - some commands yet missing in dbginfo.sh script - - command vmcp q cache is missing a mandatory parameter -Solution: Stop to issue a vmcp q cache command (fails always) and add - - collect /proc/kallsyms as a tgz file (because of huge size) - - lscpu -ye - - vmcp q memassist - - vmcp q pcifunction - - vmcp q vmrelocate -Reproduction: Run the dbginfo.sh and check for results in DBGINFOxxx.tgz file - - /proc/kallsyms - - zvm_runtime.out - - runtime.out -Upstream-ID: eb1fd47a85c93ec247d89a4d02b0a5a2c5a8d444 -Problem-ID: 192022 ---- - scripts/dbginfo.sh | 32 +++++++++++++++++++++++++++----- - scripts/dbginfo.sh.1 | 8 ++++---- - 2 files changed, 31 insertions(+), 9 deletions(-) - -diff --git a/scripts/dbginfo.sh b/scripts/dbginfo.sh -index 705b5f0..405dcb3 100755 ---- a/scripts/dbginfo.sh -+++ b/scripts/dbginfo.sh -@@ -2,7 +2,7 @@ - # - # dbginfo.sh - Tool to collect runtime, configuration, and trace information - # --# Copyright IBM Corp. 2002, 2020 -+# Copyright IBM Corp. 2002, 2021 - # - # s390-tools is free software; you can redistribute it and/or modify - # it under the terms of the MIT license. See LICENSE for details. -@@ -21,7 +21,7 @@ readonly SCRIPTNAME="${0##*/}" - print_version() { - cat </dev/null | while IFS= read -r file_name; do -+ tmp_file=${file_name}-`uname -r`.tgz -+ ch_dir="${WORKPATH}proc/" -+ orig_file="kallsyms" -+ -+ -+ echo " ${file_name}" -+ if ! test -e "${file_name}"; then -+ echo "${SCRIPTNAME}: Warning: Postprocessing failed on ${file_name}" -+ echo -+ fi -+ -+ tar -cvzf "${tmp_file}" -C "${ch_dir}" "${orig_file}" -+ rm -f "${file_name}" -+ -+ done - - pr_log_stdout " " - } -@@ -1124,6 +1144,8 @@ create_package() - pr_stdout "Finalizing: Creating archive with collected data" - cd "${WORKDIR_BASE}" - -+ touch "${WORKARCHIVE}" -+ chmod 0600 "${WORKARCHIVE}" - tar -czf "${WORKARCHIVE}" "${WORKDIR_CURRENT}" - rc_tar=$? - if [ $rc_tar -eq 0 ]; then -diff --git a/scripts/dbginfo.sh.1 b/scripts/dbginfo.sh.1 -index ef9fe89..a59e4c0 100644 ---- a/scripts/dbginfo.sh.1 -+++ b/scripts/dbginfo.sh.1 -@@ -2,7 +2,7 @@ - - .SH NAME - dbginfo.sh \- collect runtime, configuration and trace information --for debugging Linux on System z -+for debugging Linux on IBM Z - - .SH SYNOPSIS - .br -@@ -12,7 +12,7 @@ for debugging Linux on System z - - .SH DESCRIPTION - This script collects runtime, configuration and trace information that can --be used to debug a Linux on System z instance. -+be used to debug a Linux on IBM Z instance. - For Linux on z/VM, the script also traces information about the z/VM system. - The debug information is written to a file - /tmp/DBGINFO\-\-