From: Yvan Janssens <yvanj@cyber.gent>
To: pve-devel@lists.proxmox.com
Subject: [PATCH pve-cluster] pmxcfs: check_memdb: accept the big-endian index checksum
Date: Wed, 18 Nov 2026 10:07:35 +0100 [thread overview]
Message-ID: <20261118090735.71816-1-yvanj@cyber.gent> (raw)
The memdb index and its per-entry digests are built from host-endian
integers, so the checksum hard-coded in test_indextest1 only matches on
little-endian hosts, and the test fails on every big-endian one (for
example s390x and big-endian ppc64).
Add the big-endian checksum. On s390x, converting all integers to
little-endian before hashing reproduces the existing checksum, so both
values describe the same index. As the index has only fixed-width
fields, the big-endian value holds for any big-endian host.
Signed-off-by: Yvan Janssens <yvanj@cyber.gent>
---
src/pmxcfs/check_memdb.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/pmxcfs/check_memdb.c b/src/pmxcfs/check_memdb.c
index 74728df..616ae61 100644
--- a/src/pmxcfs/check_memdb.c
+++ b/src/pmxcfs/check_memdb.c
@@ -270,10 +270,13 @@ START_TEST(test_indextest1) {
ck_assert(sha256 != NULL);
g_checksum_update(sha256, (unsigned char *)idx, idx->bytes);
const char *csum = g_checksum_get_string(sha256);
- ck_assert_msg(
- strcmp(csum, "913fd95015af9d93f10dd51ba2a7bb11351bcfe040be21e95fcba834adc3ec10") == 0,
- "wrong idx checksum %s", csum
- );
+ /* the index and its per-entry digests are built from host-endian integers */
+#if G_BYTE_ORDER == G_BIG_ENDIAN
+ const char *expected = "efdfcdde67acb6b48e4b415a172d5a1897c725b03a9b2c12d20efe0ab8adad44";
+#else
+ const char *expected = "913fd95015af9d93f10dd51ba2a7bb11351bcfe040be21e95fcba834adc3ec10";
+#endif
+ ck_assert_msg(strcmp(csum, expected) == 0, "wrong idx checksum %s", csum);
g_free(idx);
g_free(testdata);
}
--
2.54.0 (Apple Git-157)
next reply other threads:[~2026-11-18 9:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 9:07 Yvan Janssens [this message]
2026-11-18 9:22 ` [PATCH pve-cluster] pmxcfs: check_memdb: accept the big-endian index checksum Dominik Csapak
2026-11-18 9:29 ` Yvan Janssens
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261118090735.71816-1-yvanj@cyber.gent \
--to=yvanj@cyber.gent \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.