public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH pve-cluster] pmxcfs: check_memdb: accept the big-endian index checksum
@ 2026-11-18  9:07 Yvan Janssens
  2026-11-18  9:22 ` Dominik Csapak
  0 siblings, 1 reply; 3+ messages in thread
From: Yvan Janssens @ 2026-11-18  9:07 UTC (permalink / raw)
  To: pve-devel

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)





^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-18  9:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-18  9:07 [PATCH pve-cluster] pmxcfs: check_memdb: accept the big-endian index checksum Yvan Janssens
2026-11-18  9:22 ` Dominik Csapak
2026-11-18  9:29   ` Yvan Janssens

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal