Skip to contentSkip to conversation

fix 32/64 wire interoperability

PATCH In review Pete Zaitcev 2 participants 3 messages Aug 4, 2010 – Aug 5, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 fix 32/64 wire interoperability

Testing found that tabled and chunkd running on CPUs with different word length cannot talk to each other.

The bug was introduced by commit ea5d20bc22aeed077312c9c1824e84651af17a16.

The fix is to add named padding that takes the place of the invisible padding, thus making the layout platform-neutral.

---
 include/chunk_msg.h |    1 +
 1 file changed, 1 insertion(+)
include/chunk_msg.h +1 -0
index a34fc21..4c170e4 100644
@@ -91,6 +91,7 @@ struct chunksrv_resp {
 	uint32_t		nonce;	/* txn id, copied from request */
 	uint64_t		data_len;		/* len of addn'l data */
 	unsigned char		hash[CHD_CSUM_SZ];	/* SHA1 checksum */
+	unsigned char		rsv2[4];		/* pad for 64 bits */
 };
 
 struct chunksrv_resp_get {
#1 lore raw
Quoted 19 lines · Pete Zaitcev

Testing found that tabled and chunkd running on CPUs with different word length cannot talk to each other.

The bug was introduced by commit ea5d20bc22aeed077312c9c1824e84651af17a16.

The fix is to add named padding that takes the place of the invisible padding, thus making the layout platform-neutral.

---
  include/chunk_msg.h |    1 +
  1 file changed, 1 insertion(+)
include/chunk_msg.h +0 -0
index a34fc21..4c170e4 100644

include/chunk_msg.h struct chunksrv_resp { · line 95

Quoted 5 lines
include/chunk_msg.h +1 -0
@@ -91,6 +91,7 @@ struct chunksrv_resp {
  	uint32_t		nonce;	/* txn id, copied from request */
  	uint64_t		data_len;		/* len of addn'l data */
  	unsigned char		hash[CHD_CSUM_SZ];	/* SHA1 checksum */
+	unsigned char		rsv2[4];		/* pad for 64 bits */
  };

good catch. applied 1-3, and pushed out.

I wonder if we shouldn't switch to attribute(packed) for safety, though.

#2 lore raw
Quoted 1 line · On Thu, 05 Aug 2010 17:25:30 -0400 Jeff Garzik <[email protected]> wrote:

I wonder if we shouldn't switch to attribute(packed) for safety, though.

I dunno, as long as we test this... I irrationally hate the gcc attributes, although probably any viable competitor will have to support them. Talk about embrace-and-extend. Fine when FSF does it, not fine when Microsoft does, huh.

-- Pete