On Fri, Nov 09, 2012 at 03:19:12PM -0800, Darrick J. Wong wrote: > On Thu, Nov 08, 2012 at 10:53:07AM -0500, Theodore Ts'o wrote: > > Hey Darrick, > > > > I was looking at this code a bit more closely while applying the > > revised version of this patch --- and this in particular raised a red > > flag for me: > > > > *(u32 *)desc.ctx = crc; > > ... > > return *(u32 *)desc.ctx; > > > > Does this raise any byte swapping issues? Looking at how the crc32 > > code in crypto/ works, I'm almost certain this is broken on big-endian > > systems, and we need to add le32_to_cup() and cpu_to_le32() calls here. > > > > Am I missing something? > > crc32_[bl]e_generic() in lib/crc32.c contains the appropriate be/le-to-cpu > conversion calls to ensure that the results are always returned in cpu-endian > format. The crypto/crc32.c file is basically just a crypto-hash wrapper around > the lib/crc32.c code, and don't touch the endianness at all. The ext4 code > receives the results from the crypto code in cpu-endian format and always > converts it to (or from) little-endian format when accessing disk structures. > > As far as e2fsprogs, it leaves the checksums in le format, only converting it > to cpu-endian format when verifying or setting the checksum. I forgot to mention -- I tried creating a metadata_csum filesystem on an x86 box. Then I bounced it between that machine and my one remaining ppc32 box, running a mount/read/write/unmount/fsck script on each bounce. I didn't see any errors. Sadly, I no longer have anything weirder (sparc64/s390x) to test. --D > > --D > > > > - Ted > -- > To unsubscribe from this list: send the line "unsubscribe linux-ext4" in > the body of a message to majordomo@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html