Author: tsoome Date: Sun Nov 3 07:11:09 2019 New Revision: 354277 URL: https://svnweb.freebsd.org/changeset/base/354277
Log: MFC: r354127 loader: zio_checksum_verify should check byteswap We do have both native and byteswap checksum callbacks in place but the selection is not wired. Modified: stable/12/sys/cddl/boot/zfs/zfsimpl.h stable/12/sys/cddl/boot/zfs/zfssubr.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cddl/boot/zfs/zfsimpl.h ============================================================================== --- stable/12/sys/cddl/boot/zfs/zfsimpl.h Sun Nov 3 03:23:27 2019 (r354276) +++ stable/12/sys/cddl/boot/zfs/zfsimpl.h Sun Nov 3 07:11:09 2019 (r354277) @@ -442,6 +442,13 @@ _NOTE(CONSTCOND) } while (0) ZIO_SET_CHECKSUM(&(bp)->blk_cksum, 0, 0, 0, 0); \ } +#if BYTE_ORDER == _BIG_ENDIAN +#define ZFS_HOST_BYTEORDER (0ULL) +#else +#define ZFS_HOST_BYTEORDER (1ULL) +#endif + +#define BP_SHOULD_BYTESWAP(bp) (BP_GET_BYTEORDER(bp) != ZFS_HOST_BYTEORDER) #define BPE_NUM_WORDS 14 #define BPE_PAYLOAD_SIZE (BPE_NUM_WORDS * sizeof (uint64_t)) #define BPE_IS_PAYLOADWORD(bp, wp) \ Modified: stable/12/sys/cddl/boot/zfs/zfssubr.c ============================================================================== --- stable/12/sys/cddl/boot/zfs/zfssubr.c Sun Nov 3 03:23:27 2019 (r354276) +++ stable/12/sys/cddl/boot/zfs/zfssubr.c Sun Nov 3 07:11:09 2019 (r354277) @@ -318,8 +318,9 @@ zio_checksum_verify(const spa_t *spa, const blkptr_t * byteswap_uint64_array(&expected_cksum, sizeof (zio_cksum_t)); } else { + byteswap = BP_SHOULD_BYTESWAP(bp); expected_cksum = bp->blk_cksum; - ci->ci_func[0](data, size, ctx, &actual_cksum); + ci->ci_func[byteswap](data, size, ctx, &actual_cksum); } if (!ZIO_CHECKSUM_EQUAL(actual_cksum, expected_cksum)) { _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"