based on Julien Cristau's and Patrick Baggett's comments I put together
the attatched patch to fix the alignment issues they identified (I have
not done anything regarding the poor choice of prototype or the
theoretical strict-aliasing issue).
Unfortunately the test still fails with a bus error and I can't seem to
figure out how to run the test manually to get a new backtrace. The
executable "./integrity" simply doesn't seem to exist after the build
process ends.
Jurij, can you tell me exactly what you did to get your backtrace?
diff -ur nbd-3.0/nbd-tester-client.c nbd-3.0.new/nbd-tester-client.c
--- nbd-3.0/nbd-tester-client.c 2011-10-01 10:28:58.000000000 +0000
+++ nbd-3.0.new/nbd-tester-client.c 2012-04-12 13:15:18.000000000 +0000
@@ -714,8 +714,8 @@
}
static inline int checkbuf(char *buf, uint64_t seq, uint64_t blknum) {
- char cmp[512];
- makebuf(cmp, seq, blknum);
+ uint64_t cmp[64]; // 512/8 = 64
+ makebuf((char *)cmp, seq, blknum);
return memcmp(cmp, buf, 512)?-1:0;
}
@@ -1100,7 +1100,9 @@
goto err_open;
}
- prc = g_hash_table_lookup(handlehash, rep.handle);
+ uint64_t handle;
+ memcpy(&handle,rep.handle,8);
+ prc = g_hash_table_lookup(handlehash, &handle);
if (!prc) {
retval=-1;
snprintf(errstr, errstr_len, "Unrecognised handle in reply: 0x%llX", *(long long unsigned int*)(rep.handle));