mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 03:09:34 +03:00
ZIL: Do not encrypt block pointers in lr_clone_range_t
In case of crash cloned blocks need to be claimed on pool import. It is only possible if they (lr_bps) and their count (lr_nbps) are not encrypted but only authenticated, similar to block pointer in lr_write_t. Few other fields can be and are still encrypted. This should fix panic on ZIL claim after crash when block cloning is actively used. Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu> Reviewed-by: Tom Caputi <caputit1@tcnj.edu> Reviewed-by: Sean Eric Fagan <sef@FreeBSD.org> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Edmund Nadolski <edmund.nadolski@ixsystems.com> Signed-off-by: Alexander Motin <mav@FreeBSD.org> Sponsored by: iXsystems, Inc. Closes #15543 Closes #15513
This commit is contained in:
parent
9b9b09f452
commit
56a2a0981e
@ -1364,6 +1364,19 @@ zio_crypt_init_uios_zil(boolean_t encrypt, uint8_t *plainbuf,
|
|||||||
vec++;
|
vec++;
|
||||||
total_len += crypt_len;
|
total_len += crypt_len;
|
||||||
}
|
}
|
||||||
|
} else if (txtype == TX_CLONE_RANGE) {
|
||||||
|
const size_t o = offsetof(lr_clone_range_t, lr_nbps);
|
||||||
|
crypt_len = o - sizeof (lr_t);
|
||||||
|
dst_iovecs[vec].iov_base = (char *)dlrp + sizeof (lr_t);
|
||||||
|
dst_iovecs[vec].iov_len = crypt_len;
|
||||||
|
|
||||||
|
/* copy the bps now since they will not be encrypted */
|
||||||
|
memcpy(dlrp + o, slrp + o, lr_len - o);
|
||||||
|
memcpy(aadp, slrp + o, lr_len - o);
|
||||||
|
aadp += lr_len - o;
|
||||||
|
aad_len += lr_len - o;
|
||||||
|
vec++;
|
||||||
|
total_len += crypt_len;
|
||||||
} else {
|
} else {
|
||||||
crypt_len = lr_len - sizeof (lr_t);
|
crypt_len = lr_len - sizeof (lr_t);
|
||||||
dst_iovecs[vec].iov_base = (char *)dlrp +
|
dst_iovecs[vec].iov_base = (char *)dlrp +
|
||||||
|
@ -1543,6 +1543,21 @@ zio_crypt_init_uios_zil(boolean_t encrypt, uint8_t *plainbuf,
|
|||||||
nr_iovecs++;
|
nr_iovecs++;
|
||||||
total_len += crypt_len;
|
total_len += crypt_len;
|
||||||
}
|
}
|
||||||
|
} else if (txtype == TX_CLONE_RANGE) {
|
||||||
|
const size_t o = offsetof(lr_clone_range_t, lr_nbps);
|
||||||
|
crypt_len = o - sizeof (lr_t);
|
||||||
|
src_iovecs[nr_iovecs].iov_base = slrp + sizeof (lr_t);
|
||||||
|
src_iovecs[nr_iovecs].iov_len = crypt_len;
|
||||||
|
dst_iovecs[nr_iovecs].iov_base = dlrp + sizeof (lr_t);
|
||||||
|
dst_iovecs[nr_iovecs].iov_len = crypt_len;
|
||||||
|
|
||||||
|
/* copy the bps now since they will not be encrypted */
|
||||||
|
memcpy(dlrp + o, slrp + o, lr_len - o);
|
||||||
|
memcpy(aadp, slrp + o, lr_len - o);
|
||||||
|
aadp += lr_len - o;
|
||||||
|
aad_len += lr_len - o;
|
||||||
|
nr_iovecs++;
|
||||||
|
total_len += crypt_len;
|
||||||
} else {
|
} else {
|
||||||
crypt_len = lr_len - sizeof (lr_t);
|
crypt_len = lr_len - sizeof (lr_t);
|
||||||
src_iovecs[nr_iovecs].iov_base = slrp + sizeof (lr_t);
|
src_iovecs[nr_iovecs].iov_base = slrp + sizeof (lr_t);
|
||||||
|
Loading…
Reference in New Issue
Block a user